Changeset 22069


Ignore:
Timestamp:
2012/11/04 07:02:38 (9 years ago)
Author:
pineray
Message:

#1958 (別お届け先関連の処理をページクラスから分離)

関数名が冗長なので変更.
other_deliv_id だけで対象を特定できるので引数を整理.

Location:
branches/version-2_12-dev/data/class
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Address.php

    r22065 r22069  
    3434     * お届け先を登録 
    3535     * 
    36      * @param integer $customer_id 
    3736     * @param array $sqlval 
    38      * @param integer $other_deliv_id 
    3937     * @return array() 
    4038     */ 
    41     function registAddress($customer_id, $sqlval, $other_deliv_id = '') { 
     39    function save($sqlval) { 
    4240        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     41        $customer_id = $sqlval['customer_id']; 
     42        $other_deliv_id = $sqlval['other_deliv_id']; 
    4343 
     44        // 顧客IDのチェック 
     45        if (is_null($customer_id) || !is_numeric($customer_id) || !preg_match("/^\d+$/", $customer_id)) { 
     46            SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, '顧客IDを正しく指定して下さい。'); 
     47        } 
    4448        // 追加 
    4549        if (strlen($other_deliv_id == 0)) { 
     
    5761        // 変更 
    5862        } else { 
    59             $deliv_count = $objQuery->count('dtb_other_deliv','customer_id = ? AND other_deliv_id = ?' ,array($customer_id, $other_deliv_id)); 
     63            $deliv_count = $objQuery->count('dtb_other_deliv','other_deliv_id = ?' ,array($other_deliv_id)); 
    6064            if ($deliv_count != 1) { 
    6165                SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, '一致する別のお届け先がありません。'); 
     
    7074     * お届け先を取得 
    7175     * 
    72      * @param integer $customer_id 
    7376     * @param integer $other_deliv_id 
    7477     * @return array() 
    7578     */ 
    76     function getAddress($customer_id, $other_deliv_id) { 
     79    function get($other_deliv_id) { 
    7780        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    78         $address = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ? AND other_deliv_id = ?', array($customer_id, $other_deliv_id)); 
     81        $address = $objQuery->select('*', 'dtb_other_deliv', 'other_deliv_id = ?', array($other_deliv_id)); 
    7982        return $address ? $address[0] : FALSE; 
    8083    } 
     
    100103     * お届け先の削除 
    101104     * 
    102      * @param integer $customerId 
    103105     * @param integer $delivId 
    104106     * @return void 
    105107     */ 
    106     function deleteAddress($customer_id, $other_deliv_id) { 
    107         $where      = 'customer_id = ? AND other_deliv_id = ?'; 
     108    function delete($other_deliv_id) { 
     109        $where      = 'other_deliv_id = ?'; 
    108110        $objQuery   =& SC_Query_Ex::getSingletonInstance(); 
    109         $objQuery->delete('dtb_other_deliv', $where, array($customer_id, $other_deliv_id)); 
     111        $objQuery->delete('dtb_other_deliv', $where, array($other_deliv_id)); 
    110112    } 
    111113 
  • branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_Delivery.php

    r22065 r22069  
    8585                } 
    8686 
    87                 $objAddress->deleteAddress($customer_id, $objFormParam->getValue('other_deliv_id')); 
     87                $objAddress->delete($objFormParam->getValue('other_deliv_id')); 
    8888                break; 
    8989 
  • branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php

    r22065 r22069  
    136136 
    137137                if ($_GET['other_deliv_id'] != '') { 
    138                     $arrOtherDeliv = $objAddress->getAddress($objCustomer->getValue('customer_id'), $_SESSION['other_deliv_id']); 
     138                    $arrOtherDeliv = $objAddress->get($_SESSION['other_deliv_id']); 
    139139 
    140140                    //不正アクセス判定 
     
    171171        $sqlval     = $objFormParam->getDbArray(); 
    172172 
     173        $sqlval['other_deliv_id'] = $arrRet['other_deliv_id']; 
    173174        $sqlval['customer_id'] = $customer_id; 
    174175 
    175         $objAddress->registAddress($customer_id, $sqlval, $arrRet['other_deliv_id']); 
     176        $objAddress->save($sqlval); 
    176177    } 
    177178 
  • branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php

    r22065 r22069  
    110110            // 削除 
    111111            case 'delete': 
    112                 $objAddress->deleteAddress($objCustomer->getValue('customer_id'), $arrForm['other_deliv_id']); 
     112                $objAddress->delete($arrForm['other_deliv_id']); 
    113113                break; 
    114114 
     
    228228        // 別のお届け先がチェックされている場合 
    229229        else { 
    230             $arrOtherDeliv = $objAddress->getAddress($objCustomer->getValue('customer_id'), $other_deliv_id); 
     230            $arrOtherDeliv = $objAddress->get($other_deliv_id); 
    231231            if (!$arrOtherDeliv) { 
    232232                return false; 
  • branches/version-2_12-dev/data/class/pages/shopping/LC_Page_Shopping_Multiple.php

    r22065 r22069  
    309309            if ($objCustomer->isLoginSuccess(true)) { 
    310310                if ($other_deliv_id != 0) { 
    311                     $otherDeliv = $objAddress->getAddress($objCustomer->getValue('customer_id'), $other_deliv_id); 
     311                    $otherDeliv = $objAddress->get($other_deliv_id); 
    312312                    foreach ($otherDeliv as $key => $val) { 
    313313                        $arrValues[$other_deliv_id]['shipping_' . $key] = $val; 
Note: See TracChangeset for help on using the changeset viewer.