source: branches/version-2_12-multilang/data/class/pages/shopping/LC_Page_Shopping.php @ 22100

Revision 22100, 24.2 KB checked in by pineray, 11 years ago (diff)

#163 (テキスト出力多言語対応)

グローバル化に伴い、不要となった SC_I18n を削除.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2012 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_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
26
27/**
28 * ショッピングログインのページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Shopping extends LC_Page_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_title = t('LC_Page_Shopping_001');
47        $masterData = new SC_DB_MasterData_Ex();
48        $this->arrPref = $masterData->getMasterData('mtb_pref');
49        $this->arrSex = $masterData->getMasterData('mtb_sex');
50        $this->arrJob = $masterData->getMasterData('mtb_job');
51        $this->tpl_onload = 'fnCheckInputDeliv();';
52
53        $objDate = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now')));
54        $this->arrYear = $objDate->getYear('', START_BIRTH_YEAR, '');
55        $this->arrMonth = $objDate->getMonth(true);
56        $this->arrDay = $objDate->getDay(true);
57
58        $this->httpCacheControl('nocache');
59    }
60
61    /**
62     * Page のプロセス.
63     *
64     * @return void
65     */
66    function process() {
67        parent::process();
68        $this->action();
69        $this->sendResponse();
70    }
71
72    /**
73     * Page のプロセス.
74     *
75     * @return void
76     */
77    function action() {
78
79        $objSiteSess = new SC_SiteSession_Ex();
80        $objCartSess = new SC_CartSession_Ex();
81        $objCustomer = new SC_Customer_Ex();
82        $objCookie = new SC_Cookie_Ex();
83        $objPurchase = new SC_Helper_Purchase_Ex();
84        $objFormParam = new SC_FormParam_Ex();
85
86        $nonmember_mainpage = 'shopping/nonmember_input.tpl';
87        $nonmember_title = t('LC_Page_Shopping_002');
88
89        $this->tpl_uniqid = $objSiteSess->getUniqId();
90        $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
91
92        $this->cartKey = $objCartSess->getKey();
93
94        // ログイン済みの場合は次画面に遷移
95        if ($objCustomer->isLoginSuccess(true)) {
96
97            SC_Response_Ex::sendRedirect(
98                    $this->getNextlocation($this->cartKey, $this->tpl_uniqid,
99                                           $objCustomer, $objPurchase,
100                                           $objSiteSess));
101            SC_Response_Ex::actionExit();
102        }
103        // 非会員かつ, ダウンロード商品の場合はエラー表示
104        else {
105            if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) {
106                $msg = t('LC_Page_Shopping_003');
107                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, $objSiteSess, false, $msg);
108                SC_Response_Ex::actionExit();
109            }
110        }
111
112        switch ($this->getMode()) {
113            // ログイン実行
114            case 'login':
115                $this->lfInitLoginFormParam($objFormParam);
116                $objFormParam->setParam($_POST);
117                $objFormParam->trimParam();
118                $objFormParam->convParam();
119                $objFormParam->toLower('login_email');
120                $this->arrErr = $objFormParam->checkError();
121
122                // ログイン判定
123                if (SC_Utils_Ex::isBlank($this->arrErr)
124                    && $objCustomer->doLogin($objFormParam->getValue('login_email'),
125                                             $objFormParam->getValue('login_pass'))) {
126
127                    // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移
128                    if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
129                        if (!$objCustomer->hasValue('email_mobile')) {
130
131                            SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php');
132                            SC_Response_Ex::actionExit();
133                        }
134                    }
135                    // スマートフォンの場合はログイン成功を返す
136                    elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
137
138                        echo SC_Utils_Ex::jsonEncode(array('success' =>
139                                                     $this->getNextLocation($this->cartKey, $this->tpl_uniqid,
140                                                                            $objCustomer, $objPurchase,
141                                                                            $objSiteSess)));
142                        SC_Response_Ex::actionExit();
143                    }
144
145                    SC_Response_Ex::sendRedirect(
146                            $this->getNextLocation($this->cartKey, $this->tpl_uniqid,
147                                                   $objCustomer, $objPurchase,
148                                                   $objSiteSess));
149                    SC_Response_Ex::actionExit();
150                }
151                // ログインに失敗した場合
152                else {
153                    // 仮登録の場合
154                    if (SC_Helper_Customer_Ex::checkTempCustomer($objFormParam->getValue('login_email'))) {
155                        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
156                            echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR);
157                            SC_Response_Ex::actionExit();
158                        } else {
159                            SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
160                            SC_Response_Ex::actionExit();
161                        }
162                    } else {
163                        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) {
164                            echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR);
165                            SC_Response_Ex::actionExit();
166                        } else {
167                            SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
168                            SC_Response_Ex::actionExit();
169                        }
170                    }
171                }
172                break;
173
174            // お客様情報登録
175            case 'nonmember_confirm':
176                $this->tpl_mainpage = $nonmember_mainpage;
177                $this->tpl_title = $nonmember_title;
178                $this->lfInitParam($objFormParam);
179                $objFormParam->setParam($_POST);
180                $this->arrErr = $this->lfCheckError($objFormParam);
181
182                if (SC_Utils_Ex::isBlank($this->arrErr)) {
183                    $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam);
184
185                    $arrParams = $objFormParam->getHashArray();
186                    $shipping_id = $arrParams['deliv_check'] == '1' ? 1 : 0;
187                    $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id);
188
189                    $objSiteSess->setRegistFlag();
190
191
192                    SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
193                    SC_Response_Ex::actionExit();
194                }
195                break;
196
197            // 前のページに戻る
198            case 'return':
199
200                SC_Response_Ex::sendRedirect(CART_URLPATH);
201                SC_Response_Ex::actionExit();
202                break;
203
204            // 複数配送ページへ遷移
205            case 'multiple':
206                // 複数配送先指定が無効な場合はエラー
207                if (USE_MULTIPLE_SHIPPING === false) {
208                    SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true);
209                    SC_Response_Ex::actionExit();
210                }
211
212                $this->lfInitParam($objFormParam);
213                $objFormParam->setParam($_POST);
214                $this->arrErr = $this->lfCheckError($objFormParam);
215
216                if (SC_Utils_Ex::isBlank($this->arrErr)) {
217                    $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam, true);
218
219                    $objSiteSess->setRegistFlag();
220
221
222                    SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH);
223                    SC_Response_Ex::actionExit();
224                }
225                $this->tpl_mainpage = $nonmember_mainpage;
226                $this->tpl_title = $nonmember_title;
227                break;
228
229            // お客様情報入力ページの表示
230            case 'nonmember':
231                $this->tpl_mainpage = $nonmember_mainpage;
232                $this->tpl_title = $nonmember_title;
233                $this->lfInitParam($objFormParam);
234                // ※breakなし
235
236            default:
237                // 前のページから戻ってきた場合は, お客様情報入力ページ
238                if (isset($_GET['from']) && $_GET['from'] == 'nonmember') {
239                    $this->tpl_mainpage = $nonmember_mainpage;
240                    $this->tpl_title = $nonmember_title;
241                    $this->lfInitParam($objFormParam);
242                }
243                // 通常はログインページ
244                else {
245                    $this->lfInitLoginFormParam($objFormParam);
246                }
247
248                $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid);
249                break;
250        }
251
252        // 記憶したメールアドレスを取得
253        $this->tpl_login_email = $objCookie->getCookie('login_email');
254        if (!SC_Utils_Ex::isBlank($this->tpl_login_email)) {
255            $this->tpl_login_memory = '1';
256        }
257
258        // 入力値の取得
259        $this->arrForm = $objFormParam->getFormParamList();
260
261        // 携帯端末IDが一致する会員が存在するかどうかをチェックする。
262        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
263            $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
264        }
265
266    }
267
268    /**
269     * デストラクタ.
270     *
271     * @return void
272     */
273    function destroy() {
274        parent::destroy();
275    }
276
277    /**
278     * お客様情報入力時のパラメーター情報の初期化を行う.
279     *
280     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
281     * @return void
282     */
283    function lfInitParam(&$objFormParam) {
284
285        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_LASTNAME'), 'order_name01', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
286        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_FIRSTNAME'), 'order_name02', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
287        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_LASTKANA'), 'order_kana01', STEXT_LEN, 'KVCa', array('EXIST_CHECK', 'KANA_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
288        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_FIRSTKANA'), 'order_kana02', STEXT_LEN, 'KVCa', array('EXIST_CHECK', 'KANA_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
289        $objFormParam->addParam(t('PARAM_LABEL_ZIP01'), 'order_zip01', ZIP01_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'NUM_COUNT_CHECK'));
290        $objFormParam->addParam(t('PARAM_LABEL_ZIP02'), 'order_zip02', ZIP02_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'NUM_COUNT_CHECK'));
291        $objFormParam->addParam(t('PARAM_LABEL_PREF'), 'order_pref', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
292        $objFormParam->addParam(t('PARAM_LABEL_ADDR1'), 'order_addr01', MTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
293        $objFormParam->addParam(t('PARAM_LABEL_ADDR2'), 'order_addr02', MTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
294        $objFormParam->addParam(t('PARAM_LABEL_TEL1'), 'order_tel01', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK'));
295        $objFormParam->addParam(t('PARAM_LABEL_TEL2'), 'order_tel02', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK'));
296        $objFormParam->addParam(t('PARAM_LABEL_TEL3'), 'order_tel03', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK'));
297        $objFormParam->addParam(t('PARAM_LABEL_FAX1'), 'order_fax01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
298        $objFormParam->addParam(t('PARAM_LABEL_FAX2'), 'order_fax02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
299        $objFormParam->addParam(t('PARAM_LABEL_FAX3'), 'order_fax03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
300        $objFormParam->addParam(t('PARAM_LABEL_EMAIL'), 'order_email', null, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'NO_SPTAB', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK'));
301        $objFormParam->addParam(t('PARAM_LABEL_EMAIL_CONFIRM'), 'order_email02', null, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'NO_SPTAB', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK'), '', false);
302        $objFormParam->addParam(t('PARAM_LABEL_YEAR'), 'year', INT_LEN, 'n', array('MAX_LENGTH_CHECK'), '', false);
303        $objFormParam->addParam(t('PARAM_LABEL_MONTH'), 'month', INT_LEN, 'n', array('MAX_LENGTH_CHECK'), '', false);
304        $objFormParam->addParam(t('PARAM_LABEL_DAY'), 'day', INT_LEN, 'n', array('MAX_LENGTH_CHECK'), '', false);
305        $objFormParam->addParam(t('PARAM_LABEL_SEX'), 'order_sex', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
306        $objFormParam->addParam(t('PARAM_LABEL_JOB'), 'order_job', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
307        $objFormParam->addParam(t('PARAM_LABEL_OTHER_DELIV'), 'deliv_check', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
308        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_LASTNAME'), 'shipping_name01', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
309        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_FIRSTNAME'), 'shipping_name02', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
310        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_LASTKANA'), 'shipping_kana01', STEXT_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
311        $objFormParam->addParam(t('PARAM_LABEL_CUSTOMER_FIRSTKANA'), 'shipping_kana02', STEXT_LEN, 'KVCa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
312        $objFormParam->addParam(t('PARAM_LABEL_ZIP01'), 'shipping_zip01', ZIP01_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
313        $objFormParam->addParam(t('PARAM_LABEL_ZIP02'), 'shipping_zip02', ZIP02_LEN, 'n', array('NUM_CHECK', 'NUM_COUNT_CHECK'));
314        $objFormParam->addParam(t('PARAM_LABEL_PREF'), 'shipping_pref', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
315        $objFormParam->addParam(t('PARAM_LABEL_ADDR1'), 'shipping_addr01', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
316        $objFormParam->addParam(t('PARAM_LABEL_ADDR2'), 'shipping_addr02', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
317        $objFormParam->addParam(t('PARAM_LABEL_TEL1'), 'shipping_tel01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
318        $objFormParam->addParam(t('PARAM_LABEL_TEL2'), 'shipping_tel02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
319        $objFormParam->addParam(t('PARAM_LABEL_TEL3'), 'shipping_tel03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK'));
320        $objFormParam->addParam(t('PARAM_LABEL_MAILMAGAZINE'), 'mail_flag', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'), 1);
321    }
322
323    /**
324     * ログイン時のパラメーター情報の初期化を行う.
325     *
326     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
327     * @return void
328     */
329    function lfInitLoginFormParam(&$objFormParam) {
330        $objFormParam->addParam(t('PARAM_LABEL_MEMORY'), 'login_memory', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK'));
331        $objFormParam->addParam(t('PARAM_LABEL_EMAIL'), 'login_email', STEXT_LEN, 'a', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
332        $objFormParam->addParam(t('PARAM_LABEL_PASSWORD'), 'login_pass', PASSWORD_MAX_LEN, '', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
333    }
334
335    /**
336     * ログイン済みの場合の遷移先を取得する.
337     *
338     * 商品種別IDが, ダウンロード商品の場合は, 会員情報を受注一時情報に保存し,
339     * 支払方法選択画面のパスを返す.
340     * それ以外は, お届け先選択画面のパスを返す.
341     *
342     * @param integer $product_type_id 商品種別ID
343     * @param string $uniqid 受注一時テーブルのユニークID
344     * @param SC_Customer $objCustomer SC_Customer インスタンス
345     * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
346     * @param SC_SiteSession $objSiteSess SC_SiteSession インスタンス
347     * @return string 遷移先のパス
348     */
349    function getNextLocation($product_type_id, $uniqid, &$objCustomer, &$objPurchase, &$objSiteSess) {
350        switch ($product_type_id) {
351            case PRODUCT_TYPE_DOWNLOAD:
352                $objPurchase->saveOrderTemp($uniqid, array(), $objCustomer);
353                $objSiteSess->setRegistFlag();
354                return 'payment.php';
355
356            case PRODUCT_TYPE_NORMAL:
357            default:
358                return 'deliv.php';
359        }
360    }
361
362    /**
363     * データの一時登録を行う.
364     *
365     * 非会員向けの処理
366     * @param integer $uniqid 受注一時テーブルのユニークID
367     * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
368     * @param SC_Customer $objCustomer SC_Customer インスタンス
369     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
370     * @param boolean $isMultiple 複数配送の場合 true
371     */
372    function lfRegistData($uniqid, &$objPurchase, &$objCustomer, &$objFormParam, $isMultiple = false) {
373        $arrParams = $objFormParam->getHashArray();
374
375        // 注文者をお届け先とする配列を取得
376        $arrShippingOwn = array();
377        $objPurchase->copyFromOrder($arrShippingOwn, $arrParams);
378
379        // 都度入力されたお届け先
380        $arrShipping = $objPurchase->extractShipping($arrParams);
381
382        if ($isMultiple) {
383            $objPurchase->unsetOneShippingTemp(0);
384            $objPurchase->unsetOneShippingTemp(1);
385            $objPurchase->saveShippingTemp($arrShippingOwn, 0);
386            if ($arrParams['deliv_check'] == '1') {
387                $objPurchase->saveShippingTemp($arrShipping, 1);
388            }
389        } else {
390            $objPurchase->unsetAllShippingTemp(true);
391            if ($arrParams['deliv_check'] == '1') {
392                $objPurchase->saveShippingTemp($arrShipping, 1);
393            } else {
394                $objPurchase->saveShippingTemp($arrShippingOwn, 0);
395            }
396        }
397
398        $arrValues = $objFormParam->getDbArray();
399
400        // 登録データの作成
401        $arrValues['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrParams['year'], $arrParams['month'], $arrParams['day']);
402        $arrValues['update_date'] = 'CURRENT_TIMESTAMP';
403        $arrValues['customer_id'] = '0';
404        $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
405    }
406
407    /**
408     * 入力内容のチェックを行う.
409     *
410     * 追加の必須チェック, 相関チェックを行うため, SC_CheckError を使用する.
411     *
412     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
413     * @return array エラー情報の配
414     */
415    function lfCheckError(&$objFormParam) {
416        // 入力値の変換
417        $objFormParam->convParam();
418        $objFormParam->toLower('order_mail');
419        $objFormParam->toLower('order_mail_check');
420
421        $arrParams = $objFormParam->getHashArray();
422        $objErr = new SC_CheckError_Ex($arrParams);
423        $objErr->arrErr = $objFormParam->checkError();
424
425        // 別のお届け先チェック
426        if (isset($arrParams['deliv_check']) && $arrParams['deliv_check'] == '1') {
427            $objErr->doFunc(array(t('PARAM_LABEL_CUSTOMER_LASTNAME'), 'shipping_name01'), array('EXIST_CHECK'));
428            $objErr->doFunc(array(t('PARAM_LABEL_CUSTOMER_FIRSTNAME'), 'shipping_name02'), array('EXIST_CHECK'));
429            $objErr->doFunc(array(t('PARAM_LABEL_CUSTOMER_LASTKANA'), 'shipping_kana01'), array('EXIST_CHECK'));
430            $objErr->doFunc(array(t('PARAM_LABEL_CUSTOMER_FIRSTKANA'), 'shipping_kana02'), array('EXIST_CHECK'));
431            $objErr->doFunc(array(t('PARAM_LABEL_ZIP01'), 'shipping_zip01'), array('EXIST_CHECK'));
432            $objErr->doFunc(array(t('PARAM_LABEL_ZIP02'), 'shipping_zip02'), array('EXIST_CHECK'));
433            $objErr->doFunc(array(t('PARAM_LABEL_PREF'), 'shipping_pref'), array('EXIST_CHECK'));
434            $objErr->doFunc(array(t('PARAM_LABEL_ADDR1'), 'shipping_addr01'), array('EXIST_CHECK'));
435            $objErr->doFunc(array(t('PARAM_LABEL_ADDR2'), 'shipping_addr02'), array('EXIST_CHECK'));
436            $objErr->doFunc(array(t('PARAM_LABEL_TEL1'), 'shipping_tel01'), array('EXIST_CHECK'));
437            $objErr->doFunc(array(t('PARAM_LABEL_TEL2'), 'shipping_tel02'), array('EXIST_CHECK'));
438            $objErr->doFunc(array(t('PARAM_LABEL_TEL3'), 'shipping_tel03'), array('EXIST_CHECK'));
439        }
440
441        // 複数項目チェック
442        $objErr->doFunc(array(t('PARAM_LABEL_TEL'), 'order_tel01', 'order_tel02', 'order_tel03'), array('TEL_CHECK'));
443        $objErr->doFunc(array(t('PARAM_LABEL_FAX'), 'order_fax01', 'order_fax02', 'order_fax03'), array('TEL_CHECK'));
444        $objErr->doFunc(array(t('PARAM_LABEL_ZIP'), 'order_zip01', 'order_zip02'), array('ALL_EXIST_CHECK'));
445        $objErr->doFunc(array(t('PARAM_LABEL_TEL'), 'shipping_tel01', 'shipping_tel02', 'shipping_tel03'), array('TEL_CHECK'));
446        $objErr->doFunc(array(t('PARAM_LABEL_ZIP'), 'shipping_zip01', 'shipping_zip02'), array('ALL_EXIST_CHECK'));
447        $objErr->doFunc(array(t('PARAM_LABEL_BIRTHDAY'), 'year', 'month', 'day'), array('CHECK_BIRTHDAY'));
448        $objErr->doFunc(array(t('PARAM_LABEL_EMAIL'), t('PARAM_LABEL_EMAIL_CONFIRM'), 'order_email', 'order_email02'), array('EQUAL_CHECK'));
449
450        return $objErr->arrErr;
451    }
452
453    /**
454     * 入力済みの購入情報をフォームに設定する.
455     *
456     * 受注一時テーブル, セッションの配送情報から入力済みの購入情報を取得し,
457     * フォームに設定する.
458     *
459     * @param SC_FormParam $objFormParam SC_FormParam インスタンス
460     * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
461     * @param integer $uniqid 購入一時情報のユニークID
462     * @return void
463     */
464    function setFormParams(&$objFormParam, &$objPurchase, $uniqid) {
465        $arrOrderTemp = $objPurchase->getOrderTemp($uniqid);
466        if (SC_Utils_Ex::isBlank($arrOrderTemp)) {
467            $arrOrderTemp = array(
468                'order_email' => '',
469                'order_birth' => '',
470            );
471        }
472        $arrShippingTemp = $objPurchase->getShippingTemp();
473
474        $objFormParam->setParam($arrOrderTemp);
475        /*
476         * count($arrShippingTemp) > 1 は複数配送であり,
477         * $arrShippingTemp[0] は注文者が格納されている
478         */
479        if (count($arrShippingTemp) > 1) {
480            $objFormParam->setParam($arrShippingTemp[1]);
481        } else {
482            $objFormParam->setParam($arrShippingTemp[0]);
483        }
484        $objFormParam->setValue('order_email02', $arrOrderTemp['order_email']);
485        $objFormParam->setDBDate($arrOrderTemp['order_birth']);
486    }
487
488    /**
489     * エラーメッセージを JSON 形式で返す.
490     *
491     * TODO リファクタリング
492     * この関数は主にスマートフォンで使用します.
493     *
494     * @param integer エラーコード
495     * @return string JSON 形式のエラーメッセージ
496     * @see LC_PageError
497     */
498    function lfGetErrorMessage($error) {
499        switch ($error) {
500            case TEMP_LOGIN_ERROR:
501                $msg = t('LC_Page_Shopping_004');
502                break;
503            case SITE_LOGIN_ERROR:
504            default:
505                $msg = t('LC_Page_Shopping_005');
506        }
507        return SC_Utils_Ex::jsonEncode(array('login_error' => $msg));
508    }
509}
Note: See TracBrowser for help on using the repository browser.