source: branches/version-2_13-dev/data/class/pages/mypage/LC_Page_Mypage_Change.php @ 23026

Revision 23026, 7.4 KB checked in by AMUAMU, 11 years ago (diff)

#2323 (税率対応)
#2235 (越境ECを想定した機能の追加)
#2234 (非会員お客様情報入力テンプレートと機能の共通化)
#2324 (会員登録、注文フォームに「会社名」フィールドを足す)
#2233 (購入手続きのログイン画面でログイン出来ないユーザーがいる)
などの修正

  • 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
RevLine 
[16070]1<?php
2/*
[16582]3 * This file is part of EC-CUBE
4 *
[22206]5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
[16070]6 *
7 * http://www.lockon.co.jp/
[16582]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.
[16070]22 */
23
[20534]24require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
[16070]25
26/**
27 * 登録内容変更 のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
[22856]33class LC_Page_Mypage_Change extends LC_Page_AbstractMypage_Ex
[22567]34{
[16070]35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
[22567]40    function init()
41    {
[16070]42        parent::init();
[17519]43        $this->tpl_subtitle = '会員登録内容変更(入力ページ)';
[16070]44        $this->tpl_mypageno = 'change';
45
[20147]46        $masterData         = new SC_DB_MasterData_Ex();
[21481]47        $this->arrReminder  = $masterData->getMasterData('mtb_reminder');
[20147]48        $this->arrPref      = $masterData->getMasterData('mtb_pref');
[23026]49        $this->arrCountry   = $masterData->getMasterData('mtb_country');
[21481]50        $this->arrJob       = $masterData->getMasterData('mtb_job');
51        $this->arrMAILMAGATYPE = $masterData->getMasterData('mtb_mail_magazine_type');
52        $this->arrSex       = $masterData->getMasterData('mtb_sex');
[18187]53        $this->httpCacheControl('nocache');
[20041]54
[19892]55        // 生年月日選択肢の取得
[20538]56        $objDate            = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now')));
[20477]57        $this->arrYear      = $objDate->getYear('', START_BIRTH_YEAR, '');
[20147]58        $this->arrMonth     = $objDate->getMonth(true);
59        $this->arrDay       = $objDate->getDay(true);
[16070]60    }
61
62    /**
63     * Page のプロセス.
64     *
65     * @return void
66     */
[22567]67    function process()
68    {
[20147]69        parent::process();
[19661]70    }
[20041]71
[19661]72    /**
[19892]73     * Page のプロセス
[19661]74     * @return void
75     */
[22567]76    function action()
77    {
[20490]78        $objCustomer = new SC_Customer_Ex();
[20147]79        $customer_id = $objCustomer->getValue('customer_id');
[20041]80
[19892]81        // mobile用(戻るボタンでの遷移かどうかを判定)
[20538]82        if (!empty($_POST['return'])) {
83            $_POST['mode'] = 'return';
[16070]84        }
[20041]85
[20970]86        // パラメーター管理クラス,パラメーター情報の初期化
[20501]87        $objFormParam = new SC_FormParam_Ex();
[20147]88        SC_Helper_Customer_Ex::sfCustomerMypageParam($objFormParam);
89        $objFormParam->setParam($_POST);    // POST値の取得
[20041]90
[20147]91        switch ($this->getMode()) {
[21275]92            // 確認
93            case 'confirm':
[21683]94                if (isset($_POST['submit_address'])) {
[21679]95                    // 入力エラーチェック
[21883]96                    $this->arrErr = $this->lfCheckError($_POST);
[21679]97                    // 入力エラーの場合は終了
98                    if (count($this->arrErr) == 0) {
99                        // 郵便番号検索文作成
100                        $zipcode = $_POST['zip01'] . $_POST['zip02'];
101
102                        // 郵便番号検索
103                        $arrAdsList = SC_Utils_Ex::sfGetAddress($zipcode);
[21683]104
[21679]105                        // 郵便番号が発見された場合
106                        if (!empty($arrAdsList)) {
107                            $data['pref'] = $arrAdsList[0]['state'];
108                            $data['addr01'] = $arrAdsList[0]['city']. $arrAdsList[0]['town'];
[21683]109                            $objFormParam->setParam($data);
110                        }
111                        // 該当無し
112                        else {
[21679]113                            $this->arrErr['zip01'] = '※該当する住所が見つかりませんでした。<br>';
114                        }
115                    }
[21683]116                    $this->arrForm  = $objFormParam->getHashArray();
117                    break;
118                }
[21275]119                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
120                $this->arrForm = $objFormParam->getHashArray();
[20041]121
[21275]122                // 入力エラーなし
123                if (empty($this->arrErr)) {
124                    //パスワード表示
125                    $this->passlen      = SC_Utils_Ex::sfPassLen(strlen($this->arrForm['password']));
[20041]126
[21275]127                    $this->tpl_mainpage = 'mypage/change_confirm.tpl';
128                    $this->tpl_title    = '会員登録(確認ページ)';
[21359]129                    $this->tpl_subtitle = '会員登録内容変更(確認ページ)';
[21275]130                }
131                break;
132            // 会員登録と完了画面
133            case 'complete':
134                $this->arrErr = SC_Helper_Customer_Ex::sfCustomerMypageErrorCheck($objFormParam);
135                $this->arrForm = $objFormParam->getHashArray();
[20041]136
[21275]137                // 入力エラーなし
138                if (empty($this->arrErr)) {
139                    // 会員情報の登録
140                    $this->lfRegistCustomerData($objFormParam, $customer_id);
[21596]141
[21737]142                    //セッション情報を最新の状態に更新する
143                    $objCustomer->updateSession();
144
[21275]145                    // 完了ページに移動させる。
146                    SC_Response_Ex::sendRedirect('change_complete.php');
147                }
148                break;
149            // 確認ページからの戻り
150            case 'return':
151                $this->arrForm = $objFormParam->getHashArray();
152                break;
153            default:
154                $this->arrForm = SC_Helper_Customer_Ex::sfGetCustomerData($customer_id);
155                break;
[16234]156        }
[21743]157
[16234]158    }
159
160    /**
[20147]161     *  会員情報を登録する
[18839]162     *
[20147]163     * @param mixed $objFormParam
164     * @param mixed $customer_id
165     * @access private
166     * @return void
[18839]167     */
[22567]168    function lfRegistCustomerData(&$objFormParam, $customer_id)
169    {
[20147]170        $arrRet             = $objFormParam->getHashArray();
171        $sqlval             = $objFormParam->getDbArray();
172        $sqlval['birth']    = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
[20041]173
[20147]174        SC_Helper_Customer_Ex::sfEditCustomerData($sqlval, $customer_id);
[16070]175    }
[21679]176
177    /**
178     * 入力エラーのチェック.
179     *
180     * @param array $arrRequest リクエスト値($_GET)
181     * @return array $arrErr エラーメッセージ配列
182     */
[22567]183    function lfCheckError($arrRequest)
184    {
[21679]185        // パラメーター管理クラス
186        $objFormParam = new SC_FormParam_Ex();
187        // パラメーター情報の初期化
188        $objFormParam->addParam('郵便番号1', 'zip01', ZIP01_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
189        $objFormParam->addParam('郵便番号2', 'zip02', ZIP02_LEN, 'n', array('EXIST_CHECK', 'NUM_COUNT_CHECK', 'NUM_CHECK'));
190        // // リクエスト値をセット
[21683]191        $arrData['zip01'] = $arrRequest['zip01'];
192        $arrData['zip02'] = $arrRequest['zip02'];
[21679]193        $objFormParam->setParam($arrData);
194        // エラーチェック
195        $arrErr = $objFormParam->checkError();
196
197        return $arrErr;
198    }
[16070]199}
Note: See TracBrowser for help on using the repository browser.