added accounting failing handles

This commit is contained in:
2026-08-27 16:16:20 +03:30
parent 93834c9f40
commit 6b5b490e2b
9 changed files with 959 additions and 0 deletions
+23
View File
@@ -30,6 +30,7 @@ class Product extends Model
private static ?bool $cashFeePercentModeColumnsExist = null;
private static ?bool $physicalDeliveryColumnsExist = null;
private static ?bool $descriptionColumnExists = null;
private static ?bool $karatColumnExists = null;
private static ?bool $tvPriceFormulaColumnsExist = null;
private static ?bool $priceFormulaColumnsExist = null;
@@ -73,6 +74,9 @@ class Product extends Model
if (!static::hasDescriptionColumn()) {
unset($product->attributes['description']);
}
if (!static::hasKaratColumn()) {
unset($product->attributes['karat']);
}
if (!static::hasOverrideTradingHoursColumn()) {
unset($product->attributes['override_trading_hours']);
}
@@ -407,6 +411,24 @@ class Product extends Model
return static::$descriptionColumnExists;
}
public static function hasKaratColumn(): bool
{
if (static::$karatColumnExists !== null) {
return static::$karatColumnExists;
}
try {
static::$karatColumnExists = Schema::hasColumn(
(new static)->getTable(),
'karat'
);
} catch (\Throwable) {
static::$karatColumnExists = false;
}
return static::$karatColumnExists;
}
public function orderLimitsEnabled(): bool
{
if (!static::hasOrderLimitColumns() || !($this->order_limit_enabled ?? false)) {
@@ -510,6 +532,7 @@ class Product extends Model
'bubble',
'inventory',
'description',
'karat',
'direct_price',
'app_price', // روشن: قیمت واحد از قیمت زندهٔ اپ هر گرم × وزن محاسبه می‌شود
'price_formula_enabled',