
sunnavy at bestpractical
Feb 27, 2012, 12:09 AM
Post #1 of 1
(119 views)
Permalink
|
|
rt branch, 4.0/rest-load-ticket-cf-with-queue-limit, created. rt-4.0.5-79-g959ad3d
|
|
The branch, 4.0/rest-load-ticket-cf-with-queue-limit has been created at 959ad3d4e999585d5a42f87241c7e49703d05f5c (commit) - Log ----------------------------------------------------------------- commit 959ad3d4e999585d5a42f87241c7e49703d05f5c Author: sunnavy <sunnavy [at] bestpractical> Date: Mon Feb 27 15:47:06 2012 +0800 limit queue when loading ticket cf in REST. as there could be multiple cfs with same name but applied in different queues. we may load a wrong cf without Queue limit. see also #19471 also fixed a current user issue(RT->SystemUser => $session{CurrentUser}) diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default index 9ae803d..30caf04 100755 --- a/share/html/REST/1.0/Forms/ticket/default +++ b/share/html/REST/1.0/Forms/ticket/default @@ -149,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} ); + unless ( $cf->id ) { + $cf->LoadByName( Name => $key, Queue => 0 ); + } + + if (not $cf->id) { + push @comments, "# Invalid custom field name ($key)"; delete $data{$k}; next; } @@ -348,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."; } ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|