From 42306d1910c1e11f2754578c264827e03df15b55 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Wed, 19 Mar 2025 12:53:02 +0100 Subject: [PATCH 1/3] merge with main --- .../contenttypes/indexers/configure.zcml | 4 ++++ .../plone/contenttypes/indexers/events.py | 13 ++++++++++ .../profiles/default/metadata.xml | 2 +- .../profiles/default/registry/criteria.xml | 21 +++++++++++++++- .../contenttypes/upgrades/configure.zcml | 7 ++++++ .../plone/contenttypes/upgrades/to_730x.py | 24 +++++++++++++++++++ 6 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/design/plone/contenttypes/indexers/configure.zcml b/src/design/plone/contenttypes/indexers/configure.zcml index eb8c127b..7a660671 100644 --- a/src/design/plone/contenttypes/indexers/configure.zcml +++ b/src/design/plone/contenttypes/indexers/configure.zcml @@ -8,6 +8,10 @@ factory=".events.effectivestart" name="effectivestart" /> + 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/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..2c89fd66 100644 --- a/src/design/plone/contenttypes/upgrades/to_730x.py +++ b/src/design/plone/contenttypes/upgrades/to_730x.py @@ -197,3 +197,27 @@ 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") + update_registry(context) + logger.info("Add new effectiveend (DateRecurringIndex) index") + + class extra: + recurdef = "recurrence" + until = "" + + name = "effectiveend" + catalog = api.portal.get_tool(name="portal_catalog") + catalog.addIndex(name, "DateRecurringIndex", extra=extra()) + logger.info("Catalog DateRecurringIndex {} created.".format(name)) + + logger.info("Reindex Events") + pc = api.portal.get_tool(name="portal_catalog") + brains = pc(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"]) From b555fc764a01fd3771bb6ab8eb42dbd0f2718512 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Wed, 19 Mar 2025 15:08:17 +0100 Subject: [PATCH 2/3] add index and profile to add index --- CHANGES.rst | 2 ++ src/design/plone/contenttypes/configure.zcml | 9 +++++++ .../profiles/to_7313/registry.xml | 25 +++++++++++++++++++ .../plone/contenttypes/upgrades/to_730x.py | 15 ++++++----- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/design/plone/contenttypes/profiles/to_7313/registry.xml diff --git a/CHANGES.rst b/CHANGES.rst index 3b681fca..e8c1455d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,8 @@ Changelog [lucabel] - Add upgrade-step to add missing metadata for image captions. [cekk] +- Add "data fine effettiva" for events, to order listing correctly + [lucabel] 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" /> + + + + + + 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/to_730x.py b/src/design/plone/contenttypes/upgrades/to_730x.py index 2c89fd66..67a7af0c 100644 --- a/src/design/plone/contenttypes/upgrades/to_730x.py +++ b/src/design/plone/contenttypes/upgrades/to_730x.py @@ -201,21 +201,24 @@ def to_7312(context): def to_7313(context): logger.info("Update registry") - update_registry(context) - logger.info("Add new effectiveend (DateRecurringIndex) index") + 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") - catalog.addIndex(name, "DateRecurringIndex", extra=extra()) - logger.info("Catalog DateRecurringIndex {} created.".format(name)) + + if 'effectiveend' not in catalog.indexes(): + catalog.addIndex(name, "DateRecurringIndex", extra=extra()) + logger.info("Catalog DateRecurringIndex {} created.".format(name)) logger.info("Reindex Events") - pc = api.portal.get_tool(name="portal_catalog") - brains = pc(portal_type="Event") + brains = catalog(portal_type="Event") tot = len(brains) for i, brain in enumerate(brains): if i % 15 == 0: From 1dfa913f34e832c578ac989f848bc2146a52ab41 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Wed, 19 Mar 2025 15:49:29 +0100 Subject: [PATCH 3/3] black --- src/design/plone/contenttypes/upgrades/to_730x.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/design/plone/contenttypes/upgrades/to_730x.py b/src/design/plone/contenttypes/upgrades/to_730x.py index 67a7af0c..e6487c88 100644 --- a/src/design/plone/contenttypes/upgrades/to_730x.py +++ b/src/design/plone/contenttypes/upgrades/to_730x.py @@ -202,10 +202,11 @@ def to_7312(context): def to_7313(context): logger.info("Update registry") context.runImportStepFromProfile( - "profile-design.plone.contenttypes:to_7313", - "plone.app.registry", False) + "profile-design.plone.contenttypes:to_7313", "plone.app.registry", False + ) logger.info("Add new effectiveend (DateRecurringIndex) index") + class extra: recurdef = "recurrence" until = "" @@ -213,7 +214,7 @@ class extra: name = "effectiveend" catalog = api.portal.get_tool(name="portal_catalog") - if 'effectiveend' not in catalog.indexes(): + if "effectiveend" not in catalog.indexes(): catalog.addIndex(name, "DateRecurringIndex", extra=extra()) logger.info("Catalog DateRecurringIndex {} created.".format(name))