Subject: | off by one error in fuel surcharge update script |
In the script that updates fuel surcharges (recommended to be run monthly), there is an off-by-one error in the loop that checks for the month. Attached is a patch to fix this problem.
Thanks for your work on this module, we've used it with great success on several different web sites.
diff -ur Business-Shipping-2.01.orig/bin/Business-Shipping-UPS_Offline-update-fuel-surcharge.pl Business-Shipping-2.01/bin/Business-Shipping-UPS_Offline-update-fuel-surcharge.pl
--- Business-Shipping-2.01.orig/bin/Business-Shipping-UPS_Offline-update-fuel-surcharge.pl 2005-09-16 21:19:17.000000000 -0400
+++ Business-Shipping-2.01/bin/Business-Shipping-UPS_Offline-update-fuel-surcharge.pl 2005-12-22 13:51:54.555017136 -0500
@@ -131,7 +131,7 @@
my %cur = %{ $rates->{ $service_type }{ $date_type } };
my $found_month;
- for my $c ( 1 .. @month_names ) {
+ for my $c ( 0 .. $#month_names ) {
if ( $cur{ month } eq $month_names[ $c ] ) {
$cur{ month } = $c;
$found_month = 1;