1 Jul 2010 17:12
[Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[27819] trunk/lib
Revision: 27819
http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27819&view=rev
Author: lphuberdeau
Date: 2010-07-01 15:12:10 +0000 (Thu, 01 Jul 2010)
Log Message:
-----------
[FIX] Tolerate lowercase letters in zip codes
Modified Paths:
--------------
trunk/lib/shipping/shippinglib.php
trunk/lib/test/shipping/ShippingTest.php
Modified: trunk/lib/shipping/shippinglib.php
===================================================================
--- trunk/lib/shipping/shippinglib.php 2010-07-01 04:28:16 UTC (rev 27818)
+++ trunk/lib/shipping/shippinglib.php 2010-07-01 15:12:10 UTC (rev 27819)
<at> <at> -38,6 +38,10 <at> <at>
}
private function completeAddressInformation( $address ) {
+ if( isset( $address['zip'] ) ) {
+ $address['zip'] = strtoupper( $address['zip'] );
+ }
+
if( ! isset( $address['country'] ) ) {
foreach( $this->formats as $pattern => $country ) {
if( preg_match( $pattern, $address['zip'] ) ) {
Modified: trunk/lib/test/shipping/ShippingTest.php
===================================================================
--- trunk/lib/test/shipping/ShippingTest.php 2010-07-01 04:28:16 UTC (rev 27818)
+++ trunk/lib/test/shipping/ShippingTest.php 2010-07-01 15:12:10 UTC (rev 27819)
<at> <at> -43,6 +43,16 <at> <at>
$this->assertEquals( 'CA', $this->to['country'] );
}
+ function testZipUpperCased() {
+ $lib = new ShippingLib;
+ $lib->addProvider( $this );
+
+ $lib->getRates( array( 'zip' => '12345' ), array( 'zip' => 'a1b 2c3' ), array( array( 'weight' => 5 ) ) );
+
+ $this->assertEquals( 'A1B 2C3', $this->to['zip'] );
+ $this->assertEquals( 'CA', $this->to['country'] );
+ }
+
function testUnknownFormat() {
$lib = new ShippingLib;
$lib->addProvider( $this );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open
Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
RSS Feed