[rt-users] Re-Display Ticket with added warning if owner changed during responding

David Schmidt david.schmidt at univie.ac.at
Mon Jun 27 03:25:58 EDT 2016


On 24.06.2016 14:19, Jim Brandt wrote:
> On 6/23/16 8:19 AM, David Schmidt wrote:
>> Hello
>> 
>> In case someone takes the ticket ownership wile I am composing a
>> response I would like to redisplay the ticket (the submitted response
>> shouldnt be deleted) and add a warning informing the user about the
>> change in ownership.
>> 
>> I guess this is the correct callback
>> 
>> html/Callbacks/RT-Extension-WarnTicketTaken/Ticket/Update.html/BeforeSubmit
>> 
>> but /Ticket/Update.html is quite the monster for an unexperienced RT
>> dev. :)
>> 
>> Where can I get the response text from so it doesnt get lost and how 
>> do
>> I add a warning?
> 
> I might try the BeforeUpdate callback. You should be able to use the
> validation code to add your new check. You can make the page redisplay
> by setting $checks_failure to 1 and you can display a message by
> adding it to @results. BeforeUpdate gives you both of those. You can
> see an example above after the call to ValidateCustomFields.
> 
>     unless ( $status ) {
>         push @results, @msg;
>         $checks_failure = 1;
>     }
> 
> You shouldn't need to worry about re-adding input values yourself, it
> should happen automatically.
> 
> You didn't mention your RT version, but this should be similar across
> most current versions.
> ---------
> RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
> * Los Angeles - September, 2016


Hey and thank you for your answer,

I am using RT 4.4


<%init>
warn 'set checks_failure => 1';
$checks_failure = 1;
</%init>
<%args>
$checks_failure => undef
</%args>

I expected every update to fail, but when I add a reply the ticket is 
updated with "correspondence added".

I noticed that outside of the Callback component $checks_failure value 
is 0. And that seems to be the cause while changing checks_failure 
inside of the callback doesnt have an effect. Is there a reason why 
$checks_failure isnt passed by reference?

I dont want to add code to Ticket/Update.html because I want to make a 
maintainable extension that isnt lost in case of an RT upgrade.

cheers
david



More information about the rt-users mailing list