From 2322d0c6a0518ae36eed21f9515cf272461f4374 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Tue, 24 May 2022 11:55:07 +0200
Subject: [PATCH] =?UTF-8?q?Complement=20de=20e860673=20et=207ecacee=20pour?=
 =?UTF-8?q?=20eviter=20une=20erreur=20=C3=A0=20la=20compilation=20dans=20l?=
 =?UTF-8?q?e=20public=20quand=20la=20fonction=20statut=5Ftitre=20n'est=20p?=
 =?UTF-8?q?as=20charg=C3=A9e?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 formidable_fonctions.php | 15 +++++++++++++++
 modeles/form.html        |  4 ++--
 modeles/formidable.html  |  4 ++--
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/formidable_fonctions.php b/formidable_fonctions.php
index 00a637fc..0fa36105 100644
--- a/formidable_fonctions.php
+++ b/formidable_fonctions.php
@@ -273,3 +273,18 @@ function formidable_ajouter_action_recuperer_fichier($saisie_a_modifier, $nom_sa
 function generer_titre_formulaires_reponse(int $id_formulaires_reponse, $champs): string {
 	return affiche_resume_reponse($id_formulaires_reponse);
 }
+
+/**
+ * Afficher le status en clair si pas dans la liste $not_in
+ * @param string $statut
+ * @param array $not_in
+ * @return string
+ */
+function formidable_afficher_statut_si_different_de($statut,$not_in = array()) {
+	if (!in_array($statut, $not_in)) {
+		include_spip('inc/puce_statut');
+		return statut_titre('formidable', $statut);
+	}
+
+	return '';
+}
diff --git a/modeles/form.html b/modeles/form.html
index 40bb5a3f..fa4d8bf7 100644
--- a/modeles/form.html
+++ b/modeles/form.html
@@ -1,6 +1,6 @@
 [(#REM|test_espace_prive|oui)
-<BOUCLE_f(FORMULAIRES){identifiant=form#ENV{id,#ENV{id_form}}}{statut==.*}{0,1}>[(#STATUT|=={publie}|non)
-<div class="msg-alert info"><:formidable:changer_statut:> [(#VAL{formidable}|statut_titre{#STATUT})]</div>
+<BOUCLE_f(FORMULAIRES){identifiant=form#ENV{id,#ENV{id_form}}}{statut==.*}{0,1}>[
+<div class="msg-alert info"><:formidable:changer_statut:> (#STATUT|formidable_afficher_statut_si_different_de{#LISTE{publie}})</div>
 ]#FORMULAIRE_FORMIDABLE{#ID_FORMULAIRE}
 </BOUCLE_f>
 ][(#REM|test_espace_prive|non)
diff --git a/modeles/formidable.html b/modeles/formidable.html
index 6aed7b21..37266c97 100644
--- a/modeles/formidable.html
+++ b/modeles/formidable.html
@@ -1,6 +1,6 @@
 [(#REM|test_espace_prive|oui)
-<BOUCLE_f(FORMULAIRES){id_formulaire=#ID}{statut==.*}{0,1}>[(#STATUT|=={publie}|non)
-<div class="msg-alert info"><:formidable:changer_statut:> [(#VAL{formidable}|statut_titre{#STATUT})]</div>
+<BOUCLE_f(FORMULAIRES){id_formulaire=#ID}{statut==.*}{0,1}>[
+<div class="msg-alert info"><:formidable:changer_statut:> (#STATUT|formidable_afficher_statut_si_different_de{#LISTE{publie}})</div>
 ]#FORMULAIRE_FORMIDABLE{#ID_FORMULAIRE}
 </BOUCLE_f>
 ][(#REM|test_espace_prive|non)
-- 
GitLab