RT mandatory custom fields, RT#9260
[freeside.git] / rt / share / html / Callbacks / CheckMandatoryFields / Ticket / Update.html / BeforeDisplay
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 $TicketObj = $ARGS{'Ticket'};
10 my $ARGSRef = $ARGS{'ARGSRef'};
11 my $oldStatus = $TicketObj->Status();
12 my $newStatus = $ARGSRef->{'Status'} || $ARGSRef->{'DefaultStatus'};
13 if( $oldStatus ne 'resolved' and 
14     $newStatus eq 'resolved' and
15     $m->comp('/Ticket/Elements/CheckMandatoryFields', 
16               Ticket => $TicketObj
17               ) ) {
18     $m->clear_buffer;
19     RT::Interface::Web::Redirect( 
20       RT->Config->Get('WebURL')."Ticket/Modify.html?id=".$TicketObj->Id."&resolve=1"
21     );
22     $m->abort;
23 }
24 </%init>