[Rt-commit] r4538 - in rtir/branches/1.9-EXPERIMENTAL: . html/RTIR/Elements html/RTIR/Incident html/RTIR/Report html/RTIR/Reporting lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Wed Feb 15 17:25:37 EST 2006


Author: ruz
Date: Wed Feb 15 17:25:36 2006
New Revision: 4538

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowRTIRField
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Reporting/Report.html
   rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm

Log:
 r718 at cubic-pc:  cubic | 2006-02-16 01:28:53 +0300
  use ticket's utility to get RTIR's CF values


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	Wed Feb 15 17:25:36 2006
@@ -214,7 +214,7 @@
 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
                      $Ticket->CurrentUserHasRight('ModifyTicket') );
 
-my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 unless ($OnlySearchForPeople) {
     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS );
     push @results, ProcessTicketBasics(   TicketObj => $Ticket, ARGSRef => \%ARGS );
@@ -223,7 +223,7 @@
     push @results, ProcessTicketLinks(    TicketObj => $Ticket, ARGSRef => \%ARGS );
     push @results, ProcessUpdateMessage(  TicketObj => $Ticket, ARGSRef=>\%ARGS );
 }
-my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 if ($newstate ne $oldstate) {
   push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
 }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	Wed Feb 15 17:25:36 2006
@@ -80,14 +80,14 @@
                         path  => "RTIR/Display.html?id=$id",
                         title => loc("$Type #[_1]", $id) };
     
+    my %can = map { $_, $Ticket->CurrentUserHasRight($_) }
+              qw(ModifyTicket ReplyToTicket OwnTicket CommentOnTicket);
+
     my $ticket_page_tabs = {
         _A => { title => loc('Display'),
                 path  => "RTIR/Display.html?id=$id" }
     };
 
-    my %can = map { $_ => $Ticket->CurrentUserHasRight($_) }
-              qw(ModifyTicket ReplyToTicket OwnTicket CommentOnTicket);
-
     # only show edit option if they can do it
     if ( $can{'ModifyTicket'} ) {
         $ticket_page_tabs->{'_E'} = { title => loc('Edit'),
@@ -110,14 +110,13 @@
         }
     }
     $tabs->{'this'}->{'subtabs'} = $ticket_page_tabs;
+    $current_subtab ||= "RTIR/Display.html?id=$id";
 
-    if( $current_subtab ) {
-        foreach my $tab ( values %$ticket_page_tabs ) {
-            next unless $tab->{'path'} eq $current_subtab;
+    foreach my $tab ( values %$ticket_page_tabs ) {
+        next unless $tab->{'path'} eq $current_subtab;
 
-            $tab->{'subtabs'} = $subtabs;
-            $tabs->{'this'}->{'current_subtab'} = $tab->{'path'};
-        }
+        $tab->{'subtabs'} = $subtabs;
+        $tabs->{'this'}->{'current_subtab'} = $tab->{'path'};
     }
 
     ### Reply ###
@@ -143,7 +142,7 @@
     if ( $can{'ModifyTicket'} ) {
         if ( $Type eq 'Report' ) {
             if ( $Ticket->QueueObj->IsActiveStatus( $Ticket->Status ) ) {
-                my $state = $Ticket->FirstCustomFieldValue('_RTIR_State');
+                my $state = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State');
                 if ($state ne 'new') {
                     $actions->{'Ac'} = {
                         path => "RTIR/Update.html?Action=Comment&DefaultStatus=resolved&id=$id",
@@ -244,9 +243,9 @@
                      separator => 1 };
 }
 
-foreach ( keys %{$tabs} ) {
-    if ( $tabs->{ $_ }->{'path'} eq $current_tab ) {
-        $tabs->{ $_ }->{'subtabs'} = { %{$tabs->{ $_ }->{'subtabs'} || {}}, %$subtabs };
+foreach my $tab ( values %{$tabs} ) {
+    if ( $tab->{'path'} eq $current_tab ) {
+        $tab->{'subtabs'} = { %{$tab->{'subtabs'} || {}}, %$subtabs };
     }
 }
 

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	Wed Feb 15 17:25:36 2006
@@ -25,7 +25,7 @@
 %  while (my $incident = $incidents->Next) {
 %   $count++;
 % my $State = $m->scomp("/RTIR/Elements/ShowRTIRField", Ticket => $incident, Name => 'State');
-<a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$incident->Id%>"><%$incident->Id%>: <%$incident->Subject%></a> <i>(<%$State%>)</i>
+<a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$incident->Id%>"><%$incident->Id%>: <%$incident->Subject%></a> <i>(<% $State |n %>)</i>
 % if ($depth < 8) {
 <& /RTIR/Elements/ShowIncidents, Ticket => $incident, depth => ($depth+1) &> 
 %   }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowRTIRField
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowRTIRField	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowRTIRField	Wed Feb 15 17:25:36 2006
@@ -22,13 +22,14 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-% if ($fieldvalue) {
-<%$fieldvalue%>
+% if ( $fieldvalue ) {
+<span class="cf-value"><% $fieldvalue %></span>
 % } else {
-<i><&|/l&>(no value)</&></i>
+<span class="cf-value novalue"><&|/l&>no value</&></class>
 % }
 <%INIT>
-my $fieldvalue = $Ticket->FirstCustomFieldValue("_RTIR_".$Name);
+use RT::IR::Ticket;
+my $fieldvalue = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, "_RTIR_".$Name );
 </%INIT>
 <%ARGS>
 $Ticket => undef

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	Wed Feb 15 17:25:36 2006
@@ -135,11 +135,11 @@
 
         push @tmp, $t;
         foreach my $t( @tmp ) {
-            my $oldstate = $t->FirstCustomFieldValue('_RTIR_State');
-            
+            my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $t, '_RTIR_State' );
+
             push @tempresults, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $t );
 
-            my $newstate = $t->FirstCustomFieldValue('_RTIR_State');
+            my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $t, '_RTIR_State' );
             if ( $newstate ne $oldstate ) {
                 push @tempresults,
                      [ $t->id, loc("State changed from [_1] to [_2]", $oldstate, $newstate ) ];

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	Wed Feb 15 17:25:36 2006
@@ -265,16 +265,16 @@
 $ARGS{'id'} = $id = $TicketObj->Id;
 
 if( 1 ) {
-    my $oldstate = $TicketObj->FirstCustomFieldValue('_RTIR_State');
+    my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $TicketObj, '_RTIR_State' );
 
-    if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(?:Steal|Kill|Take|SetTold)$/ )
+    if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
     {
         my ($res, $msg) = $TicketObj->$1();
         push @results, $msg;
     }
 
     unless( $new_ticket ) {
-        push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj=>$TicketObj );
+        push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
     }
 
     if ( $ARGS{'BulkLink'} || $Child ) {
@@ -297,7 +297,7 @@
         push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj );
     }
 
-    my $newstate = $TicketObj->FirstCustomFieldValue('_RTIR_State');
+    my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $TicketObj, '_RTIR_State' );
     if ($newstate ne $oldstate) {
         push @results, loc("State changed from [_1] to [_2]", $oldstate, $newstate );
     }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html	Wed Feb 15 17:25:36 2006
@@ -146,7 +146,7 @@
 $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
                      $Ticket->CurrentUserHasRight('ModifyTicket') );
 
-my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 unless ($OnlySearchForPeople) {
     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
     push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
@@ -155,7 +155,7 @@
     push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
    	push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
 }
-my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 if ($newstate ne $oldstate) {
   push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
 }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html	Wed Feb 15 17:25:36 2006
@@ -126,13 +126,13 @@
             next;
         }
         $id = $Ticket->id;
-        my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+        my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 
         my @tempresults;
         push @tempresults, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS );
         push @tempresults, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
 
-        my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
+        my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
 
         if ($newstate ne $oldstate) {
             push (@tempresults, loc("State changed from [_1] to [_2]", $oldstate, $newstate));

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html	Wed Feb 15 17:25:36 2006
@@ -107,7 +107,7 @@
             next;
         }
 
-        my $oldstate = $t->FirstCustomFieldValue('_RTIR_State');
+        my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $t, '_RTIR_State' );
         
         if ( $t->Owner != $session{'CurrentUser'}->id &&
              $t->Owner == $RT::Nobody->id )
@@ -122,7 +122,7 @@
 
         push @tempresults, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $t );
 
-        my $newstate = $t->FirstCustomFieldValue('_RTIR_State');
+        my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $t, '_RTIR_State' );
         if ( $newstate ne $oldstate ) {
             push @tempresults,
                  [ $id, loc("State changed from [_1] to [_2]", $oldstate, $newstate ) ];

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Reporting/Report.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Reporting/Report.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Reporting/Report.html	Wed Feb 15 17:25:36 2006
@@ -268,29 +268,17 @@
 }
 
 sub get_incident_field {
-  my $t = shift;
-  my $field = shift;
+    my $t = shift;
+    my $field = shift;
 
-  # find the parent incident
-  my $query = "Queue = 'Incidents' AND HasMember = " . $t->Id;
-
-  my $incidents = new RT::Tickets($session{'CurrentUser'});
-  $incidents->FromSQL($query);
-
-  my $parent;
-  $incidents->GotoFirstItem();
-  while (my $incident = $incidents->Next) {
-    if ($incident->QueueObj->Name eq 'Incidents') {
-      $parent = $incident;
-      last;
-    }
-  }
-
-  if ( $parent ) {
-      return $parent->FirstCustomFieldValue($field);
-  } else {
-      return undef;
-  }
+    # find the parent incident
+    my $query = "Queue = 'Incidents' AND HasMember = ". $t->Id;
+    my $incidents = new RT::Tickets( $session{'CurrentUser'} );
+    $incidents->FromSQL( $query );
+
+    my $parent = $incidents->First;
+    return undef unless $parent;
+    return RT::IR::Ticket::FirstCustomFieldValue( $parent, $field );
 }
 
 if ($tabbed) {

Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetDueBySLA.pm	Wed Feb 15 17:25:36 2006
@@ -81,7 +81,7 @@
     # now that we know the SLA, set the value of the CF
     unless ( $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA') ) {
         my $cf = RT::CustomField->new( $self->CurrentUser );
-        $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
+        $cf->LoadByNameAndQueue( Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA' );
         return unless $cf->Id;
 
         my $SLAObj = RT::IR::SLAInit();


More information about the Rt-commit mailing list