[interchange-cvs] interchange - edl modified 4 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Nov 14 17:51:39 EST 2003


User:      edl
Date:      2003-11-14 22:51:39 GMT
Modified:  lib/Vend Interpolate.pm Config.pm
Modified:  code/SystemTag assign.coretag
Modified:  dist/foundation catalog.cfg
Log:
This is the skeleton of a new order summary line called 'credit applied'
which can be used to show outstanding credits, gift certs and any other
non-cash forms of payment which would be applied against an order at
checkout time. More fleshing out in different parts of the server and
catalog code to follow...

Revision  Changes    Path
2.196     +23 -2     interchange/lib/Vend/Interpolate.pm


rev 2.196, prev_rev 2.195
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.195
retrieving revision 2.196
diff -u -r2.195 -r2.196
--- Interpolate.pm	31 Oct 2003 23:53:41 -0000	2.195
+++ Interpolate.pm	14 Nov 2003 22:51:38 -0000	2.196
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.195 2003/10/31 23:53:41 racke Exp $
+# $Id: Interpolate.pm,v 2.196 2003/11/14 22:51:38 edl Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.195 $, 10);
+$VERSION = substr(q$Revision: 2.196 $, 10);
 
 @EXPORT = qw (
 
@@ -5771,6 +5771,26 @@
     return $subtotal;
 }
 
+# figures any credits the customer may have
+# that can be applied to this order
+
+sub credit {
+    my $credit = 0;
+    if (defined $Vend::Session->{assigned}{credit}
+	&& $Vend::Session->{assigned}{credit} > 0) {
+	$credit = $Vend::Session->{assigned}{credit};
+    }
+    elsif ($Vend::Cfg->{CreditField}) {
+	# credit field from userdb should always be put in scratch space
+	# using 'Userdb default scratch' to avoid hacking by nefarious customers
+	if ($Scratch->{$Vend::Cfg->{CreditField}} > 0) {
+	    $credit = $Scratch->{$Vend::Cfg->{CreditField}};
+	}
+    }
+    return $credit;
+}
+
+
 
 # Returns the total cost of items ordered.
 
@@ -5798,6 +5818,7 @@
 		$total += subtotal();
 		$total += $shipping;
 		$total += salestax();
+		$total -= credit();
 	}
 	$Vend::Items = $save if defined $save;
 	$Vend::Session->{latest_total} = $total;



2.128     +3 -2      interchange/lib/Vend/Config.pm


rev 2.128, prev_rev 2.127
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.127
retrieving revision 2.128
diff -u -r2.127 -r2.128
--- Config.pm	10 Sep 2003 17:01:33 -0000	2.127
+++ Config.pm	14 Nov 2003 22:51:38 -0000	2.128
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.127 2003/09/10 17:01:33 mheins Exp $
+# $Id: Config.pm,v 2.128 2003/11/14 22:51:38 edl Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -48,7 +48,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.127 $, 10);
+$VERSION = substr(q$Revision: 2.128 $, 10);
 
 my %CDname;
 my %CPname;
@@ -549,6 +549,7 @@
 	['Levies',		 	 'array',     	 	 ''],
 	['Levy',		 	 'locale',     	 	 ''],
 	['AutoVariable',	 'autovar',     	 ''],
+	['CreditField',     undef,			''],	
 
 	];
 



1.2       +2 -1      interchange/code/SystemTag/assign.coretag


rev 1.2, prev_rev 1.1
Index: assign.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/assign.coretag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- assign.coretag	29 Jan 2002 05:52:38 -0000	1.1
+++ assign.coretag	14 Nov 2003 22:51:38 -0000	1.2
@@ -5,7 +5,8 @@
 				salestax	1
 				shipping	1
 				handling	1
-				subtotal    1
+				subtotal	1
+				credit		1	
 				/);
 sub {
 	my ($opt) = @_;



2.26      +6 -1      interchange/dist/foundation/catalog.cfg


rev 2.26, prev_rev 2.25
Index: catalog.cfg
===================================================================
RCS file: /var/cvs/interchange/dist/foundation/catalog.cfg,v
retrieving revision 2.25
retrieving revision 2.26
diff -u -r2.25 -r2.26
--- catalog.cfg	2 Sep 2003 13:47:04 -0000	2.25
+++ catalog.cfg	14 Nov 2003 22:51:38 -0000	2.26
@@ -184,7 +184,12 @@
 UserDB    default    time_field    mod_time
 
 # Don't want people setting their credit limit or dealer status directly
-UserDB    default    scratch       "dealer price_level credit_limit"
+UserDB    default    scratch       "dealer price_level credit_limit credit_balance"
+
+# Field in userdb which stores credit balance for cust (if any)
+# NOTE: the field needs to be defined in scratch space above!!
+CreditField credit_balance
+
 
 # minimal login stuff for affiliate
 UserDB    affiliate  user_field    affiliate








More information about the interchange-cvs mailing list