<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 22, 2013 at 12:18 AM, Bradley Bell <span dir="ltr"><<a href="mailto:bradleyb@uw.edu" target="_blank">bradleyb@uw.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, May 21, 2013 at 12:26 PM, Ruslan Zakirov <<a href="mailto:ruz@bestpractical.com">ruz@bestpractical.com</a>> wrote:<br>
> On Tue, May 21, 2013 at 11:14 PM, Bradley Bell <<a href="mailto:bradleyb@uw.edu">bradleyb@uw.edu</a>> wrote:<br>
>><br>
>> As far as I can tell, there is no easy way for a scrip to provide<br>
>> feedback to end users.<br>
>> For example if I have a scrip that reverts a status change, the<br>
>> scrip's Commit method could return (1, "Feedback Here") and then in<br>
>> the UI, instead of just seeing:<br>
>><br>
>> * Ticket 8: Status changed from 'open' to 'stalled'<br>
>><br>
>> They would also see<br>
>> * Ticket 8: Can't be stalled without a Due date. Status changed back to<br>
>> 'open'<br>
>><br>
>> or whatever.<br>
>><br>
>> Is there something that already provides this functionality or would a<br>
>> patch be welcomed?<br>
><br>
><br>
> 1) Scrips are not best for such things. New RT allows you to prevent<br>
> operations much easily in UI by using checks_failure (grep) and callbacks.<br>
<br>
</div>I thought about using callbacks instead, but there are so many places<br>
in the UI to change things it seems like the complexity in maintenance<br>
goes up very fast, and I'd have to keep the scrip around as well<br>
because I'd probably miss one. I do agree that checking beforehand<br>
would be better than reverting transaction afterwards.<br></blockquote><div><br></div><div style>Callbacks can return person to the same form with all data in place, so he can adjust input to fulfill required workflow. This is huge advantage in user friendliness.</div>
<div style><br></div><div style>Instead of reverting Scrip that clobbers ticket's history you can wrap SetStatus method and return (0, "Can't stall without Due"). This is valid use as we have to use SetXxx methods in most cases exactly because of such checks unless we want to play really dirty games for some reason. Such implementation would abort the action. It just has the same problem as scrips - it doesn't prevent other actions on the same form.</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> 2) Patch is not bad. I want user visible feedback from Scrips too.<br>
><br>
> 3) Return value of Prepare/Commit methods is not good candidate. Mostly<br>
> because of backwards compatibility. I think a method in scrip action's class<br>
> can be used, for example AddMessage or something like that.<br>
><br>
> 4) If you want to see it merged into RT core then it's better to implement<br>
> something dirty and quick, publish it for review and comments on rt-devel@<br>
> list.<br>
<br>
</div>I will think about implementing this, I have to figure out if it will<br>
solve my current problems though.<br>
<br>
Another half-baked idea: custom conditions in the lifecycle?<br>
<br>
actions => [<br>
'open -> stalled' => {<br>
label => 'Stall', # loc<br>
update => 'Comment',<br>
condition => sub { return $_->CheckOkToStall; }<br>
},<br>
<br>
but of course there are many things other than status to be concerned about.<br></blockquote><div><br></div><div style>It's not that bad option.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
--<br>
Bradley Bell<br>
Classroom Support Services | University of Washington<br>
035 Kane Hall | Box 353095 Seattle, WA 98195-3095<br>
p 206.543.9900 | f 206.685.7892 | <a href="http://www.css.washington.edu" target="_blank">www.css.washington.edu</a><br>
<br>
<br>
--<br>
RT Training in Seattle, June 19-20: <a href="http://bestpractical.com/training" target="_blank">http://bestpractical.com/training</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards, Ruslan.
</div></div>