Source for file LC_Page_Shopping_DelivAddr.php
Documentation is available at LC_Page_Shopping_DelivAddr.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH .
"pages/LC_Page.php");
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Shopping_DelivAddr.php 17969 2009-04-10 14:20:10Z Seasoft $
$this->arrPref =
$masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
if (!$objCustomer->isLoginSuccess(true)){
SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
foreach($_POST as $key =>
$val) {
if ($key !=
"mode" &&
$key !=
"return" &&
$key !=
"submit" &&
$key !=
session_name()) {
$this->list_data[ $key ] =
$val;
// ユーザユニークIDの取得と購入状態の正当性をチェック
$uniqid =
SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
$arrRegistColumn =
array(
array( "column" =>
"name01", "convert" =>
"aKV" ),
array( "column" =>
"name02", "convert" =>
"aKV" ),
array( "column" =>
"kana01", "convert" =>
"CKV" ),
array( "column" =>
"kana02", "convert" =>
"CKV" ),
array( "column" =>
"zip01", "convert" =>
"n" ),
array( "column" =>
"zip02", "convert" =>
"n" ),
array( "column" =>
"pref", "convert" =>
"n" ),
array( "column" =>
"addr01", "convert" =>
"aKV" ),
array( "column" =>
"addr02", "convert" =>
"aKV" ),
array( "column" =>
"tel01", "convert" =>
"n" ),
array( "column" =>
"tel02", "convert" =>
"n" ),
array( "column" =>
"tel03", "convert" =>
"n" ),
if (!empty($_POST["return"])) {
switch ($_POST["mode"]) {
if (count($this->arrErr) ==
0 &&
empty($_POST["return"])) {
$checkVal =
array("pref", "addr01", "addr02", "addr03", "tel01", "tel02", "tel03");
foreach($checkVal as $key) {
unset
($this->list_data[$key]);
if (@$this->arrForm['pref'] ==
"" &&
@$this->arrForm['addr01'] ==
"" &&
@$this->arrForm['addr02'] ==
"") {
$address =
$this->lfGetAddress($_REQUEST['zip01'].
$_REQUEST['zip02']);
$this->arrForm['pref'] =
@$address[0]['state'];
$this->arrForm['addr01'] =
@$address[0]['city'] .
@$address[0]['town'];
$checkVal =
array("name01", "name02", "kana01", "kana02", "zip01", "zip02");
foreach($checkVal as $key) {
unset
($this->list_data[$key]);
if (count($this->arrErr) ==
0 &&
empty($_POST["return"])) {
$checkVal =
array("pref", "addr01", "addr02", "addr03", "tel01", "tel02", "tel03");
foreach($checkVal as $key) {
unset
($this->list_data[$key]);
if (count($this->arrErr) ==
0) {
$other_deliv_id =
$this->lfRegistData($_POST,$arrRegistColumn, $objCustomer);
// 登録済みの別のお届け先を受注一時テーブルに書き込む
$objSiteSess->setRegistFlag();
SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
$deliv_count =
$objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
if ($deliv_count >=
DELIV_ADDR_MAX){
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "最大登録件数を超えています。");
$objView->assignobj($this);
$objView->display(SITE_FRAME);
$objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(カナ/姓)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("お名前(カナ/名)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
$objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
$objErr->doFunc(array("市区町村", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("番地", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
$objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
$objErr->doFunc(array("お名前(カナ/姓)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("お名前(カナ/名)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
$objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
$objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
$objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
$objErr->doFunc(array("市区町村", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("番地", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
$objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
function lfRegistData($array, $arrRegistColumn, &$objCustomer) {
$objConn =
new SC_DBConn();
foreach ($arrRegistColumn as $data) {
if (strlen($array[ $data["column"] ]) >
0) {
$arrRegist[ $data["column"] ] =
$array[ $data["column"] ];
$arrRegist['customer_id'] =
$objCustomer->getvalue('customer_id');
$objConn->query("BEGIN");
if ($array['other_deliv_id'] !=
""){
$objConn->autoExecute("dtb_other_deliv", $arrRegist, "other_deliv_id=" .
SC_Utils_Ex::sfQuoteSmart($array["other_deliv_id"]));
$objConn->autoExecute("dtb_other_deliv", $arrRegist);
$sqlse =
"SELECT max(other_deliv_id) FROM dtb_other_deliv WHERE customer_id = ?";
$array['other_deliv_id'] =
$objConn->getOne($sqlse, array($arrRegist['customer_id']));
$objConn->query("COMMIT");
return $array['other_deliv_id'];
* K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換
* C : 「全角ひら仮名」を「全角かた仮名」に変換
* V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します
* n : 「全角」数字を「半角(ハンカク)」に変換
foreach ($arrRegistColumn as $data) {
$arrConvList[ $data["column"] ] =
$data["convert"];
foreach ($arrConvList as $key =>
$val) {
if(strlen(($array[$key])) >
0) {
$conn =
new SC_DBconn(ZIP_DSN);
$sqlse =
"SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
$data_list =
$conn->getAll($sqlse, array($zipcode));
総務省からダウンロードしたデータをそのままインポートすると
$town =
$data_list[0]['town'];
$data_list[0]['town'] =
$town;
$data_list[0]['state'] =
$arrREV_PREF[$data_list[0]['state']];
$sqlval['order_temp_id'] =
$uniqid;
$sqlval['update_date'] =
'Now()';
$sqlval['customer_id'] =
$objCustomer->getValue('customer_id');
$sqlval['order_birth'] =
$objCustomer->getValue('birth');
$where =
"other_deliv_id = ?";
$arrRet =
$objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
$sqlval['deliv_check'] =
'1';
$sqlval['deliv_name01'] =
$arrRet[0]['name01'];
$sqlval['deliv_name02'] =
$arrRet[0]['name02'];
$sqlval['deliv_kana01'] =
$arrRet[0]['kana01'];
$sqlval['deliv_kana02'] =
$arrRet[0]['kana02'];
$sqlval['deliv_zip01'] =
$arrRet[0]['zip01'];
$sqlval['deliv_zip02'] =
$arrRet[0]['zip02'];
$sqlval['deliv_pref'] =
$arrRet[0]['pref'];
$sqlval['deliv_addr01'] =
$arrRet[0]['addr01'];
$sqlval['deliv_addr02'] =
$arrRet[0]['addr02'];
$sqlval['deliv_tel01'] =
$arrRet[0]['tel01'];
$sqlval['deliv_tel02'] =
$arrRet[0]['tel02'];
$sqlval['deliv_tel03'] =
$arrRet[0]['tel03'];
$objDb->sfRegistTempOrder($uniqid, $sqlval);
Documentation generated on Tue, 28 Apr 2009 18:12:57 +0900 by phpDocumentor 1.4.2