|
@@ 889-912 (lines=24) @@
|
| 886 |
|
if (StringUtil::isBlank($row[$headerByKey['stock_unlimited']])) { |
| 887 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock_unlimited']]); |
| 888 |
|
$this->addErrors($message); |
| 889 |
|
} else { |
| 890 |
|
if ($row[$headerByKey['stock_unlimited']] == (string) Constant::DISABLED) { |
| 891 |
|
$ProductClass->setStockUnlimited(false); |
| 892 |
|
// 在庫数が設定されていなければエラー |
| 893 |
|
if (isset($row[$headerByKey['stock']]) && StringUtil::isNotBlank($row[$headerByKey['stock']])) { |
| 894 |
|
$stock = str_replace(',', '', $row[$headerByKey['stock']]); |
| 895 |
|
if (preg_match('/^\d+$/', $stock) && $stock >= 0) { |
| 896 |
|
$ProductClass->setStock($stock); |
| 897 |
|
} else { |
| 898 |
|
$message = trans('csvimportcontroller.great_than_zero', ['%line%' => $line, '%name%' => $headerByKey['stock']]); |
| 899 |
|
$this->addErrors($message); |
| 900 |
|
} |
| 901 |
|
} else { |
| 902 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock']]); |
| 903 |
|
$this->addErrors($message); |
| 904 |
|
} |
| 905 |
|
} elseif ($row[$headerByKey['stock_unlimited']] == (string) Constant::ENABLED) { |
| 906 |
|
$ProductClass->setStockUnlimited(true); |
| 907 |
|
$ProductClass->setStock(null); |
| 908 |
|
} else { |
| 909 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock_unlimited']]); |
| 910 |
|
$this->addErrors($message); |
| 911 |
|
} |
| 912 |
|
} |
| 913 |
|
|
| 914 |
|
if (isset($row[$headerByKey['sale_limit']]) && StringUtil::isNotBlank($row[$headerByKey['sale_limit']])) { |
| 915 |
|
$saleLimit = str_replace(',', '', $row[$headerByKey['sale_limit']]); |
|
@@ 1063-1086 (lines=24) @@
|
| 1060 |
|
if ($row[$headerByKey['stock_unlimited']] == '') { |
| 1061 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock_unlimited']]); |
| 1062 |
|
$this->addErrors($message); |
| 1063 |
|
} else { |
| 1064 |
|
if ($row[$headerByKey['stock_unlimited']] == (string) Constant::DISABLED) { |
| 1065 |
|
$ProductClass->setStockUnlimited(false); |
| 1066 |
|
// 在庫数が設定されていなければエラー |
| 1067 |
|
if ($row[$headerByKey['stock']] == '') { |
| 1068 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock']]); |
| 1069 |
|
$this->addErrors($message); |
| 1070 |
|
} else { |
| 1071 |
|
$stock = str_replace(',', '', $row[$headerByKey['stock']]); |
| 1072 |
|
if (preg_match('/^\d+$/', $stock) && $stock >= 0) { |
| 1073 |
|
$ProductClass->setStock($row[$headerByKey['stock']]); |
| 1074 |
|
} else { |
| 1075 |
|
$message = trans('csvimportcontroller.great_than_zero', ['%line%' => $line, '%name%' => $headerByKey['stock']]); |
| 1076 |
|
$this->addErrors($message); |
| 1077 |
|
} |
| 1078 |
|
} |
| 1079 |
|
} elseif ($row[$headerByKey['stock_unlimited']] == (string) Constant::ENABLED) { |
| 1080 |
|
$ProductClass->setStockUnlimited(true); |
| 1081 |
|
$ProductClass->setStock(null); |
| 1082 |
|
} else { |
| 1083 |
|
$message = trans('csvimportcontroller.require', ['%line%' => $line, '%name%' => $headerByKey['stock_unlimited']]); |
| 1084 |
|
$this->addErrors($message); |
| 1085 |
|
} |
| 1086 |
|
} |
| 1087 |
|
|
| 1088 |
|
if ($row[$headerByKey['sale_limit']] != '') { |
| 1089 |
|
$saleLimit = str_replace(',', '', $row[$headerByKey['sale_limit']]); |