& /Elements/Header, Title => 'Modify dates for ticket #'. $TicketObj->Id &> <& /Ticket/Elements/Tabs, Ticket => $TicketObj &> <& /Elements/ListActions, actions => \@results &> %#ACTION="" means submit to self.
<%INIT> my $field; my @results; # {{{ Load the ticket #If we get handed two ids, mason will make them an array. bleck. # We want teh first one. Just because there's no other sensible way # to deal my @id = (ref $id eq 'ARRAY') ? @{$id} : ($id); my $TicketObj = new RT::Ticket($session{'CurrentUser'}); $TicketObj->Load($id[0]) || Abort("Couldn't load ticket '$id'"); # }}} # {{{ Set date fields my @date_fields = qw( Told Resolved Starts Started Due ); #Run through each field in this list. update the value if apropriate foreach $field (@date_fields) { my ($code, $msg); my $DateObj = RT::Date->new($session{'CurrentUser'}); #If it's something other than just whitespace if ($ARGS{$field.'_Date'} ne '') { $DateObj->Set(Format => 'unknown', Value => $ARGS{$field. '_Date'}); my $obj = $field."Obj"; if ( (defined $DateObj->Unix) and ($DateObj->Unix ne $TicketObj->$obj->Unix()) ) { my $method = "Set$field"; my ($code, $msg) = $TicketObj->$method($DateObj->ISO); push @results, "$msg"; } } } # }}} %INIT> <%ARGS> $UserField => undef $UserOp => undef $UserString => undef $id => undef %ARGS>