From c25b776eb120cd9623003f626c468fedbc9e041d Mon Sep 17 00:00:00 2001
From: arman <armangill.bzp@gmail.com>
Date: Wed, 12 Feb 2025 07:07:20 +0000
Subject: [PATCH] Update registration forms received

---
 register_participants.inc.php       | 11 +++++++++++
 register_participants_signature.php |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/register_participants.inc.php b/register_participants.inc.php
index 60040c79..d1b30d46 100644
--- a/register_participants.inc.php
+++ b/register_participants.inc.php
@@ -23,6 +23,17 @@
  */
 ?>
 <?
+
+function setRegistrationFormsReceived($reg_id = ''){
+	global $pdo;
+	if ($reg_id)
+		$rid = $reg_id;
+	else
+		$rid = $_SESSION['registration_id'];
+	$q = $pdo->prepare('UPDATE registrations set status = "complete" WHERE id=?');
+	$q->execute([$rid]);
+}
+
 function registrationFormsReceived($reg_id = '')
 {
 	global $pdo;
diff --git a/register_participants_signature.php b/register_participants_signature.php
index d4cc82f4..1f36ce2f 100644
--- a/register_participants_signature.php
+++ b/register_participants_signature.php
@@ -1,6 +1,7 @@
 
 <?
 include 'data/config.inc.php';
+include 'register_participants.inc.php';
 ?>
 
 <script src="https://cdn.docuseal.com/js/form.js"></script>
@@ -13,7 +14,7 @@ include 'data/config.inc.php';
 </docuseal-form>
 
 <script>
-  window.docusealForm.addEventListener('completed', (e) => e.detail)
+  window.docusealForm.addEventListener('completed', setRegistrationFormsReceived)
 </script>