- Timestamp:
- 2010/03/11 10:35:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php
r18177 r18609 45 45 parent::init(); 46 46 $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/delivery_addr.tpl'; 47 $this->tpl_title = " 新しいお届け先の追加・変更";47 $this->tpl_title = "お届け先の追加・変更"; 48 48 $masterData = new SC_DB_MasterData_Ex(); 49 49 $this->arrPref= $masterData->getMasterData("mtb_pref", 50 50 array("pref_id", "pref_name", "rank")); 51 $this-> allowClientCache();51 $this->httpCacheControl('nocache'); 52 52 } 53 53 … … 93 93 //別のお届け先DB登録用カラム配列 94 94 $arrRegistColumn = array( 95 array( "column" => "name01", "convert" => "aKV"),96 array( "column" => "name02", "convert" => "aKV"),97 array( "column" => "kana01", "convert" => "CKV"),98 array( "column" => "kana02", "convert" => "CKV"),99 array( "column" => "zip01", "convert" => "n"),100 array( "column" => "zip02", "convert" => "n"),101 array( "column" => "pref", "convert" => "n"),102 array( "column" => "addr01", "convert" => "aKV"),103 array( "column" => "addr02", "convert" => "aKV"),104 array( "column" => "tel01", "convert" => "n"),105 array( "column" => "tel02", "convert" => "n"),106 array( "column" => "tel03", "convert" => "n"),95 array("column" => "name01", "convert" => "aKV"), 96 array("column" => "name02", "convert" => "aKV"), 97 array("column" => "kana01", "convert" => "CKV"), 98 array("column" => "kana02", "convert" => "CKV"), 99 array("column" => "zip01", "convert" => "n"), 100 array("column" => "zip02", "convert" => "n"), 101 array("column" => "pref", "convert" => "n"), 102 array("column" => "addr01", "convert" => "aKV"), 103 array("column" => "addr02", "convert" => "aKV"), 104 array("column" => "tel01", "convert" => "n"), 105 array("column" => "tel02", "convert" => "n"), 106 array("column" => "tel03", "convert" => "n"), 107 107 ); 108 108 … … 123 123 } 124 124 } else { 125 //別のお届け先登録数の取得 126 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id'))); 127 if ($deliv_count < DELIV_ADDR_MAX or isset($_POST['other_deliv_id'])){ 128 if(strlen($_POST['other_deliv_id'] != 0)){ 129 $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); 130 if ($deliv_count == 0) { 131 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 132 }else{ 133 $this->lfRegistData($_POST,$arrRegistColumn, $objCustomer); 134 } 135 }else{ 136 $this->lfRegistData($_POST,$arrRegistColumn, $objCustomer); 137 } 125 126 if ($_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP) { 127 $this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) ."'); window.close();"; 128 } else { 129 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 138 130 } 139 if( $_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP ){ 140 $this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) ."'); window.close();"; 141 }else{ 142 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 143 } 131 132 $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer); 144 133 } 145 134 break; … … 171 160 $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK")); 172 161 $objErr->doFunc(array("都道府県", 'pref'), array("SELECT_CHECK","NUM_CHECK")); 173 $objErr->doFunc(array(" ご住所(1)", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));174 $objErr->doFunc(array(" ご住所(2)", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));175 $objErr->doFunc(array(" お電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));176 $objErr->doFunc(array(" お電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));177 $objErr->doFunc(array(" お電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));178 $objErr->doFunc(array(" お電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));162 $objErr->doFunc(array("住所(1)", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 163 $objErr->doFunc(array("住所(2)", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 164 $objErr->doFunc(array("電話番号1", 'tel01'), array("EXIST_CHECK","NUM_CHECK")); 165 $objErr->doFunc(array("電話番号2", 'tel02'), array("EXIST_CHECK","NUM_CHECK")); 166 $objErr->doFunc(array("電話番号3", 'tel03'), array("EXIST_CHECK","NUM_CHECK")); 167 $objErr->doFunc(array("電話番号", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK")); 179 168 return $objErr->arrErr; 180 169 … … 184 173 function lfRegistData($array, $arrRegistColumn, &$objCustomer) { 185 174 $objConn = new SC_DBConn(); 175 $objQuery = new SC_Query(); 186 176 foreach ($arrRegistColumn as $data) { 187 177 if (strlen($array[ $data["column"] ]) > 0) { … … 192 182 $arrRegist['customer_id'] = $objCustomer->getvalue('customer_id'); 193 183 194 //-- 編集登録実行 195 $objConn->query("BEGIN"); 196 if ($array['other_deliv_id'] != ""){ 184 // 追加 185 if (strlen($_POST['other_deliv_id'] == 0)) { 186 // 別のお届け先登録数の取得 187 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id'))); 188 // 別のお届け先最大登録数に達している場合、エラー 189 if ($deliv_count >= DELIV_ADDR_MAX) { 190 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '別のお届け先最大登録数に達しています。'); 191 } 192 193 // 実行 194 $objConn->autoExecute("dtb_other_deliv", $arrRegist); 195 196 // 変更 197 } else { 198 $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); 199 if ($deliv_count != 1) { 200 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '一致する別のお届け先がありません。'); 201 } 202 203 // 実行 197 204 $objConn->autoExecute("dtb_other_deliv", $arrRegist, 198 205 "other_deliv_id = " 199 206 . SC_Utils_Ex::sfQuoteSmart($array["other_deliv_id"])); 200 }else{ 201 $objConn->autoExecute("dtb_other_deliv", $arrRegist); 202 } 203 $objConn->query("COMMIT"); 207 } 204 208 } 205 209 … … 207 211 function lfConvertParam($array, $arrRegistColumn) { 208 212 /* 209 * 210 * 211 * 212 * 213 * 213 * 文字列の変換 214 * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換 215 * C : 「全角ひら仮名」を「全角かた仮名」に変換 216 * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します 217 * n : 「全角」数字を「半角(ハンカク)」に変換 214 218 * a : 全角英数字を半角英数字に変換する 215 219 */
Note: See TracChangeset
for help on using the changeset viewer.