source: branches/mobile/html/mypage/delivery_addr.php @ 8425

Revision 8425, 5.7 KB checked in by kakinaka, 16 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9session_start();
10
11class LC_Page{
12    function LC_Page(){
13        $this->tpl_mainpage = USER_PATH . 'templates/mypage/delivery_addr.tpl';
14        $this->tpl_title = "¿·¤·¤¤¤ªÆϤ±Àè¤ÎÄɲÎ¥Êѹ¹";
15        global $arrPref;
16        $this->arrPref = $arrPref;
17    }
18}
19
20$objPage = new LC_Page();
21$objView = new SC_SiteView(false);
22$objQuery = new SC_Query();
23$objCustomer = new SC_Customer();
24$objConn = new SC_DBConn();
25$ParentPage = MYPAGE_DELIVADDR_URL;
26
27// GET¤Ç¥Ú¡¼¥¸¤ò»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï»ØÄê¥Ú¡¼¥¸¤ËÌ᤹
28if (isset($_GET['page'])) {
29    $ParentPage = $_GET['page'];
30}
31$objPage->ParentPage = $ParentPage;
32
33//¥í¥°¥¤¥óȽÄê
34if (!$objCustomer->isLoginSuccess()){
35    sfDispSiteError(CUSTOMER_ERROR);
36}
37
38if ($_POST['mode'] == ""){
39    $_SESSION['other_deliv_id'] = $_GET['other_deliv_id'];
40}
41
42if ($_GET['other_deliv_id'] != ""){
43    //ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
44    $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']));
45    if (!$objCustomer->isLoginSuccess() || $flag == 0){
46        sfDispSiteError(CUSTOMER_ERROR);
47    }
48}
49
50//Ê̤ΤªÆϤ±Àè£Ä£ÂÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
51$arrRegistColumn = array(
52                             array(  "column" => "name01",      "convert" => "aKV" ),
53                             array(  "column" => "name02",      "convert" => "aKV" ),
54                             array(  "column" => "kana01",      "convert" => "CKV" ),
55                             array(  "column" => "kana02",      "convert" => "CKV" ),
56                             array(  "column" => "zip01",       "convert" => "n" ),
57                             array(  "column" => "zip02",       "convert" => "n" ),
58                             array(  "column" => "pref",        "convert" => "n" ),
59                             array(  "column" => "addr01",      "convert" => "aKV" ),
60                             array(  "column" => "addr02",      "convert" => "aKV" ),
61                             array(  "column" => "tel01",       "convert" => "n" ),
62                             array(  "column" => "tel02",       "convert" => "n" ),
63                             array(  "column" => "tel03",       "convert" => "n" ),
64                        );
65
66switch ($_POST['mode']){
67    case 'edit':
68        $_POST = lfConvertParam($_POST,$arrRegistColumn);
69        $objPage->arrErr =lfErrorCheck($_POST);
70        if ($objPage->arrErr){
71            foreach ($_POST as $key => $val){
72                $objPage->$key = $val;
73            }
74        }else{
75            //Ê̤ΤªÆϤ±ÀèÅÐÏ¿¿ô¤Î¼èÆÀ
76            $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
77            if ($deliv_count < DELIV_ADDR_MAX){
78                lfRegistData($_POST,$arrRegistColumn);
79            }
80            $objPage->tpl_onload = "fnUpdateParent('".$_POST['ParentPage']."'); window.close();";
81        }
82        break;
83}
84
85if ($_GET['other_deliv_id'] != ""){
86    //Ê̤ΤªÆϤ±Àè¾ðÊó¼èÆÀ
87    $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id']));
88    $objPage->arrOtherDeliv = $arrOtherDeliv[0];
89}
90
91$objView->assignobj($objPage);
92$objView->display($objPage->tpl_mainpage);
93
94//-------------------------------------------------------------------------------------------------------------
95
96/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
97function lfErrorCheck() {
98    $objErr = new SC_CheckError();
99   
100    $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
101    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
102    $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÀ«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
103    $objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê̾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
104    $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
105    $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
106    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
107    $objErr->doFunc(array("ÅÔÆ»Éܸ©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
108    $objErr->doFunc(array("¤´½»½ê¡Ê1¡Ë", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
109    $objErr->doFunc(array("¤´½»½ê¡Ê2¡Ë", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
110    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
111    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
112    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
113    $objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
114    return $objErr->arrErr;
115   
116}
117
118/* ÅÐÏ¿¼Â¹Ô */
119function lfRegistData($array, $arrRegistColumn) {
120    global $objConn;
121    global $objCustomer;
122   
123    foreach ($arrRegistColumn as $data) {
124        if (strlen($array[ $data["column"] ]) > 0) {
125            $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
126        }
127    }
128   
129    $arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');
130   
131    //-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
132    $objConn->query("BEGIN");
133    if ($array['other_deliv_id'] != ""){
134    $objConn->autoExecute("dtb_other_deliv", $arrRegist, "other_deliv_id='" .addslashes($array["other_deliv_id"]). "'");
135    }else{
136    $objConn->autoExecute("dtb_other_deliv", $arrRegist);
137    }
138    $objConn->query("COMMIT");
139}
140
141//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
142function lfConvertParam($array, $arrRegistColumn) {
143    /*
144     *  ʸ»úÎó¤ÎÊÑ´¹
145     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
146     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
147     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹ 
148     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)¡×¤ËÊÑ´¹
149     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
150     */
151    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
152    foreach ($arrRegistColumn as $data) {
153        $arrConvList[ $data["column"] ] = $data["convert"];
154    }
155   
156    // ʸ»úÊÑ´¹
157    foreach ($arrConvList as $key => $val) {
158        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
159        if(strlen(($array[$key])) > 0) {
160            $array[$key] = mb_convert_kana($array[$key] ,$val);
161        }
162    }
163    return $array;
164}
165?>
Note: See TracBrowser for help on using the repository browser.