initial release
[RTx-MandatoryCustomFields.git] / html / Callbacks / MandatoryCustomFields / Ticket / Update.html / BeforeUpdate
1 <%doc>
2 When the user tries to change a ticket's status to "resolved" through 
3 the Update interface, check mandatory fields.  If they aren't all set, 
4 redirect to Ticket Basics instead of updating.  Note that this will 
5 lose any comments/time/other information the user has entered.
6 </%doc>
7
8 <%init>
9 my $oldStatus = $TicketObj->Status();
10 my $newStatus = $ARGSRef->{'Status'} || $ARGSRef->{'DefaultStatus'} || '';
11 if( $oldStatus ne 'resolved' and 
12     $newStatus eq 'resolved' and
13     $m->comp('/Ticket/Elements/CheckMandatoryFields', 
14               Ticket => $TicketObj
15               ) ) {
16     $m->clear_buffer;
17     RT::Interface::Web::Redirect( 
18       RT->Config->Get('WebURL')."Ticket/Modify.html?id=".$TicketObj->Id."&resolve=1"
19     );
20     $m->abort;
21 }
22 </%init>
23 <%args>
24 $ARGSRef => {}
25 $checks_failure => undef
26 $results => []
27 $TicketObj => undef
28 </%args>