From c455cb6253a5cdaf607b57341bd0a4fb4096977a Mon Sep 17 00:00:00 2001 From: Eric Beliveau Date: Wed, 16 Jul 2025 23:44:33 -0400 Subject: [PATCH] fix(reservation): pdf generation is not working in French When a reminder is set and the language is set to French, the reservation pdf can't be generated because the template does not escape for javascript after translation. In French the default string contains an apostrophe and this is breaking the javascript code. It also makes the update of the reservation impossible since the javascript code generate an error. Adding "|escape:'javascript'" to ReminderBeforeStart and ReminderBeforeEnd fix the problem. The code also fix the French translation. Closes: #584 --- lang/fr_fr.php | 8 ++++---- tpl/Reservation/pdf.tpl | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lang/fr_fr.php b/lang/fr_fr.php index b94c246a1..d9908571e 100644 --- a/lang/fr_fr.php +++ b/lang/fr_fr.php @@ -411,7 +411,7 @@ protected function _LoadStrings() $strings['hours'] = 'heures'; $strings['days'] = 'jours'; $strings['ReminderBeforeStart'] = 'avant l\'heure de début'; - $strings['ReminderBeforeEnd'] = 'après l\'heure de fin'; + $strings['ReminderBeforeEnd'] = 'avant l\'heure de fin'; $strings['Logo'] = 'Logo'; $strings['CssFile'] = 'Fichier CSS'; $strings['ThemeUploadSuccess'] = 'Vos modifications ont été sauvegardées. Rafraîchissez la page pour que les changements prennent effet.'; @@ -502,7 +502,7 @@ protected function _LoadStrings() $strings['AutoReleaseNotification'] = 'Libéré automatiquement dans %s minutes sans confirmation'; $strings['RequiresCheckInNotification'] = 'Nécessite un check in/out'; $strings['NoCheckInRequiredNotification'] = 'Ne nécessite pas de check in/out'; - $strings['RequiresApproval'] = 'Nécessite un ccord'; + $strings['RequiresApproval'] = 'Nécessite un accord'; $strings['CheckingIn'] = 'Check In'; $strings['CheckingOut'] = 'Check Out'; $strings['CheckIn'] = 'Check In'; @@ -530,10 +530,10 @@ protected function _LoadStrings() $strings['SendAsEmail'] = 'Envoyer par Email'; $strings['UsersInGroups'] = 'Utilisateurs dans le Groupe'; $strings['UsersWithAccessToResources'] = 'Utilisateurs avec Accès à la Ressource'; - $strings['AnnouncementSubject'] = 'Une nouvelle annonce a été posdtée par %s'; + $strings['AnnouncementSubject'] = 'Une nouvelle annonce a été postée par %s'; $strings['AnnouncementEmailNotice'] = 'Les utilisateurs recevront cette annonce par email'; $strings['Day'] = 'Jour'; - $strings['NotifyWhenAvailable'] = 'Me notifier Quand Disponible'; + $strings['NotifyWhenAvailable'] = 'Me notifier quand disponible'; $strings['AddingToWaitlist'] = 'Rajouté à la liste d\'attente'; $strings['WaitlistRequestAdded'] = 'Vous serez notifié si cet horaire devient disponible'; $strings['PrintQRCode'] = 'Imprimer le code QR'; diff --git a/tpl/Reservation/pdf.tpl b/tpl/Reservation/pdf.tpl index b50e772c3..c5d6281ac 100644 --- a/tpl/Reservation/pdf.tpl +++ b/tpl/Reservation/pdf.tpl @@ -254,10 +254,12 @@ $('.btnPDF').click(function (e) { body: [ [{ content: '{translate key="SendReminder"}', styles: { fontStyle: 'bold'}}, {if $ReminderTimeStart neq ''} - { content: '{$ReminderTimeStart} {translate key=$ReminderIntervalStart} {translate key=ReminderBeforeStart}'}, + {assign var="ReminderBeforeStart" value="{translate key=ReminderBeforeStart}"} + { content: '{$ReminderTimeStart} {translate key=$ReminderIntervalStart} {$ReminderBeforeStart|escape:'javascript'}'}, {/if} {if $ReminderTimeEnd neq ''} - { content: '{$ReminderTimeEnd} {translate key=$ReminderIntervalEnd} {translate key=ReminderBeforeEnd}'}, + {assign var="ReminderBeforeEnd" value="{translate key=ReminderBeforeEnd}"} + { content: '{$ReminderTimeEnd} {translate key=$ReminderIntervalEnd} {$ReminderBeforeEnd|escape:'javascript'}'}, {/if} ], ]