+ my $new_value = $self->{'prio'};
+ return 1 unless defined $new_value;
+
+ my $ticket = $self->TicketObj;
+ return 1 if $ticket->Priority == $new_value;
+
+ # Overide defaults from argument
+ my($record, $update) = (1, 1);
+ {
+ my $arg = $self->Argument || '';
+ if ( $arg =~ /RecordTransaction:\s*(\d+)/i ) {
+ $record = $1;
+ $RT::Logger->debug("Overrode RecordTransaction: $record");
+ }
+ if ( $arg =~ /UpdateLastUpdated:\s*(\d+)/i ) {
+ $update = $1;
+ $RT::Logger->debug("Overrode UpdateLastUpdated: $update");
+ }
+ # If creating a transaction, we have to update lastupdated
+ $update = 1 if $record;
+ }
+
+ $RT::Logger->debug(
+ 'Escalating priority of ticket #'. $ticket->Id
+ .' from '. $ticket->Priority .' to '. $new_value
+ .' and'. ($record? '': ' do not') .' record a transaction'
+ .' and'. ($update? '': ' do not') .' touch last updated field'
+ );
+
+ my ($val, $msg);
+ unless ( $record ) {
+ unless ( $update ) {
+ ( $val, $msg ) = $ticket->__Set(
+ Field => 'Priority',
+ Value => $new_value,
+ );
+ } else {
+ ( $val, $msg ) = $ticket->_Set(
+ Field => 'Priority',
+ Value => $new_value,
+ RecordTransaction => 0,
+ );
+ }
+ } else {
+ ($val, $msg) = $ticket->SetPriority($new_value);
+ }