X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fhtml%2FREST%2F1.0%2FForms%2Fticket%2Fhistory;h=5dd7417d0b7029d1bd5ded20b0aaba74fecdb916;hp=4663e97eedf5a5ce2883a58bf985c9f3c5029bb2;hb=ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4;hpb=a513c0bef534d05f03c1242831b6f3be19b97dae diff --git a/rt/html/REST/1.0/Forms/ticket/history b/rt/html/REST/1.0/Forms/ticket/history index 4663e97ee..5dd7417d0 100644 --- a/rt/html/REST/1.0/Forms/ticket/history +++ b/rt/html/REST/1.0/Forms/ticket/history @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -51,7 +53,7 @@ $args => undef $format => undef $fields => undef -<%perl> +<%INIT> my $ticket = new RT::Ticket $session{CurrentUser}; my ($c, $o, $k, $e) = ("", [], {}, ""); @@ -94,7 +96,19 @@ if ($type) { if ($tid) { my @data; my $t = new RT::Transaction $session{CurrentUser}; - $t->Load($tid); + + # this paragraph limits the transaction ID query to transactions on this ticket. + # Otherwise you can query any transaction from any ticket, which makes no sense. + my $Transactions = $ticket->Transactions; + my $tok=0; + while (my $T = $Transactions->Next()) { + $tok=1 if ($T->Id == $tid) + } + if ($tok) { + $t->Load($tid); + } else { + return [ "# Transaction $tid is not related to Ticket $id", [], {}, 1 ]; + } push @data, [ id => $t->Id ]; push @data, [ Ticket => $t->Ticket ] @@ -168,8 +182,7 @@ if ($tid) { $fieldstring .= $key; } my ($content, $forms); - - $m->subexec("$RT::WebPath/REST/1.0/show", + $m->subexec("/REST/1.0/show", id => \@tid, format => $format, fields => $fieldstring); @@ -184,4 +197,4 @@ if (!$c) { return [ $c, $o, $k, $e ]; - +