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

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Oct 30 11:23:33 EST 2007


User:      heins
Date:      2007-10-30 16:23:32 GMT
Modified:  lib/Vend Interpolate.pm
Log:
* Fix salestax() routine to not allow negative tax. Allow it with use of a
  Pragma, if someone wants to implement refunds.

* Remove code that does nothing -- fly_tax was being run frequently when
  not needed at all. (The $cost var was never accessed again.)

Revision  Changes    Path
2.287     +10 -6     interchange/lib/Vend/Interpolate.pm


rev 2.287, prev_rev 2.286
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.286
retrieving revision 2.287
diff -u -r2.286 -r2.287
--- Interpolate.pm	11 Oct 2007 01:37:16 -0000	2.286
+++ Interpolate.pm	30 Oct 2007 16:23:32 -0000	2.287
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.286 2007/10/11 01:37:16 kwalsh Exp $
+# $Id: Interpolate.pm,v 2.287 2007/10/30 16:23:32 mheins Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.286 $, 10);
+$VERSION = substr(q$Revision: 2.287 $, 10);
 
 @EXPORT = qw (
 
@@ -5564,6 +5564,7 @@
 		}
 
 	}
+
 	return $total;
 }
 
@@ -5611,13 +5612,12 @@
 	if(defined $cost) {
 		$Vend::Items = $save if $save;
 		switch_discount_space($oldspace) if defined $oldspace;
+		if($cost < 0 and ! $::Pragma->{allow_negative_tax}) {
+			$cost = 0;
+		}
 		return Vend::Util::round_to_frac_digits($cost);
 	}
 
-	if(! $tax_hash) {
-		$cost = fly_tax();
-	}
-
 #::logDebug("got to tax function: " . uneval($tax_hash));
 	my $amount = taxable_amount();
 	# Restore the original discount namespace if appropriate; no other routines need the discount info.
@@ -5668,6 +5668,10 @@
 	}
 
 	$Vend::Items = $save if defined $save;
+
+	if($r < 0 and ! $::Pragma->{allow_negative_tax}) {
+		$r = 0;
+	}
 
 	return Vend::Util::round_to_frac_digits($r);
 }








More information about the interchange-cvs mailing list