[interchange-cvs] interchange - kwalsh modified lib/Vend/Cart.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Sep 14 09:02:12 EDT 2007


User:      kwalsh
Date:      2007-09-14 13:02:11 GMT
Modified:  lib/Vend Cart.pm
Log:
    * Modified MaxQuantityField to support more than one quantity
      "[table:]column" specification.  The column values get added
      together to create the maximum quantity value.

      The idea is that you might have an "on hand" quantity and an "on
      order" quantity that you want to consider when allowing orders.

Revision  Changes    Path
2.18      +13 -7     interchange/lib/Vend/Cart.pm


rev 2.18, prev_rev 2.17
Index: Cart.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Cart.pm,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -r2.17 -r2.18
--- Cart.pm	9 Aug 2007 13:40:53 -0000	2.17
+++ Cart.pm	14 Sep 2007 13:02:11 -0000	2.18
@@ -1,6 +1,6 @@
 # Vend::Cart - Interchange shopping cart management routines
 #
-# $Id: Cart.pm,v 2.17 2007/08/09 13:40:53 pajamian Exp $
+# $Id: Cart.pm,v 2.18 2007/09/14 13:02:11 kwalsh Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -25,7 +25,7 @@
 
 package Vend::Cart;
 
-$VERSION = substr(q$Revision: 2.17 $, 10);
+$VERSION = substr(q$Revision: 2.18 $, 10);
 
 use strict;
 
@@ -240,12 +240,18 @@
 			}
 
 			if($Vend::Cfg->{MaxQuantityField}) {
-				my ($tab, $col) = split /:+/, $Vend::Cfg->{MaxQuantityField};
-				if(! length $col) {
-					$col = $tab;
-					$tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
+				$item->{mv_max_quantity} = 0;
+
+				foreach my $fieldspec (split('[, ]+', $Vend::Cfg->{MaxQuantityField})) {
+					next unless $fieldspec;
+
+					my ($tab, $col) = split /:+/, $fieldspec;
+					if(! length $col) {
+						$col = $tab;
+						$tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
+					}
+					$item->{mv_max_quantity} += ::tag_data($tab, $col, $item->{code});
 				}
-				$item->{mv_max_quantity} = ::tag_data($tab, $col, $item->{code});
 
 				if(
 					length $item->{mv_max_quantity}








More information about the interchange-cvs mailing list