Index: branches/comu-ver2/data/class/helper/SC_Helper_DB.php
===================================================================
--- branches/comu-ver2/data/class/helper/SC_Helper_DB.php	(revision 18436)
+++ branches/comu-ver2/data/class/helper/SC_Helper_DB.php	(revision 18489)
@@ -206,9 +206,9 @@
     function sf_getBasisData($force = false) {
         static $data;
-        
+
         if ($force || !isset($data)) {
             $objQuery = new SC_Query();
             $arrRet = $objQuery->select('*', 'dtb_baseinfo');
-            
+
             if (isset($arrRet[0])) {
                 $data = $arrRet[0];
@@ -217,5 +217,5 @@
             }
         }
-        
+
         return $data;
     }
@@ -344,5 +344,5 @@
                     $quantity = $arrCart['quantity'];
                 }
-                
+
                 // (商品規格単位でなく)商品単位での評価のための準備
                 $product_id = $arrCart['id'][0];
@@ -350,5 +350,5 @@
                 $arrQuantityInfo_by_product[$product_id]['sale_limit'] = $arrData['sale_limit'];
                 $arrQuantityInfo_by_product[$product_id]['name'] = $arrData['name'];
-                
+
                 $objPage->arrProductsClass[$cnt] = $arrData;
                 $objPage->arrProductsClass[$cnt]['quantity'] = $quantity;
@@ -391,5 +391,5 @@
             }
         }
-        
+
         foreach ($arrQuantityInfo_by_product as $product_id => $quantityInfo) {
             if (SC_Utils_Ex::sfIsInt($quantityInfo['sale_limit']) && $quantityInfo['quantity'] > $quantityInfo['sale_limit']) {
@@ -404,5 +404,5 @@
             }
         }
-        
+
         // 全商品合計金額(税込み)
         $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal();
@@ -439,5 +439,5 @@
                 $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
             }
-            
+
             // 受注_Tempテーブルの名称列を更新
             $this->sfUpdateOrderNameCol($uniqid, true);
@@ -987,18 +987,18 @@
             GROUP BY T1.category_id, T2.category_id
 __EOS__;
-        
+
         $objQuery->query($sql);
 
         //子カテゴリ内の商品数を集計する
-        
+
         // カテゴリ情報を取得
         $arrCat = $objQuery->select('category_id', 'dtb_category');
-        
+
         foreach ($arrCat as $row) {
             $category_id = $row['category_id'];
             $arrval = array();
-            
+
             $arrval[] = $category_id;
-            
+
             list($tmp_where, $tmp_arrval) = $this->sfGetCatWhere($category_id);
             if ($tmp_where != "") {
@@ -1008,5 +1008,5 @@
                 $sql_where_product_ids = '0<>0'; // 一致させない
             }
-            
+
             $sql = <<< __EOS__
                 INSERT INTO dtb_category_total_count (category_id, product_count, create_date)
@@ -1018,5 +1018,5 @@
                 WHERE ($sql_where) AND ($sql_where_product_ids)
 __EOS__;
-            
+
             $objQuery->query($sql, $arrval);
         }
@@ -1521,5 +1521,5 @@
         // 店舗基本情報を取得する
         $arrInfo = SC_Helper_DB_Ex::sf_getBasisData();
-        
+
         // 未定義変数を定義
         if (!isset($arrData['deliv_pref'])) $arrData['deliv_pref'] = "";
@@ -1553,5 +1553,5 @@
             // 商品の合計数量
             $total_quantity = $objCartSess->getTotalQuantity(true);
-            
+
             if($total_quantity >= DELIV_FREE_AMOUNT) {
                 $arrData['deliv_fee'] = 0;
@@ -1576,5 +1576,5 @@
         if (USE_POINT !== false) {
             $arrData['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point']);
-                
+
             if($objCustomer != "") {
                 // 誕生日月であった場合
@@ -1765,5 +1765,5 @@
     function sfUpdateOrderNameCol($order_id, $temp_table = false) {
         $objQuery = new SC_Query();
-        
+
         if ($temp_table) {
             $tgt_table = 'dtb_order_temp';
@@ -1773,5 +1773,5 @@
             $sql_where = 'WHERE order_id = ?';
         }
-        
+
         $sql = <<< __EOS__
             UPDATE
@@ -1782,5 +1782,5 @@
             $sql_where
 __EOS__;
-        
+
         $objQuery->query($sql, array($order_id));
     }
@@ -1795,5 +1795,5 @@
         // 店舗基本情報を取得
         $CONF = SC_Helper_DB_Ex::sf_getBasisData();
-        
+
         return SC_Utils_Ex::sfTax($price, $CONF['tax'], $CONF['tax_rule']);
     }
@@ -1808,5 +1808,5 @@
         // 店舗基本情報を取得
         $CONF = SC_Helper_DB_Ex::sf_getBasisData();
-        
+
         return SC_Utils_Ex::sfPreTax($price, $CONF['tax'], $CONF['tax_rule']);
     }
@@ -1822,5 +1822,5 @@
         // 店舗基本情報を取得
         $CONF = SC_Helper_DB_Ex::sf_getBasisData();
-        
+
         return SC_Utils_Ex::sfGetAddPoint($totalpoint, $use_point, $CONF['point_rate']);
     }
@@ -1834,39 +1834,56 @@
      * @param integer|null $newStatus 対応状況 (null=変更無し)
      * @param integer|null $newAddPoint 加算ポイント (null=変更無し)
-     * @param integer|null $newUsePoint ポイント (null=変更無し)
+     * @param integer|null $newUsePoint 使用ポイント (null=変更無し)
      * @return void
      */
     function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddPoint = null, $newUsePoint = null) {
         $objQuery = new SC_Query();
-        
+
         $arrOrderOld = $objQuery->getRow('dtb_order', 'status, add_point, use_point, customer_id', 'order_id = ?', array($orderId));
-        
-        // 対応状況
+
+        // 対応状況が変更無しの場合、DB値を引き継ぐ
         if (is_null($newStatus)) {
             $newStatus = $arrOrderOld['status'];
         }
-        
+
+        // 使用ポイント、DB値を引き継ぐ
+        if (is_null($newUsePoint)) {
+            $newUsePoint = $arrOrderOld['use_point'];
+        }
+
+        // 加算ポイント、DB値を引き継ぐ
+        if (is_null($newAddPoint)) {
+            $newAddPoint = $arrOrderOld['add_point'];
+        }
+
         if (USE_POINT !== false) {
-            $addPoint = 0;
-            
-            // 使用ポイント
-            if (!is_null($newUsePoint)) {
-                $addPoint += $arrOrderOld['use_point']; // 変更前のポイントを戻す
-                $addPoint -= $newUsePoint;              // 変更後のポイントを引く
-            }
-            
+            // 顧客.ポイントの加減値
+            $addCustomerPoint = 0;
+
+            // ▼使用ポイント
+            // 変更前の対応状況が利用対象の場合、変更前の使用ポイント分を戻す
+            if (SC_Utils_Ex::sfIsUsePoint($arrOrderOld['status'])) {
+                $addCustomerPoint += $arrOrderOld['use_point'];
+            }
+
+            // 変更後の対応状況が利用対象の場合、変更後の使用ポイント分を引く
+            if (SC_Utils_Ex::sfIsUsePoint($newStatus)) {
+                $addCustomerPoint -= $newUsePoint;
+            }
+            // ▲使用ポイント
+
             // ▼加算ポイント
-            // 変更前の状態が加算対象の場合、
+            // 変更前の対応状況が加算対象の場合、変更前の加算ポイント分を戻す
             if (SC_Utils_Ex::sfIsAddPoint($arrOrderOld['status'])) {
-                $addPoint -= $arrOrderOld['add_point'];
-            }
-            
-            // 変更後の状態が加算対象の場合、
+                $addCustomerPoint -= $arrOrderOld['add_point'];
+            }
+
+            // 変更後の対応状況が加算対象の場合、変更後の加算ポイント分を足す
             if (SC_Utils_Ex::sfIsAddPoint($newStatus)) {
-                $addPoint += is_null($newAddPoint) ? $arrOrderOld['add_point'] : $newAddPoint;
+                $addCustomerPoint += $newAddPoint;
             }
             // ▲加算ポイント
-            
-            if ($addPoint != 0) {
+
+            if ($addCustomerPoint != 0) {
                 // ▼顧客テーブルの更新
                 $sqlval = array();
@@ -1875,19 +1892,19 @@
                 $arrRawSql = array();
                 $arrRawSqlVal = array();
-                
+
                 $sqlval['update_date'] = 'Now()';
                 $arrRawSql['point'] = 'point + ?';
-                $arrRawSqlVal[] = $addPoint;
+                $arrRawSqlVal[] = $addCustomerPoint;
                 $where .= 'customer_id = ?';
                 $arrVal[] = $arrOrderOld['customer_id'];
-                
+
                 $objQuery->update('dtb_customer', $sqlval, $where, $arrVal, $arrRawSql, $arrRawSqlVal);
                 // ▲顧客テーブルの更新
-                
-                // ポイントをマイナスした場合、
-                if ($addPoint < 0) {
+
+                // 顧客.ポイントをマイナスした場合、
+                if ($addCustomerPoint < 0) {
                     $sql = 'SELECT point FROM dtb_customer WHERE customer_id = ?';
                     $point = $objQuery->getone($sql, array($arrOrderOld['customer_id']));
-                    // 変更後のポイントがマイナスの場合、
+                    // 変更後の顧客.ポイントがマイナスの場合、
                     if ($point < 0) {
                         // ロールバック
@@ -1899,14 +1916,10 @@
             }
         }
-        
+
         // ▼受注テーブルの更新
         $sqlval = array();
         if (USE_POINT !== false) {
-            if (!is_null($newAddPoint)) {
-                $sqlval['add_point'] = $newAddPoint;
-            }
-            if (!is_null($newUsePoint)) {
-                $sqlval['use_point'] = $newUsePoint;
-            }
+            $sqlval['add_point'] = $newAddPoint;
+            $sqlval['use_point'] = $newUsePoint;
         }
         // ステータスが発送済みに変更の場合、発送日を更新
@@ -1916,5 +1929,5 @@
         $sqlval['status'] = $newStatus;
         $sqlval['update_date'] = 'Now()';
-        
+
         $objQuery->update('dtb_order', $sqlval, 'order_id = ?', array($orderId));
         // ▲受注テーブルの更新
Index: branches/comu-ver2/data/class/util/SC_Utils.php
===================================================================
--- branches/comu-ver2/data/class/util/SC_Utils.php	(revision 18435)
+++ branches/comu-ver2/data/class/util/SC_Utils.php	(revision 18489)
@@ -2054,4 +2054,21 @@
 
     /**
+     * ポイント使用するかの判定
+     * 
+     * @param integer $status 対応状況
+     * @return boolean 使用するか(顧客テーブルから減算するか)
+     */
+    function sfIsUsePoint($status) {
+        switch ($status) {
+            case ORDER_CANCEL:      // キャンセル
+                return false;
+            default:
+                break;
+        }
+
+        return true;
+    }
+
+    /**
      * ポイント加算するかの判定
      * 
@@ -2074,5 +2091,5 @@
                 break;
         }
-        
+
         return false;
     }
Index: branches/comu-ver2/data/Smarty/templates/default/admin/order/edit.tpl
===================================================================
--- branches/comu-ver2/data/Smarty/templates/default/admin/order/edit.tpl	(revision 18464)
+++ branches/comu-ver2/data/Smarty/templates/default/admin/order/edit.tpl	(revision 18489)
@@ -99,4 +99,13 @@
         <!--{/if}-->
         <tr>
+            <th>注文番号</th>
+            <td><!--{$arrForm.order_id.value}--></td>
+        </tr>
+        <tr>
+            <th>受注日</th>
+            <td><!--{$arrForm.create_date.value|sfDispDBDate}--></td>
+            <input type="hidden" name="create_date" value="<!--{$arrForm.create_date.value}-->" />
+        </tr>
+        <tr>
             <th>対応状況</th>
             <td>
@@ -125,13 +134,4 @@
     <table class="form">
         <tr>
-            <th>注文番号</th>
-            <td><!--{$arrForm.order_id.value}--></td>
-        </tr>
-        <tr>
-            <th>受注日</th>
-            <td><!--{$arrForm.create_date.value|sfDispDBDate}--></td>
-            <input type="hidden" name="create_date" value="<!--{$arrForm.create_date.value}-->" />
-        </tr>
-        <tr>
             <th>顧客ID</th>
             <td>
@@ -214,4 +214,15 @@
             <th>備考</th>
             <td><!--{$arrForm.message.value|escape|nl2br}--></td>
+        </tr>
+        <tr>
+            <th>現在ポイント</th>
+            <td>
+                <!--{if $arrForm.customer_id > 0}-->
+                    <!--{$arrForm.point.value|number_format}-->
+                     pt
+                <!--{else}-->
+                    （非会員）
+            <!--{/if}-->
+            </td>
         </tr>
     </table>
@@ -408,15 +419,4 @@
                 </td>
             </tr>
-            <tr>
-                <!--{if $arrForm.customer_id > 0}-->
-                <th colspan="5" class="right">現在ポイント（ポイントの修正は<a href="?" onclick="return fnEdit('<!--{$arrForm.customer_id.value}-->');">顧客編集</a>から手動にてお願い致します。）</th>
-                <td class="right">
-                    <!--{$arrForm.point.value|number_format}-->
-                     pt
-                </td>
-                <!--{else}-->
-                <th colspan="5" class="right">現在ポイント</th><td align="center">（なし）</td>
-                <!--{/if}-->
-            </tr>
         <!--{/if}-->
     </table>
