Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/URB-3487.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Extract the “decisional delay” vocabulary from the code.
[WBoudabous]
13 changes: 1 addition & 12 deletions src/Products/urban/content/licence/RoadDecree.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def get_raw_voc(self, context, licence_type):
label=_("urban_label_decisional_delay", default="DecisionalDelay"),
),
schemata="urban_analysis",
vocabulary="list_decisional_delay",
vocabulary=UrbanVocabulary("decisionaldelay", inUrbanConfig=True),
default_method="getDefaultValue",
),
),
Expand Down Expand Up @@ -284,17 +284,6 @@ def listProcedureChoices(self):
)
return DisplayList(vocab)

security.declarePublic("list_decisional_delay")

def list_decisional_delay(self):
vocabulary = (
("ukn", _("unknown")),
("75j", _("75 days")),
("105j", _("105 days")),
("150j", _("150 days")),
("210j", _("210 days")),
)
return DisplayList(vocabulary)

def get_decisional_delays(self, *values):
selection = [v["val"] for v in values if v["selected"]]
Expand Down
23 changes: 3 additions & 20 deletions src/Products/urban/locales/fr/LC_MESSAGES/urban.po
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,14 @@ msgstr "%s_folder_title"
msgid "%s_urbanconfig_title"
msgstr "%s_urbanconfig_title"

#: ../content/licence/RoadDecree.py:288
msgid "105 days"
msgstr "105 jours"

#: ../content/licence/RoadDecree.py:289
msgid "150 days"
msgstr "150 jours"

#: ../content/licence/ExplosivesPossession.py:140
msgid "1st class"
msgstr "1ère classe : Collège provincial"

#: ../content/licence/RoadDecree.py:290
msgid "210 days"
msgstr "210 jours"

#: ../content/licence/ExplosivesPossession.py:141
msgid "2nd class"
msgstr "2ème classe : Collège communal"

#: ../content/licence/RoadDecree.py:287
msgid "75 days"
msgstr "75 jours"

#: ../contentrules/event_type.py:70
msgid "A Event type condition makes the rule apply only if Event type correspond to the one from the context."
msgstr "Une condition de type d'événement rend la règle applicable uniquement si le type d'événement correspond à celui du contexte."
Expand Down Expand Up @@ -2752,10 +2736,6 @@ msgstr "Par"
msgid "uniquelicence_urbanconfig_title"
msgstr "Paramètres des permis uniques"

#: ../content/licence/RoadDecree.py:286
msgid "unknown"
msgstr "Non déterminé"

msgid "unknown_worktype_on_licence"
msgstr "nature des travaux ${worktype} inconnue sur le permis ${reference}"

Expand Down Expand Up @@ -5718,3 +5698,6 @@ msgstr "Partie de l'immeuble concernée"

msgid "urban_label_buildingType"
msgstr "Nature de l'immeuble"

msgid "decisionaldelay_folder_title"
msgstr " Délai de décision du conseil "
Comment on lines +5702 to +5703

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove surrounding whitespace from the translation value.

Line 5703 has leading/trailing spaces in msgstr, which can show up in UI labels.

💡 Proposed fix
 msgid "decisionaldelay_folder_title"
-msgstr " Délai de décision du conseil "
+msgstr "Délai de décision du conseil"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
msgid "decisionaldelay_folder_title"
msgstr " Délai de décision du conseil "
msgid "decisionaldelay_folder_title"
msgstr "Délai de décision du conseil"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Products/urban/locales/fr/LC_MESSAGES/urban.po` around lines 5702 - 5703,
The translated string for msgid "decisionaldelay_folder_title" contains
leading/trailing spaces in its msgstr; remove the surrounding whitespace so
msgstr is "Délai de décision du conseil" (no leading or trailing spaces) to
prevent extra spaces appearing in the UI.

31 changes: 31 additions & 0 deletions src/Products/urban/migration/update_290.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from Products.urban import UrbanMessage as _
from Products.urban.migration.utils import cook_javascript_resources
from Products.urban.utils import moveElementAfter
from Products.urban.profiles.extra.config_default_values import default_values
from Products.urban.setuphandlers import set_licence_folder_security
from Products.urban.setuphandlers import createFolderDefaultValues
from Products.urban.setuphandlers import createVocabularyFolder
from dm.historical import getHistory
from imio.helpers.catalog import reindexIndexes
from plone import api
Expand Down Expand Up @@ -362,3 +365,31 @@ def update_folder_manager_notice(context):
notice_folder_manager.reindexObject()

logger.info("manageableLicences updated for notice FolderManager")
def extract_decision_delay_vocabulary(context):
""" """
logger = logging.getLogger(
"urban: Extract decision delay vocabulary from code"
)
logger.info("starting upgrade steps")

container = api.portal.get_tool("portal_urban")

roaddecree_folder = getattr(container, "roaddecree", None)

if roaddecree_folder is None:
return
delay_config = default_values["RoadDecree"][
"decisionaldelay"
]
allowedtypes = delay_config[0]
delay_config = createVocabularyFolder(
roaddecree_folder, "decisionaldelay", context, allowedtypes
)
createFolderDefaultValues(
delay_config,
default_values["RoadDecree"]["decisionaldelay"][1:],
default_values["RoadDecree"]["decisionaldelay"][0],
)

logger.info("migration step done!")

19 changes: 18 additions & 1 deletion src/Products/urban/migration/upgrades_290.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@
destination="2908"
handler=".update_290.setup_index_referenceFT"
profile="Products.urban:default" />
<gs:upgradeStep
title="Extract decision delay vocabulary from codes"
description=""
source="2908"
destination="2909"
handler=".update_290.extract_decision_delay_vocabulary"
profile="Products.urban:default"
/>

<gs:upgradeStep
title="Fix housing and roaddecree security"
Expand All @@ -83,7 +91,7 @@
destination="2909"
handler=".update_290.fix_housing_roaddecree"
profile="Products.urban:default" />

<gs:upgradeStep
title="Update manageableLicences for notice FolderManager"
description=""
Expand All @@ -92,4 +100,13 @@
handler=".update_290.update_folder_manager_notice"
profile="Products.urban:default" />

<gs:upgradeStep
title="Extract decision delay vocabulary from codes"
description=""
source="2910"
destination="2911"
handler=".update_290.extract_decision_delay_vocabulary"
profile="Products.urban:default"
/>

</configure>
2 changes: 1 addition & 1 deletion src/Products/urban/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>2910</version>
<version>2911</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down
10 changes: 10 additions & 0 deletions src/Products/urban/profiles/extra/config_default_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -3949,4 +3949,14 @@
},
],
},
"RoadDecree":{
"decisionaldelay": [
"UrbanVocabularyTerm",
{"id": "ukn", "title": "Non déterminé"},
{"id": "75j", "title": "75 jours"},
{"id": "105j", "title": "105 jours"},
{"id": "150j", "title": "150 jours"},
{"id": "210j", "title": "210 jours"},

],},
}