[Rt-commit] r8033 - rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements

ruz at bestpractical.com ruz at bestpractical.com
Wed Jun 27 21:12:57 EDT 2007


Author: ruz
Date: Wed Jun 27 21:12:56 2007
New Revision: 8033

Modified:
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/UpdateData

Log:
* make ticket object an optional argument so bulk abandon works again

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/UpdateData
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/UpdateData	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/UpdateData	Wed Jun 27 21:12:56 2007
@@ -23,9 +23,13 @@
 %# 
 %# END LICENSE BLOCK
 
+% if ( $Ticket ) {
 <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $Ticket &>
+% }
+
 <tr><td colspan="2"><& /RTIR/Create.html:AttachmentsForm &></td></tr>
 
+% if ( $siblings ) {
 <tr><td colspan="2">
 <&| /Widgets/TitleBox, title => loc("Attach Reports") &>
 <& /Elements/TicketList,
@@ -36,6 +40,7 @@
     ShowNavigation => 0,
 &>
 </&></td></tr>
+% }
 
 % if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
 <tr><td>&nbsp;</td><td>
@@ -61,41 +66,41 @@
 $UpdateBcc => ''
 </%ARGS>
 <%INIT>
-my @parents;
-
-my $type = RT::IR::TicketType( Ticket => $Ticket );
-if ( $type eq 'Incident' ) {
-    push @parents, $Ticket->id;
-} else {
-    my $tickets = RT::Tickets->new( $Ticket->CurrentUser );
-    $tickets->FromSQL( "Queue = 'Incidents' AND HasMember = ". $Ticket->id );
-    while ( my $parent = $tickets->Next ) {
-        push @parents, $parent->id;
-    }
-}
-
 if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
     foreach ( qw(Sign Encrypt) ) {
         $ARGS{ $_ } = $m->comp( '/Widgets/Form/Boolean:Process',
             Name => $_,
-            DefaultValue => $Ticket->QueueObj->$_,
+            DefaultValue => $Ticket? $Ticket->QueueObj->$_: 0,
             Arguments => \%ARGS,
         );
     }
 }
 
-my $siblings = RT::Tickets->new( $Ticket->CurrentUser );
-if ( @parents ) {
-    my $siblings_query = "Queue = 'Incident Reports'"
-        ." AND (". join( ' OR ', map "MemberOf = $_", @parents ) . ")";
-
-    if ( $type eq 'Report' ) {
-        $siblings_query .= " AND id != ". $Ticket->id;
+my $siblings;
+if ( $Ticket ) {
+    my @parents;
+    my $type = RT::IR::TicketType( Ticket => $Ticket );
+    if ( $type eq 'Incident' ) {
+        push @parents, $Ticket->id;
+    } else {
+        my $tickets = RT::Tickets->new( $Ticket->CurrentUser );
+        $tickets->FromSQL( "Queue = 'Incidents' AND HasMember = ". $Ticket->id );
+        while ( my $parent = $tickets->Next ) {
+            push @parents, $parent->id;
+        }
     }
 
-    $siblings->FromSQL( $siblings_query );
-} else {
-    $siblings->FromSQL("id = 0");
+    if ( @parents ) {
+        $siblings = RT::Tickets->new( $Ticket->CurrentUser );
+        my $siblings_query = "Queue = 'Incident Reports'"
+            ." AND (". join( ' OR ', map "MemberOf = $_", @parents ) . ")";
+
+        if ( $type eq 'Report' ) {
+            $siblings_query .= " AND id != ". $Ticket->id;
+        }
+
+        $siblings->FromSQL( $siblings_query );
+    }
 }
 
 my $Format = q{


More information about the Rt-commit mailing list