From: Kurund Jalmi Date: Fri, 11 Aug 2023 12:34:59 +0000 (+0100) Subject: lets not process data if email confirmation is enabled. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2ec2fd6a7577c7a61cba1d3f3c32af259aef92f4;p=civicrm-core.git lets not process data if email confirmation is enabled. --- diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php index 1bde2e3ff2..b05c2b087b 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php @@ -74,13 +74,24 @@ class Submit extends AbstractProcessor { // Save submission record if (!empty($this->_afform['create_submission'])) { + $status = 'Processed'; + if (!empty($this->_afform['require_email_confirmation'])) { + $status = 'Pending'; + } + $submission = AfformSubmission::create(FALSE) ->addValue('contact_id', \CRM_Core_Session::getLoggedInContactID()) ->addValue('afform_name', $this->name) ->addValue('data', $this->getValues()) + ->addValue('status_id:name', $status) ->execute()->first(); } + // let's not save the data in other CiviCRM table if email verification is needed. + if (!empty($this->_afform['require_email_confirmation'])) { + return []; + } + // Call submit handlers $entityWeights = \Civi\Afform\Utils::getEntityWeights($this->_formDataModel->getEntities(), $entityValues); foreach ($entityWeights as $entityName) {