diff --git a/CHANGES.rst b/CHANGES.rst index 4a442909..115daa81 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,24 +5,27 @@ Changelog 2.0.1 (unreleased) ------------------ -- Add booking details to the export file +- Add hidden booking types for the operator use. [folix-01] -- Change PrenotazioniFolder.cosa_serve field type to RichText +- Add booking details to the export file. + [folix-01] + +- Change PrenotazioniFolder.cosa_serve field type to RichText. [folix-01] - Utilizzare defaultFactory se il default รจ una funzione, altrimenti non viene eseguita nel momento corretto. [mamico] -- Rimosso searchabletext di prenotazioni doppio +- Rimosso searchabletext di prenotazioni doppio. [mamico] - Aggiunto indexer per fiscalcode uppercase per - fare ricerche case insensitive + fare ricerche case insensitive. [mamico] -- Remove Contributor from the package permissions map +- Remove Contributor from the package permissions map. [folix-01] - Add configurable simultaneous bookings limit for the same user. diff --git a/src/redturtle/prenotazioni/content/prenotazioni_folder.py b/src/redturtle/prenotazioni/content/prenotazioni_folder.py index c2d45174..082f13aa 100644 --- a/src/redturtle/prenotazioni/content/prenotazioni_folder.py +++ b/src/redturtle/prenotazioni/content/prenotazioni_folder.py @@ -18,10 +18,7 @@ from redturtle.prenotazioni import _ from redturtle.prenotazioni.browser.widget import WeekTableOverridesFieldWidget from redturtle.prenotazioni.config import DEFAULT_VISIBLE_BOOKING_FIELDS -from redturtle.prenotazioni.content.validators import ( - PauseValidator, - checkOverrides, -) +from redturtle.prenotazioni.content.validators import PauseValidator, checkOverrides try: from plone.app.dexterity import textindexer @@ -45,9 +42,7 @@ def get_from_form(form, fieldname): return value return None - number_of_entry = request.form.get( - "form.widgets.{}.count".format(fieldname) - ) + number_of_entry = request.form.get("form.widgets.{}.count".format(fieldname)) data = [] prefix = "form.widgets.{}".format(fieldname) for counter in range(int(number_of_entry)): @@ -87,9 +82,7 @@ class IWeekTableRow(model.Schema): ) afternoon_start = schema.Choice( - title=_( - "afternoon_start_label", default="Start time in the afternoon" - ), + title=_("afternoon_start_label", default="Start time in the afternoon"), vocabulary="redturtle.prenotazioni.VocOreInizio", required=False, ) @@ -229,9 +222,7 @@ class IPrenotazioniFolder(model.Schema): descriptionAgenda = RichText( required=False, title=_("Descrizione Agenda", default="Descrizione Agenda"), - description=_( - "Inserire il testo di presentazione dell'agenda corrente" - ), + description=_("Inserire il testo di presentazione dell'agenda corrente"), ) form.mode(descriptionAgenda="display") @@ -246,9 +237,7 @@ class IPrenotazioniFolder(model.Schema): directives.widget(visible_booking_fields=CheckBoxFieldWidget) visible_booking_fields = schema.List( - title=_( - "label_visible_booking_fields", default="Visible booking fields" - ), + title=_("label_visible_booking_fields", default="Visible booking fields"), description=_( "help_visible_booking_fields", "User will not be able to add a booking unless those " @@ -266,9 +255,7 @@ class IPrenotazioniFolder(model.Schema): directives.widget(required_booking_fields=CheckBoxFieldWidget) required_booking_fields = schema.List( - title=_( - "label_required_booking_fields", default="Required booking fields" - ), + title=_("label_required_booking_fields", default="Required booking fields"), description=_( "help_required_booking_fields", "User will not be able to add a booking unless those " @@ -518,14 +505,10 @@ def data_validation(data): raise Invalid(_("You should set a start time for afternoon.")) if interval["morning_start"] and interval["morning_end"]: if interval["morning_start"] > interval["morning_end"]: - raise Invalid( - _("Morning start should not be greater than end.") - ) + raise Invalid(_("Morning start should not be greater than end.")) if interval["afternoon_start"] and interval["afternoon_end"]: if interval["afternoon_start"] > interval["afternoon_end"]: - raise Invalid( - _("Afternoon start should not be greater than end.") - ) + raise Invalid(_("Afternoon start should not be greater than end.")) # TODO: definire o descrivere quando avviee la notifica # TODO: inserire qui la chiave IO ? o su un config in zope.conf/environment ? diff --git a/src/redturtle/prenotazioni/restapi/serializers/adapters/prenotazioni_folder.py b/src/redturtle/prenotazioni/restapi/serializers/adapters/prenotazioni_folder.py index 392c246c..ee5a7f5c 100644 --- a/src/redturtle/prenotazioni/restapi/serializers/adapters/prenotazioni_folder.py +++ b/src/redturtle/prenotazioni/restapi/serializers/adapters/prenotazioni_folder.py @@ -1,25 +1,14 @@ # -*- coding: utf-8 -*- -from plone import api -from plone.restapi.interfaces import IFieldSerializer, ISerializeToJson -from plone.restapi.serializer.converters import json_compatible -from zope.component import adapter, getMultiAdapter -from zope.i18n import translate -from zope.interface import implementer -from zope.publisher.interfaces import IRequest -from zope.schema import getFields +from copy import deepcopy + +from plone.restapi.interfaces import ISerializeToJson from plone.restapi.serializer.dxcontent import SerializeFolderToJson +from zope.component import adapter +from zope.interface import implementer -from redturtle.prenotazioni import logger -from redturtle.prenotazioni.content.prenotazioni_folder import ( - IPrenotazioniFolder, -) -from redturtle.prenotazioni.interfaces import ( - ISerializeToPrenotazioneSearchableItem, -) +from redturtle.prenotazioni.content.prenotazioni_folder import IPrenotazioniFolder from redturtle.prenotazioni.interfaces import IRedturtlePrenotazioniLayer -from copy import deepcopy - @implementer(ISerializeToJson) @adapter(IPrenotazioniFolder, IRedturtlePrenotazioniLayer) diff --git a/src/redturtle/prenotazioni/tests/test_prenotazioni_context_state.py b/src/redturtle/prenotazioni/tests/test_prenotazioni_context_state.py index 9b52602c..31eb4519 100644 --- a/src/redturtle/prenotazioni/tests/test_prenotazioni_context_state.py +++ b/src/redturtle/prenotazioni/tests/test_prenotazioni_context_state.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import unittest from datetime import date, datetime + from Acquisition import aq_parent from plone import api from plone.app.testing import ( @@ -10,6 +11,7 @@ setRoles, ) from plone.restapi.testing import RelativeSession + from redturtle.prenotazioni.adapters.booker import IBooker from redturtle.prenotazioni.testing import REDTURTLE_PRENOTAZIONI_INTEGRATION_TESTING from redturtle.prenotazioni.tests.helpers import WEEK_TABLE_SCHEMA diff --git a/src/redturtle/prenotazioni/tests/test_prenotazioni_folder_serializer.py b/src/redturtle/prenotazioni/tests/test_prenotazioni_folder_serializer.py index d8dbc97d..893cb227 100644 --- a/src/redturtle/prenotazioni/tests/test_prenotazioni_folder_serializer.py +++ b/src/redturtle/prenotazioni/tests/test_prenotazioni_folder_serializer.py @@ -1,26 +1,16 @@ # -*- coding: UTF-8 -*- -import email import unittest -from datetime import date, datetime, timedelta +from datetime import date -import pytz -from collective.contentrules.mailfromfield.actions.mail import ( - MailFromFieldAction, -) from plone import api from plone.app.testing import TEST_USER_ID, setRoles -from plone.contentrules.rule.interfaces import IExecutable -from Products.CMFCore.WorkflowCore import ActionSucceededEvent +from plone.restapi.interfaces import ISerializeToJson from zope.component import getMultiAdapter +from zope.globalrequest import getRequest from zope.interface import implementer from zope.interface.interfaces import IObjectEvent -from zope.globalrequest import getRequest -from plone.restapi.interfaces import ISerializeToJson -from redturtle.prenotazioni.adapters.booker import IBooker -from redturtle.prenotazioni.testing import ( - REDTURTLE_PRENOTAZIONI_FUNCTIONAL_TESTING, -) +from redturtle.prenotazioni.testing import REDTURTLE_PRENOTAZIONI_FUNCTIONAL_TESTING @implementer(IObjectEvent)