Ignore:
Timestamp:
2009/01/13 22:41:55 (15 years ago)
Author:
x41
Message:

ステータスを発送にした場合にポイント付与するようにコミットしておりましたが、付与後のキャンセルや新規等に戻した場合にポイントを付与する前のポイント数に戻し、キャンセルの場合は使用したポイントも自動で返還されるにようにしました。キャンセルから新規に戻した場合は使用したポイントは再び自動で差し引きされます。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/admin/order/LC_Page_Admin_Order_Status.php

    r17422 r17741  
    160160        $where = 'order_id = ?'; 
    161161        $arrUpdate = array('update_date' => 'NOW()'); 
    162     $col = 'customer_id, add_point'; 
     162    $col = 'customer_id, add_point, use_point, status'; 
    163163 
    164164        $delflg  = '1'; // 削除フラグ 
     
    184184                if ( $val != "" ) { 
    185185        if ( $status_id == ORDER_DELIV ) { 
    186         $arrRet = $objQuery->select($col, $table, $where, array($val)); 
    187         $customer_id = $arrRet[0]['customer_id']; 
    188         $add_point = $arrRet[0]['add_point']; 
    189         if($customer_id != "" && $customer_id >= 1) { 
    190             $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
    191             $arrRet[0]['point']+= $add_point; 
    192             $sqlval['point'] = $arrRet[0]['point']; 
    193             $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
    194            } 
    195         } 
     186        $arrRet = $objQuery->select($col, $table, $where, array($val)); 
     187        $customer_id = $arrRet[0]['customer_id']; 
     188        $add_point = $arrRet[0]['add_point']; 
     189        $status = $arrRet[0]['status']; 
     190        if($customer_id != "" && $customer_id >= 1) { 
     191            $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     192            $arrRet[0]['point']+= $add_point; 
     193            $sqlval['point'] = $arrRet[0]['point']; 
     194            $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     195          } 
     196        } 
     197         elseif ( $status_id == ORDER_CANCEL ) { 
     198            $arrRet = $objQuery->select($col, $table, $where, array($val)); 
     199            $customer_id = $arrRet[0]['customer_id']; 
     200            $add_point = $arrRet[0]['add_point']; 
     201            $use_point = $arrRet[0]['use_point']; 
     202            $status = $arrRet[0]['status']; 
     203            if($customer_id != "" && $customer_id >= 1) { 
     204               if($status == 5) { 
     205               $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     206               $arrRet[0]['point']-= $add_point; 
     207               $arrRet[0]['point']+= $use_point; 
     208               $sqlval['point'] = $arrRet[0]['point']; 
     209               $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     210            } else { 
     211               $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     212               $arrRet[0]['point']+= $use_point; 
     213               $sqlval['point'] = $arrRet[0]['point']; 
     214               $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     215            } 
     216          } 
     217        } 
     218        else { 
     219            $arrRet = $objQuery->select($col, $table, $where, array($val)); 
     220            $customer_id = $arrRet[0]['customer_id']; 
     221            $add_point = $arrRet[0]['add_point']; 
     222            $use_point = $arrRet[0]['use_point']; 
     223            $status = $arrRet[0]['status']; 
     224            if($customer_id != "" && $customer_id >= 1) { 
     225               if($status == 5) { 
     226               $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     227               $arrRet[0]['point']-= $add_point; 
     228               $sqlval['point'] = $arrRet[0]['point']; 
     229               $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     230            } 
     231             elseif($status == 3) { 
     232               $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     233               $arrRet[0]['point']-= $use_point; 
     234               $sqlval['point'] = $arrRet[0]['point']; 
     235               $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     236            } 
     237            else { 
     238               $arrRet = $objQuery->select("point", 'dtb_customer', 'customer_id = ?', array($customer_id)); 
     239               $sqlval['point'] = $arrRet[0]['point']; 
     240               $objQuery->update('dtb_customer', $sqlval, 'customer_id = ?', array($customer_id)); 
     241            } 
     242          } 
     243         } 
    196244                    $objQuery->update($table, $arrUpdate, $where, array($val)); 
    197245                } 
Note: See TracChangeset for help on using the changeset viewer.