bug fix in avatar controller for not exist files

This commit is contained in:
Hesabix 2024-12-07 12:57:40 +00:00
parent f1c1c4a593
commit 492b601255
3 changed files with 9 additions and 7 deletions

View file

@ -24,7 +24,7 @@ class AvatarController extends AbstractController
if (!$bid)
return new BinaryFileResponse(dirname(__DIR__, 3) . '/hesabixArchive/avatars/default.png');
$fileAdr = dirname(__DIR__, 3) . '/hesabixArchive/avatars/' . $bid->getAvatar();
if (!$bid->getAvatar())
if (!$bid->getAvatar() || !file_exists($fileAdr))
return new BinaryFileResponse(dirname(__DIR__, 3) . '/hesabixArchive/avatars/default.png');
$response = new BinaryFileResponse($fileAdr);
return $response;

View file

@ -229,7 +229,7 @@ class PrintersController extends AbstractController
#[Route('/api/print/last', name: 'app_print_last')]
public function app_print_last(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager): Response
{
$acc = $access->hasRole('join');
$acc = $access->hasRole('owner');
if (!$acc)
throw $this->createAccessDeniedException();
$printer = $entityManager->getRepository(Printer::class)->findBy([

View file

@ -274,12 +274,14 @@
حمل و نقل:
{{transfer | number_format}}
</h4>
{% if doc.amount != (doc.amount + discount) %}
<h4>
مبلغ کل بدون تخفیف:
{{ (doc.amount + discount) | number_format}}
</h4>
{% endif %}
<h4>
جمع کل قابل پرداخت:
جمع کل:
{{ doc.amount | number_format }}
</h4>
</td>