[interchange-cvs] interchange - racke modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Sep 26 14:57:58 UTC 2008


User:      racke
Date:      2008-09-26 14:57:58 GMT
Modified:  .        WHATSNEW-5.7
Modified:  lib/Vend Util.pm
Log:
lines attribute added to [nitems] to show the number of lines in the shopping
cart instead of the sum of the items (#225).

Revision  Changes    Path
2.13                 interchange/WHATSNEW-5.7


rev 2.13, prev_rev 2.12
Index: WHATSNEW-5.7
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.7,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -r2.12 -r2.13
--- WHATSNEW-5.7	26 Sep 2008 12:27:40 -0000	2.12
+++ WHATSNEW-5.7	26 Sep 2008 14:57:58 -0000	2.13
@@ -49,6 +49,9 @@
 * scratch attribute added to [capture-page] to store the resulting page in a
   scratch variable, supplied by Phil Smith.
 
+* lines attribute added to [nitems] to show the number of lines in the shopping
+  cart instead of the sum of the items (#225).
+
 OrderCheck
 ----------
 



2.120                interchange/lib/Vend/Util.pm


rev 2.120, prev_rev 2.119
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.119
retrieving revision 2.120
diff -u -r2.119 -r2.120
--- Util.pm	13 Sep 2008 04:28:56 -0000	2.119
+++ Util.pm	26 Sep 2008 14:57:58 -0000	2.120
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.119 2008-09-13 04:28:56 jon Exp $
+# $Id: Util.pm,v 2.120 2008-09-26 14:57:58 racke Exp $
 # 
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -91,7 +91,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.119 $, 10);
+$VERSION = substr(q$Revision: 2.120 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -1395,6 +1395,10 @@
 		}
 	}
 
+	if($opt->{lines}) {
+		return scalar(grep {! $attr or $sub->($_->{$attr})} @$cart);
+	}
+
     $total = 0;
     foreach $item (@$cart) {
 		next if $attr and ! $sub->($item->{$attr});







More information about the interchange-cvs mailing list