fix transaction
This commit is contained in:
@@ -405,7 +405,7 @@ class WalletController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$product = $this->resolveTransactionProduct($record);
|
||||
$product = $this->resolveTransactionProductForLedgerTitle($record);
|
||||
if (!$product || trim((string) $product->title) === '') {
|
||||
return;
|
||||
}
|
||||
@@ -525,7 +525,7 @@ class WalletController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$product = $this->resolveTransactionProduct($record);
|
||||
$product = $this->resolveTransactionProductForLedgerTitle($record);
|
||||
if (!$product || trim((string) $product->title) === '') {
|
||||
return;
|
||||
}
|
||||
@@ -633,6 +633,19 @@ class WalletController extends Controller
|
||||
return Wallet::with('product')->find($walletId);
|
||||
}
|
||||
|
||||
/**
|
||||
* عنوان هر سطر دفترکل — محصول همان کیف پول (مثلاً کاتد در سطر برداشت کاتد برای خرید مفتول).
|
||||
*/
|
||||
private function resolveTransactionProductForLedgerTitle($record): ?Product
|
||||
{
|
||||
$wallet = $this->resolveTransactionWallet($record);
|
||||
if ($wallet?->product instanceof Product && trim((string) $wallet->product->title) !== '') {
|
||||
return $wallet->product;
|
||||
}
|
||||
|
||||
return $this->resolveTransactionProduct($record);
|
||||
}
|
||||
|
||||
private function resolveTransactionProduct($record): ?Product
|
||||
{
|
||||
$productId = $this->resolveAbshodeProductId($record) ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user