[interchange-cvs] interchange - jon modified code/UserTag/fedex_query.tag
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Tue Jun 11 18:39:02 2002
User: jon
Date: 2002-06-11 22:35:14 GMT
Modified: code/UserTag fedex_query.tag
Log:
Stop dying if there's a problem with FedExexpress lookups, which kept
even ground rate lookups from being done during the first request when
the Business::Fedex object is first created.
Instead, just log the error but continue on with possible ground lookup.
(This situation resulted in the oddity of the shipping rate displaying
as $0.00 on the checkout page, but still getting added into the total cost
and displaying in the shipping rate pulldown select box just fine.)
Also removed a duplicated debug statement and one left over from the
ups_query tag, and prettified some default values initialization.
Revision Changes Path
1.3 +8 -14 interchange/code/UserTag/fedex_query.tag
rev 1.3, prev_rev 1.2
Index: fedex_query.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/fedex_query.tag,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- fedex_query.tag 5 Feb 2002 20:57:04 -0000 1.2
+++ fedex_query.tag 11 Jun 2002 22:35:14 -0000 1.3
@@ -217,19 +217,13 @@
my $fed;
- $opt->{target_url} = 'http://grd.fedex.com/cgi-bin/rrr2010.exe'
- unless $opt->{target_url};
- $opt->{origin} = $::Variable->{UPS_ORIGIN}
- if ! $opt->{origin};
- $opt->{country} = $::Values->{$::Variable->{UPS_COUNTRY_FIELD}}
- if ! $opt->{country};
- $opt->{zip} = $::Values->{$::Variable->{UPS_POSTCODE_FIELD}}
- if ! $opt->{zip};
+ $opt->{target_url} ||= 'http://grd.fedex.com/cgi-bin/rrr2010.exe';
+ $opt->{origin_country} ||= $::Variable->{COUNTRY} || 'US';
+ $opt->{origin} ||= $::Variable->{UPS_ORIGIN};
+ $opt->{zip} ||= $::Values->{$::Variable->{UPS_POSTCODE_FIELD}};
+ $opt->{country} ||= $::Values->{$::Variable->{UPS_COUNTRY_FIELD}};
$opt->{country} = uc $opt->{country};
- $opt->{origin_country} = $::Variable->{COUNTRY} || 'US'
- if ! $opt->{origin_country};
-
if($can_do_express and (! $opt->{cache} || ! $Vend::fedex_object) ) {
eval {
$Vend::fedex_object = new Business::Fedex (
@@ -242,7 +236,9 @@
);
$Vend::fedex_object->getrate;
};
- return $die->($@) if $@;
+ # if there's a problem here with express lookups, log the error
+ # but don't actually return so ground lookups can still be done
+ $die->($@) if $@;
}
$fed = $Vend::fedex_object if $can_do_express;
@@ -269,7 +265,6 @@
my @services;
#Debug("can_ground=$can_do_ground country=$opt->{country} orig_country=$opt->{origin_country}");
if($opt->{services}) {
-#Debug("can_ground=$can_do_ground country=$opt->{country} orig_country=$opt->{origin_country}");
if(
$can_do_ground
and ($opt->{country} eq 'US' or $opt->{country} eq 'CA')
@@ -294,7 +289,6 @@
}
return 0;
}
-#::logGlobal("calling with: " . join("|", $mode, $origin, $zip, $weight, $country));
if($opt->{mode} eq 'FEH') {
$opt->{mode} = 'HomeD';