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

@ -26,7 +26,7 @@ class BankController extends AbstractController
//bug fix for bank with no money type //bug fix for bank with no money type
$datas = $entityManager->getRepository(BankAccount::class)->findBy([ $datas = $entityManager->getRepository(BankAccount::class)->findBy([
'bid' => $request->headers->get('activeBid'), 'bid' => $request->headers->get('activeBid'),
'money'=>null 'money' => null
]); ]);
foreach ($datas as $data) { foreach ($datas as $data) {
$data->setMoney($acc['bid']->getMoney()); $data->setMoney($acc['bid']->getMoney());
@ -37,7 +37,7 @@ class BankController extends AbstractController
$datas = $entityManager->getRepository(BankAccount::class)->findBy([ $datas = $entityManager->getRepository(BankAccount::class)->findBy([
'bid' => $request->headers->get('activeBid'), 'bid' => $request->headers->get('activeBid'),
'money'=>$acc['money'] 'money' => $acc['money']
]); ]);
foreach ($datas as $data) { foreach ($datas as $data) {
$bs = 0; $bs = 0;
@ -62,7 +62,7 @@ class BankController extends AbstractController
throw $this->createAccessDeniedException(); throw $this->createAccessDeniedException();
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([ $data = $entityManager->getRepository(BankAccount::class)->findOneBy([
'bid' => $acc['bid'], 'bid' => $acc['bid'],
'money'=>$acc['money'], 'money' => $acc['money'],
'code' => $code 'code' => $code
]); ]);
return $this->json(data: Explore::ExploreBank($data)); return $this->json(data: Explore::ExploreBank($data));
@ -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());