Skip to content

Commit

Permalink
Fix reminder
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Kysil authored and Roman Kysil committed Sep 13, 2024
1 parent e392f85 commit 485643c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
@@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand All @@ -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 ""

Expand Down
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>\n"
"Language-Team: American English <[email protected]>\n"
Expand Down Expand Up @@ -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: "

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand All @@ -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"

Expand Down
15 changes: 10 additions & 5 deletions src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 ""

Expand All @@ -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 ""

Expand Down
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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(
Expand Down

0 comments on commit 485643c

Please sign in to comment.