[Rt-commit] rt branch, 4.2/skip-validating-unsubmitted-cfs, created. rt-4.1.5-149-g80b777f

Thomas Sibley trs at bestpractical.com
Thu Dec 20 16:25:17 EST 2012


The branch, 4.2/skip-validating-unsubmitted-cfs has been created
        at  80b777fb852325e28d5c21dbaaa9206745a71930 (commit)

- Log -----------------------------------------------------------------
commit 80b777fb852325e28d5c21dbaaa9206745a71930
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 20 13:01:20 2012 -0800

    Skip CF validation for empty fields which aren't submitted with "Magic"
    
    If a CF value is not submitted and the "Magic" marker is also missing,
    skip validation.  The most likely trigger for this is a link containing
    only core field query parameters submitted to a page which processes
    both core fields and CFs.  By skipping validation in this case, we avoid
    nonsensical errors.

diff --git a/share/html/Elements/ValidateCustomFields b/share/html/Elements/ValidateCustomFields
index ca2be2a..757611e 100644
--- a/share/html/Elements/ValidateCustomFields
+++ b/share/html/Elements/ValidateCustomFields
@@ -56,6 +56,12 @@ while ( my $CF = $CustomFields->Next ) {
     # Pick the first grouping
     $submitted = $submitted ? $submitted->{(keys %$submitted)[0]} : {};
 
+    # If we don't have a value and we don't see the Magic, then we're not
+    # submitting a field.
+    next if not exists $submitted->{"Value"}
+        and not exists $submitted->{"Values"}
+        and not $submitted->{"Values-Magic"};
+
     # We only validate Single Combos -- multis can never be user input
     next if $submitted->{"Values-Magic"} and exists $submitted->{"Values"}
         and ref $submitted->{"Values"};

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


More information about the Rt-commit mailing list