From 1af8ffe3237176b64d1722a1810e022dc206dca9 Mon Sep 17 00:00:00 2001
From: Kurund Jalmi
Date: Fri, 11 Aug 2023 13:04:22 +0100
Subject: [PATCH] add email verification flag in the UI and API
---
.../admin/ang/afGuiEditor/afGuiEditor.component.js | 12 ++++++++++++
ext/afform/admin/ang/afGuiEditor/config-form.html | 11 +++++++++--
ext/afform/core/Civi/Api4/Afform.php | 4 ++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js
index 7d33889d37..f593defc15 100644
--- a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js
+++ b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js
@@ -403,6 +403,14 @@
}
};
+ this.toggleEmailVerification = function() {
+ if (editor.afform.require_email_confirmation) {
+ editor.afform.require_email_confirmation = null;
+ } else {
+ editor.afform.create_submission = true;
+ }
+ }
+
function loadNavigationMenu() {
if ('navigationMenu' in editor) {
return;
@@ -615,6 +623,10 @@
var afform = JSON.parse(angular.toJson(editor.afform));
// This might be set to undefined by validation
afform.server_route = afform.server_route || '';
+ // create submission is required if email confirmation is selected.
+ if (afform.require_email_confirmation) {
+ afform.create_submission = true;
+ }
$scope.saving = true;
crmApi4('Afform', 'save', {formatWhitespace: true, records: [afform]})
.then(function (data) {
diff --git a/ext/afform/admin/ang/afGuiEditor/config-form.html b/ext/afform/admin/ang/afGuiEditor/config-form.html
index b439b4c816..0d2701e0c5 100644
--- a/ext/afform/admin/ang/afGuiEditor/config-form.html
+++ b/ext/afform/admin/ang/afGuiEditor/config-form.html
@@ -122,10 +122,9 @@
-
+
+