From 097f923232c125e718aa972b85233e46b47657c4 Mon Sep 17 00:00:00 2001
From: enured <enis.nuredini@uzh.ch>
Date: Tue, 21 Dec 2021 17:14:42 +0100
Subject: [PATCH] F13527. recordId variable and record id from sip store will
 change to zero if multi-mode from form is not 'none'.

---
 extension/Classes/Core/QuickFormQuery.php | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/extension/Classes/Core/QuickFormQuery.php b/extension/Classes/Core/QuickFormQuery.php
index 3d29658cf..c62dc958a 100644
--- a/extension/Classes/Core/QuickFormQuery.php
+++ b/extension/Classes/Core/QuickFormQuery.php
@@ -472,6 +472,12 @@ class QuickFormQuery {
             }
         }
 
+        //Change recordId from Multiform to 0 - No row exception possible
+        if($this->formSpec["multiMode"] !== 'none'){
+            $recordId = 0;
+            $this->store->setVar(SIP_RECORD_ID, $recordId, STORE_SIP);
+        }
+
         // Fill STORE_BEFORE
         if ($formName !== false && $this->store->getVar($this->formSpec[F_PRIMARY_KEY], STORE_BEFORE) === false) {
             $this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $recordId,
@@ -1036,6 +1042,12 @@ class QuickFormQuery {
             $this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
         }
 
+        //Change recordId from Multiform to 0 - No row exception possible
+        if($form["multiMode"] !== 'none'){
+            $recordId = 0;
+            $this->store->setVar(SIP_RECORD_ID, $recordId, STORE_SIP);
+        }
+
         // This is needed for filling templateGroup records with their default values
         // and for evaluating variables in the Form title
         $this->store->fillStoreWithRecord($form[F_TABLE_NAME], $recordId, $this->dbArray[$this->dbIndexData], $form[F_PRIMARY_KEY]);
-- 
GitLab