Refactor cookie consent management to improve label handling

This commit updates the `fxEnsureLegalPage` function to utilize the `fxLegalLabelIsDraft` function for checking and updating French and English labels. This change enhances the clarity and maintainability of the code by ensuring that labels are only updated when they are in draft status, aligning with the overall improvements in cookie consent management.
This commit is contained in:
2026-06-27 14:57:01 -04:00
parent 33f5c3d0dd
commit 1b30f7e0ea

View File

@ -576,11 +576,19 @@ function fxEnsureLegalPage(string $code, string $labelFr, string $labelEn, strin
$updates[] = "pag_texte_en = '" . $objDatabase->fxEscape($textEn) . "'";
}
if (trim((string) $row['pag_titre_fr']) === '') {
if (fxLegalLabelIsDraft((string) $row['pag_label_fr'])) {
$updates[] = "pag_label_fr = '" . $objDatabase->fxEscape($labelFr) . "'";
}
if (fxLegalLabelIsDraft((string) $row['pag_label_en'])) {
$updates[] = "pag_label_en = '" . $objDatabase->fxEscape($labelEn) . "'";
}
if (fxLegalLabelIsDraft((string) $row['pag_titre_fr'])) {
$updates[] = "pag_titre_fr = '" . $objDatabase->fxEscape($titleFr) . "'";
}
if (trim((string) $row['pag_titre_en']) === '') {
if (fxLegalLabelIsDraft((string) $row['pag_titre_en'])) {
$updates[] = "pag_titre_en = '" . $objDatabase->fxEscape($titleEn) . "'";
}