[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Apr 8 23:18:56 EDT 2004


User:      heins
Date:      2004-04-09 03:18:56 GMT
Modified:  lib/Vend Ship.pm
Modified:  lib/Vend/Ship Postal.pm
Log:
* Add source_kg, source_oz, and source_grams option for internal
  UPS -- makes match the Ship::Postal module.

* Add packaging_weight option to add a fixed (or variable when passed
  by parameter) packaging weight when appropriate.

Revision  Changes    Path
2.6       +17 -2     interchange/lib/Vend/Ship.pm


rev 2.6, prev_rev 2.5
Index: Ship.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Ship.pm,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -r2.5 -r2.6
--- Ship.pm	12 Sep 2003 19:45:49 -0000	2.5
+++ Ship.pm	9 Apr 2004 03:18:55 -0000	2.6
@@ -1,6 +1,6 @@
 # Vend::Ship - Interchange shipping code
 # 
-# $Id: Ship.pm,v 2.5 2003/09/12 19:45:49 jon Exp $
+# $Id: Ship.pm,v 2.6 2004/04/09 03:18:55 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -1038,6 +1038,22 @@
 	my(@fieldnames);
 	my($i,$point,$zone);
 
+	$weight += $opt->{packaging_weight} if $opt->{packaging_weight};
+
+	if($opt->{source_grams}) {
+		$weight *= 0.00220462;
+	}
+	elsif($opt->{source_kg}) {
+		$weight *= 2.20462;
+	}
+	elsif($opt->{source_oz}) {
+		$weight /= 16;
+	}
+
+	if($opt->{oz}) {
+		$weight *= 16;
+	}
+
 #::logDebug("tag_ups: type=$type zip=$zip weight=$weight code=$code opt=" . uneval($opt));
 
 	if(my $modulo = $opt->{aggregate}) {
@@ -1055,7 +1071,6 @@
 	}
 
 	$code = 'u' unless $code;
-
 
 	unless (defined $Vend::Database{$type}) {
 		logError("Shipping lookup called, no database table named '%s'", $type);



1.3       +6 -1      interchange/lib/Vend/Ship/Postal.pm


rev 1.3, prev_rev 1.2
Index: Postal.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Ship/Postal.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Postal.pm	18 Jun 2003 17:34:46 -0000	1.2
+++ Postal.pm	9 Apr 2004 03:18:55 -0000	1.3
@@ -1,6 +1,6 @@
 # Vend::Ship - Interchange shipping code
 # 
-# $Id: Postal.pm,v 1.2 2003/06/18 17:34:46 jon Exp $
+# $Id: Postal.pm,v 1.3 2004/04/09 03:18:55 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -51,6 +51,10 @@
 	}
 
 	$country = $::Values->{$o->{geo}};
+
+	if($opt->{packaging_weight}) {
+		$weight += $opt->{packaging_weight};
+	}
 #::logDebug("ready to calculate postal type=$type country=$country weight=$weight");
 
 	if($opt->{source_grams}) {
@@ -152,6 +156,7 @@
 
 	do {
 		$cost = tag_data($opt->{table}, $zone, $weight);
+		$weight++;
 	} until $cost or $its++ > $maxits;
 		
 	return do_error(








More information about the interchange-cvs mailing list