Changeset 18355 for branches/comu-ver2
- Timestamp:
- 2009/10/29 21:10:03 (13 years ago)
- Location:
- branches/comu-ver2/data/class
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/pages/LC_Page_InputZip.php
r18234 r18355 53 53 */ 54 54 function process() { 55 $conn = new SC_DBconn(ZIP_DSN);56 55 $objView = new SC_SiteView(false); 57 56 … … 63 62 SC_Utils::sfDispSiteError(CUSTOMER_ERROR); 64 63 } 65 64 66 65 // 郵便番号検索文作成 67 66 $zipcode = $_GET['zip1'].$_GET['zip2']; 68 $zipcode = mb_convert_kana($zipcode ,"n");69 $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";70 67 71 $data_list = $conn->getAll($sqlse, array($zipcode)); 72 if (empty($data_list)) $data_list = array(); 73 74 $masterData = new SC_DB_MasterData_Ex(); 75 $arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); 76 // インデックスと値を反転させる。 77 $arrREV_PREF = array_flip($arrPref); 78 79 if (!empty($data_list)) { 80 $this->tpl_state = isset($arrREV_PREF[$data_list[0]['state']]) 81 ? $arrREV_PREF[$data_list[0]['state']] : ""; 82 $this->tpl_city = isset($data_list[0]['city']) ? $data_list[0]['city'] : ""; 83 $town = isset($data_list[0]['town']) ? $data_list[0]['town'] : ""; 84 } else { 85 $town = ""; 86 } 87 88 /* 89 総務省からダウンロードしたデータをそのままインポートすると 90 以下のような文字列が入っているので 対策する。 91 ・(1~19丁目) 92 ・以下に掲載がない場合 93 */ 94 $town = ereg_replace("(.*)$","",$town); 95 $town = ereg_replace("以下に掲載がない場合","",$town); 96 $this->tpl_town = $town; 68 $data_list = SC_Utils_Ex::sfGetAddress($zipcode); 97 69 98 70 // 郵便番号が発見された場合 99 71 if(!empty($data_list)) { 72 $this->tpl_state = $data_list[0]['state']; 73 $this->tpl_city = $data_list[0]['city']; 74 $this->tpl_town = $data_list[0]['town']; 75 100 76 $func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');"; 101 77 $this->tpl_onload = "$func"; -
branches/comu-ver2/data/class/pages/entry/LC_Page_Entry.php
r18353 r18355 469 469 470 470 if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") { 471 $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);471 $address = SC_Utils_Ex::sfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']); 472 472 $this->pref = @$address[0]['state']; 473 473 $this->addr01 = @$address[0]['city'] . @$address[0]['town']; … … 836 836 // {{{ mobile functions 837 837 838 // 郵便番号から住所の取得839 function lfGetAddress($zipcode) {840 841 $conn = new SC_DBconn(ZIP_DSN);842 843 // 郵便番号検索文作成844 $zipcode = mb_convert_kana($zipcode ,"n");845 $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";846 847 $data_list = $conn->getAll($sqlse, array($zipcode));848 849 // インデックスと値を反転させる。850 $arrREV_PREF = array_flip($this->arrPref);851 852 /*853 総務省からダウンロードしたデータをそのままインポートすると854 以下のような文字列が入っているので 対策する。855 ・(1・19丁目)856 ・以下に掲載がない場合857 */858 $town = $data_list[0]['town'];859 $town = ereg_replace("(.*)$","",$town);860 $town = ereg_replace("以下に掲載がない場合","",$town);861 $data_list[0]['town'] = $town;862 $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];863 864 return $data_list;865 }866 867 838 //---- 入力エラーチェック 868 839 function lfErrorCheck1($array) { -
branches/comu-ver2/data/class/pages/shopping/LC_Page_Shopping_DelivAddr.php
r18276 r18355 138 138 // 郵便番号から住所の取得 139 139 if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") { 140 $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);140 $address = SC_Utils_Ex::sfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']); 141 141 $this->arrForm['pref'] = @$address[0]['state']; 142 142 $this->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town']; … … 298 298 } 299 299 300 // 郵便番号から住所の取得301 function lfGetAddress($zipcode) {302 303 $conn = new SC_DBconn(ZIP_DSN);304 305 // 郵便番号検索文作成306 $zipcode = mb_convert_kana($zipcode ,"n");307 $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";308 309 $data_list = $conn->getAll($sqlse, array($zipcode));310 311 // インデックスと値を反転させる。312 $arrREV_PREF = array_flip($this->arrPref);313 314 /*315 総務省からダウンロードしたデータをそのままインポートすると316 以下のような文字列が入っているので 対策する。317 ・(1・19丁目)318 ・以下に掲載がない場合319 */320 $town = $data_list[0]['town'];321 $town = ereg_replace("(.*)$","",$town);322 $town = ereg_replace("以下に掲載がない場合","",$town);323 $data_list[0]['town'] = $town;324 $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];325 326 return $data_list;327 }328 329 300 /* 別のお届け先住所を一時受注テーブルへ */ 330 301 function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) { -
branches/comu-ver2/data/class/util/SC_Utils.php
r18293 r18355 2206 2206 return defined('INSTALL_FUNCTION') && INSTALL_FUNCTION; 2207 2207 } 2208 2209 // 郵便番号から住所の取得 2210 function sfGetAddress($zipcode) { 2211 2212 $conn = new SC_DBconn(ZIP_DSN); 2213 2214 $masterData = new SC_DB_MasterData_Ex(); 2215 $arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); 2216 // インデックスと値を反転させる。 2217 $arrREV_PREF = array_flip($arrPref); 2218 2219 // 郵便番号検索文作成 2220 $zipcode = mb_convert_kana($zipcode ,"n"); 2221 $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?"; 2222 2223 $data_list = $conn->getAll($sqlse, array($zipcode)); 2224 if (empty($data_list)) return array(); 2225 2226 /* 2227 総務省からダウンロードしたデータをそのままインポートすると 2228 以下のような文字列が入っているので 対策する。 2229 ・(1・19丁目) 2230 ・以下に掲載がない場合 2231 */ 2232 $town = $data_list[0]['town']; 2233 $town = ereg_replace("(.*)$","",$town); 2234 $town = ereg_replace("以下に掲載がない場合","",$town); 2235 $data_list[0]['town'] = $town; 2236 $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']]; 2237 2238 return $data_list; 2239 } 2208 2240 } 2209 2241 ?>
Note: See TracChangeset
for help on using the changeset viewer.