Format oz in the USPS shipping driver to the nearest tenth of an oz. Change the minimum to be 0.1 oz

This commit is contained in:
Colin Kuskie 2009-11-05 12:38:56 -08:00
parent 2c5c2ea5ee
commit 63b797c875
3 changed files with 18 additions and 18 deletions

View file

@ -6,7 +6,7 @@
- fixed #11197: Survey Edit Console is not i18n'ed
- fixed USPS driver only works on domestic addresses.
- fixed Shop is not sending notification emails to the user, or to the notification group.
- Set a minimum package weight of 1 oz for the USPS driver.
- Set a minimum package weight of 0.1 oz for the USPS driver.
- Handle per package errors in USPS response data.
7.8.3

View file

@ -73,9 +73,9 @@ sub buildXML {
$weight += $itemWeight;
}
my $pounds = int($weight);
my $ounces = int(16 * ($weight - $pounds));
if ($pounds == 0 && $ounces == 0 ) {
$ounces = 1;
my $ounces = sprintf '%3.1f', (16 * ($weight - $pounds));
if ($pounds == 0 && $ounces eq '0.0' ) {
$ounces = 0.1;
}
my $destination = $package->[0]->getShippingAddress;
my $destZipCode = $destination->get('code');

View file

@ -334,7 +334,7 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
@ -414,14 +414,14 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '2', Ounces => '0',
Pounds => '2', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
{
ID => 1,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
@ -445,7 +445,7 @@ SKIP: {
{
ID => 0,
ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 0,
Machinable => ignore(), Ounces => '0.0',
Pounds => 2, Size => ignore(),
Zone => ignore(),
Postage => {
@ -457,7 +457,7 @@ SKIP: {
{
ID => 1,
ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 8,
Machinable => ignore(), Ounces => '8.0',
Pounds => 1, Size => ignore(),
Zone => ignore(),
Postage => {
@ -545,21 +545,21 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '2', Ounces => '0',
Pounds => '2', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
{
ID => 1,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
{
ID => 2,
ZipDestination => '53703', ZipOrigination => '97123',
Pounds => '12', Ounces => '0',
Pounds => '12', Ounces => '0.0',
Size => 'REGULAR', Service => 'PARCEL',
Machinable => 'true',
},
@ -583,7 +583,7 @@ SKIP: {
{
ID => 0,
ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 0,
Machinable => ignore(), Ounces => '0.0',
Pounds => 2, Size => ignore(),
Zone => ignore(),
Postage => {
@ -595,7 +595,7 @@ SKIP: {
{
ID => 1,
ZipOrigination => ignore(), ZipDestination => ignore(),
Machinable => ignore(), Ounces => 8,
Machinable => ignore(), Ounces => '8.0',
Pounds => 1, Size => ignore(),
Zone => ignore(),
Postage => {
@ -607,7 +607,7 @@ SKIP: {
{
ID => 2,
ZipOrigination => ignore(), ZipDestination => 53703,
Machinable => ignore(), Ounces => 0,
Machinable => ignore(), Ounces => '0.0',
Pounds => 12, Size => ignore(),
Zone => ignore(),
Postage => {
@ -650,7 +650,7 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PRIORITY',
Machinable => 'true', Container => 'FLAT RATE BOX',
},
@ -715,7 +715,7 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'EXPRESS',
Machinable => 'true',
},
@ -779,7 +779,7 @@ cmp_deeply(
{
ID => 0,
ZipDestination => '53715', ZipOrigination => '97123',
Pounds => '1', Ounces => '8',
Pounds => '1', Ounces => '8.0',
Size => 'REGULAR', Service => 'PRIORITY',
Machinable => 'true',# Container => 'VARIABLE',
},