Skip to content

Commit

Permalink
Merge branch 'develop' into change_max_default
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk authored Oct 18, 2023
2 parents 3b8880a + b70fe02 commit db59ae7
Show file tree
Hide file tree
Showing 19 changed files with 521 additions and 267 deletions.
29 changes: 23 additions & 6 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@ Changelog
=========


2.1.2 (unreleased)
2.1.4 (unreleased)
------------------

- Change bookings default limit to 0.
[folix-01]

- Add booking_refuse_message to Prenotazione stringinterp variables.
[folix-01]


2.1.3 (2023-10-13)
------------------

- Resect hidden booking types from @booking-schema.
[folix-01]


2.1.2 (2023-10-13)
------------------

- Add hidden booking types for operator use.
[folix-01]


2.1.1 (2023-10-11)
Expand All @@ -19,24 +36,24 @@ Changelog
2.1.0 (2023-10-11)
------------------

- Add booking details to the export file
- Add booking details to the export file.
[folix-01]

- Change PrenotazioniFolder.cosa_serve field type to RichText
- 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.
Expand Down
9 changes: 8 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,19 @@ Creating a new Booking Folder
If the product is correctly installed the **Booking Folder** entry is available on the `add new` action menu.

You can configure:

- hidden booking types for the internal usage
- more then one gate
- booking vacations
- custom duration for booking types
- week schedule for morning and afternoon time tables

Creating the hidden booking types
---------------------------------

You can hide your booking types from simple and anonymous users by using the 'Hidden Booking' flag
in your booking types definition. This way, it will only be available to users with the 'Bookings Manager'
permission. This feature may be useful if you want to restrict booking types for internal corporate use.

Creating a new booking content
------------------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name="redturtle.prenotazioni",
version="2.1.2.dev0",
version="2.1.4.dev0",
description="An add-on for Plone",
long_description=long_description,
# Get more from https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
6 changes: 6 additions & 0 deletions src/redturtle/prenotazioni/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@
for="*"
name="booking_url_with_delete_token"
/>
<adapter
factory=".stringinterp.BookingRefuseMessage"
provides="plone.stringinterp.interfaces.IStringSubstitution"
for="*"
name="booking_refuse_message"
/>

<!-- ical adapters -->
<adapter
Expand Down
24 changes: 24 additions & 0 deletions src/redturtle/prenotazioni/adapters/stringinterp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.app.event.base import default_timezone
from plone.app.layout.viewlets.content import ContentHistoryViewlet
from plone.stringinterp.adapters import BaseSubstitution
from zope.component import adapter
from zope.globalrequest import getRequest
from zope.interface import Interface

from redturtle.prenotazioni import _, logger
Expand Down Expand Up @@ -238,3 +241,24 @@ class BookingOperatorUrlSubstitution(BaseSubstitution):

def safe_call(self):
return self.context.absolute_url()


@adapter(Interface)
class BookingRefuseMessage(BaseSubstitution):
category = _("Booking")
description = _("The booking refuse message")

def safe_call(self):
content_history_viewlet = ContentHistoryViewlet(
self.context, getRequest(), None, None
)
site_url = api.portal.get().absolute_url()
content_history_viewlet.navigation_root_url = site_url
content_history_viewlet.site_url = site_url
history = content_history_viewlet.workflowHistory()

refuse_history = [i for i in history if i.get("action", "") == "refuse"]

refuse_message = refuse_history and refuse_history[0].get("comments") or ""

return refuse_message
9 changes: 8 additions & 1 deletion src/redturtle/prenotazioni/content/prenotazioni_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class IBookingTypeRow(Interface):
required=True,
vocabulary="redturtle.prenotazioni.VocDurataIncontro",
)
hidden = schema.Bool(
title=_("Hidden type"),
required=False,
default=False,
)


@provider(IContextAwareDefaultFactory)
Expand Down Expand Up @@ -442,7 +447,9 @@ def get_options():
"booking_types_help",
default="Put booking types there (one per line).\n"
"If you do not provide this field, "
"not type selection will be available",
"not type selection will be available. "
"If the 'Hidden Type' flag is selected the type will only "
"be available to users with the 'Bookings Manager' permission",
),
value_type=DictRow(schema=IBookingTypeRow),
)
Expand Down
Loading

0 comments on commit db59ae7

Please sign in to comment.