Changeset 21036


Ignore:
Timestamp:
2011/07/21 17:49:18 (13 years ago)
Author:
sunat134
Message:

#1401 (受注編集時で支払方法変更時にpayment_methodが更新されない)
payment_idが変更された場合のみ、名称も変更するするように。
支払い方法が削除された場合も考慮するようにしました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php

    r21019 r21036  
    125125        $objFormParam->convParam(); 
    126126        $order_id = $objFormParam->getValue('order_id'); 
     127        $arrValuesBefore = array(); 
    127128 
    128129        // DBから受注情報を読み込む 
     
    130131            $this->setOrderToFormParam($objFormParam, $order_id); 
    131132            $this->tpl_subno = 'index'; 
     133            $arrValuesBefore['payment_id'] = $objFormParam->getValue('payment_id'); 
     134            $arrValuesBefore['payment_method'] = $objFormParam->getValue('payment_method'); 
    132135        } else { 
    133136            $this->tpl_subno = 'add'; 
    134137            $this->tpl_mode = 'add'; 
     138            $arrValuesBefore['payment_id'] = NULL; 
     139            $arrValuesBefore['payment_method'] = NULL; 
    135140        } 
    136141 
     
    148153            if (SC_Utils_Ex::isBlank($this->arrErr)) { 
    149154                $message = '受注を編集しました。'; 
    150                 $order_id = $this->doRegister($order_id, $objPurchase, $objFormParam, $message); 
     155                $order_id = $this->doRegister($order_id, $objPurchase, $objFormParam, $message, $arrValuesBefore); 
    151156                if ($order_id >= 0) { 
    152157                    $this->setOrderToFormParam($objFormParam, $order_id); 
     
    163168                if (SC_Utils_Ex::isBlank($this->arrErr)) { 
    164169                    $message = '受注を登録しました。'; 
    165                     $order_id = $this->doRegister(null, $objPurchase, $objFormParam, $message); 
     170                    $order_id = $this->doRegister(null, $objPurchase, $objFormParam, $message, $arrValuesBefore); 
    166171                    if ($order_id >= 0) { 
    167172                        $this->tpl_mode = 'edit'; 
     
    242247        $this->tpl_onload .= $this->getAnchorKey($objFormParam); 
    243248        $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); 
     249        if ($arrValuesBefore['payment_id']) 
     250            $this->arrPayment[$arrValuesBefore['payment_id']] = $arrValuesBefore['payment_method']; 
     251 
    244252    } 
    245253 
     
    606614     * @param SC_FormParam $objFormParam SC_FormParam インスタンス 
    607615     * @param string $message 通知メッセージ 
     616     * @param array $arrValuesBefore 更新前の受注情報 
    608617     * @return integer $order_id 受注ID 
    609618     * 
    610619     * エラー発生時は負数を返す。 
    611620     */ 
    612     function doRegister($order_id, &$objPurchase, &$objFormParam, &$message) { 
     621    function doRegister($order_id, &$objPurchase, &$objFormParam, &$message, &$arrValuesBefore) { 
    613622 
    614623        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     
    618627 
    619628        $objQuery->begin(); 
     629         
     630        // 支払い方法が変更されたら、支払い方法名称も更新 
     631        if ($arrValues['payment_id'] != $arrValuesBefore['payment_id']) { 
     632            $arrValues['payment_method'] = $this->arrPayment[$arrValues['payment_id']]; 
     633            $arrValuesBefore['payment_id'] = NULL; 
     634        } 
    620635 
    621636        // 受注テーブルの更新 
Note: See TracChangeset for help on using the changeset viewer.