Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fix long-undiscovered bug whereby certain LARGE or HUGE tables coul…
…d 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.
  • Loading branch information
Mike Heins committed Sep 29, 2016
1 parent fedd953 commit 4bc69a0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions 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
1 change: 1 addition & 0 deletions code/UI_Tag/flex_select.coretag
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion dist/lib/UI/pages/admin/flex_select.html
Expand Up @@ -70,7 +70,7 @@
[/if]
[output name=""]

[flex-select]
[flex-select mv_form_profile=some_spec]

<!-- ----- END REAL STUFF ----- -->

Expand Down
7 changes: 7 additions & 0 deletions 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__

0 comments on commit 4bc69a0

Please sign in to comment.