[Rt-commit] rtir branch 5.0/work-with-timetracking created. 5.0.1-36-gaf984391

BPS Git Server git at git.bestpractical.com
Wed Dec 22 18:51:47 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtir".

The branch, 5.0/work-with-timetracking has been created
        at  af984391c22d6813aec6f1d893fcc170fab208ac (commit)

- Log -----------------------------------------------------------------
commit af984391c22d6813aec6f1d893fcc170fab208ac
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Dec 22 22:45:32 2021 +0800

    Update TimeWorked for incident only on incident reply/resolve pages
    
    Previously TimeWorked would be updated for all the selected tickets,
    which is quite confusing.

diff --git a/html/RTIR/Incident/Elements/ReplyForm b/html/RTIR/Incident/Elements/ReplyForm
index 109139f5..8425054f 100644
--- a/html/RTIR/Incident/Elements/ReplyForm
+++ b/html/RTIR/Incident/Elements/ReplyForm
@@ -101,6 +101,9 @@
     &>
   </div>
 </div>
+
+% # UpdateTimeWorked is shown in "Incident Time Taken" widget on individual incident pages
+% if ( !$TicketObj ) {
 <div class="form-row">
   <div class="label col-2">
     <&|/l&>Worked</&>:
@@ -112,6 +115,7 @@
     &>
   </div>
 </div>
+% }
 
 <& /RTIR/Elements/UpdateData, %ARGS, Ticket => $TicketObj, QueueObj => $QueueObj, Action => $Action &>
 
diff --git a/html/RTIR/Incident/Reply/index.html b/html/RTIR/Incident/Reply/index.html
index 8d1a67de..76169679 100644
--- a/html/RTIR/Incident/Reply/index.html
+++ b/html/RTIR/Incident/Reply/index.html
@@ -128,6 +128,21 @@
 <& /Elements/ListActions, actions => loc('Warning: no recipients!'), titlebox => { class => 'error-titlebox', bodyclass => 'py-0' } &>
 % }
 
+<&| /Widgets/TitleBox, title => loc('Incident Time Taken') &>
+  <div class="form-row">
+    <div class="label col-2">
+      <&|/l&>Worked</&>:
+    </div>
+    <div class="value col-9">
+      <& /Elements/EditTimeValue,
+          Name => 'UpdateTimeWorked',
+          Default => $ARGS{'UpdateTimeWorked'} || '',
+      &>
+    </div>
+  </div>
+% $m->callback( %ARGS, CallbackName => 'AfterTimeWorked', TicketObj => $IncidentObj );
+</&>
+
 <& ../Elements/ReplyForm, %ARGS,
     TicketObj   => $IncidentObj,
     Status      => $Status,
@@ -197,18 +212,20 @@ if ( $SubmitTicket && !$checks_failure ) {
     foreach my $Ticket ( @selected_children ) {
         my $id = $Ticket->id;
 
-        push @results, map { loc("Ticket [_1]: [_2]", $id, $_) }
-            ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS, KeepAttachments => 1 );
+        # UpdateTimeWorked is only for current incident
+        my %children_args = map { $_ => $ARGS{$_} } grep { $_ ne 'UpdateTimeWorked' } keys %ARGS;
 
-        my %additional;
         if ( $Status ) {
-            $additional{Status} = RT::IR->MapStatus( $Status, $incident_cycle => $Ticket );
+            $children_args{Status} = RT::IR->MapStatus( $Status, $incident_cycle => $Ticket );
         }
 
+        push @results, map { loc("Ticket [_1]: [_2]", $id, $_) }
+            ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%children_args, KeepAttachments => 1 );
+
         unless ( RT::IR->IsLinkedToActiveIncidents( $Ticket, $IncidentObj ) ) {
             push @results, ProcessTicketBasics(
                 TicketObj => $Ticket,
-                ARGSRef => { %ARGS, %additional },
+                ARGSRef => \%children_args,
             );
         }
     }
@@ -229,7 +246,12 @@ if ( $SubmitTicket && !$checks_failure ) {
             Object => $IncidentObj, ARGSRef => \%ARGS
         );
         push @results, ProcessTicketBasics(
-            TicketObj => $IncidentObj, ARGSRef => { %ARGS, Status => $Status },
+            TicketObj => $IncidentObj,
+            ARGSRef   => {
+                %ARGS,
+                Status => $Status,
+                TimeWorked => $IncidentObj->TimeWorked + $ARGS{UpdateTimeWorked},
+            },
         );
     } else {
         push @results, loc("Status of the Incident left unchanged; not all children were updated");

commit 8048cb33b313f8cbf797df0ad7f19160a007966d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 29 22:58:19 2021 +0800

    Call ProcessUpdateMessage to process UpdateTimeWorked on incident display page
    
    When clicking "Add" in the "Add to time worked" row(from TimeTracking
    extension) on display page, "UpdateTimeWorked" field is submitted, which
    is handled by ProcessUpdateMessage function.

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 914ddcb5..7656f7f3 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -452,6 +452,7 @@ if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
 
 
 unless( $new_ticket ) {
+    push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj );
     push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
     push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $TicketObj );
     push @results, ProcessTicketDates( ARGSRef => \%ARGS, TicketObj => $TicketObj );

commit 15b152b5319f6cf2a89f67595a84c332832f238a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 29 22:57:38 2021 +0800

    Add EndOfBasics callback to ticket display pages
    
    This is for TimeTracking extension so it can insert "Add to time worked"
    row accrodingly.

diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index ad4b7a26..addc8d9c 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -127,6 +127,7 @@
     </div>
 
     <& /Elements/ShowCustomFields, Grouping => 'Basics', Object => $Ticket, Table => 0 &>
+%   $m->callback( %ARGS, TicketObj => $Ticket, CallbackName => 'EndOfBasics' );
   </div>
 % }
 % if ($modify_behavior ne 'hide') {
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 6e192d6c..914ddcb5 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -142,6 +142,7 @@
       </div>
 
   <& /Elements/ShowCustomFields, Grouping => 'Basics', Object => $TicketObj, Table => 0 &>
+%     $m->callback( %ARGS, TicketObj => $TicketObj, CallbackName => 'EndOfBasics' );
 
     </div>
 % }

-----------------------------------------------------------------------


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list