Skip to content

EspoCRM – Open Source CRM Application

lead form is active check

Yuri Kuznetsov73e3c8f3729e
diff --git a/application/Espo/Entities/LeadCapture.php b/application/Espo/Entities/LeadCapture.php
index 09e25c713a..18da1c990d 100644
--- a/application/Espo/Entities/LeadCapture.php
+++ b/application/Espo/Entities/LeadCapture.php
@@ -45,6 +45,11 @@ class LeadCapture extends Entity
return $this->get('subscribeToTargetList') && $this->get('subscribeContactToTargetList');
}
+ public function isActive(): bool
+ {
+ return (bool) $this->get('isActive');
+ }
+
public function hasFormCaptcha(): bool
{
return (bool) $this->get('formCaptcha');
diff --git a/application/Espo/Tools/LeadCapture/FormService.php b/application/Espo/Tools/LeadCapture/FormService.php
index dae7420952..a23c8aa6d6 100644
--- a/application/Espo/Tools/LeadCapture/FormService.php
+++ b/application/Espo/Tools/LeadCapture/FormService.php
@@ -360,7 +360,7 @@ class FormService
->where(['formId' => $id])
->findOne();
- if (!$leadCapture || !$leadCapture->hasFormEnabled()) {
+ if (!$leadCapture || !$leadCapture->hasFormEnabled() || !$leadCapture->isActive()) {
throw new NotFound();
}