bug fix in banks controller

This commit is contained in:
Hesabix 2024-12-06 15:22:46 +00:00
parent 1835fca354
commit 2535104807

View file

@ -131,8 +131,11 @@ class BankController extends AbstractController
$rows = $entityManager->getRepository(HesabdariRow::class)->findby(['bid' => $acc['bid'], 'bank' => $bank]); $rows = $entityManager->getRepository(HesabdariRow::class)->findby(['bid' => $acc['bid'], 'bank' => $bank]);
if (count($rows) > 0) if (count($rows) > 0)
return $this->json(['result' => 2]); return $this->json(['result' => 2]);
if (!$acc['bid']->getWalletMatchBank()) {
if ($acc['bid']->getWalletMatchBank()->getId() == $bank->getId()) if ($acc['bid']->getWalletMatchBank()->getId() == $bank->getId())
return $this->json(['result' => 3]); return $this->json(['result' => 3]);
}
$name = $bank->getName(); $name = $bank->getName();
$entityManager->remove($bank); $entityManager->remove($bank);
$log->insert('بانکداری', ' حساب بانکی با نام ' . $name . ' حذف شد. ', $this->getUser(), $acc['bid']->getId()); $log->insert('بانکداری', ' حساب بانکی با نام ' . $name . ' حذف شد. ', $this->getUser(), $acc['bid']->getId());