[Rt-commit] [svn] r918 - in rt/branches/rt-3.3: . bin html/Admin/Groups html/Elements html/Search/Elements html/Tools lib/RT lib/RT/Action lib/t

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon May 17 22:02:34 EDT 2004


Author: jesse
Date: Mon May 17 22:02:24 2004
New Revision: 918

Modified:
   rt/branches/rt-3.3/   (props changed)
   rt/branches/rt-3.3/bin/rt.in
   rt/branches/rt-3.3/html/Admin/Groups/index.html
   rt/branches/rt-3.3/html/Elements/MyTickets
   rt/branches/rt-3.3/html/Search/Elements/PickCFs
   rt/branches/rt-3.3/html/Tools/Offline.html
   rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm
   rt/branches/rt-3.3/lib/RT/Attachment_Overlay.pm
   rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
   rt/branches/rt-3.3/lib/RT/Tickets_Overlay_SQL.pm
   rt/branches/rt-3.3/lib/t/04_send_email.pl.in
Log:
 ----------------------------------------------------------------------
 r1191 at Jesse-Vincents-Computer:  jesse | 2004-05-18T00:35:23.362237Z
 
 
 ----------------------------------------------------------------------
 r1192 at Jesse-Vincents-Computer:  jesse | 2004-05-18T02:01:52.198022Z
 
 Merged forward from rt 3.1
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.3/bin/rt.in
==============================================================================
--- rt/branches/rt-3.3/bin/rt.in	(original)
+++ rt/branches/rt-3.3/bin/rt.in	Mon May 17 22:02:24 2004
@@ -150,11 +150,11 @@
             my $title = $item->[2]{Title};
             my @titles = ref $title eq 'ARRAY' ? @$title : $title;
 
-            foreach $title (grep $_, @titles) {
-                $help{$title} = $item->[2]{Text};
-            }
+        foreach $title (grep $_, @titles) {
+            $help{$title} = $item->[2]{Text};
         }
     }
+    }
 
     # What does the user want help with?
     undef $action if ($action && $actions{$action} eq \&help);

Modified: rt/branches/rt-3.3/html/Admin/Groups/index.html
==============================================================================
--- rt/branches/rt-3.3/html/Admin/Groups/index.html	(original)
+++ rt/branches/rt-3.3/html/Admin/Groups/index.html	Mon May 17 22:02:24 2004
@@ -52,11 +52,6 @@
 </FORM>
 <%INIT>
 my $Groups = RT::Groups->new($session{'CurrentUser'});
-
-if ($FindDisabledGroups) {
-  $Groups->{'find_disabled_rows'} = 1;
-}
-
 $Groups->LimitToUserDefinedGroups();
 my $title = loc('Select a group');
 my $caption;

Modified: rt/branches/rt-3.3/html/Elements/MyTickets
==============================================================================
--- rt/branches/rt-3.3/html/Elements/MyTickets	(original)
+++ rt/branches/rt-3.3/html/Elements/MyTickets	Mon May 17 22:02:24 2004
@@ -34,6 +34,6 @@
         &>
 </&> 
 <%init>
-my $rows=10;
+my $rows = $RT::MyTicketsLength;
 </%init>
 

Modified: rt/branches/rt-3.3/html/Search/Elements/PickCFs
==============================================================================
--- rt/branches/rt-3.3/html/Search/Elements/PickCFs	(original)
+++ rt/branches/rt-3.3/html/Search/Elements/PickCFs	Mon May 17 22:02:24 2004
@@ -23,22 +23,16 @@
 %# END LICENSE BLOCK
 <table cellspacing=0 border=0>
 % while ( my $CustomField = $CustomFields->Next ) {
+
 <tr><td>
 
-% my $name;
-% if ($CustomField->QueueObj) {
-%   $name = "CF." . $CustomField->QueueObj->Name . 
-%	".{" . $CustomField->Name . "}";
-% } else {
-%   $name = "CF." . $CustomField->Name;
-% }
 <% $CustomField->Name %> 
-        <& /Elements/SelectCustomFieldOperator, Name => $name . "Op", 
+        <& /Elements/SelectCustomFieldOperator, Name => "CustomFieldOp". $CustomField->id, 
                                     True => loc("is"), 
                                     False => loc("isn't"), 
                                     TrueVal=> '=', FalseVal => '!=' &>
 
-<& /Elements/SelectCustomFieldValue, Name => "ValueOf" . $name,
+<& /Elements/SelectCustomFieldValue, Name => "CustomField".$CustomField->id,
                             CustomField => $CustomField,
                             &>
 </td></tr>

Modified: rt/branches/rt-3.3/html/Tools/Offline.html
==============================================================================
--- rt/branches/rt-3.3/html/Tools/Offline.html	(original)
+++ rt/branches/rt-3.3/html/Tools/Offline.html	Mon May 17 22:02:24 2004
@@ -31,32 +31,24 @@
 <FORM ACTION="Offline.html" NAME="TicketUpdate" 
 	METHOD=POST enctype="multipart/form-data">
 <table>
-<tr>
-<td>
-<&|/l&>Default Queue</&>:
+<tr><td class=label>
+<&|/l&>Upload file</&>:
 </td>
 <td>
-<& /Elements/SelectQueue, Name => "qname", NamedValues => 1 &>
-<i><&|/l&>If no queue is specified, create tickets in this queue.</&></i>
+<input name="Template" type="file" value="foo">
+<INPUT TYPE=SUBMIT NAME="Parse" VALUE="<&|/l&>Parse</&>">
 </td>
 </tr>
+<tr>
 <tr><td class=labeltop>
 <&|/l&>Template</&>:
 </td>
-<td colspan=2>
+<td>
 <textarea name=string cols=80 rows=30>
 <%$string%>
 </textarea>
 </td>
 </tr>
-<tr><td class=label>
-<&|/l&>Get template from file</&>:
-</td>
-<td>
-<input name="Template" type="file" value="foo">
-<INPUT TYPE=SUBMIT NAME="Parse" VALUE="<&|/l&>Go</&>">
-</td>
-</tr>
 </table>
 <& /Elements/Submit, Name => 'UpdateTickets', Label => loc('Upload'), Caption => loc("Upload your changes"), color => "#993333" &>
 
@@ -79,7 +71,7 @@
     while ( my $bytesread = read( $fh, $buffer, 4096 ) ) {
 	$template .= $buffer;
     }
-    $action->Parse($template, $ARGS{'qname'});
+    $action->Parse($template);
     foreach (@{ $action->{'create_tickets'} }) {
 	my $id = $_;
 	$id =~ s/^create\-//;

Modified: rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm	Mon May 17 22:02:24 2004
@@ -297,6 +297,7 @@
 Subject: foo, bar
 Owner: root
 Content: blah
+ENDOFCONTENT
 EOF
 
 $expected{ticket2} = <<EOF;
@@ -304,6 +305,7 @@
 Subject: foo bar
 Owner: root
 Content: blah
+ENDOFCONTENT
 EOF
 
 $expected{ticket3} = <<EOF;
@@ -311,6 +313,7 @@
 Subject: foo' bar
 Owner: root
 Content: blah'boo
+ENDOFCONTENT
 EOF
 
 $expected{ticket10} = <<EOF;
@@ -318,6 +321,7 @@
 Subject: foo' bar
 Owner: root
 Content: blah'
+ENDOFCONTENT
 EOF
 
 $expected{ticket11} = <<EOF;
@@ -325,6 +329,7 @@
 Subject: foo, bar
 Owner: root
 Content: blah
+ENDOFCONTENT
 EOF
 
 $expected{ticket12} = <<EOF;
@@ -332,6 +337,7 @@
 Subject: foo' bar
 Owner: root
 Content: blah'boo
+ENDOFCONTENT
 EOF
 
 $action->Parse($commas);
@@ -598,11 +604,18 @@
 
     my @template_order;
     my $template_id;
+    my $queue;
     if (substr($content, 0, 3) eq '===') {
 	$RT::Logger->debug("Line: ===");
 	foreach my $line (split(/\n/, $content)) {
 	    $line =~ s/\r$//;
 	    $RT::Logger->debug("Line: $line");
+	    if ($line =~ /^===$/) {
+		if ($template_id && !$queue) {
+		    $self->{'templates'}->{$template_id} .= "Queue: $qname\n";
+		}
+		$queue = 0;
+	    }
 	    if ($line =~ /^===Create-Ticket: (.*)$/) {
 		$template_id = "create-$1";
 		$RT::Logger->debug("****  Create ticket: $template_id");
@@ -617,9 +630,19 @@
 		push @{$self->{'base_tickets'}},$template_id;
 	    } elsif ($line =~ /^===#.*$/) { # a comment
 		     next;
-		 } else {
-		     $self->{'templates'}->{$template_id} .= $line."\n";
-		 }
+	    } else {
+		if ( $line =~ /^Queue:(.*)/i) {
+		    $queue = 1;
+		    my $value = $1;
+		    $value =~ s/^\s//;
+		    $value =~ s/\s$//;
+		    if (!$value) {
+			$value = $qname;
+			$line = "Queue: $value";
+		    }
+		}
+		$self->{'templates'}->{$template_id} .= $line."\n";
+	    }
 	}
     } elsif (substr($content, 0, 2) =~ /^id$/i) {
 	$RT::Logger->debug("Line: id");

Modified: rt/branches/rt-3.3/lib/RT/Attachment_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Attachment_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Attachment_Overlay.pm	Mon May 17 22:02:24 2004
@@ -384,7 +384,7 @@
 Returns this object's headers as a string.  This method specifically
 removes the RT-Send-Bcc: header, so as to never reveal to whom RT sent a Bcc.
 We need to record the RT-Send-Cc and RT-Send-Bcc values so that we can actually send
-out mail. (The mailing rules are separated from the ticket update code by
+out mail. (The mailing rules are seperated from the ticket update code by
 an abstraction barrier that makes it impossible to pass this data directly
 
 =cut
@@ -461,9 +461,9 @@
 
 =cut
 
-sub _Value  {
+sub _Value {
 
-    my $self = shift;
+    my $self  = shift;
     my $field = shift;
 
     #if the field is public, return it.

Modified: rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	Mon May 17 22:02:24 2004
@@ -317,27 +317,28 @@
 
     my %args = (
         id                 => undef,
-                 EffectiveId     => undef,
-                 Queue           => undef,
-                 Requestor       => undef,
-                 Cc              => undef,
-                 AdminCc         => undef,
-                 Type            => 'ticket',
-                 Owner           => undef,
-                 Subject         => '',
-                 InitialPriority => undef,
-                 FinalPriority   => undef,
-                 Priority   => undef,
-                 Status          => 'new',
-                 TimeWorked      => "0",
-                 TimeLeft        => 0,
-                 TimeEstimated        => 0,
-                 Due             => undef,
-                 Starts          => undef,
-                 Started         => undef,
-                 Resolved        => undef,
-                 MIMEObj         => undef,
-                 _RecordTransaction => 1,
+        EffectiveId        => undef,
+        Queue              => undef,
+        Requestor          => undef,
+        Cc                 => undef,
+        AdminCc            => undef,
+        Type               => 'ticket',
+        Owner              => undef,
+        Subject            => '',
+        InitialPriority    => undef,
+        FinalPriority      => undef,
+        Priority           => undef,
+        Status             => 'new',
+        TimeWorked         => "0",
+        TimeLeft           => 0,
+        TimeEstimated      => 0,
+        Due                => undef,
+        Starts             => undef,
+        Started            => undef,
+        Resolved           => undef,
+        MIMEObj            => undef,
+        _RecordTransaction => 1,
+
         @_
     );
 
@@ -409,26 +410,26 @@
     my $Due = new RT::Date( $self->CurrentUser );
 
     if ( $args{'Due'} ) {
-        $Due->Set( Format => 'ISO', Value  => $args{'Due'} );
+        $Due->Set( Format => 'ISO', Value => $args{'Due'} );
     }
-    elsif (  $QueueObj->DefaultDueIn  ) {
+    elsif ( $QueueObj->DefaultDueIn ) {
         $Due->SetToNow;
         $Due->AddDays( $QueueObj->DefaultDueIn );
     }
 
     my $Starts = new RT::Date( $self->CurrentUser );
     if ( defined $args{'Starts'} ) {
-        $Starts->Set( Format => 'ISO', Value  => $args{'Starts'} );
+        $Starts->Set( Format => 'ISO', Value => $args{'Starts'} );
     }
 
     my $Started = new RT::Date( $self->CurrentUser );
     if ( defined $args{'Started'} ) {
-        $Started->Set( Format => 'ISO', Value  => $args{'Started'} );
+        $Started->Set( Format => 'ISO', Value => $args{'Started'} );
     }
 
     my $Resolved = new RT::Date( $self->CurrentUser );
     if ( defined $args{'Resolved'} ) {
-        $Resolved->Set( Format => 'ISO', Value  => $args{'Resolved'} );
+        $Resolved->Set( Format => 'ISO', Value => $args{'Resolved'} );
     }
 
     #If the status is an inactive status, set the resolved date
@@ -474,8 +475,8 @@
     #to own a ticket, scream about it and make them not the owner
     if (
             ( defined($Owner) )
-         and ( $Owner->Id )
-         and ( $Owner->Id != $RT::Nobody->Id )
+        and ( $Owner->Id )
+        and ( $Owner->Id != $RT::Nobody->Id )
         and (
             !$Owner->HasRight(
                 Object => $QueueObj,
@@ -486,10 +487,10 @@
     {
 
         $RT::Logger->warning( "User "
-                              . $Owner->Name . "("
-                              . $Owner->id
-                              . ") was proposed "
-                              . "as a ticket owner but has no rights to own "
+              . $Owner->Name . "("
+              . $Owner->id
+              . ") was proposed "
+              . "as a ticket owner but has no rights to own "
               . "tickets in "
               . $QueueObj->Name );
 
@@ -516,7 +517,7 @@
         foreach my $watcher (
             ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) )
         {
-        my $user = RT::User->new($RT::SystemUser);
+            my $user = RT::User->new($RT::SystemUser);
             $user->LoadOrCreateByEmail($watcher)
               if ( $watcher && $watcher !~ /^\d+$/ );
         }
@@ -526,19 +527,19 @@
 
     my %params = (
         Queue           => $QueueObj->Id,
-                                   Owner           => $Owner->Id,
-                                   Subject         => $args{'Subject'},
-                                   InitialPriority => $args{'InitialPriority'},
-                                   FinalPriority   => $args{'FinalPriority'},
-                                   Priority        => $priority,
-                                   Status          => $args{'Status'},
-                                   TimeWorked      => $args{'TimeWorked'},
-                                   TimeEstimated   => $args{'TimeEstimated'},
-                                   TimeLeft        => $args{'TimeLeft'},
-                                   Type            => $args{'Type'},
-                                   Starts          => $Starts->ISO,
-                                   Started         => $Started->ISO,
-                                   Resolved        => $Resolved->ISO,
+        Owner           => $Owner->Id,
+        Subject         => $args{'Subject'},
+        InitialPriority => $args{'InitialPriority'},
+        FinalPriority   => $args{'FinalPriority'},
+        Priority        => $priority,
+        Status          => $args{'Status'},
+        TimeWorked      => $args{'TimeWorked'},
+        TimeEstimated   => $args{'TimeEstimated'},
+        TimeLeft        => $args{'TimeLeft'},
+        Type            => $args{'Type'},
+        Starts          => $Starts->ISO,
+        Started         => $Started->ISO,
+        Resolved        => $Resolved->ISO,
         Due             => $Due->ISO
     );
 
@@ -581,8 +582,8 @@
     my $create_groups_ret = $self->_CreateTicketGroups();
     unless ($create_groups_ret) {
         $RT::Logger->crit( "Couldn't create ticket groups for ticket "
-                           . $self->Id
-                           . ". aborting Ticket creation." );
+              . $self->Id
+              . ". aborting Ticket creation." );
         $RT::Handle->Rollback();
         return ( 0, 0,
             $self->loc("Ticket could not be created due to an internal error")
@@ -619,19 +620,19 @@
             if ( $type eq 'AdminCc' ) {
 
         # Note that we're using AddWatcher, rather than _AddWatcher, as we
-                # actually _want_ that ACL check. Otherwise, random ticket creators
-                # could make themselves adminccs and maybe get ticket rights. that would
-                # be poor
+        # actually _want_ that ACL check. Otherwise, random ticket creators
+        # could make themselves adminccs and maybe get ticket rights. that would
+        # be poor
                 ( $wval, $wmsg ) = $self->AddWatcher(
                     Type   => $type,
-                                                         $field => $watcher,
+                    $field => $watcher,
                     Silent => 1
                 );
             }
             else {
                 ( $wval, $wmsg ) = $self->_AddWatcher(
                     Type   => $type,
-                                                          $field => $watcher,
+                    $field => $watcher,
                     Silent => 1
                 );
             }
@@ -663,16 +664,16 @@
     # {{{ Add all the custom fields
 
     foreach my $arg ( keys %args ) {
-    next unless ( $arg =~ /^CustomField-(\d+)$/i );
-    my $cfid = $1;
-    foreach
+        next unless ( $arg =~ /^CustomField-(\d+)$/i );
+        my $cfid = $1;
+        foreach
       my $value ( UNIVERSAL::isa($args{$arg}, 'ARRAY') ? @{ $args{$arg} } : ( $args{$arg} ) ) {
         next unless (length($value));
         $self->_AddCustomFieldValue( Field => $cfid,
-                                     Value => $value,
-                                     RecordTransaction => 0
-                                 );
-    }
+                Value             => $value,
+                RecordTransaction => 0
+            );
+        }
     }
 
     # }}}
@@ -681,9 +682,9 @@
 
         # {{{ Add a transaction for the create
         my ( $Trans, $Msg, $TransObj ) = $self->_NewTransaction(
-                                                     Type      => "Create",
-                                                     TimeTaken => 0,
-                                                     MIMEObj => $args{'MIMEObj'}
+            Type      => "Create",
+            TimeTaken => 0,
+            MIMEObj   => $args{'MIMEObj'}
         );
 
         if ( $self->Id && $Trans ) {
@@ -2714,7 +2715,7 @@
 
     # We use EffectiveId here even though it duplicates information from
     # the links table becasue of the massive performance hit we'd take
-    # by trying to do a separate database query for merge info everytime 
+    # by trying to do a seperate database query for merge info everytime 
     # loaded a ticket. 
 
     #update this ticket's effective id to the new ticket's id.

Modified: rt/branches/rt-3.3/lib/RT/Tickets_Overlay_SQL.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Tickets_Overlay_SQL.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Tickets_Overlay_SQL.pm	Mon May 17 22:02:24 2004
@@ -457,53 +457,8 @@
 ok ($cols[0] == undef, "We haven't explicitly asked to display anything");
 
 
-my (@ids, @expectedids);
 
-my $t = RT::Ticket->new($RT::SystemUser);
 
-my $string = 'subject/content SQL test';
-ok( $t->Create(Queue => 'General', Subject => $string), "Ticket Created");
-
-push @ids, $t->Id;
-
-my $Message = MIME::Entity->build(
-			     Subject     => 'this is my subject',
-			     From        => 'jesse at example.com',
-			     Data        => [ $string ],
-        );
-
-ok( $t->Create(Queue => 'General', Subject => 'another ticket', MIMEObj => $Message, MemberOf => $ids[0]), "Ticket Created");
-
-push @ids, $t->Id;
-
-$query = ("Subject LIKE '$string' OR Content LIKE '$string'");
-
-my ($id, $msg) = $tix->FromSQL($query);
-
-ok ($id, $msg);
-
-is ($tix->Count, scalar @ids, "number of returned tickets same as entered");
-
-while (my $tick = $tix->Next) {
-    push @expectedids, $tick->Id;
-}
-
-ok (eq_array(\@ids, \@expectedids), "returned expected tickets");
-
-$query = ("id = $ids[0] OR MemberOf = $ids[0]");
-
-my ($id, $msg) = $tix->FromSQL($query);
-
-ok ($id, $msg);
-
-is ($tix->Count, scalar @ids, "number of returned tickets same as entered");
-
- at expectedids = ();
-while (my $tick = $tix->Next) {
-    push @expectedids, $tick->Id;
-}
-
-ok (eq_array(\@ids, \@expectedids), "returned expected tickets");
 
 =end testing
 

Modified: rt/branches/rt-3.3/lib/t/04_send_email.pl.in
==============================================================================
--- rt/branches/rt-3.3/lib/t/04_send_email.pl.in	(original)
+++ rt/branches/rt-3.3/lib/t/04_send_email.pl.in	Mon May 17 22:02:24 2004
@@ -476,6 +476,31 @@
 
 # }}}
 
+# {{{ test a multi-line RT-Send-CC header
+
+my $content =  `cat @RT_LIB_PATH@/t/data/rt-send-cc` || die "couldn't find new content";
+
+$parser->ParseMIMEEntityFromScalar($content);
+
+
+
+my %args =        (message => $content, queue => 1, action => 'correspond');
+ RT::Interface::Email::Gateway(\%args);
+my $tickets = RT::Tickets->new($RT::SystemUser);
+$tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
+$tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
+my $tick = $tickets->First();
+ok ($tick->Id, "found ticket ".$tick->Id);
+
+my $cc = $tick->Transactions->First->Attachments->First->GetHeader('RT-Send-Cc');
+ok ($cc =~ /test1/, "Found test 1");
+ok ($cc =~ /test2/, "Found test 2");
+ok ($cc =~ /test3/, "Found test 3");
+ok ($cc =~ /test4/, "Found test 4");
+ok ($cc =~ /test5/, "Found test 5");
+
+# }}}
+
 # Don't taint the environment
 $everyone->PrincipalObj->RevokeRight(Right =>'SuperUser');
 1;


More information about the Rt-commit mailing list