[interchange] * Fix long-undiscovered bug whereby certain LARGE or HUGE tables could have

Mike Heins interchange-cvs at icdevgroup.org
Thu Sep 29 11:52:33 UTC 2016


commit 4bc69a0769e37f53f321ff43b40141e947d0d261
Author: Mike Heins <mikeh at endpoint.com>
Date:   Thu Sep 29 07:49:04 2016 -0400

    * Fix long-undiscovered bug whereby certain LARGE or HUGE tables could have
      large searches embarked upon by hitting return with the cursor in the
      entry box.
    
      Discovered when one administrator developed the habit of going to a
      user screen then hitting (or holding down) the ENTER Key repeatedly,
      crashing the catalog.
    
      Believe this same phenomenon has caused many mystery crashes over
      the years.
    
      To fix, add mv_form_profile=some_spec to
    
      Will consider adding new "mv_form_profile_direct" to Interchange
      to avoid having to institute a mandatory profile circumlocution for
      these types of admin functions.

 MANIFEST                                   |    2 ++
 code/OrderCheck/some_spec.oc               |   26 ++++++++++++++++++++++++++
 code/UI_Tag/flex_select.coretag            |    1 +
 dist/lib/UI/pages/admin/flex_select.html   |    2 +-
 dist/strap/include/profiles/profiles.admin |    7 +++++++
 5 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/MANIFEST b/MANIFEST
index 7f74412..5e21e04 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -108,6 +108,7 @@ code/OrderCheck/numeric.oc
 code/OrderCheck/numeric_strict.oc
 code/OrderCheck/regex.oc
 code/OrderCheck/relative_filename.oc
+code/OrderCheck/some_spec.oc
 code/OrderCheck/unique.oc
 code/SystemTag/accessories.coretag
 code/SystemTag/accounting.coretag
@@ -886,6 +887,7 @@ dist/strap/include/menus/catalog/line.txt
 dist/strap/include/menus/catalog/service.txt
 dist/strap/include/menus/catalog/top.txt
 dist/strap/include/menus/Top.txt
+dist/strap/include/profiles/profiles.admin
 dist/strap/include/profiles/profiles.login
 dist/strap/include/profiles/profiles.order
 dist/strap/include/profiles/searchprofiles
diff --git a/code/OrderCheck/some_spec.oc b/code/OrderCheck/some_spec.oc
new file mode 100644
index 0000000..6079f7e
--- /dev/null
+++ b/code/OrderCheck/some_spec.oc
@@ -0,0 +1,26 @@
+CodeDef some_spec OrderCheck 1
+CodeDef some_spec Description Check to see some value is input. Designed for flex_select/mv_like_spec.
+CodeDef some_spec Routine <<EOR
+sub {
+    ## $ref is to Vend::Session->{'values'} hash
+    ## $var is the passed name of the variable
+    ## $val is the current value of the checked variable
+    my($ref, $var, $val, $len) = @_;
+    $len ||= 3;
+    my @things = split /\0/, $val;
+    my $found;
+
+    ### If reference not defined, don't want to fail this check
+    unless (defined $ref->{$var} ) {
+        return (1, $var, '') if $found >= $len;
+    }
+
+    for(@things) {
+        $found += length($_);
+    }
+    return (1, $var, '') if $found >= $len;
+    return (undef, $var,
+        errmsg( "Must input some sort of search --  at least $len characters total")
+    );
+}
+EOR
diff --git a/code/UI_Tag/flex_select.coretag b/code/UI_Tag/flex_select.coretag
index 2ccfa0e..9b96c2a 100644
--- a/code/UI_Tag/flex_select.coretag
+++ b/code/UI_Tag/flex_select.coretag
@@ -737,6 +737,7 @@ EOF
 <input type=hidden name=mv_data_table    value="$table">
 <input type=hidden name=mv_action        value="$opt->{mv_action}">
 <input type=hidden name=mv_click         value="warn_me_main_form">
+<input type=hidden name=mv_form_profile  value="$opt->{mv_form_profile}">
 <input type=hidden name=mv_session_id    value="$Vend::SessionID">
 EOF
 
diff --git a/dist/lib/UI/pages/admin/flex_select.html b/dist/lib/UI/pages/admin/flex_select.html
index 212002a..7ad8a0c 100644
--- a/dist/lib/UI/pages/admin/flex_select.html
+++ b/dist/lib/UI/pages/admin/flex_select.html
@@ -70,7 +70,7 @@
 [/if]
 [output name=""]
 
-[flex-select]
+[flex-select mv_form_profile=some_spec]
 
 <!-- ----- END REAL STUFF ----- -->
 
diff --git a/dist/strap/include/profiles/profiles.admin b/dist/strap/include/profiles/profiles.admin
new file mode 100644
index 0000000..322294c
--- /dev/null
+++ b/dist/strap/include/profiles/profiles.admin
@@ -0,0 +1,7 @@
+__NAME__ some_spec
+## Used to prevent empty mv_like_spec when present
+## Useful for flex-select tag that could conceivably do large checks
+&fatal=yes
+&fail=admin/error
+mv_like_spec=some_spec 2
+__END__



More information about the interchange-cvs mailing list