Changeset 20156
- Timestamp:
- 2011/02/12 19:01:02 (13 years ago)
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/helper/SC_Helper_Customer.php
r20148 r20156 297 297 function sfCustomerEntryParam (&$objFormParam) { 298 298 SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); 299 SC_Helper_Customer_Ex::sfCustomerRegisterParam($objFormParam); 299 300 } 300 301 … … 308 309 function sfCustomerMypageParam (&$objFormParam) { 309 310 SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); 311 SC_Helper_Customer_Ex::sfCustomerRegisterParam($objFormParam); 310 312 if (SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE){ 311 313 $objFormParam->addParam('携帯メールアドレス', "email_mobile", MTEXT_LEN, "a", array("NO_SPTAB", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); … … 315 317 316 318 /** 317 * 会員フォーム共通 319 * お届け先フォーム初期化 320 * 321 * @param mixed $objFormParam 322 * @access public 323 * @return void 324 */ 325 function sfCustomerOtherDelivParam (&$objFormParam) { 326 SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); 327 $objFormParam->addParam("", 'other_deliv_id'); 328 } 329 330 /** 331 * 会員共通 318 332 * 319 333 * @param mixed $objFormParam … … 322 336 */ 323 337 function sfCustomerCommonParam (&$objFormParam) { 324 325 338 $objFormParam->addParam("お名前(姓)", 'name01', STEXT_LEN, "aKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); 326 339 $objFormParam->addParam("お名前(名)", 'name02', STEXT_LEN, "aKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK")); 327 340 $objFormParam->addParam("お名前(フリガナ・姓)", 'kana01', STEXT_LEN, "CKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK")); 328 341 $objFormParam->addParam("お名前(フリガナ・名)", 'kana02', STEXT_LEN, "CKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK")); 329 $objFormParam->addParam("パスワード", 'password', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK"));330 $objFormParam->addParam("パスワード確認用の質問", "reminder", STEXT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK"));331 $objFormParam->addParam("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));332 342 $objFormParam->addParam("郵便番号1", "zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 333 343 $objFormParam->addParam("郵便番号2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); … … 335 345 $objFormParam->addParam("住所1", "addr01", MTEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); 336 346 $objFormParam->addParam("住所2", "addr02", MTEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); 337 $objFormParam->addParam("お電話番号1", 'tel01', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK" )); 338 $objFormParam->addParam("お電話番号2", 'tel02', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK" )); 339 $objFormParam->addParam("お電話番号3", 'tel03', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK" )); 347 $objFormParam->addParam("お電話番号1", 'tel01', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 348 $objFormParam->addParam("お電話番号2", 'tel02', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 349 $objFormParam->addParam("お電話番号3", 'tel03', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 350 } 351 352 /* 353 * 会員登録共通 354 * 355 */ 356 function sfCustomerRegisterParam (&$objFormParam) { 357 $objFormParam->addParam("パスワード", 'password', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK")); 358 $objFormParam->addParam("パスワード確認用の質問", "reminder", STEXT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 359 $objFormParam->addParam("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK")); 340 360 $objFormParam->addParam("性別", "sex", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 341 361 $objFormParam->addParam("職業", "job", INT_LEN, "n", array("NUM_CHECK")); … … 357 377 } 358 378 379 function sfCustomerOtherDelivErrorCheck(&$objFormParam) { 380 $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); 381 return $objErr->arrErr; 382 } 383 359 384 /** 360 385 * 会員登録エラーチェック … … 365 390 */ 366 391 function sfCustomerEntryErrorCheck(&$objFormParam) { 367 $objErr->arrErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); 392 $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); 393 $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck(&$objErr); 394 368 395 return $objErr->arrErr; 369 396 } … … 381 408 $objFormParam->toLower('email_mobile02'); 382 409 383 $objErr->arrErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); 410 $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); 411 $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck(&$objErr); 384 412 385 413 if (isset($objErr->arrErr['password']) && $objFormParam->getValue('password') == DEFAULT_PASSWORD) { … … 412 440 $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03"),array("TEL_CHECK")); 413 441 $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK")); 442 443 return $objErr; 444 } 445 446 /* 447 * 会員登録編集共通 448 */ 449 function sfCustomerRegisterErrorCheck(&$objErr) { 414 450 $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY")); 415 451 … … 423 459 $objErr->doFunc(array("メールアドレス", "email"), array("CHECK_REGIST_CUSTOMER_EMAIL")); 424 460 425 return $objErr->arrErr; 426 } 461 return $objErr; 462 } 463 427 464 } -
branches/version-2_5-dev/data/class/pages/mypage/LC_Page_AbstractMypage.php
r20149 r20156 61 61 62 62 // ログインしていない場合は必ずログインページを表示する 63 if( !$objCustomer->isLoginSuccess(true)) {63 if($objCustomer->isLoginSuccess(true) === false) { 64 64 // クッキー管理クラス 65 65 $objCookie = new SC_Cookie(COOKIE_EXPIRE); -
branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php
r20116 r20156 44 44 function init() { 45 45 parent::init(); 46 $this->tpl_title = "お届け先の追加・変更";47 $masterData = new SC_DB_MasterData_Ex();48 $this->arrPref = $masterData->getMasterData('mtb_pref');46 $this->tpl_title = "お届け先の追加・変更"; 47 $masterData = new SC_DB_MasterData_Ex(); 48 $this->arrPref = $masterData->getMasterData('mtb_pref'); 49 49 $this->httpCacheControl('nocache'); 50 50 } … … 67 67 */ 68 68 function action() { 69 $objQuery = new SC_Query();69 $objQuery = new SC_Query(); 70 70 $objCustomer = new SC_Customer(); 71 $ParentPage = MYPAGE_DELIVADDR_URLPATH;71 $ParentPage = MYPAGE_DELIVADDR_URLPATH; 72 72 73 73 // GETでページを指定されている場合には指定ページに戻す 74 74 if (isset($_GET['page'])) { 75 $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES);76 } else if(isset($_POST['ParentPage'])) {77 $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES);75 $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES); 76 } else if (isset($_POST['ParentPage'])) { 77 $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES); 78 78 } 79 79 $this->ParentPage = $ParentPage; … … 82 82 * ログイン判定 及び 退会判定 83 83 * 未ログインでも, 複数配送設定ページからのアクセスの場合は表示する 84 * 85 * TODO 購入遷移とMyPageで別クラスにすべき 84 86 */ 85 87 if (!$objCustomer->isLoginSuccess(true) && $ParentPage != MULTIPLE_URLPATH){ … … 87 89 } 88 90 91 // $_GET['other_deliv_id'] のあるなしで追加か編集か判定しているらしい 89 92 if (!isset($_GET['other_deliv_id'])) $_GET['other_deliv_id'] = ""; 90 91 //TODO 要リファクタリング(MODE if利用) 92 if ($this->getMode() == null){ 93 $_SESSION['other_deliv_id'] = $_GET['other_deliv_id']; 94 } 95 96 if ($_GET['other_deliv_id'] != ""){ 97 //不正アクセス判定 98 $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id'])); 99 if (!$objCustomer->isLoginSuccess(true) || $flag == 0){ 100 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 101 } 102 } 103 104 //別のお届け先DB登録用カラム配列 105 $arrRegistColumn = array( 106 array("column" => "name01", "convert" => "aKV"), 107 array("column" => "name02", "convert" => "aKV"), 108 array("column" => "kana01", "convert" => "CKV"), 109 array("column" => "kana02", "convert" => "CKV"), 110 array("column" => "zip01", "convert" => "n"), 111 array("column" => "zip02", "convert" => "n"), 112 array("column" => "pref", "convert" => "n"), 113 array("column" => "addr01", "convert" => "aKV"), 114 array("column" => "addr02", "convert" => "aKV"), 115 array("column" => "tel01", "convert" => "n"), 116 array("column" => "tel02", "convert" => "n"), 117 array("column" => "tel03", "convert" => "n"), 118 ); 119 120 121 if ($_GET['other_deliv_id'] != ""){ 122 //別のお届け先情報取得 123 $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id'])); 124 $this->arrForm = $arrOtherDeliv[0]; 125 } 93 $_SESSION['other_deliv_id'] = $_GET['other_deliv_id']; 94 95 // パラメータ管理クラス,パラメータ情報の初期化 96 $objFormParam = new SC_FormParam(); 97 SC_Helper_Customer_Ex::sfCustomerOtherDelivParam($objFormParam); 98 $objFormParam->setParam($_POST); 99 $this->arrForm = $objFormParam->getHashArray(); 126 100 127 101 switch ($this->getMode()) { 102 // 入力は必ずedit 128 103 case 'edit': 129 $_POST = $this->lfConvertParam($_POST,$arrRegistColumn); 130 $this->arrErr = $this->lfErrorCheck($_POST); 131 if ($this->arrErr){ 132 foreach ($_POST as $key => $val){ 133 if ($val != "") $this->arrForm[$key] = $val; 134 } 135 } else { 104 $this->arrErr = SC_Helper_Customer_Ex::sfCustomerOtherDelivErrorCheck($objFormParam); 105 // 入力エラーなし 106 if(empty($this->arrErr)) { 107 108 // TODO ここでやるべきではない 136 109 $validUrl = array(MYPAGE_DELIVADDR_URLPATH, 137 110 DELIV_URLPATH, … … 144 117 145 118 if ($objCustomer->isLoginSuccess(true)) { 146 $this->lfRegistData($ _POST, $arrRegistColumn, $objCustomer);119 $this->lfRegistData($objFormParam, $objCustomer->getValue("customer_id")); 147 120 } else { 148 $this->lfRegistDataNonMember($ _POST, $arrRegistColumn);149 } 150 151 if( Net_UserAgent_Mobile::isMobile() === true) {121 $this->lfRegistDataNonMember($objFormParam); 122 } 123 124 if(SC_Display::detectDevice() === DEVICE_TYPE_MOBILE) { 152 125 // モバイルの場合、元のページに遷移 153 126 SC_Response_Ex::sendRedirect($this->getLocation($_POST['ParentPage'])); … … 156 129 } 157 130 break; 158 } 159 if(Net_UserAgent_Mobile::isMobile() === true) { 131 case 'multiple': 132 // 複数配送先用? 133 break; 134 default : 135 136 if ($_GET['other_deliv_id'] != ""){ 137 //不正アクセス判定 138 $flag = $objQuery->count("dtb_other_deliv", 139 "customer_id = ? AND other_deliv_id = ?", 140 array($objCustomer->getValue("customer_id"), 141 $_SESSION['other_deliv_id'])); 142 143 if (!$objCustomer->isLoginSuccess(true) || $flag == 0){ 144 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 145 } 146 147 //別のお届け先情報取得 148 $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id = ? ", array($_SESSION['other_deliv_id'])); 149 $this->arrForm = $arrOtherDeliv[0]; 150 } 151 break; 152 } 153 154 if (SC_Display::detectDevice() === DEVICE_TYPE_MOBILE) { 160 155 $this->tpl_mainpage = 'mypage/delivery_addr.tpl'; 161 156 } else { … … 173 168 } 174 169 175 /* エラーチェック */176 function lfErrorCheck() {177 $objErr = new SC_CheckError();178 179 $objErr->doFunc(array("お名前(姓)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));180 $objErr->doFunc(array("お名前(名)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));181 $objErr->doFunc(array("お名前(フリガナ・姓)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));182 $objErr->doFunc(array("お名前(フリガナ・名)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));183 $objErr->doFunc(array("郵便番号1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));184 $objErr->doFunc(array("郵便番号2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));185 $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK"));186 $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK"));187 $objErr->doFunc(array("住所(1)", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));188 $objErr->doFunc(array("住所(2)", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));189 $objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));190 $objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));191 $objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));192 $objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03") ,array("TEL_CHECK"));193 return $objErr->arrErr;194 195 }196 170 197 171 /* 登録実行 */ 198 function lfRegistData($ array, $arrRegistColumn, &$objCustomer) {199 $objQuery = new SC_Query();200 foreach ($arrRegistColumn as $data) { 201 $arrRegist[ $data["column"] ] = $array[ $data["column"] ];202 }203 204 $ arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');172 function lfRegistData($objFormParam, $customer_id) { 173 $objQuery =& SC_Query::getSingletonInstance(); 174 175 $arrRet = $objFormParam->getHashArray(); 176 $sqlval = $objFormParam->getDbArray(); 177 178 $sqlval['customer_id'] = $customer_id; 205 179 206 180 // 追加 207 if (strlen($ _POST['other_deliv_id'] == 0)) {181 if (strlen($arrRet['other_deliv_id'] == 0)) { 208 182 // 別のお届け先登録数の取得 209 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id =?", array($objCustomer->getValue('customer_id')));183 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id = ?", array($customer_id)); 210 184 // 別のお届け先最大登録数に達している場合、エラー 211 185 if ($deliv_count >= DELIV_ADDR_MAX) { … … 214 188 215 189 // 実行 216 $ arrRegist['other_deliv_id'] = $objQuery->nextVal('dtb_other_deliv_other_deliv_id');217 $objQuery->insert("dtb_other_deliv", $ arrRegist);190 $sqlval['other_deliv_id'] = $objQuery->nextVal('dtb_other_deliv_other_deliv_id'); 191 $objQuery->insert("dtb_other_deliv", $sqlval); 218 192 219 193 // 変更 220 194 } else { 221 $deliv_count = $objQuery->count("dtb_other_deliv","customer_id =? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));195 $deliv_count = $objQuery->count("dtb_other_deliv","customer_id = ? AND other_deliv_id = ?" ,array($customer_id, $arrRet['other_deliv_id'])); 222 196 if ($deliv_count != 1) { 223 197 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '一致する別のお届け先がありません。'); … … 225 199 226 200 // 実行 227 $objQuery->update("dtb_other_deliv", $ arrRegist,228 "other_deliv_id = "229 . SC_Utils_Ex::sfQuoteSmart($array["other_deliv_id"]));230 } 231 }232 233 function lfRegistDataNonMember($array, $arrRegistColumn) { 201 $objQuery->update("dtb_other_deliv", $sqlval, "other_deliv_id = ?", array($arrRet['other_deliv_id'])); 202 } 203 } 204 205 function lfRegistDataNonMember($objFormParam) { 206 $arrRegistColumn = $objFormParam->getDbArray(); 207 234 208 foreach ($arrRegistColumn as $data) { 235 209 $arrRegist['shipping_' . $data["column"] ] = $array[ $data["column"] ]; … … 241 215 } 242 216 } 243 244 //---- 取得文字列の変換245 function lfConvertParam($array, $arrRegistColumn) {246 /*247 * 文字列の変換248 * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換249 * C : 「全角ひら仮名」を「全角かた仮名」に変換250 * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します251 * n : 「全角」数字を「半角(ハンカク)」に変換252 * a : 全角英数字を半角英数字に変換する253 */254 // カラム名とコンバート情報255 foreach ($arrRegistColumn as $data) {256 $arrConvList[ $data["column"] ] = $data["convert"];257 }258 259 // 文字変換260 foreach ($arrConvList as $key => $val) {261 // POSTされてきた値のみ変換する。262 if(strlen(($array[$key])) > 0) {263 $array[$key] = mb_convert_kana($array[$key] ,$val);264 }265 }266 return $array;267 }268 217 } 269 218 ?>
Note: See TracChangeset
for help on using the changeset viewer.