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