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

Revision 19782, 27.5 KB checked in by nanasess, 13 years ago (diff)

#748(モバイル/スマートフォンのデザイン管理)

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