Changeset 20178


Ignore:
Timestamp:
2011/02/17 14:11:57 (11 years ago)
Author:
AMUAMU
Message:

#965 (リファクタリング [管理画面]顧客管理) 管理側からも使えるように一部修正、共有処理を移動

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/helper/SC_Helper_Customer.php

    r20170 r20178  
    318318     * 
    319319     * @param mixed $objFormParam 
    320      * @access public 
    321      * @return void 
    322      */ 
    323     function sfCustomerEntryParam (&$objFormParam) { 
     320     * @param boolean isAdmin true:管理者画面 false:会員向け 
     321     * @access public 
     322     * @return void 
     323     */ 
     324    function sfCustomerEntryParam (&$objFormParam, $isAdmin = false) { 
    324325        SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam); 
    325         SC_Helper_Customer_Ex::sfCustomerRegisterParam($objFormParam); 
     326        SC_Helper_Customer_Ex::sfCustomerRegisterParam($objFormParam, $isAdmin); 
     327        if($isAdmin) { 
     328            $objFormParam->addParam('携帯メールアドレス', "email_mobile", MTEXT_LEN, "a", array("NO_SPTAB", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK")); 
     329        } 
    326330    } 
    327331 
     
    368372        $objFormParam->addParam("郵便番号1", "zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
    369373        $objFormParam->addParam("郵便番号2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
    370         $objFormParam->addParam("都道府県", 'pref', INT_LEN, "n", array("EXIST_CHECK","NUM_CHECK")); 
    371         $objFormParam->addParam("住所1", "addr01", MTEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); 
    372         $objFormParam->addParam("住所2", "addr02", MTEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK")); 
    373         $objFormParam->addParam("お電話番号1", 'tel01', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 
    374         $objFormParam->addParam("お電話番号2", 'tel02', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 
    375         $objFormParam->addParam("お電話番号3", 'tel03', TEL_ITEM_LEN, "n", array("EXIST_CHECK","SPTAB_CHECK")); 
     374        $objFormParam->addParam("都道府県", 'pref', INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 
     375        $objFormParam->addParam("住所1", "addr01", MTEXT_LEN, "aKV", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     376        $objFormParam->addParam("住所2", "addr02", MTEXT_LEN, "aKV", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     377        $objFormParam->addParam("お電話番号1", 'tel01', TEL_ITEM_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     378        $objFormParam->addParam("お電話番号2", 'tel02', TEL_ITEM_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     379        $objFormParam->addParam("お電話番号3", 'tel03', TEL_ITEM_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    376380    } 
    377381 
     
    380384     * 
    381385     */ 
    382     function sfCustomerRegisterParam (&$objFormParam) { 
    383         $objFormParam->addParam("パスワード", 'password', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK")); 
    384         $objFormParam->addParam("パスワード確認用の質問", "reminder", STEXT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 
    385         $objFormParam->addParam("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN, "aKV", array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK")); 
    386         $objFormParam->addParam("性別", "sex", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 
    387         $objFormParam->addParam("職業", "job", INT_LEN, "n", array("NUM_CHECK")); 
    388         $objFormParam->addParam("年", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); 
    389         $objFormParam->addParam("月", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); 
    390         $objFormParam->addParam("日", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false); 
    391         $objFormParam->addParam("メールマガジン", "mailmaga_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK")); 
     386    function sfCustomerRegisterParam (&$objFormParam, $isAdmin = false) { 
     387        if($isAdmin) { 
     388            $objFormParam->addParam("パスワード", 'password', STEXT_LEN, "a", array("SPTAB_CHECK", "ALNUM_CHECK", "MAX_LENGTH_CHECK")); 
     389            $objFormParam->addParam("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN, "aKV", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     390        }else{ 
     391            $objFormParam->addParam("パスワード", 'password', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK", "ALNUM_CHECK", "MAX_LENGTH_CHECK")); 
     392            $objFormParam->addParam("パスワード確認用の質問の答え", "reminder_answer", STEXT_LEN, "aKV", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     393        } 
     394        $objFormParam->addParam("パスワード確認用の質問", "reminder", STEXT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     395        $objFormParam->addParam("性別", "sex", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     396        $objFormParam->addParam("職業", "job", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
     397        $objFormParam->addParam("年", "year", 4, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"), "", false); 
     398        $objFormParam->addParam("月", "month", 2, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"), "", false); 
     399        $objFormParam->addParam("日", "day", 2, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"), "", false); 
     400        $objFormParam->addParam("メールマガジン", "mailmaga_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    392401 
    393402        if (SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE){ 
     
    395404            $objFormParam->addParam("FAX番号2", 'fax02', TEL_ITEM_LEN, "n", array("SPTAB_CHECK")); 
    396405            $objFormParam->addParam("FAX番号3", 'fax03', TEL_ITEM_LEN, "n", array("SPTAB_CHECK")); 
    397             $objFormParam->addParam("パスワード(確認)", 'password02', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK"), "", false); 
    398406            $objFormParam->addParam('メールアドレス', "email", MTEXT_LEN, "a", array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); 
    399             $objFormParam->addParam('メールアドレス(確認)', "email02", MTEXT_LEN, "a", array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"), "", false); 
     407            if(!$isAdmin) { 
     408                $objFormParam->addParam("パスワード(確認)", 'password02', STEXT_LEN, "a", array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK"), "", false); 
     409                $objFormParam->addParam('メールアドレス(確認)', "email02", MTEXT_LEN, "a", array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"), "", false); 
     410            } 
    400411        } else { 
    401412            $objFormParam->addParam('メールアドレス', "email", MTEXT_LEN, "a", array("EXIST_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK","MOBILE_EMAIL_CHECK")); 
     
    404415 
    405416    function sfCustomerOtherDelivErrorCheck(&$objFormParam) { 
    406         $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); 
     417        $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); 
    407418        return $objErr->arrErr; 
    408419    } 
     
    416427     */ 
    417428    function sfCustomerEntryErrorCheck(&$objFormParam) { 
    418         $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); 
    419         $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck($objErr); 
     429        $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck(&$objFormParam); 
     430        $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck(&$objErr); 
    420431 
    421432        return $objErr->arrErr; 
     
    435446 
    436447        $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam); 
    437         $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck($objErr); 
     448        $objErr = SC_Helper_Customer_Ex::sfCustomerRegisterErrorCheck(&$objErr); 
    438449 
    439450        if (isset($objErr->arrErr['password']) && $objFormParam->getValue('password') == DEFAULT_PASSWORD) { 
     
    487498        return $objErr; 
    488499    } 
     500 
     501    /** 
     502     * 顧客検索パラメーター(管理画面用) 
     503     * 
     504     * @param mixed $objFormParam 
     505     * @access public 
     506     * @return void 
     507     */ 
     508    function sfSetSearchParam(&$objFormParam) { 
     509        $objFormParam->addParam('顧客ID', 'customer_id', ID_MAX_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     510        $objFormParam->addParam('顧客名', 'name', STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     511        $objFormParam->addParam('顧客名(カナ)', 'kana', STEXT_LEN, 'CKV', array("SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANABLANK_CHECK")); 
     512        $objFormParam->addParam('都道府県', 'pref', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     513        $objFormParam->addParam('誕生日(開始年)', 'b_start_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     514        $objFormParam->addParam('誕生日(開始月)', 'b_start_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     515        $objFormParam->addParam('誕生日(開始日)', 'b_start_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     516 
     517        $objFormParam->addParam('誕生日(終了年)', 'b_end_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     518        $objFormParam->addParam('誕生日(終了月)', 'b_end_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     519        $objFormParam->addParam('誕生日(終了日)', 'b_end_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     520        $objFormParam->addParam('誕生月', 'birth_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     521        $objFormParam->addParam('メールアドレス', 'email', MTEXT_LEN, 'a', array("SPTAB_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); 
     522        $objFormParam->addParam('携帯メールアドレス', 'email_mobile', MTEXT_LEN, 'a', array("SPTAB_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); 
     523        $objFormParam->addParam('電話番号', 'birth_month', TEL_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     524        $objFormParam->addParam('購入金額(開始)', 'buy_total_from', PRICE_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     525        $objFormParam->addParam('購入金額(終了)', 'buy_total_to', PRICE_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     526        $objFormParam->addParam('購入回数(開始)', 'buy_times_from', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     527        $objFormParam->addParam('購入回数(終了)', 'buy_times_to', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     528        $objFormParam->addParam('登録・更新日(開始年)', 'start_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     529        $objFormParam->addParam('登録・更新日(開始月)', 'start_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     530        $objFormParam->addParam('登録・更新日(開始日)', 'start_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     531        $objFormParam->addParam('登録・更新日(終了年)', 'end_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     532        $objFormParam->addParam('登録・更新日(終了月)', 'end_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     533        $objFormParam->addParam('登録・更新日(終了日)', 'end_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     534        $objFormParam->addParam('表示件数', 'page_rows', 3, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     535        $objFormParam->addParam('最終購入日(開始年)', 'buy_start_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     536        $objFormParam->addParam('最終購入日(開始月)', 'buy_start_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     537        $objFormParam->addParam('最終購入日(開始日)', 'buy_start_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     538        $objFormParam->addParam('最終購入日(終了年)', 'buy_end_year', 4, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     539        $objFormParam->addParam('最終購入日(終了月)', 'buy_end_month', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     540        $objFormParam->addParam('最終購入日(終了日)', 'buy_end_day', 2, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     541        $objFormParam->addParam('購入商品コード', 'buy_product_code', STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     542        $objFormParam->addParam('購入商品名', 'buy_product_name', STEXT_LEN, 'KVa', array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
     543        $objFormParam->addParam('カテゴリ', 'category_id', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     544        $objFormParam->addParam('編集対象顧客ID', 'edit_customer_id', INT_LEN, 'n', array("NUM_CHECK","MAX_LENGTH_CHECK")); 
     545        $objFormParam->addParam('性別', 'sex'); 
     546        $objFormParam->addParam('会員状態', 'status'); 
     547        $objFormParam->addParam('職業', 'job'); 
     548    } 
     549 
     550    /** 
     551     * 顧客検索パラメーター エラーチェック(管理画面用) 
     552     * 
     553     * @param mixed $objFormParam 
     554     * @access public 
     555     * @return array エラー配列 
     556     */ 
     557    function sfCheckErrorSearchParam(&$objFormParam) { 
     558        // パラメーターの基本チェック 
     559        $arrErr = $objFormParam->checkError(); 
     560        // 拡張エラーチェック初期化 
     561        $objErr = new SC_CheckError($objFormParam->getHashArray()); 
     562        // 拡張エラーチェック 
     563        $objErr->doFunc(array("誕生日(開始日)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE")); 
     564        $objErr->doFunc(array("誕生日(終了日)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE")); 
     565         
     566        $objErr->doFunc(array("誕生日(開始日)","誕生日(終了日)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM")); 
     567        $objErr->doFunc(array("登録・更新日(開始日)", "start_year", "start_month", "start_day",), array("CHECK_DATE")); 
     568        $objErr->doFunc(array("登録・更新日(終了日)", "end_year", "end_month", "end_day"), array("CHECK_DATE")); 
     569        $objErr->doFunc(array("登録・更新日(開始日)","登録・更新日(終了日)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM")); 
     570        $objErr->doFunc(array("最終購入日(開始日)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE")); 
     571        $objErr->doFunc(array("最終購入(終了日)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE")); 
     572        //購入金額(from) > 購入金額(to) の場合はエラーとする 
     573        $objErr->doFunc(array("最終購入日(開始日)","登録・更新日(終了日)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM")); 
     574 
     575        if ((SC_Utils_Ex::sfIsInt($array["buy_total_from"]) 
     576             && SC_Utils_Ex::sfIsInt($array["buy_total_to"])) 
     577             && ($array["buy_total_from"] > $array["buy_total_to"])) { 
     578            $objErr->arrErr["buy_total_from"] .= "※ 購入金額の指定範囲が不正です。"; 
     579        } 
     580 
     581        if ((SC_Utils_Ex::sfIsInt($array["buy_times_from"]) 
     582             && SC_Utils_Ex::sfIsInt($array["buy_times_to"])) 
     583             && ($array["buy_times_from"] > $array["buy_times_to"])) { 
     584            $objErr->arrErr["buy_times_from"] .= "※ 購入回数の指定範囲が不正です。"; 
     585        } 
     586        if(!SC_Utils::isBlank($objErr->arrErr)) { 
     587            $arrErr = array_merge($arrErr, $objErr->arrErr); 
     588        } 
     589        return $arrErr; 
     590    } 
    489591} 
Note: See TracChangeset for help on using the changeset viewer.