[interchange] * Allow explicit setting of negative numbers in items without
Mike Heins
interchange-cvs at icdevgroup.org
Fri Sep 18 14:09:13 UTC 2015
commit 059f5a3e7dc9683cb7adfa30b7c99d798b32e0cc
Author: Mike Heins <mike at perusion.com>
Date: Fri Sep 18 10:07:48 2015 -0400
* Allow explicit setting of negative numbers in items without
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.)
lib/Vend/Order.pm | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/Order.pm b/lib/Vend/Order.pm
index 5944598..1eb0690 100644
--- a/lib/Vend/Order.pm
+++ b/lib/Vend/Order.pm
@@ -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;
More information about the interchange-cvs
mailing list