diff options
Diffstat (limited to 'rt/share/html/REST/1.0/Forms/ticket')
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/attachments | 2 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/comment | 11 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/default | 20 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/history | 2 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/links | 2 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/merge | 2 | ||||
-rwxr-xr-x | rt/share/html/REST/1.0/Forms/ticket/take | 2 |
7 files changed, 28 insertions, 13 deletions
diff --git a/rt/share/html/REST/1.0/Forms/ticket/attachments b/rt/share/html/REST/1.0/Forms/ticket/attachments index 43b8ed85a..ba3a24825 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/REST/1.0/Forms/ticket/comment b/rt/share/html/REST/1.0/Forms/ticket/comment index 35b543d9c..b50135fec 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -56,6 +56,7 @@ use MIME::Entity; use LWP::MediaTypes; use RT::Interface::REST; use File::Temp qw(tempfile); +my @tmp_files; $RT::Logger->debug("Got ticket id=$id for comment"); $RT::Logger->debug("Got args @{[keys(%changes)]}."); @@ -89,7 +90,10 @@ if (!$changes{Text} && @atts == 0) { } my $cgi = $m->cgi_object; -my $ent = MIME::Entity->build(Type => "multipart/mixed"); +my $ent = MIME::Entity->build( + Type => "multipart/mixed", + 'X-RT-Interface' => 'REST', +); $ent->attach(Data => $changes{Text}) if $changes{Text}; my $i = 1; @@ -103,6 +107,7 @@ foreach my $att (@atts) { my $buf; my ($w, $tmp) = tempfile(); my $info = $cgi->uploadInfo($fh); + push @tmp_files, $tmp; while (sysread($fh, $buf, 8192)) { syswrite($w, $buf); @@ -148,5 +153,7 @@ if ($changes{Status}) { } OUTPUT: + +unlink @tmp_files; return [ $c, $o, $k, $e ]; </%INIT> diff --git a/rt/share/html/REST/1.0/Forms/ticket/default b/rt/share/html/REST/1.0/Forms/ticket/default index 016a50c73..0bced1e99 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -167,7 +167,7 @@ else { elsif (lc $k eq 'text') { $text = delete $data{$k}; } - elsif ( lc $k ne 'id' ) { + elsif ( $k !~ /^(?:id|requestors)$/i ) { $e = 1; push @$o, $k; push(@comments, "# $k: Unknown field"); @@ -188,7 +188,8 @@ else { MIME::Entity->build( From => $session{CurrentUser}->EmailAddress, Subject => $v{Subject}, - Data => $text + Data => $text, + 'X-RT-Interface' => 'REST', ); } @@ -375,11 +376,18 @@ else { else { my $vals = $ticket->CustomFieldValues($cf->id); - if ( $cf->SingleValue ) { + if ( !defined $val || !length $val ) { + while ( my $val = $vals->Next ) { + ($n, $s) = $ticket->DeleteCustomFieldValue( + Field => $cf, ValueId => $val->id, + ); + $s =~ s/^# // if defined $s; + } + } + elsif ( $cf->SingleValue ) { my $old = $vals->Next; if ( $old ) { if ( $val ne $old->Content ) { - $old->Delete; ($n, $s) = $ticket->AddCustomFieldValue( Field => $cf, Value => $val ); $s =~ s/^# // if defined $s; @@ -433,7 +441,7 @@ else { $new{$c}--; } else { - $v->Delete(); + $ticket->DeleteCustomFieldValue( Field => $cf, ValueId => $v->id ); } } for ( @new ) { diff --git a/rt/share/html/REST/1.0/Forms/ticket/history b/rt/share/html/REST/1.0/Forms/ticket/history index 8b6e01722..ec4f08150 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/REST/1.0/Forms/ticket/links b/rt/share/html/REST/1.0/Forms/ticket/links index bf4f2575c..32e072457 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/REST/1.0/Forms/ticket/merge b/rt/share/html/REST/1.0/Forms/ticket/merge index a751dc558..db25bdfe2 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/REST/1.0/Forms/ticket/take b/rt/share/html/REST/1.0/Forms/ticket/take index 503ba55f0..e30cd84b6 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-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) |