diff --git a/hesabixCore/src/Controller/Front/ShortlinksController.php b/hesabixCore/src/Controller/Front/ShortlinksController.php
index a4ec2cf..02dd289 100644
--- a/hesabixCore/src/Controller/Front/ShortlinksController.php
+++ b/hesabixCore/src/Controller/Front/ShortlinksController.php
@@ -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;
diff --git a/hesabixCore/templates/bundles/TwigBundle/Exception/shortlinks_disabled.html.twig b/hesabixCore/templates/bundles/TwigBundle/Exception/shortlinks_disabled.html.twig
new file mode 100644
index 0000000..896006e
--- /dev/null
+++ b/hesabixCore/templates/bundles/TwigBundle/Exception/shortlinks_disabled.html.twig
@@ -0,0 +1,60 @@
+{% extends "blank.html.twig" %}
+{% block title %}دسترسی به لینکهای کوتاه محدود شده است{% endblock %}
+{% block body %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ دسترسی محدود شده
+
دسترسی به لینکهای کوتاه غیرفعال است
+
+ متأسفانه دسترسی به لینکهای کوتاه در این کسب و کار توسط مدیر سیستم محدود شده است.
+
+
+ برای پیگیری میتوانید با کسب و کار زیر تماس بگیرید:
+ {{ business.name }}
+ {% if business.phone %}
+ {{ business.phone }}
+ {% else %}
+ شماره تماس در دسترس نیست
+ {% endif %}
+
+
+ بازگشت به صفحه نخست
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file