diff --git a/CHANGES.rst b/CHANGES.rst index 11bc061f..a7c986ae 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,9 +11,12 @@ Changelog [lucabel] - Add upgrade-step to add missing metadata for image captions. [cekk] +- Add "data fine effettiva" for events, to order listing correctly + [lucabel] - Fix typo in Venue serializer that didn't return the right history version. [cekk] + 6.3.4 (2025-03-07) ------------------ diff --git a/src/design/plone/contenttypes/configure.zcml b/src/design/plone/contenttypes/configure.zcml index 8c7b867b..76b7e592 100644 --- a/src/design/plone/contenttypes/configure.zcml +++ b/src/design/plone/contenttypes/configure.zcml @@ -72,6 +72,15 @@ provides="Products.GenericSetup.interfaces.EXTENSION" directory="profiles/remove_eea_api_taxonomy" /> + + + + end: + end = occurrence.end + if obj.title: + print(f"{obj.title} - {end}") + return end diff --git a/src/design/plone/contenttypes/profiles/default/metadata.xml b/src/design/plone/contenttypes/profiles/default/metadata.xml index 4ff1a035..2e46e777 100644 --- a/src/design/plone/contenttypes/profiles/default/metadata.xml +++ b/src/design/plone/contenttypes/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 7312 + 7313 profile-redturtle.bandi:default profile-collective.venue:default diff --git a/src/design/plone/contenttypes/profiles/default/registry/criteria.xml b/src/design/plone/contenttypes/profiles/default/registry/criteria.xml index 068b2c5a..9be6d091 100644 --- a/src/design/plone/contenttypes/profiles/default/registry/criteria.xml +++ b/src/design/plone/contenttypes/profiles/default/registry/criteria.xml @@ -588,5 +588,24 @@ Dates - + + Data effettiva di fine evento + Criterio per ricerche che si basano sulla data effettiva di fine + True + True + + plone.app.querystring.operation.date.lessThan + plone.app.querystring.operation.date.largerThan + plone.app.querystring.operation.date.between + plone.app.querystring.operation.date.lessThanRelativeDate + plone.app.querystring.operation.date.largerThanRelativeDate + plone.app.querystring.operation.date.today + plone.app.querystring.operation.date.beforeToday + plone.app.querystring.operation.date.afterToday + plone.app.querystring.operation.date.beforeRelativeDate + plone.app.querystring.operation.date.afterRelativeDate + + Dates + diff --git a/src/design/plone/contenttypes/profiles/to_7313/registry.xml b/src/design/plone/contenttypes/profiles/to_7313/registry.xml new file mode 100644 index 00000000..8ff36aa1 --- /dev/null +++ b/src/design/plone/contenttypes/profiles/to_7313/registry.xml @@ -0,0 +1,25 @@ + + + + Data effettiva di fine evento + Criterio per ricerche che si basano sulla data effettiva di fine + True + True + + plone.app.querystring.operation.date.lessThan + plone.app.querystring.operation.date.largerThan + plone.app.querystring.operation.date.between + plone.app.querystring.operation.date.lessThanRelativeDate + plone.app.querystring.operation.date.largerThanRelativeDate + plone.app.querystring.operation.date.today + plone.app.querystring.operation.date.beforeToday + plone.app.querystring.operation.date.afterToday + plone.app.querystring.operation.date.beforeRelativeDate + plone.app.querystring.operation.date.afterRelativeDate + + Dates + + diff --git a/src/design/plone/contenttypes/upgrades/configure.zcml b/src/design/plone/contenttypes/upgrades/configure.zcml index db67db80..20c19959 100644 --- a/src/design/plone/contenttypes/upgrades/configure.zcml +++ b/src/design/plone/contenttypes/upgrades/configure.zcml @@ -941,4 +941,11 @@ destination="7312" handler=".to_730x.to_7312" /> + diff --git a/src/design/plone/contenttypes/upgrades/to_730x.py b/src/design/plone/contenttypes/upgrades/to_730x.py index e36ea572..e6487c88 100644 --- a/src/design/plone/contenttypes/upgrades/to_730x.py +++ b/src/design/plone/contenttypes/upgrades/to_730x.py @@ -197,3 +197,31 @@ def to_7312(context): for column in ["image_caption", "preview_caption"]: if column not in pc.schema(): pc.addColumn(column) + + +def to_7313(context): + logger.info("Update registry") + context.runImportStepFromProfile( + "profile-design.plone.contenttypes:to_7313", "plone.app.registry", False + ) + + logger.info("Add new effectiveend (DateRecurringIndex) index") + + class extra: + recurdef = "recurrence" + until = "" + + name = "effectiveend" + catalog = api.portal.get_tool(name="portal_catalog") + + if "effectiveend" not in catalog.indexes(): + catalog.addIndex(name, "DateRecurringIndex", extra=extra()) + logger.info("Catalog DateRecurringIndex {} created.".format(name)) + + logger.info("Reindex Events") + brains = catalog(portal_type="Event") + tot = len(brains) + for i, brain in enumerate(brains): + if i % 15 == 0: + logger.info("Progress: {}/{}".format(i, tot)) + brain.getObject().reindexObject(idxs=["effectiveend"])