From 4e0a83dd56c70e37c4138a3f68c2ea7f9eb10f34 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Tue, 13 Jun 2023 01:10:06 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20Le=20nom=20d=E2=80=99une=20table=20optio?=
 =?UTF-8?q?nnelle=20est=20conserv=C3=A9=20dans=20un=20champ=20d=C3=A9di?=
 =?UTF-8?q?=C3=A9,=20pas=20dans=20un=20bool=C3=A9en?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit 1e7a474f0df4fea3f8f146c52f5feb0cb9fed3c4)
---
 ecrire/public/decompiler.php            | 2 +-
 ecrire/public/phraser_html.php          | 3 ++-
 ecrire/src/Compilateur/Noeud/Boucle.php | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ecrire/public/decompiler.php b/ecrire/public/decompiler.php
index 06d502891c..252974af61 100644
--- a/ecrire/public/decompiler.php
+++ b/ecrire/public/decompiler.php
@@ -27,7 +27,7 @@ function decompiler_boucle($struct, $fmt = '', $prof = 0) {
 	$postaff = decompiler_($struct->postaff, $fmt, $prof);
 
 	$type = $struct->sql_serveur ? "$struct->sql_serveur:" : '';
-	$type .= ($struct->type_requete ?: $struct->table_optionnelle);
+	$type .= ($struct->type_requete ?: $struct->type_table_optionnelle);
 
 	if ($struct->jointures_explicites) {
 		$type .= ' ' . $struct->jointures_explicites;
diff --git a/ecrire/public/phraser_html.php b/ecrire/public/phraser_html.php
index 46b37469cf..b6efaa7c82 100644
--- a/ecrire/public/phraser_html.php
+++ b/ecrire/public/phraser_html.php
@@ -1099,7 +1099,8 @@ function public_phraser_html_dist($texte, $id_parent, &$boucles, $descr, $ligne_
 		}
 
 		if ($table_optionnelle) {
-			$result->table_optionnelle = $type;
+			$result->table_optionnelle = true;
+			$result->type_table_optionnelle = $type;
 		}
 
 		// 1ere passe sur les criteres, vu comme des arguments sans fct
diff --git a/ecrire/src/Compilateur/Noeud/Boucle.php b/ecrire/src/Compilateur/Noeud/Boucle.php
index 7c58af3d61..c938f8e8d4 100644
--- a/ecrire/src/Compilateur/Noeud/Boucle.php
+++ b/ecrire/src/Compilateur/Noeud/Boucle.php
@@ -84,6 +84,7 @@ class Boucle
 	 * Si oui, aucune erreur ne sera générée si la table demandée n'est pas présente
 	 */
 	public bool $table_optionnelle = false;
+	public string $type_table_optionnelle = '';
 
 	/**
 	 * Nom du fichier de connexion
-- 
GitLab