Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
On 27.06.2016 21:31, Jim Brandt wrote: On 6/27/16 1:38 PM, Jim Brandt wrote: Hey and thank you for your answer, I am using RT 4.4 <%init> warn 'set checks_failure => 1'; $checks_failure = 1; <%args> $checks_failure => undef 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. Hmm, yeah, that's strange. Everything else is passed by reference, we may need to look into changing that. In the meantime, you could update just that line to pass $checks_failure by reference to limit your changes to Update.html. Alternatively, you could add another line that duplicates the existing callback but passes checks_failure by reference. Then give it your own name for CallbackName. That might make it easier to pull forward when upgrading. Looking closer, I believe $skip_update was added just for this purpose since it also can stop the update and is passed by reference. I think setting $skip_update to 1 when you want to trigger the message should do the trick. - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016 thank you very much. its working now. https://github.com/davewood/RT-Extension-WarnTicketTaken - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
On 6/27/16 1:38 PM, Jim Brandt wrote: Hey and thank you for your answer, I am using RT 4.4 <%init> warn 'set checks_failure => 1'; $checks_failure = 1; <%args> $checks_failure => undef 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. Hmm, yeah, that's strange. Everything else is passed by reference, we may need to look into changing that. In the meantime, you could update just that line to pass $checks_failure by reference to limit your changes to Update.html. Alternatively, you could add another line that duplicates the existing callback but passes checks_failure by reference. Then give it your own name for CallbackName. That might make it easier to pull forward when upgrading. Looking closer, I believe $skip_update was added just for this purpose since it also can stop the update and is passed by reference. I think setting $skip_update to 1 when you want to trigger the message should do the trick. - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
On 6/27/16 3:25 AM, David Schmidt wrote: 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; <%args> $checks_failure => undef 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. Hmm, yeah, that's strange. Everything else is passed by reference, we may need to look into changing that. In the meantime, you could update just that line to pass $checks_failure by reference to limit your changes to Update.html. Alternatively, you could add another line that duplicates the existing callback but passes checks_failure by reference. Then give it your own name for CallbackName. That might make it easier to pull forward when upgrading. - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
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; <%args> $checks_failure => undef 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 - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016
Re: [rt-users] Re-Display Ticket with added warning if owner changed during responding
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
[rt-users] Re-Display Ticket with added warning if owner changed during responding
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? regards david - RT 4.4 and RTIR Training Sessions https://bestpractical.com/training * Los Angeles - September, 2016