diff --git a/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/email/events.py b/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/email/events.py index 5b32727f..e0dab16a 100644 --- a/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/email/events.py +++ b/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/email/events.py @@ -23,7 +23,6 @@ def booking_folder_provides_current_behavior(booking): def send_email_notification_on_transition(context, event) -> None: if not booking_folder_provides_current_behavior(context): return - booking_folder = context.getPrenotazioniFolder() flags = booking_folder.get_notification_flags() diff --git a/src/redturtle/prenotazioni/locales/en/LC_MESSAGES/redturtle.prenotazioni.po b/src/redturtle/prenotazioni/locales/en/LC_MESSAGES/redturtle.prenotazioni.po index 5730946d..a2ce06d6 100644 --- a/src/redturtle/prenotazioni/locales/en/LC_MESSAGES/redturtle.prenotazioni.po +++ b/src/redturtle/prenotazioni/locales/en/LC_MESSAGES/redturtle.prenotazioni.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-08-19 14:54+0000\n" +"POT-Creation-Date: 2024-09-13 14:01+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -620,7 +620,7 @@ msgid "booked_prenotation_message" msgstr "" #. Default: "Booking canceled: " -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:368 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:371 msgid "booking_canceled_mail_subject_part" msgstr "" @@ -752,6 +752,11 @@ msgstr "" msgid "canceled" msgstr "Annullato" +#. Default: "Confirm" +#: redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py:33 +msgid "confirm" +msgstr "" + #. Default: "Your booking has been canceled." #: redturtle/prenotazioni/browser/prenotazione_print.py:35 msgid "confirm_booking_canceled_message" @@ -999,7 +1004,7 @@ msgid "history_appio_transition_sent" msgstr "" #. Default: "Email notification was sent to booking manager" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:258 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:261 msgid "history_email_manager_notification_sent" msgstr "" @@ -1009,12 +1014,12 @@ msgid "history_email_reschedule_sent" msgstr "" #. Default: "Email message about the ${transition} transition was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:165 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:168 msgid "history_email_transition_sent" msgstr "" #. Default: "Email reminder was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:213 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:216 msgid "history_reminder_sent" msgstr "" diff --git a/src/redturtle/prenotazioni/locales/it/LC_MESSAGES/redturtle.prenotazioni.po b/src/redturtle/prenotazioni/locales/it/LC_MESSAGES/redturtle.prenotazioni.po index 8ff6fd47..e5f20dd3 100644 --- a/src/redturtle/prenotazioni/locales/it/LC_MESSAGES/redturtle.prenotazioni.po +++ b/src/redturtle/prenotazioni/locales/it/LC_MESSAGES/redturtle.prenotazioni.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2024-08-19 14:54+0000\n" +"POT-Creation-Date: 2024-09-13 14:01+0000\n" "PO-Revision-Date: 2014-05-27 17:36+0200\n" "Last-Translator: Alessandro Pisa \n" "Language-Team: American English \n" @@ -622,7 +622,7 @@ msgid "booked_prenotation_message" msgstr "${day}, ore ${booking_time}, prenotato da ${booked_by}, prenotazione: ${booking_type} durata: ${duration} minuti" #. Default: "Booking canceled: " -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:368 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:371 msgid "booking_canceled_mail_subject_part" msgstr "Prenotazione cancellata: " @@ -755,6 +755,11 @@ msgstr "Occupato" msgid "canceled" msgstr "Annullato" +#. Default: "Confirm" +#: redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py:33 +msgid "confirm" +msgstr "Conferma" + #. Default: "Your booking has been canceled." #: redturtle/prenotazioni/browser/prenotazione_print.py:35 msgid "confirm_booking_canceled_message" @@ -1002,7 +1007,7 @@ msgid "history_appio_transition_sent" msgstr "Inviata notifica AppIO per il cambio di stato della prenotazione: ${transition}" #. Default: "Email notification was sent to booking manager" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:258 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:261 msgid "history_email_manager_notification_sent" msgstr "Inviata notifica email al Gestore delle prenotazioni" @@ -1012,12 +1017,12 @@ msgid "history_email_reschedule_sent" msgstr "Inviata notifica email per lo spostamento della prenotazione" #. Default: "Email message about the ${transition} transition was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:165 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:168 msgid "history_email_transition_sent" msgstr "Inviata notifica email per il cambio di stato della prenotazione: ${transition}" #. Default: "Email reminder was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:213 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:216 msgid "history_reminder_sent" msgstr "Inviata notifica email per il promemoria" diff --git a/src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot b/src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot index 3def06f2..ef7bf69a 100644 --- a/src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot +++ b/src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-08-19 14:54+0000\n" +"POT-Creation-Date: 2024-09-13 14:01+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -623,7 +623,7 @@ msgid "booked_prenotation_message" msgstr "" #. Default: "Booking canceled: " -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:368 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:371 msgid "booking_canceled_mail_subject_part" msgstr "" @@ -755,6 +755,11 @@ msgstr "" msgid "canceled" msgstr "" +#. Default: "Confirm" +#: redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py:33 +msgid "confirm" +msgstr "" + #. Default: "Your booking has been canceled." #: redturtle/prenotazioni/browser/prenotazione_print.py:35 msgid "confirm_booking_canceled_message" @@ -1002,7 +1007,7 @@ msgid "history_appio_transition_sent" msgstr "" #. Default: "Email notification was sent to booking manager" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:258 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:261 msgid "history_email_manager_notification_sent" msgstr "" @@ -1012,12 +1017,12 @@ msgid "history_email_reschedule_sent" msgstr "" #. Default: "Email message about the ${transition} transition was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:165 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:168 msgid "history_email_transition_sent" msgstr "" #. Default: "Email reminder was sent" -#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:213 +#: redturtle/prenotazioni/behaviors/booking_folder/notifications/email/notification_email_message.py:216 msgid "history_reminder_sent" msgstr "" diff --git a/src/redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py b/src/redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py index a43ddef2..664e8f7d 100644 --- a/src/redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py +++ b/src/redturtle/prenotazioni/restapi/services/booking/notify_about_confirm.py @@ -1,12 +1,16 @@ # -*- coding: utf-8 -*- from plone import api +from plone.protect.interfaces import IDisableCSRFProtection from plone.restapi.services import Service from Products.DCWorkflow.events import AfterTransitionEvent from zExceptions import BadRequest from zope.event import notify +from zope.interface import alsoProvides from zope.interface import implementer from zope.publisher.interfaces import IPublishTraverse +from redturtle.prenotazioni import _ + @implementer(IPublishTraverse) class NotifyUserAboutBookingConfirm(Service): @@ -18,13 +22,20 @@ def publishTraverse(self, request, booking_uid): return self def reply(self): + alsoProvides(self.request, IDisableCSRFProtection) + booking = api.content.get(UID=self.booking_uid) if not booking: raise BadRequest("Booking not found") transition_billet = type( - "TranstionBillet", (object,), {"__name__": "confirm", "title": "Confirm"} + "TransitionBillet", + (object,), + { + "__name__": "confirm", + "title": _("confirm", default="Confirm"), + }, )() notify(