-- MSIN-4471 — Libellés feuille bénévole PDF distribution (nom+prénom, case remise)
-- Prérequis : clés bib_v4_dist_print_* (MSIN-4433)
-- Idempotent : INSERT si absent ; UPDATE si déjà présent avec texte vide

SET NAMES utf8mb4;

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_dist_print_col_nom_prenom', 'fr', 'Nom, Prénom', '', 'compte.php', 'MSIN-4471', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (
  SELECT 1 FROM info WHERE info_clef = 'bib_v4_dist_print_col_nom_prenom' AND info_langue = 'fr' AND info_prg = 'compte.php'
);

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_dist_print_col_nom_prenom', 'en', 'Last name, First name', '', 'compte.php', 'MSIN-4471', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (
  SELECT 1 FROM info WHERE info_clef = 'bib_v4_dist_print_col_nom_prenom' AND info_langue = 'en' AND info_prg = 'compte.php'
);

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_dist_print_col_check', 'fr', 'OK', '', 'compte.php', 'MSIN-4471', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (
  SELECT 1 FROM info WHERE info_clef = 'bib_v4_dist_print_col_check' AND info_langue = 'fr' AND info_prg = 'compte.php'
);

INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation)
SELECT 'bib_v4_dist_print_col_check', 'en', 'OK', '', 'compte.php', 'MSIN-4471', 0, 1, '', '', '', NOW()
FROM DUAL WHERE NOT EXISTS (
  SELECT 1 FROM info WHERE info_clef = 'bib_v4_dist_print_col_check' AND info_langue = 'en' AND info_prg = 'compte.php'
);

UPDATE info SET info_texte = 'OK', info_description = 'MSIN-4471'
WHERE info_clef = 'bib_v4_dist_print_col_check' AND info_prg = 'compte.php' AND (info_texte = '' OR info_texte IS NULL);
