[Rt-commit] rt branch, 4.2/cf-validation-messages, updated. rt-4.0.6-490-gea42dd6

Thomas Sibley trs at bestpractical.com
Fri Aug 24 17:52:21 EDT 2012


The branch, 4.2/cf-validation-messages has been updated
       via  ea42dd602f696ae53a83ab968b81ca0637970953 (commit)
      from  0e5986034ed4c750338938f80af3c0ad751991ae (commit)

Summary of changes:
 share/html/Ticket/Create.html | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

- Log -----------------------------------------------------------------
commit ea42dd602f696ae53a83ab968b81ca0637970953
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Aug 24 14:33:20 2012 -0700

    Use validation results returned by ValidateCustomFields
    
    The primary ticket create page was missed by 0e598603.

diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index d0d99ab..e48fd3a 100755
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -343,6 +343,7 @@ if ($CloneTicket) {
 }
 
 my @results;
+my $checks_failure = 0;
 
 my $title = loc("Create a new ticket");
 
@@ -355,13 +356,17 @@ $m->scomp( '/Articles/Elements/SubjectOverride', ARGSRef => \%ARGS, QueueObj =>
 
 $QueueObj->Disabled && Abort(loc("Cannot create tickets in a disabled queue."));
 
-my $CFs = $QueueObj->TicketCustomFields();
-
-my $ValidCFs = $m->comp(
-    '/Elements/ValidateCustomFields',
-    CustomFields => $CFs,
-    ARGSRef => \%ARGS
-);
+{
+    my ($status, @msg) = $m->comp(
+        '/Elements/ValidateCustomFields',
+        CustomFields    => $QueueObj->TicketCustomFields,
+        ARGSRef         => \%ARGS
+    );
+    unless ($status) {
+        push @results, @msg;
+        $checks_failure = 1;
+    }
+}
 
 # deal with deleting uploaded attachments
 foreach my $key (keys %ARGS) {
@@ -389,8 +394,6 @@ unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
     delete $session{'Attachments'};
 }
 
-my $checks_failure = 0;
-
 my $gnupg_widget = $m->comp('/Elements/GnuPG/SignEncryptWidget:new', Arguments => \%ARGS );
 $m->comp( '/Elements/GnuPG/SignEncryptWidget:Process',
     self      => $gnupg_widget,
@@ -431,18 +434,11 @@ $m->comp( '/Articles/Elements/CheckSkipCreate', ARGSRef => \%ARGS, skip_create =
               checks_failure => $checks_failure, results => \@results );
 
 if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket?
-    if ( $ValidCFs && !$checks_failure && !$skip_create ) {
+    if ( !$checks_failure && !$skip_create ) {
         $m->comp('Display.html', %ARGS);
         $RT::Logger->crit("After display call; error is $@");
         $m->abort();
     }
-    elsif ( !$ValidCFs ) {
-        # Invalid CFs
-        while (my $CF = $CFs->Next) {
-            my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
-            push @results, $CF->Name . ': ' . $msg;
-        }
-    }
 }
 PageMenu->child( basics => raw_html =>  q[<a href="#basics" onclick="return switchVisibility('Ticket-Create-basics','Ticket-Create-details');">] . loc('Basics') . q[</a>]);
 PageMenu->child( details => raw_html =>  q[<a href="#details" onclick="return switchVisibility('Ticket-Create-details','Ticket-Create-basics');">] . loc('Details') . q[</a>]);

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


More information about the Rt-commit mailing list