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

BPS Git Server git at git.bestpractical.com
Wed Feb 23 18:46:17 UTC 2022


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  fb716c48b98bd594d22863ade4342c88181c2f02 (commit)

- Log -----------------------------------------------------------------
commit fb716c48b98bd594d22863ade4342c88181c2f02
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..68ba6114 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,
+                $ARGS{UpdateTimeWorked} ? ( TimeWorked => $IncidentObj->TimeWorked + $ARGS{UpdateTimeWorked} ) : (),
+            },
         );
     } else {
         push @results, loc("Status of the Incident left unchanged; not all children were updated");

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

    Call ProcessUpdateMessage first to update TimeWorked 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 supposed to be handled by ProcessUpdateMessage first(to convert
    "UpdateTimeWorked" to "TimeWorked") and then ProcessTicketBasics(to
    actually update "TimeWorked").

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 914ddcb5..29fe5499 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 );
@@ -485,10 +486,6 @@ if ( $ARGS{'BulkArticles'} && @SelectedTickets ) {
     );
 }
 
-unless( $new_ticket ) {
-    push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj, Actions => \@results );
-}
-
 if ( $ARGS{'MarkAsSeen'} ) {
     $TicketObj->SetAttribute(
         Name => 'User-'. $TicketObj->CurrentUser->id .'-SeenUpTo',

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