[Rt-commit] rtir branch, 2.5-trunk, updated. 903cc39f9fed1b2e9970504e7ba88087fc240a3b

Kevin Falcone falcone at bestpractical.com
Wed Nov 25 16:14:57 EST 2009


The branch, 2.5-trunk has been updated
       via  903cc39f9fed1b2e9970504e7ba88087fc240a3b (commit)
      from  984fd28b9599979b415bb015ddb70d8bfe68402c (commit)

Summary of changes:
 html/RTIR/Create.html          |    9 +++++++--
 html/RTIR/Incident/Create.html |    9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 903cc39f9fed1b2e9970504e7ba88087fc240a3b
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Nov 25 16:14:03 2009 -0500

    Make Custom Field Validation error messages useful
    
    Steal the code from RT's Ticket/Create.html which tells you what Custom
    Field failed the validation check, rather than just spitting out "input
    must match [Mandatory]" 5 times.

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 8354cbf..638c097 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -344,12 +344,17 @@ unless ( $skip_create ) {
         $checks_failure = 1;
     }
 
+    my $TicketCFs = $QueueObj->TicketCustomFields;
     my ($status, @msg) = $m->comp('/Elements/ValidateCustomFields',
-        CustomFields => $QueueObj->TicketCustomFields,
+        CustomFields => $TicketCFs,
         ARGSRef      => \%ARGS,
     );
     unless ( $status ) {
-        push @results, loc( "Invalid value(s) of the custom fields:" ), @msg;
+        push @results, loc( "Invalid value(s) of the custom fields:" );
+        while (my $CF = $TicketCFs->Next) {
+            my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
+            push @results, $CF->Name . ': ' . $msg;
+        }
         $checks_failure = 1;
     }
 }
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index d4efb0a..6c8a38d 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -254,12 +254,17 @@ if ( $CreateIncident && $gnupg_widget ) {
 }
 
 if ( $CreateIncident ) {
+    my $TicketCFs = $QueueObj->TicketCustomFields;
     my ($status, @msg) = $m->comp('/Elements/ValidateCustomFields',
-        CustomFields => $QueueObj->TicketCustomFields,
+        CustomFields => $TicketCFs,
         ARGSRef      => \%ARGS,
     );
     unless ( $status ) {
-        push @results, loc( "Invalid value(s) of the custom fields:" ), @msg;
+        push @results, loc( "Invalid value(s) of the custom fields:" );
+        while (my $CF = $TicketCFs->Next) {
+            my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
+            push @results, $CF->Name . ': ' . $msg;
+        }
         $checks_failure = 1;
     }
 

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


More information about the Rt-commit mailing list