Navigation Menu

Skip to content

Commit

Permalink
* Allow explicit setting of negative numbers in items without
Browse files Browse the repository at this point in the history
  raising error on quantity update.

  To make an item eligible, set the mv_negative attribute true.
  (You must also have mv_control = notoss if you wish to survive
  the cart toss routine.)
  • Loading branch information
perusionmike committed Sep 18, 2015
1 parent 3a8884b commit 059f5a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Vend/Order.pm
Expand Up @@ -2132,15 +2132,20 @@ sub update_quantity {
$quantity = $CGI::values{"quantity$i"};
next unless defined $quantity;
my $do_update;

## Allow explicit negative numbers in items
my $intro = '';
$line->{mv_negative} and $intro = '-?';

my $old_item = $old_items{$i} ||= { %$line } if $raise_event;
if ($quantity =~ m/^\d*$/) {
if ($quantity =~ m/^$intro\d*$/) {
$line->{'quantity'} = $quantity || 0;
$do_update = 1;
$altered_items{$i} = 1
if $quantity_raise_event
and $line->{quantity} != $old_item->{quantity};
}
elsif ($quantity =~ m/^[\d.]+$/
elsif ($quantity =~ m/^$intro[\d.]+$/
and $Vend::Cfg->{FractionalItems} ) {
$line->{'quantity'} = $quantity;
$do_update = 1;
Expand Down

0 comments on commit 059f5a3

Please sign in to comment.