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

BPS Git Server git at git.bestpractical.com
Fri Nov 17 21:22:06 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  629e58baa0ca1da9d77284a731746f63ede70b3d (commit)
       via  e80f6f64341c944238edd40a45e12bfe4669d178 (commit)
      from  f69de59afbd7fd7db0cbd04983f840c7a7d0b6a1 (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 629e58baa0ca1da9d77284a731746f63ede70b3d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Nov 17 15:52:12 2023 -0500

    Clear all invalid cf inputs on back
    
    Previously we only cleared empty fields, which wasn't complete. This
    commit calls ValidateCustomFields to completely validate submitted args.

diff --git a/html/Forms/dhandler b/html/Forms/dhandler
index f20d3ea..561cf1d 100644
--- a/html/Forms/dhandler
+++ b/html/Forms/dhandler
@@ -261,10 +261,25 @@ if ( $ARGS{Back} and $ARGS{Back} eq 'Back' ) {
     $_form_tools_next = '';
     delete $ARGS{'_form_tools_next'} if $ARGS{'_form_tools_next'};
 
-    for my $field ( grep { /Object-RT::Ticket--CustomField-/ } keys %ARGS ) {
-        next if length $ARGS{$field};
-        delete $ARGS{$field};
-        delete $ARGS{"$field-Magic"};
+    my ($status, @msg) = $m->comp(
+        '/Elements/ValidateCustomFields',
+        CustomFields    => $queue_obj->TicketCustomFields,
+        ARGSRef         => \%ARGS,
+    );
+
+    if ( !$status ) {
+        my %invalid_fields;
+        for my $note ( keys %{ $m->notes } ) {
+            if ( $note =~ /^InvalidField-(\d+)/ ) {
+                $invalid_fields{$1} = 1;
+            }
+        }
+
+        for my $field ( keys %ARGS ) {
+            if ( $field =~ /^Object-RT::Ticket--CustomField-(\d+)-/ ) {
+                delete $ARGS{$field} if $invalid_fields{$1};
+            }
+        }
     }
 
     # Redirect to the previous page

commit e80f6f64341c944238edd40a45e12bfe4669d178
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Nov 17 15:56:40 2023 -0500

    Skip required check on back

diff --git a/html/Forms/dhandler b/html/Forms/dhandler
index 8b494dc..f20d3ea 100644
--- a/html/Forms/dhandler
+++ b/html/Forms/dhandler
@@ -143,6 +143,11 @@ jQuery(function () {
             syncValidation(jQuery(':input[type=hidden][name="' + dependent_name +'"]'));
         }
     });
+
+    jQuery(':input[name=Back]').click(function() {
+        const form = jQuery(this).closest('form');
+        form.find(':input[required]').attr('required', false);
+    });
 });
 </script>
 

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

Summary of changes:
 html/Forms/dhandler | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)


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


More information about the Bps-public-commit mailing list