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

Revision 19832, 27.3 KB checked in by Seasoft, 13 years ago (diff)

#714(パス指定によるリダイレクトの記述を簡潔にする) 共通処理実装、個別処理の一部を実装
#869(create_date, update_date 列の定義が、表やDBによるバラツキがある)

  • NOT NULL 制約により実装漏れに気づいたので修正

#893(SC_Response#reload を使うべきであろう箇所で SC_Response#sendRedirect を利用している)
#628(未使用処理・定義などの削除)

  • 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        // クッキー管理クラス
82        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
83        // パラメータ管理クラス
84        $this->objFormParam = new SC_FormParam();
85        // パラメータ情報の初期化
86        $this->lfInitParam();
87        // POST値の取得
88        $this->objFormParam->setParam($_POST);
89
90        $this->objLoginFormParam = new SC_FormParam();  // ログインフォーム用
91        $this->lfInitLoginFormParam();
92        //パスワード・Eメールにある空白をトリム
93        $this->lfConvertEmail($_POST["login_email"]);
94        $this->lfConvertLoginPass($_POST["login_pass"]);
95        $this->objLoginFormParam->setParam($_POST);     // POST値の取得
96
97        // ユーザユニークIDの取得と購入状態の正当性をチェック
98        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
99        $this->tpl_uniqid = $uniqid;
100
101        //ダウンロード商品判定
102        $this->cartdown = $objDb->chkCartDown($objCartSess);
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->cartdown==2){
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            // 会員登録住所がチェックされている場合
163            if ($_POST['deliv_check'] == '-1') {
164                // 会員情報の住所を受注一時テーブルに書き込む
165                $this->lfRegistDelivData($uniqid, $objCustomer);
166                // 正常に登録されたことを記録しておく
167                $objSiteSess->setRegistFlag();
168                // お支払い方法選択ページへ移動
169                $this->objDisplay->redirect($this->getLocation(URL_SHOP_PAYMENT, array(), true));
170                exit;
171            // 別のお届け先がチェックされている場合
172            } elseif($_POST['deliv_check'] >= 1) {
173                if (SC_Utils_Ex::sfIsInt($_POST['deliv_check'])) {
174                    $objQuery = new SC_Query();
175                    $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['deliv_check']));
176                    if ($deliv_count != 1) {
177                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
178                    }
179
180                    // 登録済みの別のお届け先を受注一時テーブルに書き込む
181                    $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['deliv_check']);
182                    // 正常に登録されたことを記録しておく
183                    $objSiteSess->setRegistFlag();
184                    // お支払い方法選択ページへ移動
185                    $this->objDisplay->redirect($this->getLocation(URL_SHOP_PAYMENT, array(), true));
186                    exit;
187                }
188            }else{
189                // エラーを返す
190                $arrErr['deli'] = '※ お届け先を選択してください。';
191            }
192            break;
193        // 前のページに戻る
194        case 'return':
195            // 確認ページへ移動
196            $this->objDisplay->redirect($this->getLocation(URL_CART_TOP, array(), true));
197            exit;
198            break;
199        default:
200            $objQuery = new SC_Query();
201            $where = "order_temp_id = ?";
202            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
203            if (empty($arrRet)) $arrRet = array("");
204            $this->objFormParam->setParam($arrRet[0]);
205            break;
206        }
207
208        /** 表示処理 **/
209
210        // 会員登録住所の取得
211        $col = "name01, name02, pref, addr01, addr02";
212        $where = "customer_id = ?";
213        $objQuery = new SC_Query();
214        $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
215        // 別のお届け先住所の取得
216        $col = "other_deliv_id, name01, name02, pref, addr01, addr02";
217        $objQuery->setOrder("other_deliv_id DESC");
218        $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
219        $this->arrAddr = $arrCustomerAddr;
220        $this->tpl_addrmax = count($objOtherAddr);
221        $cnt = 1;
222        foreach($objOtherAddr as $val) {
223            $this->arrAddr[$cnt] = $val;
224            $cnt++;
225        }
226
227        // 入力値の取得
228        if (!isset($arrErr)) $arrErr = array();
229        $this->arrForm = $this->objFormParam->getFormParamList();
230        $this->arrErr = $arrErr;
231    }
232
233    /**
234     * モバイルページを初期化する.
235     *
236     * @return void
237     */
238    function mobileInit() {
239        $this->init();
240    }
241
242    /**
243     * Page のプロセス(モバイル).
244     *
245     * @return void
246     */
247    function mobileProcess() {
248        $this->mobileAction();
249        $this->sendResponse();
250    }
251
252    /**
253     * Page のプロセス(モバイル).
254     *
255     * @return void
256     */
257    function mobileAction() {
258        $objView = new SC_MobileView();
259        $objSiteSess = new SC_SiteSession();
260        $objCartSess = new SC_CartSession();
261        $objCustomer = new SC_Customer();
262        $objDb = new SC_Helper_DB_Ex();
263        // クッキー管理クラス
264        $objCookie = new SC_Cookie(COOKIE_EXPIRE);
265        // パラメータ管理クラス
266        $this->objFormParam = new SC_FormParam();
267        // パラメータ情報の初期化
268        $this->lfInitParam();
269        // POST値の取得
270        $this->lfConvertEmail($_POST["login_email"]);
271        $this->lfConvertLoginPass($_POST["login_pass"]);
272
273        $this->objFormParam->setParam($_POST);
274
275        $this->objLoginFormParam = new SC_FormParam();  // ログインフォーム用
276        $this->lfInitLoginFormParam();                      // 初期設定
277        $this->objLoginFormParam->setParam($_POST);     // POST値の取得
278
279        // ユーザユニークIDの取得と購入状態の正当性をチェック
280        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
281        $this->tpl_uniqid = $uniqid;
282
283        //ダウンロード商品判定
284        $this->cartdown = $objDb->chkCartDown($objCartSess);
285
286        if (!isset($_POST['mode'])) $_POST['mode'] = "";
287
288        // ログインチェック
289        if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) {
290            // 不正アクセスとみなす
291            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
292        }
293
294        switch($_POST['mode']) {
295        case 'login':
296            $this->objLoginFormParam->toLower('login_email');
297            $this->arrErr = $this->objLoginFormParam->checkError();
298            $arrForm =  $this->objLoginFormParam->getHashArray();
299            // クッキー保存判定
300            if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
301                $objCookie->setCookie('login_email', $_POST['login_email']);
302            } else {
303                $objCookie->setCookie('login_email', '');
304            }
305
306            if(count($this->arrErr) == 0) {
307                // ログイン判定
308                if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) &&
309                   !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
310                    // 仮登録の判定
311                    $objQuery = new SC_Query;
312                    $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0";
313                    $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email']));
314
315                    if($ret > 0) {
316                        SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
317                    } else {
318                        SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
319                    }
320                }
321                //ダウンロード商品判定
322                if($this->cartdown==2){
323                    // 会員情報の住所を受注一時テーブルに書き込む
324                    $objDb->sfRegistDelivData($uniqid, $objCustomer);
325                    // 正常に登録されたことを記録しておく
326                    $objSiteSess->setRegistFlag();
327                    // ダウンロード商品有りの場合は、支払方法画面に転送
328                    $this->objDisplay->redirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), array());
329                    exit;
330                }
331            } else {
332                // ログインページに戻る
333                $this->objDisplay->redirect($this->getLocation(MOBILE_URL_SHOP_TOP));
334                exit;
335            }
336
337            // ログインが成功した場合は携帯端末IDを保存する。
338            $objCustomer->updateMobilePhoneId();
339
340            /*
341             * 携帯メールアドレスが登録されていない場合は,
342             * 携帯メールアドレス登録画面へ遷移
343             */
344            $objMobile = new SC_Helper_Mobile_Ex();
345            if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) {
346                if (!$objCustomer->hasValue('email_mobile')) {
347                    $this->objDisplay->redirect($this->getLocation("../entry/email_mobile.php"));
348                    exit;
349                }
350            }
351            break;
352            // 削除
353        case 'delete':
354            if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) {
355                $objQuery = new SC_Query();
356                $where = "other_deliv_id = ?";
357                $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
358                $this->objFormParam->setValue('select_addr_id', '');
359            }
360            break;
361            // 会員登録住所に送る
362        case 'customer_addr':
363            // お届け先がチェックされている場合には更新処理を行う
364            if ($_POST['deli'] != "") {
365                // 会員情報の住所を受注一時テーブルに書き込む
366                $this->lfRegistDelivData($uniqid, $objCustomer);
367                // 正常に登録されたことを記録しておく
368                $objSiteSess->setRegistFlag();
369                // お支払い方法選択ページへ移動
370                $this->objDisplay->redirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT));
371                exit;
372            }else{
373                // エラーを返す
374                $arrErr['deli'] = '※ お届け先を選択してください。';
375            }
376            break;
377
378            // 登録済みの別のお届け先に送る
379        case 'other_addr':
380            // お届け先がチェックされている場合には更新処理を行う
381            if ($_POST['deli'] != "") {
382                if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) {
383                    $objQuery = new SC_Query();
384                    $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
385                    if ($deliv_count != 1) {
386                        SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
387                    }
388                    // 登録済みの別のお届け先を受注一時テーブルに書き込む
389                    $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']);
390                    // 正常に登録されたことを記録しておく
391                    $objSiteSess->setRegistFlag();
392                    // お支払い方法選択ページへ移動
393                    $this->objDisplay->redirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT));
394                    exit;
395                }
396            }else{
397                // エラーを返す
398                $arrErr['deli'] = '※ お届け先を選択してください。';
399            }
400            break;
401
402            // 前のページに戻る
403        case 'return':
404            // 確認ページへ移動
405            $this->objDisplay->redirect($this->getLocation(MOBILE_URL_CART_TOP));
406            exit;
407            break;
408        default:
409            $objQuery = new SC_Query();
410            $where = "order_temp_id = ?";
411            $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
412            $this->objFormParam->setParam($arrRet[0]);
413            break;
414        }
415
416        /** 表示処理 **/
417
418        // 会員登録住所の取得
419        $col = "name01, name02, pref, addr01, addr02, zip01, zip02";
420        $where = "customer_id = ?";
421        $objQuery = new SC_Query();
422        $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
423        // 別のお届け先住所の取得
424        $col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02";
425        $objQuery->setOrder("other_deliv_id DESC");
426        $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
427        $this->arrAddr = $arrCustomerAddr;
428        $cnt = 1;
429        foreach($objOtherAddr as $val) {
430            $this->arrAddr[$cnt] = $val;
431            $cnt++;
432        }
433
434        // 入力値の取得
435        if (!isset($arrErr)) $arrErr = array();
436        $this->arrForm = $this->objFormParam->getFormParamList();
437        $this->arrErr = $arrErr;
438    }
439
440    /**
441     * デストラクタ.
442     *
443     * @return void
444     */
445    function destroy() {
446        parent::destroy();
447    }
448
449    /* パラメータ情報の初期化 */
450    function lfInitParam() {
451        $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
452        $this->objFormParam->addParam("お名前2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
453        $this->objFormParam->addParam("お名前(フリガナ・姓)", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
454        $this->objFormParam->addParam("お名前(フリガナ・名)", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
455        $this->objFormParam->addParam("郵便番号1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
456        $this->objFormParam->addParam("郵便番号2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
457        $this->objFormParam->addParam("都道府県", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
458        $this->objFormParam->addParam("住所1", "deliv_addr01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
459        $this->objFormParam->addParam("住所2", "deliv_addr02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
460        $this->objFormParam->addParam("電話番号1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
461        $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
462        $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
463        $this->objFormParam->addParam("", "deliv_check");
464    }
465
466    function lfInitLoginFormParam() {
467        $this->objLoginFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
468        $this->objLoginFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
469        $this->objLoginFormParam->addParam("パスワード", "login_pass", PASSWORD_LEN1, "", array("EXIST_CHECK"));
470        $this->objLoginFormParam->addParam("パスワード", "login_pass1", PASSWORD_LEN1, "", array("EXIST_CHECK", "MIN_LENGTH_CHECK"));
471        $this->objLoginFormParam->addParam("パスワード", "login_pass2", PASSWORD_LEN2, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
472    }
473
474    /* DBへデータの登録 */
475    function lfRegistNewAddrData($uniqid, $objCustomer) {
476        $sqlval = $this->objFormParam->getDbArray();
477        // 登録データの作成
478        $sqlval['deliv_check'] = '1';
479        $sqlval['order_temp_id'] = $uniqid;
480        $sqlval['update_date'] = 'Now()';
481        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
482        $sqlval['order_birth'] = $objCustomer->getValue('birth');
483
484        $objDb = new SC_Helper_DB_Ex();
485        $objDb->sfRegistTempOrder($uniqid, $sqlval);
486    }
487
488    /* 会員情報の住所を一時受注テーブルへ */
489    function lfRegistDelivData($uniqid, $objCustomer) {
490        // 登録データの作成
491        $sqlval['order_temp_id'] = $uniqid;
492        $sqlval['update_date'] = 'Now()';
493        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
494        $sqlval['order_name01'] = $objCustomer->getValue('name01');
495        $sqlval['order_name02'] = $objCustomer->getValue('name02');
496        $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
497        $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
498        $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
499        $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
500        $sqlval['order_pref'] = $objCustomer->getValue('pref');
501        $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
502        $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
503        $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
504        $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
505        $sqlval['order_tel03'] = $objCustomer->getValue('tel03');
506        $sqlval['order_fax01'] = $objCustomer->getValue('fax01');
507        $sqlval['order_fax02'] = $objCustomer->getValue('fax02');
508        $sqlval['order_fax03'] = $objCustomer->getValue('fax03');
509        $sqlval['order_birth'] = $objCustomer->getValue('birth');
510        $sqlval['order_email'] = $objCustomer->getValue('email');
511
512        $sqlval['deliv_check'] = '-1';
513        $sqlval['deliv_name01'] = $objCustomer->getValue('name01');
514        $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
515        $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
516        $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
517        $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
518        $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
519        $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
520        $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
521        $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
522        $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
523        $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
524        $sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
525        $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
526        $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
527        $sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
528
529        $objDb = new SC_Helper_DB_Ex();
530        $objDb->sfRegistTempOrder($uniqid, $sqlval);
531    }
532
533    /* 別のお届け先住所を一時受注テーブルへ */
534    function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
535        // 登録データの作成
536        $sqlval['order_temp_id'] = $uniqid;
537        $sqlval['update_date'] = 'Now()';
538        $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
539
540        $sqlval['order_name01'] = $objCustomer->getValue('name01');
541        $sqlval['order_name02'] = $objCustomer->getValue('name02');
542        $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
543        $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
544        $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
545        $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
546        $sqlval['order_pref'] = $objCustomer->getValue('pref');
547        $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
548        $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
549        $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
550        $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
551        $sqlval['order_tel03'] = $objCustomer->getValue('tel03');
552        $sqlval['order_fax01'] = $objCustomer->getValue('fax01');
553        $sqlval['order_fax02'] = $objCustomer->getValue('fax02');
554        $sqlval['order_fax03'] = $objCustomer->getValue('fax03');
555        $sqlval['order_birth'] = $objCustomer->getValue('birth');
556        $sqlval['order_email'] = $objCustomer->getValue('email');
557
558        $objQuery = new SC_Query();
559        $where = "other_deliv_id = ?";
560        $arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
561
562        $sqlval['deliv_check'] = $other_deliv_id;
563        $sqlval['deliv_name01'] = $arrRet[0]['name01'];
564        $sqlval['deliv_name02'] = $arrRet[0]['name02'];
565        $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
566        $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
567        $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
568        $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
569        $sqlval['deliv_pref'] = $arrRet[0]['pref'];
570        $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
571        $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
572        $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
573        $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
574        $sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
575
576        $objDb = new SC_Helper_DB_Ex();
577        $objDb->sfRegistTempOrder($uniqid, $sqlval);
578    }
579
580    /* 入力内容のチェック */
581    function lfCheckError() {
582        // 入力データを渡す。
583        $arrRet =  $this->objFormParam->getHashArray();
584        $objErr = new SC_CheckError($arrRet);
585        $objErr->arrErr = $this->objFormParam->checkError();
586        // 複数項目チェック
587        if ($_POST['mode'] == 'login'){
588            $objErr->doFunc(array("メールアドレス", "login_email", STEXT_LEN), array("EXIST_CHECK"));
589            $objErr->doFunc(array("パスワード", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
590        }
591        $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03"), array("TEL_CHECK"));
592        return $objErr->arrErr;
593    }
594
595    /**
596     * 入力されたEmailから余分な改行・空白を削除する
597     *
598     * @param string $_POST["login_email"]
599     */
600    function lfConvertEmail(){
601        if( strlen($_POST["login_email"]) < 1 ){ return ; }
602        $_POST["login_email"] = preg_replace('/^[  \r\n]*(.*?)[  \r\n]*$/u', '$1', $_POST["login_email"]);
603    }
604
605    /**
606     * 入力されたPassから余分な空白を削除し、最小桁数・最大桁数チェック用に変数に入れる
607     *
608     * @param string $_POST["login_pass"]
609     */
610    function lfConvertLoginPass(){
611    if( strlen($_POST["login_pass"]) < 1 ){ return ; }
612        $_POST["login_pass"] = trim($_POST["login_pass"]); //認証用
613        $_POST["login_pass1"] = $_POST["login_pass"];      //最小桁数比較用
614        $_POST["login_pass2"] = $_POST["login_pass"];      //最大桁数比較用
615    }
616}
617?>
Note: See TracBrowser for help on using the repository browser.