[Rt-users] resolved timeworked check

Senoner Samuel Samuel.Senoner at eurac.edu
Fri Apr 16 05:28:11 EDT 2004


If all members of your staff just use one browser (every user uses IE).....

>
thanks... any reason not to do this client side?


In my case it wasn't so, so I did it on server side, I don't remember if I posted it to list.

Anyway here a patch, which covers many point where you can resolve a ticket whitout entering time, one is missing, I will provide the complete patch later.

I think this should be better in rt-devel... But it started in users, so I will continue in users. 

If someone has ideas and corrections to my patch, please let me know. Thanks
Samuel

patch for rt 3.0.4

The error is now displayed above the input mask and in all the pages where you can set the status to resolved (I found one possibility where it isn't so, but I will provide another patch)

Diffs:

--- /usr/share/request-tracker3/html/Ticket/ModifyAll.html      2003-07-29 11:25:12.000000000 +0200
+++ /usr/local/share/request-tracker3/html/Ticket/ModifyAll.html        2004-02-18 18:14:28.000000000 +0100
@@ -27,6 +27,13 @@
     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id,
     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>

+% if ($Error) {
+<& /Elements/TitleBoxStart, title => loc('Error') ,  color=> "#993333" &>
+<B>
+<% $Error %>
+</B>
+<& /Elements/TitleBoxEnd &>
+% }
 <& /Elements/ListActions, actions => \@results &>

 <FORM METHOD=POST ACTION="ModifyAll.html" ENCTYPE="multipart/form-data">
@@ -90,12 +97,20 @@
 <& /Elements/TitleBoxEnd &>


-<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
+<& /Elements/Submit, Name => 'SubmitTicket' ,Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color
=> "#333399" &>
 </form>

 <%INIT>


+if ($ARGS{'Status'} eq 'resolved') {
+  if (( $ARGS{'TimeWorked'} == 0)
+  and
+  exists $ARGS{SubmitTicket} ) {
+           $Error="Please insert time worked";
+          $OnlySearchForPeople=1;
+        }
+}

 my $Ticket = LoadTicket($id);

@@ -154,5 +169,6 @@
 $UserOp => undef
 $UserString => undef
 $id => undef
+$Error => undef
 </%ARGS>




--- /usr/share/request-tracker3/html/Ticket/Update.html 2003-07-29 11:25:13.000000000 +0200
+++ /usr/local/share/request-tracker3/html/Ticket/Update.html   2004-02-18 17:53:22.000000000 +0100
@@ -26,6 +26,13 @@
     Ticket => $Ticket ,
     Title=> $title &>

+% if ($Error) {
+<& /Elements/TitleBoxStart, title => loc('Error') ,  color=> "#993333" &>
+<B>
+<% $Error %>
+</B>
+<& /Elements/TitleBoxEnd &>
+% }
 <FORM ACTION="Update.html" NAME="TicketUpdate"
        METHOD=POST enctype="multipart/form-data">
 <input type="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction} %>">
@@ -134,6 +141,17 @@
 }

 if ($ARGS{'Status'} eq 'resolved') {
+     # if we are resolving a ticket and there has been no time submitted,
+     # do not allow the ticket to resolve.  must check that SubmitTicket is
+     # set, or we prevent the close page from loading and thus NO ticket can
+     # be resolved.
+     if ((! defined($Ticket->TimeWorked) or $Ticket->TimeWorked == 0)
+ and
+          $ARGS{'UpdateTimeWorked'} == 0 and
+           exists $ARGS{SubmitTicket} ) {
+          $Error="Please insert time worked";
+#         Abort(loc('Fill in time'));
+      }
     $title = loc("Resolve ticket #[_1] ([_2])", $Ticket->id, $Ticket->Subject);
 } else {
     $title = loc("Update ticket #[_1] ([_2])", $Ticket->id, $Ticket->Subject);
@@ -192,7 +210,7 @@
 }
 # }}}

-if ( exists $ARGS{SubmitTicket} ) {
+if ( (exists $ARGS{SubmitTicket}) and (!defined($Error)) ) {
     $m->comp('Display.html', %ARGS);
     return;
 }
@@ -202,4 +220,5 @@
 $id => undef
 $Action => undef
 $DefaultStatus => undef
+$Error => undef
 </%ARGS>



--- /usr/share/request-tracker3/html/Ticket/Modify.html 2003-07-29 11:25:16.000000000 +0200
+++ /usr/local/share/request-tracker3/html/Ticket/Modify.html   2004-02-19 10:12:19.000000000 +0100
@@ -26,6 +26,13 @@
     Ticket => $TicketObj, current_subtab => "Ticket/Modify.html?id=".$TicketObj->Id,
     Title => loc('Modify ticket #[_1]', $TicketObj->Id) &>

+% if ($Error) {
+<& /Elements/TitleBoxStart, title => loc('Error') ,  color=> "#993333" &>
+<B>
+<% $Error %>
+</B>
+<& /Elements/TitleBoxEnd &>
+% }
 <& /Elements/ListActions, actions => \@results &>
 <FORM METHOD=POST ACTION="Modify.html">
 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>">
@@ -35,20 +42,29 @@
 <& Elements/EditCustomFields, TicketObj => $TicketObj &>
 <& /Elements/TitleBoxEnd &>

-<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#993333" &>
+<& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color
=> "#993333" &>
 </form>
 <%INIT>

 my $TicketObj = LoadTicket($id);
 my $CustomFields = $TicketObj->QueueObj->CustomFields();

+if ($ARGS{'Status'} eq 'resolved') {
+  if ($ARGS{'TimeWorked'} == 0
+  and
+  exists $ARGS{SubmitTicket} ) {
+           $Error="Please insert time worked";
+        }
+}
+my @results;
+unless ($Error){
 # Now let callbacks have a chance at editing %ARGS
 $m->comp('/Elements/Callback', TicketObj => $TicketObj, CustomFields => $CustomFields, %ARGS);

-my @results = ProcessTicketBasics(TicketObj => $TicketObj, ARGSRef => \%ARGS);
+   @results = ProcessTicketBasics(TicketObj => $TicketObj, ARGSRef => \%ARGS);
 my @cf_results = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
 push (@results, @cf_results);
-
+}
 # TODO: display the results, even if we can't display the ticket

 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
@@ -60,4 +76,5 @@

 <%ARGS>
 $id => undef
+$Error => undef
 </%ARGS>



More information about the rt-users mailing list