Exemplo n.º 1
0
 /**
  * 受注番号、最終ポイント、加算ポイント、利用ポイントから「オーダー前ポイント」を取得する
  *
  * @param  integer $order_id     受注番号
  * @param  integer $use_point    利用ポイント
  * @param  integer $add_point    加算ポイント
  * @param  integer $order_status 対応状況
  * @return array   オーダー前ポイントの配列
  */
 public function getRollbackPoint($order_id, $use_point, $add_point, $order_status)
 {
     /* @var $objQuery Query */
     $objQuery = Application::alias('eccube.query');
     $arrRet = $objQuery->select('customer_id', 'dtb_order', 'order_id = ?', array($order_id));
     $customer_id = $arrRet[0]['customer_id'];
     if ($customer_id != '' && $customer_id >= 1) {
         $arrRet = $objQuery->select('point', 'dtb_customer', 'customer_id = ?', array($customer_id));
         $point = $arrRet[0]['point'];
         $rollback_point = $arrRet[0]['point'];
         // 対応状況がポイント利用対象の場合、使用ポイント分を戻す
         if (PurchaseHelper::isUsePoint($order_status)) {
             $rollback_point += $use_point;
         }
         // 対応状況がポイント加算対象の場合、加算ポイント分を戻す
         if (PurchaseHelper::isAddPoint($order_status)) {
             $rollback_point -= $add_point;
         }
     } else {
         $rollback_point = '';
         $point = '';
     }
     return array($point, $rollback_point);
 }