| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of EC-CUBE |
|---|
| 4 | * |
|---|
| 5 | * Copyright(c) 2000-2010 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 | /** |
|---|
| 25 | * 会員情報の登録・編集・検索ヘルパークラス. |
|---|
| 26 | * |
|---|
| 27 | * |
|---|
| 28 | * @package Helper |
|---|
| 29 | * @author Hirokazu Fukuda |
|---|
| 30 | * @version $Id$ |
|---|
| 31 | */ |
|---|
| 32 | class SC_Helper_Customer { |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | /** |
|---|
| 36 | * 会員編集登録処理を行う. |
|---|
| 37 | * |
|---|
| 38 | * @param array $array パラメータの配列 |
|---|
| 39 | * @param array $arrRegistColumn 登録するカラムの配列 |
|---|
| 40 | * @return void |
|---|
| 41 | * @deprecated |
|---|
| 42 | * @todo sfEditCustomerData に統一。LC_Page_Admin_Customer_Edit から呼び出されているだけ |
|---|
| 43 | */ |
|---|
| 44 | function sfEditCustomerDataAdmin($array, $arrRegistColumn) { |
|---|
| 45 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 46 | |
|---|
| 47 | foreach ($arrRegistColumn as $data) { |
|---|
| 48 | if ($data["column"] != "password" && $data["column"] != "reminder_answer" ) { |
|---|
| 49 | if($array[ $data['column'] ] != "") { |
|---|
| 50 | $arrRegist[ $data["column"] ] = $array[ $data["column"] ]; |
|---|
| 51 | } else { |
|---|
| 52 | $arrRegist[ $data['column'] ] = NULL; |
|---|
| 53 | } |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) { |
|---|
| 57 | $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00"; |
|---|
| 58 | } else { |
|---|
| 59 | $arrRegist["birth"] = NULL; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | //-- パスワードの更新がある場合は暗号化。(更新がない場合はUPDATE文を構成しない) |
|---|
| 63 | $salt = ""; |
|---|
| 64 | if ($array["password"] != DEFAULT_PASSWORD) { |
|---|
| 65 | $salt = SC_Utils_Ex::sfGetRandomString(10); |
|---|
| 66 | $arrRegist["salt"] = $salt; |
|---|
| 67 | $arrRegist["password"] = SC_Utils_Ex::sfGetHashString($array["password"], $salt); |
|---|
| 68 | } |
|---|
| 69 | if ($array["reminder_answer"] != DEFAULT_PASSWORD) { |
|---|
| 70 | if($salt == "") { |
|---|
| 71 | $salt = $objQuery->get("salt", "dtb_customer", "customer_id = ? ", array($array['customer_id'])); |
|---|
| 72 | } |
|---|
| 73 | $arrRegist["reminder_answer"] = SC_Utils_Ex::sfGetHashString($array["reminder_answer"], $salt); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | $arrRegist["update_date"] = "NOW()"; |
|---|
| 77 | |
|---|
| 78 | //-- 編集登録実行 |
|---|
| 79 | $objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id'])); |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | /** |
|---|
| 83 | * 会員編集登録処理を行う. |
|---|
| 84 | * |
|---|
| 85 | * @param array $array 登録するデータの配列(SC_FormParamのgetDbArrayの戻り値) |
|---|
| 86 | * @param array $customer_id nullの場合はinsert, 存在する場合はupdate |
|---|
| 87 | * @access public |
|---|
| 88 | * @return integer 登録編集したユーザーのcustomer_id |
|---|
| 89 | */ |
|---|
| 90 | function sfEditCustomerData($array, $customer_id = null) { |
|---|
| 91 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 92 | $objQuery->begin(); |
|---|
| 93 | |
|---|
| 94 | $array["update_date"] = "now()"; // 更新日 |
|---|
| 95 | |
|---|
| 96 | // salt値の生成(insert時)または取得(update時)。 |
|---|
| 97 | if(is_numeric($customer_id)) { |
|---|
| 98 | $salt = $objQuery->get("salt", "dtb_customer", "customer_id = ? ", array($customer_id)); |
|---|
| 99 | }else{ |
|---|
| 100 | $salt = SC_Utils_Ex::sfGetRandomString(10); |
|---|
| 101 | $array["salt"] = $salt; |
|---|
| 102 | } |
|---|
| 103 | //-- パスワードの更新がある場合は暗号化 |
|---|
| 104 | if ($array["password"] == DEFAULT_PASSWORD or $array["password"] == "") { |
|---|
| 105 | //更新しない |
|---|
| 106 | unset($array["password"]); |
|---|
| 107 | } else { |
|---|
| 108 | $array["password"] = SC_Utils_Ex::sfGetHashString($array["password"], $salt); |
|---|
| 109 | } |
|---|
| 110 | //-- 秘密の質問の更新がある場合は暗号化 |
|---|
| 111 | if ($array["reminder_answer"] == DEFAULT_PASSWORD or $array["reminder_answer"] == "") { |
|---|
| 112 | //更新しない |
|---|
| 113 | unset($array["reminder_answer"]); |
|---|
| 114 | } else { |
|---|
| 115 | $array["reminder_answer"] = SC_Utils_Ex::sfGetHashString($array["reminder_answer"], $salt); |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | //-- 編集登録実行 |
|---|
| 119 | if (is_numeric($customer_id)){ |
|---|
| 120 | // 編集 |
|---|
| 121 | $objQuery->update("dtb_customer", $array, "customer_id = ? ", array($customer_id)); |
|---|
| 122 | } else { |
|---|
| 123 | // 新規登録 |
|---|
| 124 | |
|---|
| 125 | // 会員ID |
|---|
| 126 | $customer_id = $objQuery->nextVal('dtb_customer_customer_id'); |
|---|
| 127 | if (is_null($array["customer_id"])){ |
|---|
| 128 | $array['customer_id'] = $customer_id; |
|---|
| 129 | } |
|---|
| 130 | // 作成日 |
|---|
| 131 | if (is_null($array["create_date"])){ |
|---|
| 132 | $array["create_date"] = "now()"; |
|---|
| 133 | } |
|---|
| 134 | $objQuery->insert("dtb_customer", $array); |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | $objQuery->commit(); |
|---|
| 138 | return $customer_id; |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | /** |
|---|
| 142 | * 注文番号、利用ポイント、加算ポイントから最終ポイントを取得する. |
|---|
| 143 | * |
|---|
| 144 | * @param integer $order_id 注文番号 |
|---|
| 145 | * @param integer $use_point 利用ポイント |
|---|
| 146 | * @param integer $add_point 加算ポイント |
|---|
| 147 | * @return array 最終ポイントの配列 |
|---|
| 148 | */ |
|---|
| 149 | function sfGetCustomerPoint($order_id, $use_point, $add_point) { |
|---|
| 150 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 151 | $arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id)); |
|---|
| 152 | $customer_id = $arrRet[0]['customer_id']; |
|---|
| 153 | if ($customer_id != "" && $customer_id >= 1) { |
|---|
| 154 | if (USE_POINT !== false) { |
|---|
| 155 | $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); |
|---|
| 156 | $point = $arrRet[0]['point']; |
|---|
| 157 | $total_point = $arrRet[0]['point'] - $use_point + $add_point; |
|---|
| 158 | } else { |
|---|
| 159 | $total_point = 0; |
|---|
| 160 | $point = 0; |
|---|
| 161 | } |
|---|
| 162 | } else { |
|---|
| 163 | $total_point = ""; |
|---|
| 164 | $point = ""; |
|---|
| 165 | } |
|---|
| 166 | return array($point, $total_point); |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | /** |
|---|
| 170 | * emailアドレスから、登録済み会員や退会済み会員をチェックする |
|---|
| 171 | * |
|---|
| 172 | * @param string $email メールアドレス |
|---|
| 173 | * @return integer 0:登録可能 1:登録済み 2:再登録制限期間内削除ユーザー 3:自分のアドレス |
|---|
| 174 | */ |
|---|
| 175 | function sfCheckRegisterUserFromEmail($email){ |
|---|
| 176 | $return = 0; |
|---|
| 177 | |
|---|
| 178 | $objCustomer = new SC_Customer(); |
|---|
| 179 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 180 | |
|---|
| 181 | $arrRet = $objQuery->select("email, update_date, del_flg", |
|---|
| 182 | "dtb_customer", |
|---|
| 183 | "email = ? OR email_mobile = ? ORDER BY del_flg", |
|---|
| 184 | array($email, $email)); |
|---|
| 185 | |
|---|
| 186 | if(count($arrRet) > 0) { |
|---|
| 187 | if($arrRet[0]['del_flg'] != '1') { |
|---|
| 188 | // 会員である場合 |
|---|
| 189 | $return = 1; |
|---|
| 190 | } else { |
|---|
| 191 | // 退会した会員である場合 |
|---|
| 192 | $leave_time = SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']); |
|---|
| 193 | $now_time = time(); |
|---|
| 194 | $pass_time = $now_time - $leave_time; |
|---|
| 195 | // 退会から何時間-経過しているか判定する。 |
|---|
| 196 | $limit_time = ENTRY_LIMIT_HOUR * 3600; |
|---|
| 197 | if($pass_time < $limit_time) { |
|---|
| 198 | $return = 2; |
|---|
| 199 | } |
|---|
| 200 | } |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | // ログインしている場合、すでに登録している自分のemailの場合はエラーを返さない |
|---|
| 204 | if ($objCustomer->getValue('customer_id')){ |
|---|
| 205 | $arrRet = $objQuery->select("email, email_mobile", |
|---|
| 206 | "dtb_customer", |
|---|
| 207 | "customer_id = ? ORDER BY del_flg", |
|---|
| 208 | array($objCustomer->getValue('customer_id'))); |
|---|
| 209 | |
|---|
| 210 | if ($email == $arrRet[0]["email"] || $email == $arrRet[0]["email_mobile"]) { |
|---|
| 211 | $return = 3; |
|---|
| 212 | } |
|---|
| 213 | } |
|---|
| 214 | return $return; |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | /** |
|---|
| 219 | * customer_idから顧客情報を取得する |
|---|
| 220 | * |
|---|
| 221 | * @param mixed $customer_id |
|---|
| 222 | * @param mixed $mask_flg |
|---|
| 223 | * @access public |
|---|
| 224 | * @return array 顧客情報の配列を返す |
|---|
| 225 | */ |
|---|
| 226 | function sfGetCustomerData($customer_id, $mask_flg = true) { |
|---|
| 227 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 228 | |
|---|
| 229 | // 顧客情報DB取得 |
|---|
| 230 | $ret = $objQuery->select("*","dtb_customer","customer_id=?", array($customer_id)); |
|---|
| 231 | $arrForm = $ret[0]; |
|---|
| 232 | |
|---|
| 233 | // 確認項目に複製 |
|---|
| 234 | $arrForm['email02'] = $arrForm['email']; |
|---|
| 235 | $arrForm['email_mobile02'] = $arrForm['email_mobile']; |
|---|
| 236 | |
|---|
| 237 | // 誕生日を年月日に分ける |
|---|
| 238 | if (isset($arrForm['birth'])){ |
|---|
| 239 | $birth = split(" ", $arrForm["birth"]); |
|---|
| 240 | list($arrForm['year'], $arrForm['month'], $arrForm['day']) = split("-",$birth[0]); |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | if ($mask_flg) { |
|---|
| 244 | $arrForm['password'] = DEFAULT_PASSWORD; |
|---|
| 245 | $arrForm['password02'] = DEFAULT_PASSWORD; |
|---|
| 246 | $arrForm['reminder_answer'] = DEFAULT_PASSWORD; |
|---|
| 247 | } |
|---|
| 248 | return $arrForm; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | /** |
|---|
| 252 | * sfGetUniqSecretKey |
|---|
| 253 | * |
|---|
| 254 | * 重複しない会員登録キーを発行する。 |
|---|
| 255 | * |
|---|
| 256 | * @access public |
|---|
| 257 | * @return void |
|---|
| 258 | */ |
|---|
| 259 | function sfGetUniqSecretKey() { |
|---|
| 260 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 261 | $count = 1; |
|---|
| 262 | while ($count != 0) { |
|---|
| 263 | $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r"); |
|---|
| 264 | $count = $objQuery->count("dtb_customer", "secret_key = ?", array($uniqid)); |
|---|
| 265 | } |
|---|
| 266 | return $uniqid; |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | /** |
|---|
| 271 | * sfGetCustomerId |
|---|
| 272 | * |
|---|
| 273 | * @param mixed $uniqid |
|---|
| 274 | * @param mixed $check_status |
|---|
| 275 | * @access public |
|---|
| 276 | * @return void |
|---|
| 277 | */ |
|---|
| 278 | function sfGetCustomerId($uniqid, $check_status = false) { |
|---|
| 279 | $objQuery =& SC_Query::getSingletonInstance(); |
|---|
| 280 | $where = "secret_key = ?"; |
|---|
| 281 | |
|---|
| 282 | if ($check_status) { |
|---|
| 283 | $where .= ' AND status = 1 AND del_flg = 0'; |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | return $objQuery->get("customer_id", "dtb_customer", $where, array($uniqid)); |
|---|
| 287 | } |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | /** |
|---|
| 291 | * 会員登録時フォーム初期化 |
|---|
| 292 | * |
|---|
| 293 | * @param mixed $objFormParam |
|---|
| 294 | * @access public |
|---|
| 295 | * @return void |
|---|
| 296 | */ |
|---|
| 297 | function sfCustomerEntryParam (&$objFormParam) { |
|---|
| 298 | SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | /** |
|---|
| 302 | * 会員情報変更フォーム初期化 |
|---|
| 303 | * |
|---|
| 304 | * @param mixed $objFormParam |
|---|
| 305 | * @access public |
|---|
| 306 | * @return void |
|---|
| 307 | */ |
|---|
| 308 | function sfCustomerMypageParam (&$objFormParam) { |
|---|
| 309 | SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); |
|---|
| 310 | if (SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE){ |
|---|
| 311 | $objFormParam->addParam('携帯メールアドレス', "email_mobile", MTEXT_LEN, "a", array("NO_SPTAB", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); |
|---|
| 312 | $objFormParam->addParam('携帯メールアドレス(確認)', "email_mobile02", MTEXT_LEN, "a", array("NO_SPTAB", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"), "", false); |
|---|
| 313 | } |
|---|
| 314 | } |
|---|
| 315 | |
|---|
| 316 | /** |
|---|
| 317 | * 会員フォーム共通 |
|---|
| 318 | * |
|---|
| 319 | * @param mixed $objFormParam |
|---|
| 320 | * @access public |
|---|
| 321 | * @return void |
|---|
| 322 | */ |
|---|
| 323 | function sfCustomerCommonParam (&$objFormParam) { |
|---|
| 324 | |
|---|
| 325 | $objFormParam->addParam("お名前(姓)", 'name01', STEXT_LEN, "aKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); |
|---|
| 326 | $objFormParam->addParam("お名前(名)", 'name02', STEXT_LEN, "aKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK")); |
|---|
| 327 | $objFormParam->addParam("お名前(フリガナ・姓)", 'kana01', STEXT_LEN, "CKV", array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK")); |
|---|
| 328 | $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 | $objFormParam->addParam("郵便番号1", "zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); |
|---|
| 333 | $objFormParam->addParam("郵便番号2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); |
|---|
| 334 | $objFormParam->addParam("都道府県", 'pref', INT_LEN, "n", array("EXIST_CHECK","NUM_CHECK")); |
|---|
| 335 | $objFormParam->addParam("住所1", "addr01", MTEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); |
|---|
| 336 | $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" )); |
|---|
| 340 | $objFormParam->addParam("性別", "sex", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); |
|---|
| 341 | $objFormParam->addParam("職業", "job", INT_LEN, "n", array("NUM_CHECK")); |
|---|
| 342 | $objFormParam->addParam("年", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); |
|---|
| 343 | $objFormParam->addParam("月", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); |
|---|
| 344 | $objFormParam->addParam("日", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); |
|---|
| 345 | $objFormParam->addParam("メールマガジン", "mailmaga_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); |
|---|
| 346 | |
|---|
| 347 | if (SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE){ |
|---|
| 348 | $objFormParam->addParam("FAX番号1", 'fax01', TEL_ITEM_LEN, "n", array("SPTAB_CHECK")); |
|---|
| 349 | $objFormParam->addParam("FAX番号2", 'fax02', TEL_ITEM_LEN, "n", array("SPTAB_CHECK")); |
|---|
| 350 | $objFormParam->addParam("FAX番号3", 'fax03', TEL_ITEM_LEN, "n", array("SPTAB_CHECK")); |
|---|
| 351 | $objFormParam->addParam("パスワード(確認)", 'password02', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK"), "", false); |
|---|
| 352 | $objFormParam->addParam('メールアドレス', "email", MTEXT_LEN, "a", array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); |
|---|
| 353 | $objFormParam->addParam('メールアドレス(確認)', "email02", MTEXT_LEN, "a", array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"), "", false); |
|---|
| 354 | } else { |
|---|
| 355 | $objFormParam->addParam('メールアドレス', "email", MTEXT_LEN, "a", array("EXIST_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK","MOBILE_EMAIL_CHECK")); |
|---|
| 356 | } |
|---|
| 357 | } |
|---|
| 358 | |
|---|
| 359 | /** |
|---|
| 360 | * 会員登録エラーチェック |
|---|
| 361 | * |
|---|
| 362 | * @param mixed $objFormParam |
|---|
| 363 | * @access public |
|---|
| 364 | * @return array エラーの配列 |
|---|
| 365 | */ |
|---|
| 366 | function sfCustomerEntryErrorCheck(&$objFormParam) { |
|---|
| 367 | $objErr->arrErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); |
|---|
| 368 | return $objErr->arrErr; |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | /** |
|---|
| 372 | * 会員情報変更エラーチェック |
|---|
| 373 | * |
|---|
| 374 | * @param mixed $objFormParam |
|---|
| 375 | * @access public |
|---|
| 376 | * @return array エラーの配列 |
|---|
| 377 | */ |
|---|
| 378 | function sfCustomerMypageErrorCheck(&$objFormParam) { |
|---|
| 379 | |
|---|
| 380 | $objFormParam->toLower('email_mobile'); |
|---|
| 381 | $objFormParam->toLower('email_mobile02'); |
|---|
| 382 | |
|---|
| 383 | $objErr->arrErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); |
|---|
| 384 | |
|---|
| 385 | if (isset($objErr->arrErr['password']) && $objFormParam->getValue('password') == DEFAULT_PASSWORD) { |
|---|
| 386 | unset($objErr->arrErr['password']); |
|---|
| 387 | unset($objErr->arrErr['password02']); |
|---|
| 388 | } |
|---|
| 389 | if (isset($objErr->arrErr['reminder_answer']) && $objFormParam->getValue('reminder_answer') == DEFAULT_PASSWORD) { |
|---|
| 390 | unset($objErr->arrErr['reminder_answer']); |
|---|
| 391 | } |
|---|
| 392 | return $objErr->arrErr; |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | /** |
|---|
| 396 | * 会員エラーチェック共通 |
|---|
| 397 | * |
|---|
| 398 | * @param mixed $objFormParam |
|---|
| 399 | * @access private |
|---|
| 400 | * @return array エラー情報の配列 |
|---|
| 401 | */ |
|---|
| 402 | function sfCustomerCommonErrorCheck(&$objFormParam) { |
|---|
| 403 | $objFormParam->convParam(); |
|---|
| 404 | $objFormParam->toLower('email'); |
|---|
| 405 | $objFormParam->toLower('email02'); |
|---|
| 406 | $arrParams = $objFormParam->getHashArray(); |
|---|
| 407 | |
|---|
| 408 | // 入力データを渡す。 |
|---|
| 409 | $objErr = new SC_CheckError($arrParams); |
|---|
| 410 | $objErr->arrErr = $objFormParam->checkError(); |
|---|
| 411 | |
|---|
| 412 | $objErr->doFunc(array("お電話番号", "tel01", "tel02", "tel03"),array("TEL_CHECK")); |
|---|
| 413 | $objErr->doFunc(array("郵便番号", "zip01", "zip02"), array("ALL_EXIST_CHECK")); |
|---|
| 414 | $objErr->doFunc(array("生年月日", "year", "month", "day"), array("CHECK_BIRTHDAY")); |
|---|
| 415 | |
|---|
| 416 | if (SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE){ |
|---|
| 417 | $objErr->doFunc(array('パスワード', 'パスワード(確認)', "password", "password02") ,array("EQUAL_CHECK")); |
|---|
| 418 | $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', "email", "email02") ,array("EQUAL_CHECK")); |
|---|
| 419 | $objErr->doFunc(array("FAX番号", "fax01", "fax02", "fax03") ,array("TEL_CHECK")); |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | // 現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可 |
|---|
| 423 | $objErr->doFunc(array("メールアドレス", "email"), array("CHECK_REGIST_CUSTOMER_EMAIL")); |
|---|
| 424 | |
|---|
| 425 | return $objErr->arrErr; |
|---|
| 426 | } |
|---|
| 427 | } |
|---|