[rt-users] A working MyDay.html - patch included
Chris Hobbs
chris at clanhobbs.org
Fri Jan 12 11:58:22 EST 2007
It looks like MyDay.html has been in the Tools area forever, but
incomplete - it displayed a terrific looking form but didn't actually
act on the Submit button - talk about a let-down :).
I have a very crude but working fix for this. I'd like feedback on what
else needs to be done to make it safe/sane. I don't know enough about
how the RT internals work to know whether I'm doing really stupid stuff
here or not. Do I need to be checking the permissions on each ticket
update to make sure the user has the appropriate permissions, for example?
Anyway, here it is - I hope others find it useful. I know our techs are
going to love being able to update all their tickets in one spot!
[chobbs at webservices rt3]$ diff ~/MyDay.html share/html/Tools/MyDay.html
< # Added 2007-01-11 by chris_hobbs at nhusd.k12.ca.us
< # Marches through POST'ed ARGS and acts accordingly.
< # This does the updating of the tickets.
< my $arg;
< foreach $arg (keys %ARGS)
< {
< if ($ARGS{$arg}) { # only true if there's content in a POST'ed var
< my $action;
< my $value;
< my $ticketID;
< ($action, $ticketID) = split ("-", $arg);
< $value = $ARGS{$arg};
< my $ticket = LoadTicket($ticketID);
< if ($action =~ /UpdateStatus/)
< {
< $ticket->SetStatus($value);
< }
< if ($action =~ /UpdateTimeWorked/)
< {
< $ticket->SetTimeWorked($ticket->TimeWorked +
$value);
< if ($ticket->TimeLeft >= $value) {
< # in addition to incrementing
TimeWorked, decrement TimeLeft
< $ticket->SetTimeLeft($ticket->TimeLeft -
$value);
< } else {
< $ticket->SetTimeLeft(0);
< }
< }
< if ($action =~ /UpdateContent/)
< {
< $ticket->Comment(Content => ($value));
< }
< }
< }
More information about the rt-users
mailing list