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

BPS Git Server git at git.bestpractical.com
Mon Oct 30 19:45:09 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  2d612f085fdddf35c84ce2d1bd9fdd9061443c8d (commit)
      from  bf65881a63c2da86eed2bded28411a9a17ce21ab (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 2d612f085fdddf35c84ce2d1bd9fdd9061443c8d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Oct 30 15:44:01 2023 -0400

    Pass custom labels to show them in cf validation messages
    
    Previously cf names were shown, which were inconsistent with custom
    labels and could easily confuse people.

diff --git a/html/FormTools/Form b/html/FormTools/Form
index e300468..84b09c2 100644
--- a/html/FormTools/Form
+++ b/html/FormTools/Form
@@ -13,6 +13,7 @@ $form_name           => undef
 $form_classes        => undef
 $self_service        => 0
 $results_ref         => []
+$form_config         => undef
 </%args>
 <%init>
 use RT::Extension::FormTools;
@@ -54,10 +55,15 @@ if ($validation && $real_next) {
         }
     }
 
+    my %labels = map { $_->{arguments}{name} => $_->{arguments}{label} }
+        grep { ( $_->{comp_name} // '' ) eq 'Field' && $_->{arguments}{name} && $_->{arguments}{label} }
+        map { @{ $_->{content} } } values %{ $form_config->{'formtools-pages'} };
+
     my ($status, @msg) = $m->comp(
         '/Elements/ValidateCustomFields',
         CustomFields    => $queue->TicketCustomFields,
         ARGSRef         => \%request_args,
+        Labels          => \%labels,
     );
     unless ($status) {
         push @results, @msg;
diff --git a/html/Forms/dhandler b/html/Forms/dhandler
index 0e84256..6cb11bc 100644
--- a/html/Forms/dhandler
+++ b/html/Forms/dhandler
@@ -4,6 +4,7 @@
     results_ref => \@results,
     self_service => $SelfService,
     include_tabs => 1,
+    form_config => $form_config,
 &>
 
 <%perl>

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

Summary of changes:
 html/FormTools/Form | 6 ++++++
 html/Forms/dhandler | 1 +
 2 files changed, 7 insertions(+)


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


More information about the Bps-public-commit mailing list