Skip to content

Commit

Permalink
Merge branch 'master' into fix-adddeliv
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess authored Jan 16, 2025
2 parents 643efae + 35e42bf commit 190eb71
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
63 changes: 33 additions & 30 deletions data/class/SC_Fpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,39 +236,42 @@ private function setOrderData()

$arrTaxableTotal = [];
$defaultTaxRule = SC_Helper_TaxRule_Ex::getTaxRule();
// 購入商品情報
for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) {
// 購入数量
$data[0] = $this->arrDisp['quantity'][$i];

// 税込金額(単価)
$data[1] = $this->arrDisp['price'][$i] + SC_Helper_TaxRule_Ex::calcTax($this->arrDisp['price'][$i], $this->arrDisp['tax_rate'][$i], $this->arrDisp['tax_rule'][$i]);

// 小計(商品毎)
$data[2] = $data[0] * $data[1];

$arrOrder[$i][0] = $this->arrDisp['product_name'][$i].' / ';
$arrOrder[$i][0] .= $this->arrDisp['product_code'][$i].' / ';
if ($this->arrDisp['classcategory_name1'][$i]) {
$arrOrder[$i][0] .= ' [ '.$this->arrDisp['classcategory_name1'][$i];
if ($this->arrDisp['classcategory_name2'][$i] == '') {
$arrOrder[$i][0] .= ' ]';
} else {
$arrOrder[$i][0] .= ' * '.$this->arrDisp['classcategory_name2'][$i].' ]';
$i = 0;
// 受注明細情報
if (isset($this->arrDisp['quantity']) && is_array($this->arrDisp['quantity'])) {
for (; $i < count($this->arrDisp['quantity']); $i++) {
// 購入数量
$data[0] = $this->arrDisp['quantity'][$i];

// 税込金額(単価)
$data[1] = $this->arrDisp['price'][$i] + SC_Helper_TaxRule_Ex::calcTax($this->arrDisp['price'][$i], $this->arrDisp['tax_rate'][$i], $this->arrDisp['tax_rule'][$i]);

// 小計(商品毎)
$data[2] = $data[0] * $data[1];

$arrOrder[$i][0] = $this->arrDisp['product_name'][$i].' / ';
$arrOrder[$i][0] .= $this->arrDisp['product_code'][$i].' / ';
if ($this->arrDisp['classcategory_name1'][$i]) {
$arrOrder[$i][0] .= ' [ '.$this->arrDisp['classcategory_name1'][$i];
if ($this->arrDisp['classcategory_name2'][$i] == '') {
$arrOrder[$i][0] .= ' ]';
} else {
$arrOrder[$i][0] .= ' * '.$this->arrDisp['classcategory_name2'][$i].' ]';
}
}
}

// 標準税率より低い税率は軽減税率として※を付与
if ($this->arrDisp['tax_rate'][$i] < $defaultTaxRule['tax_rate']) {
$arrOrder[$i][0] .= '';
}
$arrOrder[$i][1] = number_format($data[0]);
$arrOrder[$i][2] = number_format($data[1]).$monetary_unit;
$arrOrder[$i][3] = number_format($data[2]).$monetary_unit;
if (array_key_exists($this->arrDisp['tax_rate'][$i], $arrTaxableTotal) === false) {
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] = 0;
// 標準税率より低い税率は軽減税率として※を付与
if ($this->arrDisp['tax_rate'][$i] < $defaultTaxRule['tax_rate']) {
$arrOrder[$i][0] .= '';
}
$arrOrder[$i][1] = number_format($data[0]);
$arrOrder[$i][2] = number_format($data[1]).$monetary_unit;
$arrOrder[$i][3] = number_format($data[2]).$monetary_unit;
if (array_key_exists($this->arrDisp['tax_rate'][$i], $arrTaxableTotal) === false) {
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] = 0;
}
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] += $data[2];
}
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] += $data[2];
}

$arrOrder[$i][0] = '';
Expand Down
24 changes: 16 additions & 8 deletions data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public function lfCheckError(&$objFormParam)

$arrErr = [];
$arrErrTemp = $objFormParam->checkError();
$arrErrDate = [];
$arrErrDate = ['shipping_date_year' => []];
foreach ($arrValues['shipping_date_year'] as $key_index => $year) {
$month = $arrValues['shipping_date_month'][$key_index];
$day = $arrValues['shipping_date_day'][$key_index];
Expand All @@ -702,7 +702,7 @@ public function lfCheckError(&$objFormParam)
'shipping_date_day' => $day,
]);
$objError->doFunc(['お届け日', 'shipping_date_year', 'shipping_date_month', 'shipping_date_day'], ['CHECK_DATE']);
$arrErrDate['shipping_date_year'][$key_index] = $objError->arrErr['shipping_date_year'];
$arrErrDate['shipping_date_year'][$key_index] = isset($objError->arrErr['shipping_date_year']) ? $objError->arrErr['shipping_date_year'] : '';
}
$arrErrTemp = array_merge($arrErrTemp, $arrErrDate);

Expand All @@ -717,7 +717,10 @@ public function lfCheckError(&$objFormParam)
]);
$objError->doFunc(['生年月日', 'order_birth_year', 'order_birth_month', 'order_birth_day'],
['CHECK_BIRTHDAY']);
$arrErrTemp['order_birth_year'] = $objError->arrErr['order_birth_year'];
if (!isset($arrErrTemp['order_birth_year'])) {
$arrErrTemp['order_birth_year'] = '';
}
$arrErrTemp['order_birth_year'] = isset($objError->arrErr['order_birth_year']) ? $objError->arrErr['order_birth_year'] : '';

// 商品の種類数
$max = count($arrValues['quantity']);
Expand Down Expand Up @@ -907,7 +910,7 @@ public function doRegister($order_id, &$objPurchase, &$objFormParam, &$message,
$arrShippingValues[$shipping_index]['deliv_id'] = $objFormParam->getValue('deliv_id');

// お届け時間名称を取得
$arrShippingValues[$shipping_index]['shipping_time'] = $arrDelivTime[$arrShipping['time_id']];
$arrShippingValues[$shipping_index]['shipping_time'] = $arrDelivTime[$arrShipping['time_id']] ?? '';

// 複数配送の場合は配送商品を登録
if (!SC_Utils_Ex::isBlank($arrAllShipmentItem)) {
Expand Down Expand Up @@ -1068,7 +1071,7 @@ public function shipmentAddProduct(&$objFormParam, $add_product_class_id)
// 届け先に選択済みの商品がある場合
$arrShipmentProducts = $this->getShipmentProducts($objFormParam);

if ($arrShipmentProducts['shipment_product_class_id'] && in_array($add_product_class_id, $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id])) {
if ($arrShipmentProducts['shipment_product_class_id'] && in_array($add_product_class_id, $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id] ?? [])) {
foreach ($arrShipmentProducts['shipment_product_class_id'][$select_shipping_id] as $relation_index => $shipment_product_class_id) {
if ($shipment_product_class_id == $add_product_class_id) {
$arrShipmentProducts['shipment_quantity'][$select_shipping_id][$relation_index]++;
Expand Down Expand Up @@ -1229,9 +1232,14 @@ public function setProductsQuantity(&$objFormParam)
$arrUpdateQuantity = [];
foreach ($arrShipmentsItems as $arritems) {
foreach ($arritems['shipment_product_class_id'] as $relation_index => $shipment_product_class_id) {
if (!isset($arrUpdateQuantity[$shipment_product_class_id])) {
$arrUpdateQuantity[$shipment_product_class_id] = 0;
}
// XXX 空文字が入ってくる場合があるので数値へキャストする
// きちんとエラーハンドリングすべきだが応急処置
$arrUpdateQuantity[$shipment_product_class_id] += (int) $arritems['shipment_quantity'][$relation_index];
if (is_numeric($arritems['shipment_quantity'][$relation_index])) {
$arrUpdateQuantity[$shipment_product_class_id] += (int) $arritems['shipment_quantity'][$relation_index];
}
}
}

Expand Down Expand Up @@ -1321,11 +1329,11 @@ public function checkInsertOrderProducts(&$objFormParam, $arrProductClassIds, $i
$arrAddProducts = [];
$arrTax = SC_Helper_TaxRule_Ex::getTaxRule($arrAddProductInfo['product_id']);

$arrAddProductInfo['product_name'] = ($arrAddProductInfo['product_name'])
$arrAddProductInfo['product_name'] = isset($arrAddProductInfo['product_name'])
? $arrAddProductInfo['product_name']
: $arrAddProductInfo['name'];

$arrAddProductInfo['price'] = ($arrAddProductInfo['price'])
$arrAddProductInfo['price'] = isset($arrAddProductInfo['price'])
? $arrAddProductInfo['price']
: $arrAddProductInfo['price02'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function action()

// ぶった斬りポイント==================================================================
// ページ送りの処理
$page_max = SC_Utils_Ex::sfGetSearchPageMax($_POST['search_page_max']);
$page_max = SC_Utils_Ex::sfGetSearchPageMax($_POST['search_page_max'] ?? 0);

// ページ送りの取得
$objNavi = new SC_PageNavi_Ex($_POST['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX);
Expand Down

0 comments on commit 190eb71

Please sign in to comment.