id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	modified_flg
2428	受注編集> 数量チェック不具合	shutta	kimoto	"コミュニティにて報告あり

v2.13.0 管理画面：受注変更画面（複数配送でない）の数量チェックの動作に不具合がある。[[BR]]
http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=13423&forum=9
{{{
受注情報変更画面にて、

デモデータをもとに、
１品目　なべ　数量１
２品目　アイス　数量１
の受注情報に対し、
・２行目のアイスの数量を２に変更

情報の更新をすると、
１行目のなべの数量欄に２が表示され、「数量が在庫数より少ない」とエラーになります。

この時点で、なべの在庫は、９９。アイスは、無制限になっています。
}}}

{{{
とりあえず、原因らしきものです。
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が実行されるため、動作不良になっていると思います。
}}}"	バグ指摘	closed	中	EC-CUBE2.13.3	管理画面	2.13.0	既出			0
