source: branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php @ 19861

Revision 19861, 27.3 KB checked in by nanasess, 13 years ago (diff)

#843(複数配送先の指定)

  • お届け先の指定を修正
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_REALDIR . "pages/LC_Page.php");
26
27/**
28 * お届け先の指定 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id:LC_Page_Shopping_Deliv.php 15532 2007-08-31 14:39:46Z nanasess $
33 */
34class LC_Page_Shopping_Deliv extends LC_Page {
35
36    // {{{ properties
37
38    /** フォームパラメータの配列 */
39    var $objFormParam;
40
41    /** ログインフォームパラメータ配列 */
42    var $objLoginFormParam;
43
44    // }}}
45    // {{{ functions
46
47    /**
48     * Page を初期化する.
49     *
50     * @return void
51     */
52    function init() {
53        parent::init();
54        $masterData = new SC_DB_MasterData();
55        $this->arrPref = $masterData->getMasterData('mtb_pref');
56        $this->tpl_title = "お届け先の指定";
57        $this->httpCacheControl('nocache');
58    }
59
60    /**
61     * Page のプロセス.
62     *
63     * @return void
64     */
65    function process() {
66        $this->action();
67        $this->sendResponse();
68    }
69
70    /**
71     * Page のプロセス.
72     *
73     * @return void
74     */
75    function action() {
76        $objView = new SC_SiteView();
77        $objSiteSess = new SC_SiteSession();
78        $objCartSess = new SC_CartSession();
79        $objCustomer = new SC_Customer();
80        $objDb = new SC_Helper_DB_Ex();
81        $objPurchase = new SC_Helper_Purchase_Ex();
82        // クッキー管理クラス
83        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
84        // パラメータ管理クラス
85        $this->objFormParam = new SC_FormParam();
86        // パラメータ情報の初期化
87        $this->lfInitParam();
88        // POST値の取得
89        $this->objFormParam->setParam($_POST);
90
91        $this->objLoginFormParam = new SC_FormParam();  // ログインフォーム用
92        $this->lfInitLoginFormParam();
93        //パスワード・Eメールにある空白をトリム
94        $this->lfConvertEmail($_POST["login_email"]);
95        $this->lfConvertLoginPass($_POST["login_pass"]);
96        $this->objLoginFormParam->setParam($_POST);     // POST値の取得
97
98        // ユーザユニークIDの取得と購入状態の正当性をチェック
99        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
100        $this->tpl_uniqid = $uniqid;
101
102        $this->cartKey = $objCartSess->getKey();
103
104        if (!isset($_POST['mode'])) $_POST['mode'] = "";
105
106        // ログインチェック
107        if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
108            // 不正アクセスとみなす
109            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
110        }
111
112        switch($_POST['mode']) {
113        case 'login':
114            $this->objLoginFormParam->toLower('login_email');
115            $this->arrErr = $this->objLoginFormParam->checkError();
116            $arrForm =  $this->objLoginFormParam->getHashArray();
117            // クッキー保存判定
118            if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
119                $objCookie->setCookie('login_email', $_POST['login_email']);
120            } else {
121                $objCookie->setCookie('login_email', '');
122            }
123
124            if(count($this->arrErr) > 0) {
125                SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
126            }
127            // ログイン判定
128            if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
129                // 仮登録の判定
130                $objQuery = new SC_Query;
131                $where = "email = ? AND status = 1 AND del_flg = 0";
132                $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
133
134                if($ret > 0) {
135                    SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
136                } else {
137                    SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
138                }
139            }
140            //ダウンロード商品判定
141            if($this->cartKey == PRODUCT_TYPE_DOWNLOAD){
142                // 会員情報の住所を受注一時テーブルに書き込む
143                $objDb->sfRegistDelivData($uniqid, $objCustomer);
144                // 正常に登録されたことを記録しておく
145                $objSiteSess->setRegistFlag();
146                // ダウンロード商品有りの場合は、支払方法画面に転送
147                SC_Response_Ex::sendRedirect('payment.php');
148                exit;
149            }
150            break;
151        // 削除
152        case 'delete':
153            if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) {
154                $objQuery = new SC_Query();
155                $where = "other_deliv_id = ?";
156                $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
157                $this->objFormParam->setValue('select_addr_id', '');
158            }
159            break;
160        // 会員登録住所に送る
161        case 'customer_addr':
162            $sqlval = array();
163            // 会員登録住所がチェックされている場合
164            if ($_POST['deliv_check'] == '-1') {
165                // 会員情報の住所を受注一時テーブルに書き込む
166                $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping');
167                $sqlval['deliv_id'] = $objPurchase->getDeliv($this->cartKey);
168                $objPurchase->saveShippingTemp($sqlval);
169                $objPurchase->saveOrderTemp($uniqid, $sqlval, $objCustomer);
170                //$this->lfRegistDelivData($uniqid, $objCustomer);
171                // 正常に登録されたことを記録しておく
172                $objSiteSess->setRegistFlag();
173                // お支払い方法選択ページへ移動
174                $this->objDisplay->redirect($this->getLocation(SHOPPING_PAYMENT_URL_PATH, array(), true));
175                exit;
176            // 別のお届け先がチェックされている場合
177            } elseif($_POST['deliv_check'] >= 1) {
178                if (SC_Utils_Ex::sfIsInt($_POST['deliv_check'])) {
179                    $objQuery = new SC_Query();
180                    $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['deliv_check']));
181                    if ($deliv_count != 1) {
182                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
183                    }
184
185                    // 登録済みの別のお届け先を受注一時テーブルに書き込む
186                    $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['deliv_check']);
187                    // 正常に登録されたことを記録しておく
188                    $objSiteSess->setRegistFlag();
189                    // お支払い方法選択ページへ移動
190                    $this->objDisplay->redirect($this->getLocation(SHOPPING_PAYMENT_URL_PATH, array(), true));
191                    exit;
192                }
193            }else{
194                // エラーを返す
195                $arrErr['deli'] = '※ お届け先を選択してください。';
196            }
197            break;
198        // 前のページに戻る
199        case 'return':
200            // 確認ページへ移動
201            $this->objDisplay->redirect($this->getLocation(CART_URL_PATH, array(), true));
202            exit;
203            break;
204        // お届け先複数指定
205        case 'multiple':
206            $this->objDisplay->redirect($this->getLocation('./multiple.php', array(), true));
207            exit;
208            break;
209
210        default:
211            $objQuery = new SC_Query();
212            $where = "order_temp_id = ?";
213            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
214            if (empty($arrRet)) $arrRet = array("");
215            $this->objFormParam->setParam($arrRet[0]);
216            break;
217        }
218
219        // 登録済み住所を取得
220        $this->arrAddr = $objCustomer->getCustomerAddress($_SESSION['customer']['customer_id']);
221        // 入力値の取得
222        if (!isset($arrErr)) $arrErr = array();
223        $this->arrForm = $this->objFormParam->getFormParamList();
224        $this->arrErr = $arrErr;
225    }
226
227    /**
228     * モバイルページを初期化する.
229     *
230     * @return void
231     */
232    function mobileInit() {
233        $this->init();
234    }
235
236    /**
237     * Page のプロセス(モバイル).
238     *
239     * @return void
240     */
241    function mobileProcess() {
242        $this->mobileAction();
243        $this->sendResponse();
244    }
245
246    /**
247     * Page のプロセス(モバイル).
248     *
249     * @return void
250     */
251    function mobileAction() {
252        $objView = new SC_MobileView();
253        $objSiteSess = new SC_SiteSession();
254        $objCartSess = new SC_CartSession();
255        $objCustomer = new SC_Customer();
256        $objDb = new SC_Helper_DB_Ex();
257        // クッキー管理クラス
258        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
259        // パラメータ管理クラス
260        $this->objFormParam = new SC_FormParam();
261        // パラメータ情報の初期化
262        $this->lfInitParam();
263        // POST値の取得
264        $this->lfConvertEmail($_POST["login_email"]);
265        $this->lfConvertLoginPass($_POST["login_pass"]);
266
267        $this->objFormParam->setParam($_POST);
268
269        $this->objLoginFormParam = new SC_FormParam();  // ログインフォーム用
270        $this->lfInitLoginFormParam();                      // 初期設定
271        $this->objLoginFormParam->setParam($_POST);     // POST値の取得
272
273        // ユーザユニークIDの取得と購入状態の正当性をチェック
274        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
275        $this->tpl_uniqid = $uniqid;
276
277        //ダウンロード商品判定
278        $this->cartdown = $objDb->chkCartDown($objCartSess);
279
280        if (!isset($_POST['mode'])) $_POST['mode'] = "";
281
282        // ログインチェック
283        if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) {
284            // 不正アクセスとみなす
285            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
286        }
287
288        switch($_POST['mode']) {
289        case 'login':
290            $this->objLoginFormParam->toLower('login_email');
291            $this->arrErr = $this->objLoginFormParam->checkError();
292            $arrForm =  $this->objLoginFormParam->getHashArray();
293            // クッキー保存判定
294            if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
295                $objCookie->setCookie('login_email', $_POST['login_email']);
296            } else {
297                $objCookie->setCookie('login_email', '');
298            }
299
300            if(count($this->arrErr) == 0) {
301                // ログイン判定
302                if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) &&
303                   !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
304                    // 仮登録の判定
305                    $objQuery = new SC_Query;
306                    $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
307                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
308
309                    if($ret > 0) {
310                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
311                    } else {
312                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
313                    }
314                }
315                //ダウンロード商品判定
316                if($this->cartdown==2){
317                    // 会員情報の住所を受注一時テーブルに書き込む
318                    $objDb->sfRegistDelivData($uniqid, $objCustomer);
319                    // 正常に登録されたことを記録しておく
320                    $objSiteSess->setRegistFlag();
321                    // ダウンロード商品有りの場合は、支払方法画面に転送
322                    $this->objDisplay->redirect($this->getLocation(MOBILE_SHOPPING_PAYMENT_URL_PATH), array());
323                    exit;
324                }
325            } else {
326                // ログインページに戻る
327                $this->objDisplay->redirect($this->getLocation(MOBILE_SHOPPING_URL));
328                exit;
329            }
330
331            // ログインが成功した場合は携帯端末IDを保存する。
332            $objCustomer->updateMobilePhoneId();
333
334            /*
335             * 携帯メールアドレスが登録されていない場合は,
336             * 携帯メールアドレス登録画面へ遷移
337             */
338            $objMobile = new SC_Helper_Mobile_Ex();
339            if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
340                if (!$objCustomer->hasValue('email_mobile')) {
341                    $this->objDisplay->redirect($this->getLocation("../entry/email_mobile.php"));
342                    exit;
343                }
344            }
345            break;
346            // 削除
347        case 'delete':
348            if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) {
349                $objQuery = new SC_Query();
350                $where = "other_deliv_id = ?";
351                $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
352                $this->objFormParam->setValue('select_addr_id', '');
353            }
354            break;
355            // 会員登録住所に送る
356        case 'customer_addr':
357            // お届け先がチェックされている場合には更新処理を行う
358            if ($_POST['deli'] != "") {
359                // 会員情報の住所を受注一時テーブルに書き込む
360                $this->lfRegistDelivData($uniqid, $objCustomer);
361                // 正常に登録されたことを記録しておく
362                $objSiteSess->setRegistFlag();
363                // お支払い方法選択ページへ移動
364                $this->objDisplay->redirect($this->getLocation(MOBILE_SHOPPING_PAYMENT_URL_PATH));
365                exit;
366            }else{
367                // エラーを返す
368                $arrErr['deli'] = '※ お届け先を選択してください。';
369            }
370            break;
371
372            // 登録済みの別のお届け先に送る
373        case 'other_addr':
374            // お届け先がチェックされている場合には更新処理を行う
375            if ($_POST['deli'] != "") {
376                if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) {
377                    $objQuery = new SC_Query();
378                    $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
379                    if ($deliv_count != 1) {
380                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
381                    }
382                    // 登録済みの別のお届け先を受注一時テーブルに書き込む
383                    $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']);
384                    // 正常に登録されたことを記録しておく
385                    $objSiteSess->setRegistFlag();
386                    // お支払い方法選択ページへ移動
387                    $this->objDisplay->redirect($this->getLocation(MOBILE_SHOPPING_PAYMENT_URL_PATH));
388                    exit;
389                }
390            }else{
391                // エラーを返す
392                $arrErr['deli'] = '※ お届け先を選択してください。';
393            }
394            break;
395
396            // 前のページに戻る
397        case 'return':
398            // 確認ページへ移動
399            $this->objDisplay->redirect($this->getLocation(MOBILE_CART_URL_PATH));
400            exit;
401            break;
402        default:
403            $objQuery = new SC_Query();
404            $where = "order_temp_id = ?";
405            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
406            $this->objFormParam->setParam($arrRet[0]);
407            break;
408        }
409
410        /** 表示処理 **/
411
412        // 会員登録住所の取得
413        $col = "name01, name02, pref, addr01, addr02, zip01, zip02";
414        $where = "customer_id = ?";
415        $objQuery = new SC_Query();
416        $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
417        // 別のお届け先住所の取得
418        $col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02";
419        $objQuery->setOrder("other_deliv_id DESC");
420        $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
421        $this->arrAddr = $arrCustomerAddr;
422        $cnt = 1;
423        foreach($objOtherAddr as $val) {
424            $this->arrAddr[$cnt] = $val;
425            $cnt++;
426        }
427
428        // 入力値の取得
429        if (!isset($arrErr)) $arrErr = array();
430        $this->arrForm = $this->objFormParam->getFormParamList();
431        $this->arrErr = $arrErr;
432    }
433
434    /**
435     * デストラクタ.
436     *
437     * @return void
438     */
439    function destroy() {
440        parent::destroy();
441    }
442
443    /* パラメータ情報の初期化 */
444    function lfInitParam() {
445        $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
446        $this->objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
447        $this->objFormParam->addParam("お名前(フリガナ・姓)", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
448        $this->objFormParam->addParam("お名前(フリガナ・名)", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
449        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
450        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
451        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
452        $this->objFormParam->addParam("住所1", "deliv_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
453        $this->objFormParam->addParam("住所2", "deliv_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
454        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
455        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
456        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
457        $this->objFormParam->addParam("", "deliv_check");
458    }
459
460    function lfInitLoginFormParam() {
461        $this->objLoginFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
462        $this->objLoginFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
463        $this->objLoginFormParam->addParam("パスワード", "login_pass", PASSWORD_LEN1, "", array("EXIST_CHECK"));
464        $this->objLoginFormParam->addParam("パスワード", "login_pass1", PASSWORD_LEN1, "", array("EXIST_CHECK", "MIN_LENGTH_CHECK"));
465        $this->objLoginFormParam->addParam("パスワード", "login_pass2", PASSWORD_LEN2, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
466    }
467
468    /* DBへデータの登録 */
469    function lfRegistNewAddrData($uniqid, $objCustomer) {
470        $sqlval = $this->objFormParam->getDbArray();
471        // 登録データの作成
472        $sqlval['deliv_check'] = '1';
473        $sqlval['order_temp_id'] = $uniqid;
474        $sqlval['update_date'] = 'Now()';
475        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
476        $sqlval['order_birth'] = $objCustomer->getValue('birth');
477
478        $objDb = new SC_Helper_DB_Ex();
479        $objDb->sfRegistTempOrder($uniqid, $sqlval);
480    }
481
482    /* 会員情報の住所を一時受注テーブルへ */
483    function lfRegistDelivData($uniqid, $objCustomer) {
484        // 登録データの作成
485        $sqlval['order_temp_id'] = $uniqid;
486        $sqlval['update_date'] = 'Now()';
487        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
488        $sqlval['order_name01'] = $objCustomer->getValue('name01');
489        $sqlval['order_name02'] = $objCustomer->getValue('name02');
490        $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
491        $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
492        $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
493        $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
494        $sqlval['order_pref'] = $objCustomer->getValue('pref');
495        $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
496        $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
497        $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
498        $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
499        $sqlval['order_tel03'] = $objCustomer->getValue('tel03');
500        $sqlval['order_fax01'] = $objCustomer->getValue('fax01');
501        $sqlval['order_fax02'] = $objCustomer->getValue('fax02');
502        $sqlval['order_fax03'] = $objCustomer->getValue('fax03');
503        $sqlval['order_birth'] = $objCustomer->getValue('birth');
504        $sqlval['order_email'] = $objCustomer->getValue('email');
505        /*
506        $sqlval['deliv_check'] = '-1';
507        $sqlval['deliv_name01'] = $objCustomer->getValue('name01');
508        $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
509        $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
510        $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
511        $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
512        $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
513        $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
514        $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
515        $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
516        $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
517        $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
518        $sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
519        $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
520        $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
521        $sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
522        */
523        $objDb = new SC_Helper_DB_Ex();
524        $objDb->sfRegistTempOrder($uniqid, $sqlval);
525    }
526
527    /* 別のお届け先住所を一時受注テーブルへ */
528    function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
529        // 登録データの作成
530        $sqlval['order_temp_id'] = $uniqid;
531        $sqlval['update_date'] = 'Now()';
532        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
533
534        $sqlval['order_name01'] = $objCustomer->getValue('name01');
535        $sqlval['order_name02'] = $objCustomer->getValue('name02');
536        $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
537        $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
538        $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
539        $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
540        $sqlval['order_pref'] = $objCustomer->getValue('pref');
541        $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
542        $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
543        $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
544        $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
545        $sqlval['order_tel03'] = $objCustomer->getValue('tel03');
546        $sqlval['order_fax01'] = $objCustomer->getValue('fax01');
547        $sqlval['order_fax02'] = $objCustomer->getValue('fax02');
548        $sqlval['order_fax03'] = $objCustomer->getValue('fax03');
549        $sqlval['order_birth'] = $objCustomer->getValue('birth');
550        $sqlval['order_email'] = $objCustomer->getValue('email');
551
552
553        $objQuery = new SC_Query();
554        $where = "other_deliv_id = ?";
555        $arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
556        $_SESSION['shipping'] = $arrRet;
557        /*
558        $sqlval['deliv_check'] = $other_deliv_id;
559        $sqlval['deliv_name01'] = $arrRet[0]['name01'];
560        $sqlval['deliv_name02'] = $arrRet[0]['name02'];
561        $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
562        $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
563        $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
564        $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
565        $sqlval['deliv_pref'] = $arrRet[0]['pref'];
566        $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
567        $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
568        $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
569        $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
570        $sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
571        */
572        $objDb = new SC_Helper_DB_Ex();
573        $objDb->sfRegistTempOrder($uniqid, $sqlval);
574    }
575
576    /* 入力内容のチェック */
577    function lfCheckError() {
578        // 入力データを渡す。
579        $arrRet =  $this->objFormParam->getHashArray();
580        $objErr = new SC_CheckError($arrRet);
581        $objErr->arrErr = $this->objFormParam->checkError();
582        // 複数項目チェック
583        if ($_POST['mode'] == 'login'){
584            $objErr->doFunc(array("メールアドレス", "login_email", STEXT_LEN), array("EXIST_CHECK"));
585            $objErr->doFunc(array("パスワード", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
586        }
587        $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03"), array("TEL_CHECK"));
588        return $objErr->arrErr;
589    }
590
591    /**
592     * 入力されたEmailから余分な改行・空白を削除する
593     *
594     * @param string $_POST["login_email"]
595     */
596    function lfConvertEmail(){
597        if( strlen($_POST["login_email"]) < 1 ){ return ; }
598        $_POST["login_email"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["login_email"]);
599    }
600
601    /**
602     * 入力されたPassから余分な空白を削除し、最小桁数・最大桁数チェック用に変数に入れる
603     *
604     * @param string $_POST["login_pass"]
605     */
606    function lfConvertLoginPass(){
607    if( strlen($_POST["login_pass"]) < 1 ){ return ; }
608        $_POST["login_pass"] = trim($_POST["login_pass"]); //認証用
609        $_POST["login_pass1"] = $_POST["login_pass"];      //最小桁数比較用
610        $_POST["login_pass2"] = $_POST["login_pass"];      //最大桁数比較用
611    }
612}
613?>
Note: See TracBrowser for help on using the repository browser.