Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit a8d3de79839637b62eb166d4249fc0c80d10b34a
Author: Roman <[email protected]>
Date:   Tue Oct 17 11:46:03 2023 +0200

    Update the <Prenotazioni Folder>.notify_on_refuse_message value and default

commit 3a2d315
Author: Roman <[email protected]>
Date:   Tue Oct 17 11:18:00 2023 +0200

    Update changelog

commit 3316e62
Author: Roman <[email protected]>
Date:   Tue Oct 17 11:10:59 2023 +0200

    Refactor

commit 442d551
Author: Roman <[email protected]>
Date:   Tue Oct 17 10:58:48 2023 +0200

    Add booking_refuse_message to stringinterp vars
  • Loading branch information
folix-01 committed Oct 17, 2023
1 parent a0e36bf commit b70fe02
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ msgstr "Testo notifica prenotazione rifiutata"
#: redturtle/prenotazioni/content/prenotazioni_folder.py:211
#: redturtle/prenotazioni/upgrades.py:281
msgid "notify_on_refuse_message_default_value"
msgstr "La prenotazione ${booking_type} del ${booking_date} delle ore ${booking_time} è stata rifiutata."
msgstr "La prenotazione ${booking_type} del ${booking_date} delle ore ${booking_time} è stata rifiutata. Motivo del rifiuto: ${booking_refuse_message}"

#: redturtle/prenotazioni/content/prenotazioni_folder.py:625
msgid "notify_on_refuse_message_help"
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<version>1806</version>
<version>1807</version>
<dependencies>
<dependency>profile-plone.app.dexterity:default</dependency>
<dependency>profile-collective.z3cform.datagridfield:default</dependency>
Expand Down
15 changes: 15 additions & 0 deletions src/redturtle/prenotazioni/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,18 @@ def to_1806(self):
for type in getattr(brain.getObject(), "booking_types", []):
if "hidden" not in type.keys():
type["hidden"] = False


def to_1807(self):
for brain in api.portal.get_tool("portal_catalog")(
portal_type="PrenotazioniFolder"
):
obj = brain.getObject()
if obj.notify_on_refuse_message:
obj.notify_on_refuse_message += (
" Motivo del rifiuto: ${booking_refuse_message}"
)

logger.info(
"Upgraded <{UID}>.notify_on_refuse_message value".format(UID=brain.UID)
)
10 changes: 10 additions & 0 deletions src/redturtle/prenotazioni/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,14 @@
handler=".upgrades.update_rolemap"
/>
</genericsetup:upgradeSteps>
<genericsetup:upgradeSteps
profile="redturtle.prenotazioni:default"
source="1806"
destination="1807"
>
<genericsetup:upgradeStep
title="Update [Prenotazioni Folder].notify_on_refuse_message value"
handler=".upgrades.to_1807"
/>
</genericsetup:upgradeSteps>
</configure>

0 comments on commit b70fe02

Please sign in to comment.