Ticket #2428 (closed バグ指摘: 既出)
受注編集> 数量チェック不具合
| 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
Note: See
TracTickets for help on using
tickets.

追記あり http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=13423&forum=9&post_id=61215