[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-308-gfb5ed4f

Ruslan Zakirov ruz at bestpractical.com
Mon Oct 19 15:09:49 EDT 2009


The branch, 3.8-trunk has been updated
       via  fb5ed4f20b1963699fa9ce5c8d5caa11ffcc10d0 (commit)
      from  e5e0bbec968445a9f4297f274a0b6d4149847784 (commit)

Summary of changes:
 share/html/Ticket/Update.html |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit fb5ed4f20b1963699fa9ce5c8d5caa11ffcc10d0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 19 23:05:39 2009 +0400

    refactor validation of transactions CFs on ticket update

diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index c8020fc..d3c2a09 100755
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -234,16 +234,21 @@ $m->comp( '/Elements/GnuPG/SignEncryptWidget:Process',
     TicketObj => $TicketObj,
 );
 
-my $CFs = $TicketObj->TransactionCustomFields();
-my $ValidCFs = undef;
-
 if ( $ARGS{'SubmitTicket'} ) {
-    $ValidCFs = $m->comp(
+    my $CFs = $TicketObj->TransactionCustomFields;
+    my $ValidCFs = $m->comp(
         '/Elements/ValidateCustomFields',
         CustomFields => $CFs,
         NamePrefix => "Object-RT::Transaction--CustomField-",
         ARGSRef => \%ARGS
     );
+    unless ( $ValidCFs ) {
+        $checks_failure = 1;
+        while (my $CF = $CFs->Next) {
+            my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
+            push @results, loc($CF->Name) . ': ' . $msg;
+        }
+    }
     my $status = $m->comp('/Elements/GnuPG/SignEncryptWidget:Check',
         self      => $gnupg_widget,
         TicketObj => $TicketObj,
@@ -251,17 +256,10 @@ if ( $ARGS{'SubmitTicket'} ) {
     $checks_failure = 1 unless $status;
 }
 
-if ( $ValidCFs && !$checks_failure && exists $ARGS{SubmitTicket} ) {
+if ( !$checks_failure && exists $ARGS{SubmitTicket} ) {
     $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS, CallbackName => 'BeforeDisplay' );
     return $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
-} elsif ( !$ValidCFs ) {
-    # Invalid CFs
-    while (my $CF = $CFs->Next) {
-        my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
-        push @results, $CF->Name . ': ' . $msg;
-    }
 }
-
 </%INIT>
 
 <%ARGS>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list