Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

受注編集画面で数値項目に空文字を入力された場合にシステムエラーになるのを修正 #1129

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions data/Smarty/templates/admin/order/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@
<td class="center">
<!--{assign var=key value="price"}-->
<span class="attention"><!--{$arrErr[$key][$product_index]}--></span>
<input type="text" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="6" class="box6" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" />
<input type="number" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="6" class="box6" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" />
</td>
<td class="center">
<!--{assign var=key value="quantity"}-->
<span class="attention"><!--{$arrErr[$key][$product_index]}--></span>
<input type="text" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" onChange="quantityCopyForSingleShipping('<!--{$product_index}-->')" />
<input type="number" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" onChange="quantityCopyForSingleShipping('<!--{$product_index}-->')" />
</td>
<!--{assign var=price value="`$arrForm.price.value[$product_index]`"}-->
<!--{assign var=quantity value="`$arrForm.quantity.value[$product_index]`"}-->
Expand All @@ -432,7 +432,7 @@
<!--{$price|sfCalcIncTax:$tax_rate:$tax_rule|n2s}--><br />
<!--{assign var=key value="tax_rate"}-->
<span class="attention"><!--{$arrErr[$key][$product_index]}--></span>
税率<input type="text" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" />%
税率<input type="number" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" />%
</td>
<td class="right"><!--{($price|sfCalcIncTax:$tax_rate:$tax_rule*$quantity)|n2s}--></td>
</tr>
Expand All @@ -446,7 +446,7 @@
<td class="right">
<!--{assign var=key value="discount"}-->
<span class="attention"><!--{$arrErr[$key]}--></span>
<input type="text" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
<input type="number" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
</td>
</tr>
Expand All @@ -455,7 +455,7 @@
<td class="right">
<!--{assign var=key value="deliv_fee"}-->
<span class="attention"><!--{$arrErr[$key]}--></span>
<input type="text" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
<input type="number" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
</td>
</tr>
Expand All @@ -464,7 +464,7 @@
<td class="right">
<!--{assign var=key value="charge"}-->
<span class="attention"><!--{$arrErr[$key]}--></span>
<input type="text" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
<input type="number" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
</td>
</tr>
Expand All @@ -489,7 +489,7 @@
<td class="right">
<!--{assign var=key value="use_point"}-->
<span class="attention"><!--{$arrErr[$key]}--></span>
<input type="text" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|default:0|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
<input type="number" name="<!--{$key}-->" value="<!--{$arrForm[$key].value|default:0|h}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" size="5" class="box6" />
pt
</td>
</tr>
Expand Down
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
Loading