X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Fshare%2Fhtml%2FREST%2F1.0%2FForms%2Ftransaction%2Fdefault;h=a6d3f0dfe0fa8c03026bc876a1413e02076c5a49;hb=187086c479a09629b7d180eec513fb7657f4e291;hp=46488d23aaa991379a87b2d276d342d362242f66;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941;p=freeside.git diff --git a/rt/share/html/REST/1.0/Forms/transaction/default b/rt/share/html/REST/1.0/Forms/transaction/default index 46488d23a..a6d3f0dfe 100644 --- a/rt/share/html/REST/1.0/Forms/transaction/default +++ b/rt/share/html/REST/1.0/Forms/transaction/default @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -49,72 +49,69 @@ %# <%ARGS> $id -$args => undef $format => undef $fields => undef <%INIT> -my $trans = new RT::Transactions $session{CurrentUser}; +my $trans = RT::Transactions->new($session{CurrentUser}); my ($c, $o, $k, $e) = ("", [], {} , ""); -chomp $args; -my @arglist = split('/', $args); my $tid = $id; $trans->Limit(FIELD => 'Id', OPERATOR => '=', VALUE => $tid); if ($tid) { my @data; - my $t = new RT::Transaction $session{CurrentUser}; + my $t = RT::Transaction->new($session{CurrentUser}); $t->Load($tid); if ($format eq "l") { - push @data, [ id => $t->Id ]; - push @data, [ Ticket => $t->Ticket ] - if (!%$fields || exists $fields->{lc 'Ticket'}); - push @data, [ TimeTaken => $t->TimeTaken ] - if (!%$fields || exists $fields->{lc 'TimeTaken'}); - push @data, [ Type => $t->Type ] - if (!%$fields || exists $fields->{lc 'Type'}); - push @data, [ Field => $t->Field ] - if (!%$fields || exists $fields->{lc 'Field'}); - push @data, [ OldValue => $t->OldValue ] - if (!%$fields || exists $fields->{lc 'OldValue'}); - push @data, [ NewValue => $t->NewValue ] - if (!%$fields || exists $fields->{lc 'NewValue'}); - push @data, [ Data => $t->Data ] - if (!%$fields || exists $fields->{lc 'Data'}); - push @data, [ Description => $t->Description ] - if (!%$fields || exists $fields->{lc 'Description'}); - push @data, [ Content => $t->Content ] - if (!%$fields || exists $fields->{lc 'Content'}); - - if (!%$fields || exists $fields->{lc 'Content'}) { - my $creator = new RT::User $session{CurrentUser}; - $creator->Load($t->Creator); - push @data, [ Creator => $creator->Name ]; - } - push @data, [ Created => $t->Created ] - if (!%$fields || exists $fields->{lc 'Created'}); - - if (!%$fields || exists $fields->{lc 'Attachments'}) { - my $attachlist; - my $attachments = $t->Attachments; - while (my $a = $attachments->Next) { - my $size = length($a->Content); - if ($size > 1024) { - $size = int($size/102.4)/10 . "k"; - } - else { - $size .= "b"; - } - $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")"; - } - push @data, [Attachments => $attachlist]; - } - + push @data, [ id => $t->Id ]; + push @data, [ Ticket => $t->Ticket ] + if (!%$fields || exists $fields->{lc 'Ticket'}); + push @data, [ TimeTaken => $t->TimeTaken ] + if (!%$fields || exists $fields->{lc 'TimeTaken'}); + push @data, [ Type => $t->Type ] + if (!%$fields || exists $fields->{lc 'Type'}); + push @data, [ Field => $t->Field ] + if (!%$fields || exists $fields->{lc 'Field'}); + push @data, [ OldValue => $t->OldValue ] + if (!%$fields || exists $fields->{lc 'OldValue'}); + push @data, [ NewValue => $t->NewValue ] + if (!%$fields || exists $fields->{lc 'NewValue'}); + push @data, [ Data => $t->Data ] + if (!%$fields || exists $fields->{lc 'Data'}); + push @data, [ Description => $t->Description ] + if (!%$fields || exists $fields->{lc 'Description'}); + push @data, [ Content => $t->Content ] + if (!%$fields || exists $fields->{lc 'Content'}); + + if (!%$fields || exists $fields->{lc 'Content'}) { + my $creator = RT::User->new($session{CurrentUser}); + $creator->Load($t->Creator); + push @data, [ Creator => $creator->Name ]; + } + push @data, [ Created => $t->Created ] + if (!%$fields || exists $fields->{lc 'Created'}); + + if (!%$fields || exists $fields->{lc 'Attachments'}) { + my $attachlist; + my $attachments = $t->Attachments; + while (my $a = $attachments->Next) { + my $size = length($a->Content); + if ($size > 1024) { + $size = int($size/102.4)/10 . "k"; + } + else { + $size .= "b"; + } + my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "untitled"; + $attachlist .= "\n" . $a->Id.": $name ($size)"; + } + push @data, [Attachments => $attachlist]; + } } else { - push @data, [ id => $t->Id ]; - push @data, [ Description => $t->Description ]; + push @data, [ id => $t->Id ]; + push @data, [ Description => $t->Description ]; } my %k = map {@$_} @data; @@ -127,14 +124,14 @@ if ($tid) { # $format = "l" if (%$fields); # # while (my $t = $trans->Next) { -# my $tid = $t->Id; -# if ($format eq "l") { -# $tids .= "," if $tids; -# $tids .= $tid; -# } else { -# push @$o, $tid; -# $k->{$tid} = $t->Description; -# } +# my $tid = $t->Id; +# if ($format eq "l") { +# $tids .= "," if $tids; +# $tids .= $tid; +# } else { +# push @$o, $tid; +# $k->{$tid} = $t->Description; +# } # } #}