[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-70-g1f65090

BPS Git Server git at git.bestpractical.com
Mon Oct 30 19:50:16 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".

The branch, dynamic-forms-from-config has been updated
       via  1f65090fde5b01ca682b7842248ba67d2e38b2dd (commit)
      from  2d612f085fdddf35c84ce2d1bd9fdd9061443c8d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1f65090fde5b01ca682b7842248ba67d2e38b2dd
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Oct 30 15:49:17 2023 -0400

    Add RT patch to support custom labels in cf validation messages

diff --git a/patches/Support-custom-labels-for-ValidateCustomFields.patch b/patches/Support-custom-labels-for-ValidateCustomFields.patch
new file mode 100644
index 0000000..6a8a2bb
--- /dev/null
+++ b/patches/Support-custom-labels-for-ValidateCustomFields.patch
@@ -0,0 +1,63 @@
+From 33cdfe85441bd338d95eeb7a5d30a293e5e22146 Mon Sep 17 00:00:00 2001
+From: sunnavy <sunnavy at bestpractical.com>
+Date: Mon, 30 Oct 2023 10:56:28 -0400
+Subject: [PATCH] Support custom labels for ValidateCustomFields
+
+This is initially for FormTools, where we support to customize field
+labels, so the validation messages can be consistent with input labels.
+---
+ share/html/Elements/ValidateCustomFields | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/share/html/Elements/ValidateCustomFields b/share/html/Elements/ValidateCustomFields
+index 9655db7ce8..df7c752363 100644
+--- a/share/html/Elements/ValidateCustomFields
++++ b/share/html/Elements/ValidateCustomFields
+@@ -82,9 +82,10 @@ while ( my $CF = $CustomFields->Next ) {
+ 
+     $m->notes(('Field-' . $CF->Id) => $submitted->{Values} // $submitted->{Value});
+ 
++    my $label = $Labels{$CF->Name} || $CF->Name;
+     if ( $invalid ) {
+         $m->notes( 'InvalidField-' . $CF->Id => $invalid_message );
+-        push @res, $CF->Name . ': ' . $invalid_message;
++        push @res, $label . ': ' . $invalid_message;
+         $valid = 0;
+         next;
+     }
+@@ -112,7 +113,7 @@ while ( my $CF = $CustomFields->Next ) {
+             my ($ok, $msg) = $CF->_CanonicalizeValue( $ref );
+             unless ($ok) {
+                 $m->notes( ( 'InvalidField-' . $CF->Id ) => $msg );
+-                push @res, $CF->Name .': '. $msg;
++                push @res, $label . ': ' . $msg;
+                 $valid = 0;
+             }
+         }
+@@ -120,7 +121,7 @@ while ( my $CF = $CustomFields->Next ) {
+         if (!$CF->MatchPattern($value)) {
+             my $msg = $CF->FriendlyPattern;
+             $m->notes( ('InvalidField-' . $CF->Id) => $msg );
+-            push @res, $CF->Name .': '. $msg;
++            push @res, $label . ': ' . $msg;
+             $valid = 0;
+         }
+ 
+@@ -138,7 +139,7 @@ while ( my $CF = $CustomFields->Next ) {
+             while (my $ocfv = $existing->Next) {
+                 my $msg = loc("'[_1]' is not a unique value", $value);
+                 $m->notes( ('InvalidField-' . $CF->Id) => $msg );
+-                push @res, $CF->Name .': '. $msg;
++                push @res, $label . ': ' . $msg;
+                 $valid = 0;
+                 last;
+             }
+@@ -153,4 +154,5 @@ $Object => RT::Ticket->new( $session{'CurrentUser'})
+ $CustomFields
+ $ARGSRef
+ $ValidateUnsubmitted => 0
++%Labels => ()
+ </%ARGS>
+-- 
+2.39.3 (Apple Git-145)
+

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

Summary of changes:
 ...rt-custom-labels-for-ValidateCustomFields.patch | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 patches/Support-custom-labels-for-ValidateCustomFields.patch


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list