[interchange-cvs] interchange - jon modified dist/usertag/ups_query.tag

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Fri Jan 25 14:58:01 2002


User:      jon
Date:      2002-01-25 19:56:59 GMT
Modified:  dist/usertag Tag: STABLE_4_8-branch ups_query.tag
Log:
Merge user-friendliness enhancement from trunk version 2.2.

Revision  Changes    Path
No                   revision



No                   revision



2.0.2.2   +7 -0      interchange/dist/usertag/ups_query.tag


rev 2.0.2.2, prev_rev 2.0.2.1
Index: ups_query.tag
===================================================================
RCS file: /var/cvs/interchange/dist/usertag/ups_query.tag,v
retrieving revision 2.0.2.1
retrieving revision 2.0.2.2
diff -u -u -r2.0.2.1 -r2.0.2.2
--- ups_query.tag	5 Sep 2001 15:20:13 -0000	2.0.2.1
+++ ups_query.tag	25 Jan 2002 19:56:59 -0000	2.0.2.2
@@ -8,17 +8,24 @@
 			import Business::UPS;
 		};
 	};
+
 	$origin		= $::Variable->{UPS_ORIGIN}
 					if ! $origin;
 	$country	= $::Values->{$::Variable->{UPS_COUNTRY_FIELD}}
 					if ! $country;
 	$zip		= $::Values->{$::Variable->{UPS_POSTCODE_FIELD}}
 					if ! $zip;
+
 	$country = uc $country;
+
+	# In the U.S., UPS only wants the 5-digit base ZIP code, not ZIP+4
+	$country eq 'US' and $zip =~ /^(\d{5})/ and $zip = $1;
+
 #::logGlobal("calling with: " . join("|", $mode, $origin, $zip, $weight, $country));
 	my ($shipping, $zone, $error) =
 		getUPS( $mode, $origin, $zip, $weight, $country);
 #::logGlobal("received back: " . join("|", $shipping, $zone, $error));
+
 	if($error) {
 		$Vend::Session->{ship_message} .= " $mode: $error";
 		return 0;