Ticket #2428 (closed バグ指摘: 既出)

Opened 9 years ago

Last modified 9 years ago

受注編集> 数量チェック不具合

Reported by: shutta Owned by: kimoto
Priority: Milestone: EC-CUBE2.13.3
Component: 管理画面 Version: 2.13.0
Keywords: Cc:
修正済み: no

Description

コミュニティにて報告あり

v2.13.0 管理画面:受注変更画面(複数配送でない)の数量チェックの動作に不具合がある。
 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=13423&forum=9

受注情報変更画面にて、

デモデータをもとに、
1品目 なべ 数量1
2品目 アイス 数量1
の受注情報に対し、
・2行目のアイスの数量を2に変更

情報の更新をすると、
1行目のなべの数量欄に2が表示され、「数量が在庫数より少ない」とエラーになります。

この時点で、なべの在庫は、99。アイスは、無制限になっています。
とりあえず、原因らしきものです。
data/class/pages/admin/order/LC_Page_Admin_Order_edit.php
にある新規関数 setProductsQuantity が悪さをしているようです。
呼び出し元をコメントにすると、正常に動作します。


    public function setProductsQuantity(&$objFormParam)
    {
        $arrShipmentsItems = $objFormParam->getSwapArray(array('shipment_product_class_id','shipment_quantity'));
        // 配送先が存在する時のみ、商品個数の再設定を行います
        if(!SC_Utils_Ex::isBlank($arrShipmentsItems)) {
            foreach ($arrShipmentsItems as $arritems) {
                foreach ($arritems['shipment_product_class_id'] as $relation_index => $shipment_product_class_id) {
                    $arrUpdateQuantity[$shipment_product_class_id] += $arritems['shipment_quantity'][$relation_index];
                }
            }

            $arrProductsClass = $objFormParam->getValue('product_class_id');
            $arrProductsQuantity = $objFormParam->getValue('quantity');
            foreach ($arrProductsClass as $relation_key => $product_class_id) {echo $relation_key;
                $arrQuantity['quantity'][$relation_key] = $arrUpdateQuantity[$product_class_id];
            }
            $objFormParam->setParam($arrQuantity);
        }
    }


疑問点
(1) $arrProductsQuantity = $objFormParam->getValue('quantity');
  いつ使用するのか。
(2) $arrQuantity['quantity'][$relation_key] = $arrUpdateQuantity[$product_class_id];
  受注編集画面の数量と同じ名称('quantity')を使用している。ユーザが操作した情報を強制的に書き換えていることになる。
  もし、配送情報をもとにした、数量合計を保持するためであれば、名称('quantity')とは異なる名称にすべきと思います。
こちらの原因は、複数配送でない場合であっても、
setProductsQuantityが実行されるため、動作不良になっていると思います。

Change History

comment:2 Changed 9 years ago by m_uehara

  • Milestone changed from EC-CUBE 2.13.1 to EC-CUBE 2.13.2

comment:3 Changed 9 years ago by h_yoshimoto

  • Milestone changed from EC-CUBE2.13.2 to EC-CUBE2.13.3

comment:4 Changed 9 years ago by kimoto

  • Owner changed from somebody to kimoto

comment:5 Changed 9 years ago by kimoto

 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=14734&forum=4&post_id=65948#forumpost65948

問題を定義してチケットを作成していただいた手前、 以下のチケットについて、閉じていただきたく。

(1)#2423 仕様の理解不足による謝った指摘です。取消をお願いします。 (2)#2428 #2485と同件です。 (3)#2520との重複チケットです。

お手数かけますが、よろしくお願いします。

comment:6 Changed 9 years ago by kimoto

  • Status changed from new to closed
  • Resolution set to 既出
Note: See TracTickets for help on using tickets.