[Rt-commit] r4409 - in rt/branches/CHALDEA-EXPERIMENTAL: . etc html/Admin/Elements html/Elements/CollectionAsTable lib/RT lib/RT/Action lib/RT/I18N sbin

jesse at bestpractical.com jesse at bestpractical.com
Thu Jan 19 10:14:42 EST 2006


Author: jesse
Date: Thu Jan 19 10:14:40 2006
New Revision: 4409

Modified:
   rt/branches/CHALDEA-EXPERIMENTAL/   (props changed)
   rt/branches/CHALDEA-EXPERIMENTAL/etc/schema.mysql
   rt/branches/CHALDEA-EXPERIMENTAL/html/Admin/Elements/EditCustomFields
   rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N/de.po
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Template_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
   rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t
   rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/22search_tix_by_txn.t
   rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf
   rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in

Log:
 r22718 at truegrounds:  jesse | 2006-01-19 09:01:31 -0500
 Merge forward from RT 3.4 and Quebec
 
 r22386 at truegrounds:  jesse | 2006-01-13 12:50:56 -0500
   r19822 at truegrounds (orig r4253):  alexmv | 2005-12-06 18:29:47 +0100
    r7565 at zoq-fot-pik:  chmrr | 2005-12-06 12:28:41 -0500
     * Tailing test -- paging, ORDER BY, JOIN, and DISTINCT collude to
    produce incorrect results, unless the DISTINCT is done very carefully.
    See the latest DBIx-SearchBuilder.
   
   r20865 at truegrounds (orig r4330):  alexmv | 2005-12-19 20:48:21 +0100
    r7854 at zoq-fot-pik:  chmrr | 2005-12-19 14:47:41 -0500
     * Squish out duplicate SortOrders in ObjectCustomFields if they
    exist; this should be impossible, so the O(n) updates is mostly
    justified.
   
   r20866 at truegrounds (orig r4331):  alexmv | 2005-12-19 21:15:17 +0100
    r7856 at zoq-fot-pik:  chmrr | 2005-12-19 15:14:45 -0500
     * Checking Principal isn't enough to know if this is the current user
    -- we could be being passed our own email address, instead of our own
    principal.
   
   r22376 at truegrounds (orig r4387):  alexmv | 2006-01-12 17:24:24 +0100
    r8635 at zoq-fot-pik:  chmrr | 2006-01-12 11:23:39 -0500
     * Parse embedded newlines
     * Anchor column alias matches at beginning and end so they don't pick
       up things like 'CustomField-Summary Status' as =~ /Summary/
   
  
  r22387 at truegrounds:  jesse | 2006-01-13 12:56:51 -0500
  * Pulled up changes from RT 3.4.5
  
  r19695 at truegrounds:  jesse | 2005-12-02 23:58:50 +0100
   * RC2
   r20429 at truegrounds:  jesse | 2005-12-13 21:25:39 +0100
    r19996 at truegrounds (orig r4303):  alexmv | 2005-12-13 13:58:20 -0500
     r7707 at zoq-fot-pik:  chmrr | 2005-12-13 13:54:45 -0500
      * I don't think this join to Attachments is needed or useful -- it means you don't see changes with no attachments
    
   
   r20435 at truegrounds:  jesse | 2005-12-13 22:51:06 +0100
   * warning silencing for a log message
   r20436 at truegrounds:  jesse | 2005-12-13 22:51:41 +0100
   * 3.4.5rc3
   r22357 at truegrounds:  jesse | 2006-01-11 18:20:01 +0100
   RT-Ticket: 7222
   RT-Status: resolved
   RT-Update: correspond
   
   * German translation update from Dirk Pape
   r22369 at truegrounds:  jesse | 2006-01-12 16:23:48 +0100
   * Forced timezone for a date test to GMT, since it's searching on subjective dates
   r22370 at truegrounds:  jesse | 2006-01-12 16:25:19 +0100
   * Silence a warning introduced by a patch to fix oracle installs
   r22371 at truegrounds:  jesse | 2006-01-12 16:25:39 +0100
   * This be 3.4.5
  
  r22715 at truegrounds:  jesse | 2006-01-19 08:49:53 -0500
   r22708 at truegrounds (orig r4400):  alexmv | 2006-01-18 16:35:37 -0500
    r8683 at zoq-fot-pik:  chmrr | 2006-01-18 16:34:42 -0500
     * Correctly deal with 0-length field values; now passes test suite
       again.  Mea culpa.
   
   r22709 at truegrounds (orig r4401):  alexmv | 2006-01-18 17:59:16 -0500
    r8689 at zoq-fot-pik:  chmrr | 2006-01-18 17:58:29 -0500
     * Support multiple requestors, ccs, adminccs, or links on one line
   
   r22710 at truegrounds (orig r4402):  alexmv | 2006-01-18 23:15:31 -0500
    r8691 at zoq-fot-pik:  chmrr | 2006-01-18 23:14:54 -0500
     * Document and standardize UpdateType
     * Fix another possible infinite loop bug
   
   r22711 at truegrounds (orig r4403):  alexmv | 2006-01-19 00:10:27 -0500
    r8693 at zoq-fot-pik:  chmrr | 2006-01-19 00:09:49 -0500
     * ForceOwner to force ownership
   
   r22712 at truegrounds (orig r4404):  alexmv | 2006-01-19 00:13:52 -0500
    r8695 at zoq-fot-pik:  chmrr | 2006-01-19 00:13:12 -0500
     * Removed debugging statements
   
  
  r22717 at truegrounds:  jesse | 2006-01-19 08:59:52 -0500
  * Merged forward from RT 3.4
 


Modified: rt/branches/CHALDEA-EXPERIMENTAL/etc/schema.mysql
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/etc/schema.mysql	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/etc/schema.mysql	Thu Jan 19 10:14:40 2006
@@ -58,7 +58,6 @@
   PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
-CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type) ;
 CREATE INDEX Links2 ON Links (Base,  Type) ;
 CREATE INDEX Links3 ON Links (Target,  Type) ;
 CREATE INDEX Links4 ON Links (Type,LocalBase);

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Admin/Elements/EditCustomFields
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Admin/Elements/EditCustomFields	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Admin/Elements/EditCustomFields	Thu Jan 19 10:14:40 2006
@@ -88,6 +88,20 @@
 $ObjectCFs->LimitToObjectId($id);
 $ObjectCFs->LimitToLookupType($lookup);
 
+# Check sanity of SortOrders
+my %SortOrders;
+$SortOrders{$_->SortOrder}++
+  while ($_ = $ObjectCFs->Next);
+
+# If there are duplicates, run though and squash them
+if (grep {$_ > 1} values %SortOrders) {
+    my $i = 1;
+    while (my $ObjectCF = $ObjectCFs->Next) {
+        $ObjectCF->SetSortOrder($i++);
+    }
+    $ObjectCFs->GotoFirstItem;
+}
+
 # {{{ deal with moving sortorder of custom fields
 if ($CustomField and $Move) {
     my $SourceObj = RT::ObjectCustomField->new($session{'CurrentUser'});

Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/CollectionAsTable/ParseFormat	Thu Jan 19 10:14:40 2006
@@ -48,7 +48,7 @@
 </%ARGS>
 
 <%init>
-use Regexp::Common;
+use Regexp::Common qw/delimited/;
 my @Columns;
 
 while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm	Thu Jan 19 10:14:40 2006
@@ -189,6 +189,8 @@
        Resolved        => 
        Owner           => Username or id of an RT user who can and should own 
                           this ticket
+       ForceOwner      => Same as Owner, but sets the owner even if the owner
+                          is already set
    +   Requestor       => Email address
    +   Cc              => Email address 
    +   AdminCc         => Email address 
@@ -209,7 +211,12 @@
                           as content until we hit a line containing only 
                           ENDOFCONTENT
        ContentType     => the content-type of the Content field
+       UpdateType      => 'correspond' or 'comment'; used in conjunction with
+                          'content' if this is an update.
+
        CustomField-<id#> => custom field value
+       CF-name           => custom field value
+       CustomField-name  => custom field value
 
 Fields marked with an * are required.
 
@@ -700,11 +707,16 @@
             ARGSRef       => $ticketargs
         );
 
+        if ( $ticketargs->{'ForceOwner'} ) {
+            ($id, $msg) = $T::Tickets{$template_id}->SetOwner($ticketargs->{'ForceOwner'}, "Force");
+            push @results, $msg;
+        }
+
         push @results,
             $self->UpdateWatchers( $T::Tickets{$template_id}, $ticketargs );
 
-        next unless exists $ticketargs->{'UpdateType'};
-        if ( $ticketargs->{'UpdateType'} =~ /^(private|public)$/ ) {
+        next unless $ticketargs->{'MIMEObj'};
+        if ( $ticketargs->{'UpdateType'} =~ /^(private|comment)$/i ) {
             my ( $Transaction, $Description, $Object )
                 = $T::Tickets{$template_id}->Comment(
                 CcMessageTo  => $ticketargs->{'Cc'},
@@ -717,7 +729,7 @@
                     ->loc( "Ticket [_1]", $T::Tickets{$template_id}->id )
                     . ': '
                     . $Description );
-        } elsif ( $ticketargs->{'UpdateType'} eq 'response' ) {
+        } elsif ( $ticketargs->{'UpdateType'} =~ /^(public|response|correspond)$/i ) {
             my ( $Transaction, $Description, $Object )
                 = $T::Tickets{$template_id}->Correspond(
                 CcMessageTo  => $ticketargs->{'Cc'},
@@ -932,6 +944,9 @@
                     $args{$tag} =~ s/^\s+//g;
                     $args{$tag} =~ s/\s+$//g;
                 }
+                if (($tag =~ /^(requestor|cc|admincc)$/i or grep {lc $_ eq $tag} keys %LINKTYPEMAP) and $args{$tag} =~ /,/) {
+                    $args{$tag} = [ split /,\s*/, $args{$tag} ];
+                }
             }
         }
     }
@@ -960,7 +975,8 @@
         Starts          => $args{'starts'},
         Started         => $args{'started'},
         Resolved        => $args{'resolved'},
-        Owner           => $args{'owner'},
+        Owner           => $args{'forceowner'} || $args{'owner'},
+        ForceOwner      => $args{'forceowner'},
         Requestor       => $args{'requestor'},
         Cc              => $args{'cc'},
         AdminCc         => $args{'admincc'},
@@ -988,7 +1004,6 @@
         if ( $orig_tag =~ /^customfield-?(\d+)$/i ) {
             $ticketargs{ "CustomField-" . $1 } = $args{$tag};
         } elsif ( $orig_tag =~ /^(?:customfield|cf)-?(.*)$/i ) {
-            warn $orig_tag;
             my $cf = RT::CustomField->new( $self->CurrentUser );
             $cf->LoadByName( Name => $1, Queue => $ticketargs{Queue} );
             $ticketargs{ "CustomField-" . $cf->id } = $args{$tag};
@@ -999,7 +1014,6 @@
             $ticketargs{ "CustomField-" . $cf->id } = $args{$tag};
 
         }
-        warn "We have a cf! yay "
     }
 
     $self->GetDeferred( \%args, $template_id, $links, $postponed );
@@ -1017,112 +1031,105 @@
 sub _ParseXSVTemplate {
     my $self = shift;
     my %args = (@_);
-        $RT::Logger->debug("Line: id");
-        use Regexp::Common qw(delimited);
-        my $first
-            = substr( $args{'Content'}, 0, index( $args{'Content'}, "\n" ) );
-        $first =~ s/\r$//;
-
-        my $delimiter;
-        if ( $first =~ /\t/ ) {
-            $delimiter = "\t";
-        } else {
-            $delimiter = ',';
-        }
-        my @fields = split( /$delimiter/, $first );
 
-        my $delimiter_re = qr[$delimiter];
+    use Regexp::Common qw(delimited);
+    my $first
+      = substr( $args{'Content'}, 0, index( $args{'Content'}, "\n" ) );
+    $first =~ s/\r$//;
+
+    my $delimiter;
+    if ( $first =~ /\t/ ) {
+        $delimiter = "\t";
+    } else {
+        $delimiter = ',';
+    }
+    my @fields = split( /$delimiter/, $first );
 
-        my $delimited  = qr[[^$delimiter]+];
-        my $empty      = qr[^[$delimiter](?=[$delimiter])];
-        my $justquoted = qr[$RE{quoted}];
+    my $delimiter_re = qr[$delimiter];
+    my $justquoted = qr[$RE{quoted}];
 
-        $args{'Content'}
-            = substr( $args{'Content'}, index( $args{'Content'}, "\n" ) + 1 );
-        $RT::Logger->debug("First: $first");
+    $args{'Content'}
+      = substr( $args{'Content'}, index( $args{'Content'}, "\n" ) + 1 );
 
-        foreach my $line ( split( /\n/, $args{'Content'} ) ) {
-            next unless $line;
-            $RT::Logger->debug("Line: $line");
-
-            my $queue;
-            my $requestor;
-            # first item is $template_id
-            my $i = 0;
-            my $template_id;
-            while ($line
-                && $line =~ s/^($justquoted|.*?)(?:$delimiter_re|$)//ix )
-            {
-                
-                
-                # If it's the first field, it must be a ticket id. 
-                if ( $i == 0 ) {
-                    $queue     = 0;
-                    $requestor = 0;
-                    my $tid = $1;
-                    $tid =~ s/^\s*(.*?)\s*$/$1/;
-                    next unless $tid;
-
-                    if ( $tid =~ /^\d+$/ ) {
-                        $template_id = 'update-' . $tid;
-                        push @{ $self->{'update_tickets'} }, $template_id;
-
-                    } elsif ( $tid =~ /^#base-(\d+)$/ ) {
-
-                        $template_id = 'base-' . $1;
-                        push @{ $self->{'base_tickets'} }, $template_id;
-
-                    } else {
-                        $template_id = 'create-' . $tid;
-                        push @{ $self->{'create_tickets'} }, $template_id;
-                    }
-                    $RT::Logger->debug("template_id: $tid");
+  LINE:
+    while ($args{'Content'}) {
+        $args{'Content'} =~ s/^(\s*\r?\n)+//;
+
+        my $queue;
+        my $requestor;
+        # first item is $template_id
+        my $i = 0;
+        my $template_id;
+        my $EOL = 0;
+
+      COLUMN:
+        while (not $EOL and length $args{'Content'} and $args{'Content'} =~ s/^($justquoted|.*?)($delimiter_re|$)//smix) {
+            $EOL = not $2;
+            # If it's the first field, it must be a ticket id. 
+            if ( $i == 0 ) {
+                $queue     = 0;
+                $requestor = 0;
+                my $tid = $1;
+                $tid =~ s/^\s*(.*?)\s*$/$1/;
+                next COLUMN unless $tid;
+
+                if ( $tid =~ /^\d+$/ ) {
+                    $template_id = 'update-' . $tid;
+                    push @{ $self->{'update_tickets'} }, $template_id;
+                } elsif ( $tid =~ /^#base-(\d+)$/ ) {
+                    $template_id = 'base-' . $1;
+                    push @{ $self->{'base_tickets'} }, $template_id;
                 } else {
-                    my $value = $1;
-                    $value = '' if ( $value =~ /^$delimiter$/ );
-                    if ( $value =~ /^$RE{delimited}{-delim=>qq{\'\"}}$/ ) {
-                        substr( $value, 0,  1 ) = "";
-                        substr( $value, -1, 1 ) = "";
-                    }
-                    my $field = $fields[$i];
-                    next unless $field;
-                    $field =~ s/^\s//;
-                    $field =~ s/\s$//;
-                    if (   $field =~ /Body/i
-                        || $field =~ /Data/i
-                        || $field =~ /Message/i )
-                    {
-                        $field = 'Content';
-                    }
-                    if ( $field =~ /Summary/i ) {
-                        $field = 'Subject';
-                    }
-                    if ( $field =~ /Queue/i ) {
-                        $queue = 1;
-                        $value ||= $args{'Queue'};
-                    }
-                    if ( $field =~ /Requestor/i ) {
-                        $requestor = 1;
-                        $value ||= $args{'Requestor'};
-                    }
-                    $self->{'templates'}->{$template_id} .= $field . ": ";
-                    $self->{'templates'}->{$template_id} .= $value || "";
-                    $self->{'templates'}->{$template_id} .= "\n";
-                    $self->{'templates'}->{$template_id} .= "ENDOFCONTENT\n"
-                        if $field =~ /content/i;
+                    $template_id = 'create-' . $tid;
+                    push @{ $self->{'create_tickets'} }, $template_id;
                 }
-                $i++;
-            }
-            if ( !$queue && $args{'Queue'} ) {
-                $self->{'templates'}->{$template_id}
-                    .= "Queue: $args{'Queue'}\n";
-            }
-            if ( !$requestor && $args{'Requestor'} ) {
-                $self->{'templates'}->{$template_id}
-                    .= "Requestor: $args{'Requestor'}\n";
+            } else {
+                my $value = $1;
+                if ( $value =~ /^$RE{delimited}{-delim=>qq{\'\"}}$/ ) {
+                    substr( $value, 0,  1 ) = "";
+                    substr( $value, -1, 1 ) = "";
+                }
+                my $field = $fields[$i];
+                
+                next COLUMN unless $field;
+                $field =~ s/^\s//;
+                $field =~ s/\s$//;
+                if (   $field =~ /^Body$/i
+                    || $field =~ /^Data$/i
+                    || $field =~ /^Message$/i )
+                  {
+                      $field = 'Content';
+                  }
+                if ( $field =~ /^Summary$/i ) {
+                    $field = 'Subject';
+                }
+                if ( $field =~ /^Queue$/i ) {
+                    $queue = 1;
+                    $value ||= $args{'Queue'};
+                }
+                if ( $field =~ /^Requestor$/i ) {
+                    $requestor = 1;
+                    $value ||= $args{'Requestor'};
+                }
+                $self->{'templates'}->{$template_id} .= $field . ": ";
+                $self->{'templates'}->{$template_id} .= $value || "";
+                $self->{'templates'}->{$template_id} .= "\n";
+                $self->{'templates'}->{$template_id} .= "ENDOFCONTENT\n"
+                  if $field =~ /^Content$/i;
             }
+            $i++;
         }
+        if ( !$queue && $args{'Queue'} ) {
+            $self->{'templates'}->{$template_id}
+              .= "Queue: $args{'Queue'}\n";
+        }
+        if ( !$requestor && $args{'Requestor'} ) {
+            $self->{'templates'}->{$template_id}
+              .= "Requestor: $args{'Requestor'}\n";
+        }
+    }
 }
+
 sub GetDeferred {
     my $self      = shift;
     my $args      = shift;
@@ -1158,7 +1165,7 @@
     $string .= "Queue: " . $t->QueueObj->Name . "\n";
     $string .= "Subject: " . $t->Subject . "\n";
     $string .= "Status: " . $t->Status . "\n";
-    $string .= "UpdateType: response\n";
+    $string .= "UpdateType: correspond\n";
     $string .= "Content: \n";
     $string .= "ENDOFCONTENT\n";
     $string .= "Due: " . $t->DueObj->AsString . "\n";
@@ -1282,8 +1289,8 @@
         next unless defined $args->{$type};
         my $newaddr = $args->{$type};
 
-        my @old = split( ', ', $oldaddr );
-        my @new = split( ', ', $newaddr );
+        my @old = split( /,\s*/, $oldaddr );
+        my @new = split( /,\s*/, $newaddr );
         my %oldhash = map { $_ => 1 } @old;
         my %newhash = map { $_ => 1 } @new;
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Action/SendEmail.pm	Thu Jan 19 10:14:40 2006
@@ -253,12 +253,28 @@
 
     if ( $RT::MailCommand eq 'sendmailpipe' ) {
         eval {
-            open( my $mail, "|$RT::SendmailPath $RT::SendmailArguments" ) || die $!;
+            # don't ignore CHLD signal to get proper exit code
+            local $SIG{'CHLD'} = 'DEFAULT';
+
+            my $mail;
+            unless( open $mail, "|$RT::SendmailPath $RT::SendmailArguments" ) {
+                die "Couldn't run $RT::SendmailPath: $!";
+            }
+
+            # if something wrong with $mail->print we will get PIPE signal, handle it
+            local $SIG{'PIPE'} = sub { die "$RT::SendmailPath closed pipe" };
             $MIMEObj->print($mail);
-            close($mail);
+
+            unless ( close $mail ) {
+                die "Close failed: $!" if $!; # system error
+                # sendmail exit statuses mostly errors with data not software
+                # TODO: status parsing: core dump, exit on signal or EX_*
+                $RT::Logger->warning( "$RT::SendmailPath exitted with status $?" );
+            }
         };
         if ($@) {
-            $RT::Logger->crit( $msgid . "Could not send mail. -" . $@ );
+            $RT::Logger->crit( $msgid . "Could not send mail: " . $@ );
+            return 0;
         }
     }
     else {

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N.pm	Thu Jan 19 10:14:40 2006
@@ -223,7 +223,7 @@
 
 	# {{{ Convert the body
 	eval {
-	    $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". $head->get('subject'));
+	    $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". ($head->get('subject') || 'Subjectless message'));
 
 	    # NOTE:: see the comments at the end of the sub.
 	    Encode::_utf8_off( $lines[$_] ) foreach ( 0 .. $#lines );

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N/de.po
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N/de.po	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/I18N/de.po	Thu Jan 19 10:14:40 2006
@@ -3785,15 +3785,15 @@
 
 #: html/Ticket/Elements/Tabs:170
 msgid "Steal"
-msgstr "Übernehmen"
+msgstr "Stehlen"
 
 #: lib/RT/Queue_Overlay.pm:118
 msgid "Steal tickets"
-msgstr "Anfragen übernehmen"
+msgstr "Anfragen stehlen"
 
 #: lib/RT/Queue_Overlay.pm:118
 msgid "StealTicket"
-msgstr "AnfrageÜbernehmen"
+msgstr "AnfrageStehlen"
 
 #: lib/RT/Transaction_Overlay.pm:667
 #. ($Old->Name)

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Template_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Template_Overlay.pm	Thu Jan 19 10:14:40 2006
@@ -103,23 +103,11 @@
 
 sub _Set {
     my $self = shift;
-
-    # use super::value or we get acl blocked
-    if ( ( defined $self->SUPER::_Value('Queue') )
-        && ( $self->SUPER::_Value('Queue') == 0 ) )
-    {
-        unless ( $self->CurrentUser->HasRight( Object => $RT::System, Right => 'ModifyTemplate') ) {
-            return ( 0, $self->loc('Permission Denied') );
-        }
-    }
-    else {
-
-        unless ( $self->CurrentUserHasQueueRight('ModifyTemplate') ) {
-            return ( 0, $self->loc('Permission Denied') );
-        }
+    
+    unless ( $self->CurrentUserHasQueueRight('ModifyTemplate') ) {
+        return ( 0, $self->loc('Permission Denied') );
     }
-    return ( $self->SUPER::_Set(@_) );
-
+    return $self->SUPER::_Set( @_ );
 }
 
 # }}}
@@ -147,26 +135,12 @@
 =cut
 
 sub _Value {
-
     my $self  = shift;
-    my $field = shift;
 
-   
-    #If the current user doesn't have ACLs, don't let em at it.  
-    #use super::value or we get acl blocked
-    if ( ( !defined $self->__Value('Queue') )
-        || ( $self->__Value('Queue') == 0 ) )
-    {
-        unless ( $self->CurrentUser->HasRight( Object => $RT::System, Right => 'ShowTemplate') ) {
-            return (undef);
-        }
+    unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
+        return undef;
     }
-    else {
-        unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
-            return (undef);
-        }
-    }
-    return ( $self->__Value($field) );
+    return $self->__Value( @_ );
 
 }
 
@@ -183,18 +157,12 @@
 sub Load {
     my $self       = shift;
     my $identifier = shift;
+    return undef unless $identifier;
 
-    if ( !$identifier ) {
-        return (undef);
-    }
-
-    if ( $identifier !~ /\D/ ) {
-        $self->SUPER::LoadById($identifier);
-    }
-    else {
-        $self->LoadByCol( 'Name', $identifier );
-
+    if ( $identifier =~ /\D/ ) {
+        return $self->LoadByCol( 'Name', $identifier );
     }
+    return $self->LoadById( $identifier );
 }
 
 # }}}
@@ -260,32 +228,32 @@
         Content     => undef,
         Queue       => 0,
         Description => '[no description]',
-        Type => 'Action',    #By default, template are 'Action' templates
-        Name => undef,
+        Type        => 'Action', #By default, template are 'Action' templates
+        Name        => undef,
         @_
     );
 
-    if ( !$args{'Queue'}  ) {
+    unless ( $args{'Queue'} ) {
         unless ( $self->CurrentUser->HasRight(Right =>'ModifyTemplate', Object => $RT::System) ) {
-            return (undef);
+            return ( undef, $self->loc('Permission denied') );
         }
         $args{'Queue'} = 0;
     }
     else {
         my $QueueObj = new RT::Queue( $self->CurrentUser );
-        $QueueObj->Load( $args{'Queue'} ) || return ( 0, $self->loc('Invalid queue') );
+        $QueueObj->Load( $args{'Queue'} ) || return ( undef, $self->loc('Invalid queue') );
     
         unless ( $QueueObj->CurrentUserHasRight('ModifyTemplate') ) {
-            return (undef);
+            return ( undef, $self->loc('Permission denied') );
         }
         $args{'Queue'} = $QueueObj->Id;
     }
 
     my $result = $self->SUPER::Create(
-        Content => $args{'Content'},
-        Queue   =>  $args{'Queue'},
+        Content     => $args{'Content'},
+        Queue       => $args{'Queue'},
         Description => $args{'Description'},
-        Name        => $args{'Name'}
+        Name        => $args{'Name'},
     );
 
     return ($result);
@@ -340,15 +308,16 @@
     my $self = shift;
 
     #We're passing in whatever we were passed. it's destined for _ParseContent
-    my $content = $self->_ParseContent(@_);
+    my ($content, $msg) = $self->_ParseContent(@_);
+    return ( 0, $msg ) unless defined $content;
 
     #Lets build our mime Entity
 
     my $parser = MIME::Parser->new();
 
-        # On some situations TMPDIR is non-writable. sad but true.
-        $parser->output_to_core(1);
-        $parser->tmp_to_core(1);
+    # On some situations TMPDIR is non-writable. sad but true.
+    $parser->output_to_core(1);
+    $parser->tmp_to_core(1);
 
     #If someone includes a message, don't extract it
     $parser->extract_nested_messages(1);
@@ -363,15 +332,13 @@
     ### Should we forgive normally-fatal errors?
     $parser->ignore_errors(1);
     $self->{'MIMEObj'} = eval { $parser->parse_data($content) };
-    my $error = ( $@ || $parser->last_error );
-
-    if ($error) {
-        $RT::Logger->error("$error");
+    if ( my $error = $@ || $parser->last_error ) {
+        $RT::Logger->error( "$error" );
         return ( 0, $error );
     }
 
     # Unfold all headers
-    $self->{'MIMEObj'}->head->unfold();
+    $self->{'MIMEObj'}->head->unfold;
 
     return ( 1, $self->loc("Template parsed") );
 
@@ -400,9 +367,13 @@
     $T::rtname      = $RT::rtname;
     *T::loc         = sub { $T::Ticket->loc(@_) };
 
+    my $content = $self->Content;
+    unless ( defined $content ) {
+        return ( undef, $self->loc("Permissions denied") );
+    }
+
     # We need to untaint the content of the template, since we'll be working
     # with it
-    my $content = $self->Content();
     $content =~ s/^(.*)$/$1/;
     my $template = Text::Template->new(
         TYPE   => 'STRING',
@@ -413,11 +384,11 @@
     my $retval = $template->fill_in( PACKAGE => 'T', BROKEN => sub {
         my (%args) = @_;
         $RT::Logger->error("Template parsing error: $args{error}")
-	    unless $args{error} =~ /^Died at /; # ignore intentional die()
+            unless $args{error} =~ /^Died at /; # ignore intentional die()
         $is_broken++;
-	return undef;
+        return undef;
     } );
-    return undef if $is_broken;
+    return ( undef, $self->loc('Template parsing error') ) if $is_broken;
 
     # MIME::Parser has problems dealing with high-bit utf8 data.
     Encode::_utf8_off($retval);

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Thu Jan 19 10:14:40 2006
@@ -1318,7 +1318,8 @@
 
     # {{{ Check ACLS
     #If the watcher we're trying to add is for the current user
-    if ( $self->CurrentUser->PrincipalId  eq $args{'PrincipalId'}) {
+    if ( $self->CurrentUser->PrincipalId  eq $args{'PrincipalId'}
+       or $self->CurrentUser->UserObj->EmailAddress eq $args{'Email'}) {
         #  If it's an AdminCc and they don't have 
         #   'WatchAsAdminCc' or 'ModifyTicket', bail
         if ( $args{'Type'} eq 'AdminCc' ) {

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	Thu Jan 19 10:14:40 2006
@@ -273,7 +273,7 @@
         or $op     eq "!=";
 
     my $meta = $FIELD_METADATA{$field};
-    if ( defined $meta->[1] ) {
+    if ( defined $meta->[1] && defined $value && $value !~ /^\d+$/ ) {
         my $class = "RT::" . $meta->[1];
         my $o     = $class->new( $sb->CurrentUser );
         $o->Load($value);
@@ -543,8 +543,6 @@
 
     $sb->{_sql_transalias} = $sb->NewAlias('Transactions')
         unless defined $sb->{_sql_transalias};
-    $sb->{_sql_trattachalias} = $sb->NewAlias('Attachments')
-        unless defined $sb->{_sql_trattachalias};
 
     my $date = RT::Date->new( $sb->CurrentUser );
     $date->Set( Format => 'unknown', Value => $value );
@@ -596,15 +594,6 @@
         );
     }
 
-    # Join Transactions To Attachments
-
-    $sb->_SQLJoin(
-        ALIAS1 => $sb->{_sql_trattachalias},
-        FIELD1 => 'TransactionId',
-        ALIAS2 => $sb->{_sql_transalias},
-        FIELD2 => 'id',
-    );
-
     # Join Transactions to Tickets
     $sb->_SQLJoin(
         ALIAS1 => 'main',
@@ -1478,12 +1467,11 @@
         @_
     );
 
-    #TODO  VALUE should also take queue names and queue objects
-    #TODO FIXME why are we canonicalizing to name, not id, robrt?
-    if ( $args{VALUE} =~ /^\d+$/ ) {
+    #TODO  VALUE should also take queue objects
+    if ( defined $args{'VALUE'} && $args{'VALUE'} !~ /^\d+$/ ) {
         my $queue = new RT::Queue( $self->CurrentUser );
         $queue->Load( $args{'VALUE'} );
-        $args{VALUE} = $queue->Name;
+        $args{'VALUE'} = $queue->Id;
     }
 
     # What if they pass in an Id?  Check for isNum() and convert to
@@ -1493,10 +1481,10 @@
 
     $self->Limit(
         FIELD       => 'Queue',
-        VALUE       => $args{VALUE},
+        VALUE       => $args{'VALUE'},
         OPERATOR    => $args{'OPERATOR'},
         DESCRIPTION => join(
-            ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{VALUE},
+            ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{'VALUE'},
         ),
     );
 

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/20-sort-by-requestor.t	Thu Jan 19 10:14:40 2006
@@ -61,4 +61,15 @@
     is_deeply( [grep {$_} @mails], [ sort grep {$_} @mails ], "Addresses are sorted (exclude nulls, which are db-dependant)");
 }
 
+{
+    my $tix = RT::Tickets->new($RT::SystemUser);
+    $tix->FromSQL("Queue = '$queue'");
+    $tix->OrderByCols({ FIELD => "Requestor.EmailAddress" });
+    $tix->RowsPerPage(30);
+    my @mails;
+    while (my $t = $tix->Next) { push @mails, $t->RequestorAddresses; }
+    is(@mails, 30, "found thirty tickets");
+    is_deeply( [grep {$_} @mails], [ sort grep {$_} @mails ], "Paging works (exclude nulls, which are db-dependant)");
+}
+
 # vim:ft=perl:

Modified: rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/22search_tix_by_txn.t
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/22search_tix_by_txn.t	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/lib/t/regression/22search_tix_by_txn.t	Thu Jan 19 10:14:40 2006
@@ -1,6 +1,6 @@
 #use Test::More tests => 26;
 use Test::More qw/no_plan/;
-
+$ENV{'TZ'} = 'GMT';
 use RT;
 RT::LoadConfig();
 RT::Init();

Modified: rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/releng.cnf	Thu Jan 19 10:14:40 2006
@@ -1,5 +1,5 @@
 PRODUCT			        = rt
-TAG			            = 3.4.5rc1
+TAG			            = 3.4.5
 CANONICAL_REPO		    = svn+ssh://svn.bestpractical.com/svn/bps-public/rt/
 TAGS		            = tags/
 TRUNK	                = branches/3.4-RELEASE

Modified: rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in	(original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/sbin/rt-setup-database.in	Thu Jan 19 10:14:40 2006
@@ -132,6 +132,7 @@
         $dbh->disconnect;
 
 	if ($RT::DatabaseType eq "Oracle") {
+        $RT::DatabasePassword = $RT::DatabasePassword; #Warning avidance
         $dbh = DBI->connect( $Handle->DSN, ${RT::DatabaseUser}, ${RT::DatabasePassword} ) || die $DBI::errstr;
 	} else {
 	


More information about the Rt-commit mailing list