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

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Dec 2 13:56:45 EST 2005


User:      heins
Date:      2005-12-02 18:56:45 GMT
Modified:  lib/Vend Tag: STABLE_5_4-branch Interpolate.pm
Log:
* Patch error log problems with switch_discount_space().

Revision  Changes    Path
No                   revision



No                   revision



2.261.2.2 +17 -4     interchange/lib/Vend/Interpolate.pm


rev 2.261.2.2, prev_rev 2.261.2.1
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.261.2.1
retrieving revision 2.261.2.2
diff -u -r2.261.2.1 -r2.261.2.2
--- Interpolate.pm	21 Nov 2005 20:39:56 -0000	2.261.2.1
+++ Interpolate.pm	2 Dec 2005 18:56:44 -0000	2.261.2.2
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.261.2.1 2005/11/21 20:39:56 racke Exp $
+# $Id: Interpolate.pm,v 2.261.2.2 2005/12/02 18:56:44 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.261.2.1 $, 10);
+$VERSION = substr(q$Revision: 2.261.2.2 $, 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