[interchange-cvs] interchange - heins modified lib/Vend/Interpolate.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Dec 2 13:57:23 EST 2005


User:      heins
Date:      2005-12-02 18:57:23 GMT
Modified:  lib/Vend Interpolate.pm
Log:
* Fix error logging problem with switch_discount_space().

Revision  Changes    Path
2.263     +17 -4     interchange/lib/Vend/Interpolate.pm


rev 2.263, prev_rev 2.262
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.262
retrieving revision 2.263
diff -u -r2.262 -r2.263
--- Interpolate.pm	21 Nov 2005 20:41:46 -0000	2.262
+++ Interpolate.pm	2 Dec 2005 18:57:23 -0000	2.263
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.262 2005/11/21 20:41:46 racke Exp $
+# $Id: Interpolate.pm,v 2.263 2005/12/02 18:57:23 mheins Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.262 $, 10);
+$VERSION = substr(q$Revision: 2.263 $, 10);
 
 @EXPORT = qw (
 
@@ -2696,9 +2696,15 @@
 # Sets the discount namespace.
 sub switch_discount_space {
 	my $dspace = shift || 'main';
+
+	if (! $Vend::Cfg->{DiscountSpacesOn}) {
+		$::Discounts
+			= $Vend::Session->{discount}
+			||= {};
+		return $Vend::DiscountSpaceName = 'main';
+	}
+
 	my $oldspace = $Vend::DiscountSpaceName || 'main';
-	logError('Attempt to set discount space in catalog with discount spaces set to OFF.'), return $oldspace
-		unless $Vend::Cfg->{DiscountSpacesOn};
 #::logDebug("switch_discount_space: called for space '$dspace'; current space is $oldspace.");
 	unless ($Vend::Session->{discount} and $Vend::Session->{discount_space}) {
 		$::Discounts
@@ -2714,6 +2720,13 @@
 			= $Vend::Session->{discount_space}{$Vend::DiscountSpaceName = $dspace}
 			||= {};
 #::logDebug("switch_discount_space: changed discount space from '$oldspace' to '$Vend::DiscountSpaceName'");
+	}
+	else {
+		# Make certain the hash is set, in case app programmer manipulated the session directly.
+		$::Discounts
+			= $Vend::Session->{discount}
+			= $Vend::Session->{discount_space}{$Vend::DiscountSpaceName}
+			unless ref $::Discounts eq 'HASH';
 	}
 	else {
 		# Make certain the hash is set, in case app programmer manipulated the session directly.








More information about the interchange-cvs mailing list