[TEP-COMMIT] CVS: catalog/catalog checkout_payment_address.php,1.15,1.16

cvs-OfajU3CKLf1/[email protected] Thu, 18 Mar 2004 11:10:54 +0100
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Update of /pack/cvsroots/oscommerce/catalog/catalog
In directory sunsite.dk:/tmp/cvs-serv382

Modified Files:
	checkout_payment_address.php 
Log Message:
Fix last state query

Index: checkout_payment_address.php
===================================================================
RCS file: /pack/cvsroots/oscommerce/catalog/catalog/checkout_payment_address.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- checkout_payment_address.php	2003/11/17 20:58:34	1.15
+++ checkout_payment_address.php	2004/03/18 10:09:08	1.16
@@ -96,14 +96,20 @@
         $check = tep_db_fetch_array($check_query);
         $entry_state_has_zones = ($check['total'] > 0);
         if ($entry_state_has_zones == true) {
-          $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
+          $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and zone_code = '" . tep_db_input($state) . "'");
           if (tep_db_num_rows($zone_query) == 1) {
             $zone = tep_db_fetch_array($zone_query);
             $zone_id = $zone['zone_id'];
           } else {
-            $error = true;
+            $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and zone_name like '" . tep_db_input($state) . "%'");
+            if (tep_db_num_rows($zone_query) == 1) {
+              $zone = tep_db_fetch_array($zone_query);
+              $zone_id = $zone['zone_id'];
+            } else {
+              $error = true;
 
-            $messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT);
+              $messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT);
+            }
           }
         } else {
           if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click