summaryrefslogtreecommitdiff
path: root/rt/share/html/Callbacks/CheckMandatoryFields/Ticket/Update.html/BeforeDisplay
blob: 0d69bc27b516df5c885f65a4600c876f797e1323 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<%doc>
When the user tries to change a ticket's status to "resolved" through 
the Update interface, check mandatory fields.  If they aren't all set, 
redirect to Ticket Basics instead of updating.  Note that this will 
lose any comments/time/other information the user has entered.
</%doc>

<%init>
my $TicketObj = $ARGS{'Ticket'};
my $ARGSRef = $ARGS{'ARGSRef'};
my $oldStatus = $TicketObj->Status();
my $newStatus = $ARGSRef->{'Status'} || $ARGSRef->{'DefaultStatus'};
if( $oldStatus ne 'resolved' and 
    $newStatus eq 'resolved' and
    $m->comp('/Ticket/Elements/CheckMandatoryFields', 
              Ticket => $TicketObj
              ) ) {
    $m->clear_buffer;
    RT::Interface::Web::Redirect( 
      RT->Config->Get('WebURL')."Ticket/Modify.html?id=".$TicketObj->Id."&resolve=1"
    );
    $m->abort;
}
</%init>