fix bug in 22/4
This commit is contained in:
@@ -681,6 +681,28 @@ class ProductController extends SuperController
|
||||
$data['override_trading_hours'] = !empty($data['override_trading_hours']);
|
||||
}
|
||||
|
||||
if (!Product::hasPhysicalDeliveryColumns()) {
|
||||
unset($data['has_physical_delivery'], $data['min_physical_delivery_grams']);
|
||||
} else {
|
||||
$hasDelivery = array_key_exists('has_physical_delivery', $data)
|
||||
? filter_var($data['has_physical_delivery'], FILTER_VALIDATE_BOOLEAN)
|
||||
: false;
|
||||
$data['has_physical_delivery'] = $hasDelivery;
|
||||
|
||||
if (!$hasDelivery) {
|
||||
$data['min_physical_delivery_grams'] = null;
|
||||
} else {
|
||||
$rawMin = $data['min_physical_delivery_grams'] ?? null;
|
||||
$min = $this->normalizeCashFeeValue($rawMin);
|
||||
if ($min <= 0) {
|
||||
throw new UnprocessableEntityHttpException(
|
||||
'برای فعال کردن تحویل فیزیکی باید حداقل گرم معتبر وارد شود'
|
||||
);
|
||||
}
|
||||
$data['min_physical_delivery_grams'] = $min;
|
||||
}
|
||||
}
|
||||
|
||||
$data['cash_fee_buy'] = $this->normalizeCashFeeValue($data['cash_fee_buy'] ?? 0);
|
||||
$data['cash_fee_sell'] = $this->normalizeCashFeeValue($data['cash_fee_sell'] ?? 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user