source: branches/dev/html/mobile/nonmember/deliv.php @ 12696

Revision 12696, 11.6 KB checked in by nakanishi, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 */
9
10require_once("../require.php");
11
12class LC_Page {
13    var $arrSession;
14    var $tpl_mode;
15    var $arrAddr;
16    function LC_Page() {
17        $this->tpl_mainpage = 'nonmember/deliv.tpl';
18        $this->tpl_css = '/css/layout/shopping/index.css';
19        global $arrPref;
20        $this->arrPref = $arrPref;
21        $this->tpl_title = "¤ªÆϤ±Àè»ØÄê";      // ¥¿¥¤¥È¥ë
22
23        /*
24         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
25         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
26         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
27        */
28        session_cache_limiter('private-no-expire');     
29
30    }
31}
32
33$objPage = new LC_Page();
34$objView = new SC_MobileView();
35$objSiteSess = new SC_SiteSession();
36$objCartSess = new SC_CartSession();
37$objCustomer = new SC_Customer();
38// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
39$objCookie = new SC_Cookie(COOKIE_EXPIRE);
40// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
41$objFormParam = new SC_FormParam();
42// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
43lfInitParam();
44// POSTÃͤμèÆÀ
45$objFormParam->setParam($_POST);
46
47$objLoginFormParam = new SC_FormParam();    // ¥í¥°¥¤¥ó¥Õ¥©¡¼¥àÍÑ
48lfInitLoginFormParam();                     // ½é´üÀßÄê
49$objLoginFormParam->setParam($_POST);       // POSTÃͤμèÆÀ
50
51// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
52$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
53$objPage->tpl_uniqid = $uniqid;
54
55// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
56if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
57    // ÉÔÀµ¥¢¥¯¥»¥¹¤È¤ß¤Ê¤¹
58    sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
59}
60
61switch($_POST['mode']) {
62case 'login':
63    $objLoginFormParam->toLower('login_email');
64    $objPage->arrErr = $objLoginFormParam->checkError();
65    $arrForm =  $objLoginFormParam->getHashArray();
66    // ¥¯¥Ã¥­¡¼ÊݸȽÄê
67    if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
68        $objCookie->setCookie('login_email', $_POST['login_email']);
69    } else {
70        $objCookie->setCookie('login_email', '');
71    }
72
73    if(count($objPage->arrErr) == 0) {
74        // ¥í¥°¥¤¥óȽÄê
75        if(!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) &&
76           !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
77            // ²¾ÅÐÏ¿¤ÎȽÄê
78            $objQuery = new SC_Query;
79            $where = "email = ? AND status = 1 AND del_flg = 0";
80            $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
81           
82            if($ret > 0) {
83                sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true);
84            } else {
85                sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true);
86            }
87        }
88    } else {
89        // ¥í¥°¥¤¥ó¥Ú¡¼¥¸¤ËÌá¤ë
90        header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_TOP));
91        exit;
92    }
93
94    // ¥í¥°¥¤¥ó¤¬À®¸ù¤·¤¿¾ì¹ç¤Ï·ÈÂÓüËöID¤òÊݸ¤¹¤ë¡£
95    $objCustomer->updateMobilePhoneId();
96
97    // ·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£
98    $objCustomer->updateEmailMobile();
99
100    // ·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
101    if (!$objCustomer->hasValue('email_mobile')) {
102        header('Location: ' . gfAddSessionId('../entry/email_mobile.php'));
103        exit;
104    }
105    break;
106// ºï½ü
107case 'delete':
108    if (sfIsInt($_POST['other_deliv_id'])) {
109        $objQuery = new SC_Query();
110        $where = "other_deliv_id = ?";
111        $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
112        $objFormParam->setValue('select_addr_id', '');
113    }
114    break;
115// ²ñ°÷ÅÐÏ¿½»½ê¤ËÁ÷¤ë
116case 'customer_addr':
117    // ¤ªÆϤ±À褬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
118    if ($_POST['deli'] != "") {
119        // ²ñ°÷¾ðÊó¤Î½»½ê¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
120        lfRegistDelivData($uniqid, $objCustomer);
121        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
122        $objSiteSess->setRegistFlag();
123        // ¤ª»Ùʧ¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
124        header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_PAYMENT));
125        exit;
126    }else{
127        // ¥¨¥é¡¼¤òÊÖ¤¹
128        $arrErr['deli'] = '¢¨ ¤ªÆϤ±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
129    }
130    break;
131   
132// ÅÐÏ¿ºÑ¤ß¤ÎÊ̤ΤªÆϤ±Àè¤ËÁ÷¤ë
133case 'other_addr':
134    // ¤ªÆϤ±À褬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
135    if ($_POST['deli'] != "") {
136        if (sfIsInt($_POST['other_deliv_id'])) {
137            // ÅÐÏ¿ºÑ¤ß¤ÎÊ̤ΤªÆϤ±Àè¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
138            lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']);
139            // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
140            $objSiteSess->setRegistFlag();
141            // ¤ª»Ùʧ¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
142            header("Location: " . gfAddSessionId(MOBILE_URL_SHOP_PAYMENT));
143            exit;
144        }
145    }else{
146        // ¥¨¥é¡¼¤òÊÖ¤¹
147        $arrErr['deli'] = '¢¨ ¤ªÆϤ±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
148    }
149    break;
150
151/*
152// Ê̤ΤªÆϤ±Àè¤ò»ØÄê
153case 'new_addr':
154    // ÆþÎÏÃͤÎÊÑ´¹
155    $objFormParam->convParam();
156    $objPage->arrErr = lfCheckError($arrRet);
157    // ÆþÎÏ¥¨¥é¡¼¤Ê¤·
158    if(count($objPage->arrErr) == 0) {
159        // DB¤Ø¤ªÆϤ±Àè¤òÅÐÏ¿
160        lfRegistNewAddrData($uniqid, $objCustomer);
161        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
162        $objSiteSess->setRegistFlag();
163        // ¤ª»Ùʧ¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
164        header("Location: " . URL_SHOP_PAYMENT);
165        exit;
166    }
167    break;
168*/
169
170// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
171case 'return':
172    // ³Îǧ¥Ú¡¼¥¸¤Ø°ÜÆ°
173    header("Location: " . MOBILE_URL_CART_TOP);
174    exit;
175    break;
176default:
177    $objQuery = new SC_Query();
178    $where = "order_temp_id = ?";
179    $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
180    $objFormParam->setParam($arrRet[0]);
181    break;
182}
183
184/** ɽ¼¨½èÍý **/
185
186// ²ñ°÷ÅÐÏ¿½»½ê¤Î¼èÆÀ
187$col = "name01, name02, pref, addr01, addr02, zip01, zip02";
188$where = "customer_id = ?";
189$objQuery = new SC_Query();
190$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
191// Ê̤ΤªÆϤ±Àè½»½ê¤Î¼èÆÀ
192$col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02";
193$objQuery->setorder("other_deliv_id DESC");
194$objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
195$objPage->arrAddr = $arrCustomerAddr;
196$cnt = 1;
197foreach($objOtherAddr as $val) {
198    $objPage->arrAddr[$cnt] = $val;
199    $cnt++;
200}
201
202// ÆþÎÏÃͤμèÆÀ
203$objPage->arrForm = $objFormParam->getFormParamList();
204$objPage->arrErr = $arrErr;
205$objView->assignobj($objPage);
206$objView->display(SITE_FRAME);
207//--------------------------------------------------------------------------------------------------------------------------
208/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
209function lfInitParam() {
210    global $objFormParam;
211    $objFormParam->addParam("¤ªÌ¾Á°1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
212    $objFormParam->addParam("¤ªÌ¾Á°2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
213    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
214    $objFormParam->addParam("¥Õ¥ê¥¬¥Ê2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
215    $objFormParam->addParam("͹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
216    $objFormParam->addParam("͹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
217    $objFormParam->addParam("ÅÔÆ»Éܸ©", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
218    $objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
219    $objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
220    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
221    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
222    $objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
223}
224
225function lfInitLoginFormParam() {
226    global $objLoginFormParam;
227    $objLoginFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
228    $objLoginFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
229    $objLoginFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
230}
231
232/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
233function lfRegistNewAddrData($uniqid, $objCustomer) {
234    global $objFormParam;
235    $arrRet = $objFormParam->getHashArray();
236    $sqlval = $objFormParam->getDbArray();
237    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
238    $sqlval['deliv_check'] = '1';
239    $sqlval['order_temp_id'] = $uniqid;
240    $sqlval['update_date'] = 'Now()';
241    $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
242    $sqlval['order_birth'] = $objCustomer->getValue('birth');
243   
244    sfRegistTempOrder($uniqid, $sqlval);
245}
246
247/* ²ñ°÷¾ðÊó¤Î½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
248function lfRegistDelivData($uniqid, $objCustomer) {
249    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
250    $sqlval['order_temp_id'] = $uniqid;
251    $sqlval['update_date'] = 'Now()';
252    $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
253    $sqlval['deliv_check'] = '1';
254    $sqlval['deliv_name01'] = $objCustomer->getValue('name01');
255    $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
256    $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
257    $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
258    $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
259    $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
260    $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
261    $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
262    $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
263    $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
264    $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
265    $sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
266
267    $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
268    $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
269    $sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
270
271    sfRegistTempOrder($uniqid, $sqlval);
272}
273
274/* Ê̤ΤªÆϤ±Àè½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
275function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
276    // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
277    $sqlval['order_temp_id'] = $uniqid;
278    $sqlval['update_date'] = 'Now()';
279    $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
280    $sqlval['order_birth'] = $objCustomer->getValue('birth');
281       
282    $objQuery = new SC_Query();
283    $where = "other_deliv_id = ?";
284    $arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
285   
286    $sqlval['deliv_check'] = '1';
287    $sqlval['deliv_name01'] = $arrRet[0]['name01'];
288    $sqlval['deliv_name02'] = $arrRet[0]['name02'];
289    $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
290    $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
291    $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
292    $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
293    $sqlval['deliv_pref'] = $arrRet[0]['pref'];
294    $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
295    $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
296    $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
297    $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
298    $sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
299    sfRegistTempOrder($uniqid, $sqlval);
300}
301
302/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */
303function lfCheckError() {
304    global $objFormParam;
305    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
306    $arrRet =  $objFormParam->getHashArray();
307    $objErr = new SC_CheckError($arrRet);
308    $objErr->arrErr = $objFormParam->checkError();
309    // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
310    if ($_POST['mode'] == 'login'){
311    $objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK"));
312    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
313    }
314    $objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
315    return $objErr->arrErr;
316}
317?>
Note: See TracBrowser for help on using the repository browser.