summaryrefslogtreecommitdiff
path: root/rt/share/html/REST/1.0/Forms
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-06-30 01:03:13 -0700
committerIvan Kohler <ivan@freeside.biz>2012-06-30 01:03:13 -0700
commitf3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7 (patch)
treee5e9a077260613e6117d4697dd2985abd9b03d34 /rt/share/html/REST/1.0/Forms
parentcf7cd8efc7095aadbdfb0cd8e7ea0e2e8b9e9085 (diff)
parentcd3eb95ed1f3dc3e04cfc2b3b405f75b3ab086da (diff)
merging RT 4.0.6
Diffstat (limited to 'rt/share/html/REST/1.0/Forms')
-rw-r--r--rt/share/html/REST/1.0/Forms/attachment/default4
-rw-r--r--rt/share/html/REST/1.0/Forms/group/customfields4
-rw-r--r--rt/share/html/REST/1.0/Forms/group/default4
-rw-r--r--rt/share/html/REST/1.0/Forms/group/ns4
-rw-r--r--rt/share/html/REST/1.0/Forms/queue/customfields4
-rwxr-xr-xrt/share/html/REST/1.0/Forms/queue/default4
-rwxr-xr-xrt/share/html/REST/1.0/Forms/queue/ns4
-rw-r--r--rt/share/html/REST/1.0/Forms/queue/ticketcustomfields6
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/attachments9
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/comment4
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/default61
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/history11
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/links11
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/merge6
-rwxr-xr-xrt/share/html/REST/1.0/Forms/ticket/take4
-rw-r--r--rt/share/html/REST/1.0/Forms/transaction/default14
-rwxr-xr-xrt/share/html/REST/1.0/Forms/user/default4
-rwxr-xr-xrt/share/html/REST/1.0/Forms/user/ns4
18 files changed, 91 insertions, 71 deletions
diff --git a/rt/share/html/REST/1.0/Forms/attachment/default b/rt/share/html/REST/1.0/Forms/attachment/default
index b53f6fdc9..3f9bd1b63 100644
--- a/rt/share/html/REST/1.0/Forms/attachment/default
+++ b/rt/share/html/REST/1.0/Forms/attachment/default
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -54,7 +54,7 @@ $args => undef
<%INIT>
my @data;
my ($c, $o, $k, $e) = ("", [], {}, "");
-my $attachment = new RT::Attachment $session{CurrentUser};
+my $attachment = RT::Attachment->new($session{CurrentUser});
$attachment->Load($id);
unless ( $attachment->Id ) {
diff --git a/rt/share/html/REST/1.0/Forms/group/customfields b/rt/share/html/REST/1.0/Forms/group/customfields
index b7b679274..70b50cceb 100644
--- a/rt/share/html/REST/1.0/Forms/group/customfields
+++ b/rt/share/html/REST/1.0/Forms/group/customfields
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -55,7 +55,7 @@ $changes => {}
<%perl>
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
-my $group = new RT::Group $session{CurrentUser};
+my $group = RT::Group->new($session{CurrentUser});
$group->Load($id);
if (!$group->Id) {
diff --git a/rt/share/html/REST/1.0/Forms/group/default b/rt/share/html/REST/1.0/Forms/group/default
index 22ecf5840..7686f2176 100644
--- a/rt/share/html/REST/1.0/Forms/group/default
+++ b/rt/share/html/REST/1.0/Forms/group/default
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -57,7 +57,7 @@ $changes => {}
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
my %data = %$changes;
-my $group = new RT::Group $session{CurrentUser};
+my $group = RT::Group->new($session{CurrentUser});
my @fields = qw(Name Description);
my %fields = map { lc $_ => $_ } @fields;
diff --git a/rt/share/html/REST/1.0/Forms/group/ns b/rt/share/html/REST/1.0/Forms/group/ns
index ec85faeb7..2e15040c4 100644
--- a/rt/share/html/REST/1.0/Forms/group/ns
+++ b/rt/share/html/REST/1.0/Forms/group/ns
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -53,7 +53,7 @@ $id
<%perl>
use RT::Groups;
-my $groups = new RT::Groups $session{CurrentUser};
+my $groups = RT::Groups->new($session{CurrentUser});
$groups->Limit(FIELD => 'Name', OPERATOR => '=', VALUE => $id);
if ($groups->Count == 0) {
return (0, "No group named $id exists.");
diff --git a/rt/share/html/REST/1.0/Forms/queue/customfields b/rt/share/html/REST/1.0/Forms/queue/customfields
index 87f925c34..18b1222d2 100644
--- a/rt/share/html/REST/1.0/Forms/queue/customfields
+++ b/rt/share/html/REST/1.0/Forms/queue/customfields
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -55,7 +55,7 @@ $changes => {}
<%perl>
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
-my $queue = new RT::Queue $session{CurrentUser};
+my $queue = RT::Queue->new($session{CurrentUser});
$queue->Load($id);
if (!$queue->Id) {
diff --git a/rt/share/html/REST/1.0/Forms/queue/default b/rt/share/html/REST/1.0/Forms/queue/default
index d42fef9c3..e6d50f311 100755
--- a/rt/share/html/REST/1.0/Forms/queue/default
+++ b/rt/share/html/REST/1.0/Forms/queue/default
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -57,7 +57,7 @@ $changes => {}
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
my %data = %$changes;
-my $queue = new RT::Queue $session{CurrentUser};
+my $queue = RT::Queue->new($session{CurrentUser});
my @fields = qw(Name Description CorrespondAddress CommentAddress
InitialPriority FinalPriority DefaultDueIn);
my %fields = map { lc $_ => $_ } @fields;
diff --git a/rt/share/html/REST/1.0/Forms/queue/ns b/rt/share/html/REST/1.0/Forms/queue/ns
index a46431b16..255af4c0b 100755
--- a/rt/share/html/REST/1.0/Forms/queue/ns
+++ b/rt/share/html/REST/1.0/Forms/queue/ns
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -53,7 +53,7 @@ $id
<%perl>
use RT::Queues;
-my $queues = new RT::Queues $session{CurrentUser};
+my $queues = RT::Queues->new($session{CurrentUser});
$queues->Limit(FIELD => 'Name', OPERATOR => '=', VALUE => $id);
if ($queues->Count == 0) {
return (0, "No queue named $id exists.");
diff --git a/rt/share/html/REST/1.0/Forms/queue/ticketcustomfields b/rt/share/html/REST/1.0/Forms/queue/ticketcustomfields
index 61ca19da8..abbfa8ea8 100644
--- a/rt/share/html/REST/1.0/Forms/queue/ticketcustomfields
+++ b/rt/share/html/REST/1.0/Forms/queue/ticketcustomfields
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -55,7 +55,7 @@ $changes => {}
<%perl>
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
-my $queue = new RT::Queue $session{CurrentUser};
+my $queue = RT::Queue->new($session{CurrentUser});
$queue->Load($id);
if (!$queue->Id) {
@@ -71,7 +71,7 @@ if (%$changes) {
my @data;
push @data, [ id => "queue/" . $queue->Id ];
-my $qcfs = RT::CustomFields->new($session{CurrentUser});
+my $qcfs = RT::CustomFields->new($session{CurrentUser});;
$qcfs->LimitToGlobalOrQueue($id);
while ( my $qcf = $qcfs->Next() ) {
if ( $format eq "l" ) {
diff --git a/rt/share/html/REST/1.0/Forms/ticket/attachments b/rt/share/html/REST/1.0/Forms/ticket/attachments
index ac141615d..43b8ed85a 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/attachments
+++ b/rt/share/html/REST/1.0/Forms/ticket/attachments
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -54,7 +54,7 @@ $args => undef
<%INIT>
my @data;
my ($c, $o, $k, $e) = ("", [], {}, "");
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
$ticket->Load($id);
unless ($ticket->Id) {
@@ -76,7 +76,7 @@ if ($aid) {
unless ($aid =~ /^\d+$/) {
return [ "# Invalid attachment id: $aid", [], {}, 1 ];
}
- my $attachment = new RT::Attachment $session{CurrentUser};
+ my $attachment = RT::Attachment->new($session{CurrentUser});
$attachment->Load($aid);
unless ($attachment->Id eq $aid) {
return [ "# Invalid attachment id: $aid", [], {}, 1 ];
@@ -118,7 +118,8 @@ else {
my $size = length($a->Content || '');
if ($size > 1024) { $size = int($size/102.4)/10 . "k" }
else { $size .= "b" }
- push @attachments, $a->Id.": ".($a->Filename || '(Unnamed)')." (".$a->ContentType . " / ".$size.")";
+ my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "(Unnamed)";
+ push @attachments, $a->Id.": $name (".$a->ContentType . " / $size)";
}
}
diff --git a/rt/share/html/REST/1.0/Forms/ticket/comment b/rt/share/html/REST/1.0/Forms/ticket/comment
index c8d548adb..35b543d9c 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/comment
+++ b/rt/share/html/REST/1.0/Forms/ticket/comment
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -60,7 +60,7 @@ use File::Temp qw(tempfile);
$RT::Logger->debug("Got ticket id=$id for comment");
$RT::Logger->debug("Got args @{[keys(%changes)]}.");
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
my ($c, $o, $k, $e) = ("", [], {}, 0);
# http://.../REST/1.0/ticket/1/comment
diff --git a/rt/share/html/REST/1.0/Forms/ticket/default b/rt/share/html/REST/1.0/Forms/ticket/default
index 76635c85a..9a2212b55 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/default
+++ b/rt/share/html/REST/1.0/Forms/ticket/default
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -62,7 +62,7 @@ my $cf_spec = RT::Interface::REST->custom_field_spec(1);
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
my %data = %$changes;
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
my @dates = qw(Created Starts Started Due Resolved Told LastUpdated);
my @people = qw(Requestors Cc AdminCc);
my @create = qw(Queue Requestor Subject Cc AdminCc Owner Status Priority
@@ -81,20 +81,27 @@ if ($id ne 'new') {
if (!$ticket->Id) {
return [ "# Ticket $id does not exist.", [], {}, 1 ];
}
- elsif (!$ticket->CurrentUserHasRight('ShowTicket') ||
- (%data && !$ticket->CurrentUserHasRight('ModifyTicket')))
- {
- my $act = %data ? "modify" : "display";
- return [ "# You are not allowed to $act ticket $id.", [], {}, 1 ];
+ elsif ( %data ) {
+ if ( $data{status} && $data{status} eq 'deleted' && ! grep { $_ ne 'id' && $_ ne 'status' } keys %data ) {
+ if ( !$ticket->CurrentUserHasRight('DeleteTicket') ) {
+ return [ "# You are not allowed to delete ticket $id.", [], {}, 1 ];
+ }
+ }
+ elsif ( !$ticket->CurrentUserHasRight('ModifyTicket') ) {
+ return [ "# You are not allowed to modify ticket $id.", [], {}, 1 ];
+ }
+ }
+ elsif (!$ticket->CurrentUserHasRight('ShowTicket')) {
+ return [ "# You are not allowed to display ticket $id.", [], {}, 1 ];
}
}
else {
if (!keys(%data)) {
# GET ticket/new: Return a suitable default form.
# We get defaults from queue/1 (XXX: What if it isn't there?).
- my $due = new RT::Date $session{CurrentUser};
- my $queue = new RT::Queue $session{CurrentUser};
- my $starts = new RT::Date $session{CurrentUser};
+ my $due = RT::Date->new($session{CurrentUser});
+ my $queue = RT::Queue->new($session{CurrentUser});
+ my $starts = RT::Date->new($session{CurrentUser});
$queue->Load(1);
$due->SetToNow;
$due->AddDays($queue->DefaultDueIn) if $queue->DefaultDueIn;
@@ -132,7 +139,7 @@ else {
foreach my $k (keys %data) {
# flexibly parse any dates
if ($dates{lc $k}) {
- my $time = new RT::Date $session{CurrentUser};
+ my $time = RT::Date->new($session{CurrentUser});
$time->Set(Format => 'unknown', Value => $data{$k});
$data{$k} = $time->ISO;
}
@@ -142,10 +149,16 @@ else {
}
# Set custom field
elsif ($k =~ /^$cf_spec/) {
- my $cf = RT::CustomField->new( $RT::SystemUser );
- my $cfk = $1 || $2;
- unless($cf->LoadByName( Name => $cfk )) {
- push @comments, "# Invalid custom field name ($cfk)";
+ my $key = $1 || $2;
+
+ my $cf = RT::CustomField->new( $session{CurrentUser} );
+ $cf->LoadByName( Name => $key, Queue => $data{Queue} || $v{Queue} );
+ unless ( $cf->id ) {
+ $cf->LoadByName( Name => $key, Queue => 0 );
+ }
+
+ if (not $cf->id) {
+ push @comments, "# Invalid custom field name ($key)";
delete $data{$k};
next;
}
@@ -205,14 +218,14 @@ if (!keys(%data)) {
push @data, [ $key => [ $ticket->$key->MemberEmailAddresses ] ];
}
- $time = new RT::Date ($session{CurrentUser});
+ $time = RT::Date->new ($session{CurrentUser});
foreach $key (@dates) {
next unless (!%$fields || (exists $fields->{lc $key}));
$time->Set(Format => 'sql', Value => $ticket->$key);
push @data, [ $key => $time->AsString ];
}
- $time = new RT::Date ($session{CurrentUser});
+ $time = RT::Date->new ($session{CurrentUser});
foreach $key (qw(TimeEstimated TimeWorked TimeLeft)) {
next unless (!%$fields || (exists $fields->{lc $key}));
$val = $ticket->$key || 0;
@@ -280,7 +293,7 @@ else {
$key = $simple{$key};
$set = "Set$key";
- next if (($val eq $ticket->$key)|| ($ticket->$key =~ /^\d+$/ && $val == $ticket->$key));
+ next if (($val eq ($ticket->$key||''))|| ($ticket->$key =~ /^\d+$/ && $val =~ /^\d+$/ && $val == $ticket->$key));
($n, $s) = $ticket->$set("$val");
}
elsif (exists $dates{$key}) {
@@ -295,7 +308,7 @@ else {
$set = "Set$key";
- my $time = new RT::Date $session{CurrentUser};
+ my $time = RT::Date->new($session{CurrentUser});
$time->Set(Format => 'sql', Value => $ticket->$key);
next if ($val =~ /^not set$/i || $val eq $time->AsString);
@@ -341,9 +354,15 @@ else {
}
# Set custom field
elsif ($key =~ /^$cf_spec/) {
- my $cf = RT::CustomField->new( $RT::SystemUser );
$key = $1 || $2;
- if (not $cf->LoadByName( Name => $key )) {
+
+ my $cf = RT::CustomField->new( $session{CurrentUser} );
+ $cf->LoadByName( Name => $key, Queue => $ticket->Queue );
+ unless ( $cf->id ) {
+ $cf->LoadByName( Name => $key, Queue => 0 );
+ }
+
+ if (not $cf->id) {
$n = 0;
$s = "Unknown custom field.";
}
diff --git a/rt/share/html/REST/1.0/Forms/ticket/history b/rt/share/html/REST/1.0/Forms/ticket/history
index c2aa35a8e..8b6e01722 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/history
+++ b/rt/share/html/REST/1.0/Forms/ticket/history
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -54,7 +54,7 @@ $format => undef
$fields => undef
</%ARGS>
<%INIT>
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
my ($c, $o, $k, $e) = ("", [], {}, "");
$ticket->Load($id);
@@ -100,7 +100,7 @@ if ($type) {
if ($tid) {
my @data;
- my $t = new RT::Transaction $session{CurrentUser};
+ my $t = RT::Transaction->new($session{CurrentUser});
# 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.
@@ -137,7 +137,7 @@ if ($tid) {
if (!%$fields || exists $fields->{lc 'Content'}) {
- my $creator = new RT::User $session{CurrentUser};
+ my $creator = RT::User->new($session{CurrentUser});
$creator->Load($t->Creator);
push @data, [ Creator => $creator->Name ];
}
@@ -151,7 +151,8 @@ if ($tid) {
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.")";
+ my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "untitled";
+ $attachlist .= "\n" . $a->Id.": $name ($size)";
}
push @data, [Attachments => $attachlist];
diff --git a/rt/share/html/REST/1.0/Forms/ticket/links b/rt/share/html/REST/1.0/Forms/ticket/links
index fb9ee8fe1..bf4f2575c 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/links
+++ b/rt/share/html/REST/1.0/Forms/ticket/links
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -54,7 +54,7 @@ $changes => undef
</%ARGS>
<%INIT>
my @data;
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
$ticket->Load($id);
if (!$ticket->Id) {
@@ -96,11 +96,12 @@ if ($changes) {
my %new;
foreach my $nkey (@{vsplit($val)}) {
if ($nkey =~ /^\d+$/) {
- my $uri = new RT::URI $session{CurrentUser};
- my $tick = new RT::Ticket $session{CurrentUser};
+ my $uri = RT::URI->new($session{CurrentUser});
+ my $tick = RT::Ticket->new($session{CurrentUser});
$tick->Load($nkey);
if ($tick->Id) {
- $nkey = $uri->FromObject($tick);
+ $uri->FromObject($tick);
+ $nkey = $uri->URI;
}
else {
$n = 0;
diff --git a/rt/share/html/REST/1.0/Forms/ticket/merge b/rt/share/html/REST/1.0/Forms/ticket/merge
index 360ddd702..a751dc558 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/merge
+++ b/rt/share/html/REST/1.0/Forms/ticket/merge
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -56,8 +56,8 @@ use RT::Interface::REST;
my $into = $args;
-my $ticket = new RT::Ticket $session{CurrentUser};
-my $ticket_into = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
+my $ticket_into = RT::Ticket->new($session{CurrentUser});
my ($c, $o, $k, $e) = ("", [], {}, 0);
# http://.../REST/1.0/ticket/1/merge/6 (merges ticket 1 into ticket 6)
diff --git a/rt/share/html/REST/1.0/Forms/ticket/take b/rt/share/html/REST/1.0/Forms/ticket/take
index d0bf13e3a..503ba55f0 100755
--- a/rt/share/html/REST/1.0/Forms/ticket/take
+++ b/rt/share/html/REST/1.0/Forms/ticket/take
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -54,7 +54,7 @@ $id
<%INIT>
use RT::Interface::REST;
-my $ticket = new RT::Ticket $session{CurrentUser};
+my $ticket = RT::Ticket->new($session{CurrentUser});
my ($c, $o, $k, $e) = ("", [], {}, 0);
# http://.../REST/1.0/ticket/1/take
diff --git a/rt/share/html/REST/1.0/Forms/transaction/default b/rt/share/html/REST/1.0/Forms/transaction/default
index 46488d23a..2e45f6707 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-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -49,23 +49,20 @@
%#
<%ARGS>
$id
-$args => undef
$format => undef
$fields => undef
</%ARGS>
<%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 ];
@@ -89,7 +86,7 @@ if ($tid) {
if (!%$fields || exists $fields->{lc 'Content'});
if (!%$fields || exists $fields->{lc 'Content'}) {
- my $creator = new RT::User $session{CurrentUser};
+ my $creator = RT::User->new($session{CurrentUser});
$creator->Load($t->Creator);
push @data, [ Creator => $creator->Name ];
}
@@ -107,7 +104,8 @@ if ($tid) {
else {
$size .= "b";
}
- $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")";
+ my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "untitled";
+ $attachlist .= "\n" . $a->Id.": $name ($size)";
}
push @data, [Attachments => $attachlist];
}
diff --git a/rt/share/html/REST/1.0/Forms/user/default b/rt/share/html/REST/1.0/Forms/user/default
index 908eab208..a5786bab3 100755
--- a/rt/share/html/REST/1.0/Forms/user/default
+++ b/rt/share/html/REST/1.0/Forms/user/default
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -56,7 +56,7 @@ $changes => {}
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
my %data = %$changes;
-my $user = new RT::User $session{CurrentUser};
+my $user = RT::User->new($session{CurrentUser});
my @fields = qw(RealName NickName Gecos Organization Address1 Address2 City
State Zip Country HomePhone WorkPhone MobilePhone PagerPhone
FreeformContactInfo Comments Signature Lang EmailEncoding
diff --git a/rt/share/html/REST/1.0/Forms/user/ns b/rt/share/html/REST/1.0/Forms/user/ns
index 16c8902eb..0aca5de4d 100755
--- a/rt/share/html/REST/1.0/Forms/user/ns
+++ b/rt/share/html/REST/1.0/Forms/user/ns
@@ -2,7 +2,7 @@
%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
@@ -56,7 +56,7 @@ use RT::Users;
my $field = "Name";
$field = "EmailAddress" if $id =~ /\@/;
-my $users = new RT::Users $session{CurrentUser};
+my $users = RT::Users->new($session{CurrentUser});
$users->Limit(FIELD => $field, OPERATOR => '=', VALUE => $id);
if ($users->Count == 0) {
return (0, "No user named $id exists.");