[interchange-cvs] interchange - jon modified 2 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Tue Dec 10 15:11:00 2002


User:      jon
Date:      2002-12-10 20:08:57 GMT
Modified:  lib/Vend Config.pm Order.pm
Log:
Fix problem with PreFork and mod_perl modes where Interchange children
kept order profile state between runs.

Revision  Changes    Path
2.84      +4 -8      interchange/lib/Vend/Config.pm


rev 2.84, prev_rev 2.83
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.83
retrieving revision 2.84
diff -u -u -r2.83 -r2.84
--- Config.pm	20 Nov 2002 15:24:56 -0000	2.83
+++ Config.pm	10 Dec 2002 20:08:56 -0000	2.84
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.83 2002/11/20 15:24:56 racke Exp $
+# $Id: Config.pm,v 2.84 2002/12/10 20:08:56 jon Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -45,7 +45,7 @@
 use Vend::Util;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.83 $, 10);
+$VERSION = substr(q$Revision: 2.84 $, 10);
 
 my %CDname;
 
@@ -3433,7 +3433,7 @@
                 isOperator  1
                 ItemAction  1
 				noRearrange	1
-		NoReparse   1
+				NoReparse   1
                 OrderCheck  1
                 UserTag     1
 				! );
@@ -3464,12 +3464,8 @@
 		}
 	}
 
-	if(! $C and $ref = $c->{OrderCheck} and $ref->{Routine}) {
-		$Vend::Order::OrderCheck = $ref->{Routine};
-	}
-
 	no strict 'refs';
-	for my $type (qw/ ActionMap FormAction ItemAction /) {
+	for my $type (qw/ ActionMap FormAction ItemAction OrderCheck /) {
 		my $ref;
 		my $r;
 		next unless $r = $c->{$type};



2.42      +45 -22    interchange/lib/Vend/Order.pm


rev 2.42, prev_rev 2.41
Index: Order.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Order.pm,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -u -r2.41 -r2.42
--- Order.pm	28 Nov 2002 17:12:22 -0000	2.41
+++ Order.pm	10 Dec 2002 20:08:56 -0000	2.42
@@ -1,6 +1,6 @@
 # Vend::Order - Interchange order routing routines
 #
-# $Id: Order.pm,v 2.41 2002/11/28 17:12:22 kwalsh Exp $
+# $Id: Order.pm,v 2.42 2002/12/10 20:08:56 jon Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -28,7 +28,7 @@
 package Vend::Order;
 require Exporter;
 
-$VERSION = substr(q$Revision: 2.41 $, 10);
+$VERSION = substr(q$Revision: 2.42 $, 10);
 
 @ISA = qw(Exporter);
 
@@ -59,18 +59,48 @@
 
 use autouse 'Vend::Error' => qw/do_lockout/;
 
-my @Errors = ();
-my $Update = 0;
-my $Fatal = 0;
-my $And;
-my $Final = 0;
-my $Success;
-my $Profile;
-my $Tables;
-my $Fail_page;
-my $Success_page;
-my $No_error;
-use vars qw/$OrderCheck/;
+# Instance variables
+my (
+	@Errors,
+	$Update,
+	$Fatal,
+	$And,
+	$Final,
+	$Success,
+	$Profile,
+	$Tables,
+	$Fail_page,
+	$Success_page,
+	$No_error,
+	$OrderCheck,
+);
+
+sub reset_order_vars {
+	@Errors = ();
+	$Update = 0;
+	$Fatal = 0;
+	undef $And;
+	$Final = 0;
+	undef $Success;
+	undef $Profile;
+	undef $Tables;
+	undef $Fail_page;
+	undef $Success_page;
+	undef $No_error;
+
+	# copy global order check routines
+	$OrderCheck = { %$Global::OrderCheck };
+
+	# overlay any catalog order check routines
+	my $r;
+	if ($r = $Vend::Cfg->{CodeDef}{OrderCheck} and $r = $r->{Routine}) {
+		for (keys %$r) {
+			$OrderCheck->{$_} = $r->{$_};
+		}
+	}
+
+	return;
+}
 
 my %Parse = (
 
@@ -925,8 +955,8 @@
 
 sub check_order {
 	my ($profiles, $vref) = @_;
+	reset_order_vars();
 	my $status;
-	@Errors = ();
 	$Vend::Session->{errors} = {}
 		unless ref $Vend::Session->{errors} eq 'HASH';
 
@@ -987,13 +1017,6 @@
 
 	$And = 1;
 	$Fatal = $Final = 0;
-
-	my $r;
-	if( $r = $Vend::Cfg->{CodeDef}{OrderCheck} and $r = $r->{Routine}) {
-		for(keys %$r) {
-			$OrderCheck->{$_} = $r->{$_};
-		}
-	}
 
 	my($var,$val,$message);
 	my $status = 1;