%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
%# <jesse@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%# 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/licenses/old-licenses/gpl-2.0.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
$format => undef
$fields => undef
</%ARGS>
-<%perl>
+<%INIT>
my $ticket = new RT::Ticket $session{CurrentUser};
my ($c, $o, $k, $e) = ("", [], {}, "");
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 ]
$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);
return [ $c, $o, $k, $e ];
-</%perl>
+</%INIT>