Skip to content

Commit

Permalink
数値項目に空文字を入力された場合にシステムエラーになるのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Jan 9, 2025
1 parent 5ae14f6 commit ae454d1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,18 @@ public function lfCheckError(&$objFormParam)
{
$objProduct = new SC_Product_Ex();
$arrValues = $objFormParam->getHashArray();

// XXX 空文字が入ってくる場合があるので数値へキャストする
// きちんとエラーハンドリングすべきだが応急処置
foreach (['price', 'quantity', 'tax_rate'] as $key) {
foreach ($arrValues[$key] as &$val) {
$val = (int) $val;
}
}
foreach (['discount', 'charge', 'deliv_fee', 'use_point'] as $key) {
$arrValues[$key] = (int) $arrValues[$key];
}

$arrErr = [];
$arrErrTemp = $objFormParam->checkError();
$arrErrDate = [];
Expand Down Expand Up @@ -1217,7 +1229,9 @@ public function setProductsQuantity(&$objFormParam)
$arrUpdateQuantity = [];
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];
// XXX 空文字が入ってくる場合があるので数値へキャストする
// きちんとエラーハンドリングすべきだが応急処置
$arrUpdateQuantity[$shipment_product_class_id] += (int) $arritems['shipment_quantity'][$relation_index];
}
}

Expand Down

0 comments on commit ae454d1

Please sign in to comment.