EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
lead form is active check
Yuri Kuznetsov73e3c8f3729e
diff --git a/application/Espo/Entities/LeadCapture.php b/application/Espo/Entities/LeadCapture.phpindex 09e25c713a..18da1c990d 100644--- a/application/Espo/Entities/LeadCapture.php+++ b/application/Espo/Entities/LeadCapture.php@@ -45,6 +45,11 @@ class LeadCapture extends Entityreturn $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.phpindex 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();}