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