Skip to content

Commit

Permalink
Extend the email vars list
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Nov 14, 2023
1 parent 1e7f38f commit a635b07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Changelog
- Compatibilize with the 2.0.1 redturtle.prenotazioni version.
- Add the UO.contact_info field to @bookable-uo-list response.
[folix-01]
- Nothing changed yet.
- Compatibilize with the 2.0.1 redturtle.prenotazioni version.
- Add the UO.contact_info field to @bookable-uo-list response.
[folix-01]
- Extend prenotazioni email vars list.
[folix-01]


1.1.10 (2023-10-16)
Expand Down
7 changes: 7 additions & 0 deletions src/design/plone/ioprenoto/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@
name="booking_operator_url"
/>

<adapter
factory=".stringinterp.BookingUnitaOrganizzativaTitle"
provides="plone.stringinterp.interfaces.IStringSubstitution"
for="*"
name="unita_organizzativa_title"
/>

</configure>
22 changes: 22 additions & 0 deletions src/design/plone/ioprenoto/adapters/stringinterp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.registry.interfaces import IRegistry
from plone.stringinterp.adapters import BaseSubstitution
from plone.volto.interfaces import IVoltoSettings
from redturtle.prenotazioni.adapters import stringinterp as base
from zope.component import adapter, getUtility
Expand Down Expand Up @@ -62,3 +63,24 @@ def safe_call(self):
booking_folder.getPhysicalPath()[len(portal.getPhysicalPath()) :] # noqa
)
return f"{portal_url}/{booking_folder_path}?tab=search&SearchableText={self.context.getBookingCode()}&login=1"


@adapter(Interface)
class BookingUnitaOrganizzativaTitle(BaseSubstitution):
def safe_call(self):
return getattr(
getattr(
next(
iter(
getattr(
self.context.getPrenotazioniFolder(), "uffici_correlati", []
)
),
None,
),
"to_object",
None,
),
"title",
"",
)

0 comments on commit a635b07

Please sign in to comment.