bug fix in disabled shortlinks

This commit is contained in:
Hesabix 2025-06-01 08:36:46 +00:00
parent 1783aacfd4
commit 44c1a73aa1
2 changed files with 87 additions and 5 deletions

View file

@ -21,6 +21,14 @@ class ShortlinksController extends AbstractController
$bus = $entityManager->getRepository(Business::class)->find($bid);
if (!$bus)
throw $this->createNotFoundException();
if (!$bus->isShortlinks()) {
return $this->render('bundles/TwigBundle/Exception/shortlinks_disabled.html.twig', [
'business' => [
'name' => $bus->getName(),
'phone' => $bus->getTel() ?: $bus->getMobile()
]
]);
}
$ticket = $entityManager->getRepository(StoreroomTicket::class)->findOneBy([
'bid' => $bid,
'id' => $id
@ -50,8 +58,14 @@ class ShortlinksController extends AbstractController
$bus = $entityManager->getRepository(Business::class)->find($bid);
if (!$bus)
throw $this->createNotFoundException();
if (!$bus->isShortlinks())
throw $this->createNotFoundException();
if (!$bus->isShortlinks()) {
return $this->render('bundles/TwigBundle/Exception/shortlinks_disabled.html.twig', [
'business' => [
'name' => $bus->getName(),
'phone' => $bus->getTel() ?: $bus->getMobile()
]
]);
}
if ($type == 'sell') {
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
'type' => 'sell',
@ -90,6 +104,17 @@ class ShortlinksController extends AbstractController
#[Route('/slpdf/sell/{bid}/{link}', name: 'shortlinks_pdf')]
public function shortlinks_pdf(string $bid, string $link, EntityManagerInterface $entityManager, Provider $provider): Response
{
$bus = $entityManager->getRepository(Business::class)->find($bid);
if (!$bus)
throw $this->createNotFoundException();
if (!$bus->isShortlinks()) {
return $this->render('bundles/TwigBundle/Exception/shortlinks_disabled.html.twig', [
'business' => [
'name' => $bus->getName(),
'phone' => $bus->getTel() ?: $bus->getMobile()
]
]);
}
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
'type' => 'sell',
'bid' => $bid,
@ -97,9 +122,6 @@ class ShortlinksController extends AbstractController
]);
if (!$doc)
throw $this->createNotFoundException();
$bid = $entityManager->getRepository(Business::class)->find($bid);
if (!$bid)
throw $this->createNotFoundException();
$person = null;
$discount = 0;
$transfer = 0;

View file

@ -0,0 +1,60 @@
{% extends "blank.html.twig" %}
{% block title %}دسترسی به لینک‌های کوتاه محدود شده است{% endblock %}
{% block body %}
<div id="page-container">
<!-- Main Container -->
<main id="main-container">
<!-- Page Content -->
<div class="bg-image" style="background-image: url('/assets/media/photos/photo21.jpg');">
<div class="row g-0 justify-content-end bg-xwork-op">
<!-- Main Section -->
<div class="hero-static col-md-5 d-flex flex-column bg-body-extra-light">
<!-- Header -->
<div class="flex-grow-0 p-5">
<a class="link-fx fw-bold fs-2" href="/">
<span class="text-dark">{{twigFunctions.getStaticData('system', 'appName')}}</span>
</a>
<p class="text-uppercase fw-bold fs-sm text-muted mb-0">{{twigFunctions.getStaticData('system', 'appSlogan')}}</p>
</div>
<!-- END Header -->
<!-- Content -->
<div class="flex-grow-1 d-flex align-items-center p-5 bg-body-light">
<div class="w-100">
<p class="text-warning fs-4 fw-bold text-uppercase mb-2">
دسترسی محدود شده </p>
<h1 class="fw-bold mb-2"> دسترسی به لینک‌های کوتاه غیرفعال است </h1>
<p class="fs-4 fw-medium text-muted mb-3">
متأسفانه دسترسی به لینک‌های کوتاه در این کسب و کار توسط مدیر سیستم محدود شده است.
</p>
<p class="fs-4 fw-medium text-muted mb-5">
برای پیگیری می‌توانید با کسب و کار زیر تماس بگیرید:<br>
<strong>{{ business.name }}</strong><br>
{% if business.phone %}
<i class="fa fa-phone me-1"></i> {{ business.phone }}
{% else %}
<span class="text-muted">شماره تماس در دسترس نیست</span>
{% endif %}
</p>
<a class="btn btn-lg btn-alt-warning" href="{{ twigFunctions.systemSettings().appSite }}">
<i class="fa fa-arrow-right opacity-50 me-1"></i> بازگشت به صفحه نخست </a>
</div>
</div>
<!-- END Content -->
<!-- Footer -->
<ul class="list-inline flex-gow-1 p-5 fs-sm fw-medium mb-0">
<li class="list-inline-item">
<a class="text-muted" href="{{ twigFunctions.systemSettings().appSite }}/"> ورود به {{twigFunctions.getStaticData('system', 'appName')}} </a>
</li>
</ul>
<!-- END Footer -->
</div>
<!-- END Main Section -->
</div>
</div>
<!-- END Page Content -->
</main>
<!-- END Main Container -->
</div>
{% endblock %}