diff --git a/server/features/event_embedded_planning.feature b/server/features/event_embedded_planning.feature index d58feae44..7bff2d291 100644 --- a/server/features/event_embedded_planning.feature +++ b/server/features/event_embedded_planning.feature @@ -1,4 +1,5 @@ Feature: Event Embedded Planning + @auth @vocabulary Scenario: Can create and update associated Planning with an Event @@ -19,7 +20,10 @@ Feature: Event Embedded Planning "news_coverage_status": "ncostat:int", "scheduled": "2029-11-21T15:00:00.000Z" }] - }] + }], + "subject": [ + {"name": "Test", "qcode": "test", "scheme": "test"} + ] }] """ Then we get OK response @@ -57,7 +61,10 @@ Feature: Event Embedded Planning "g2_content_type": "text", "scheduled": "2029-11-21T15:00:00+0000" } - }] + }], + "subject": [ + {"name": "Test", "qcode": "test", "scheme": "test"} + ] }]} """ And we store "PLAN1" with first item diff --git a/server/planning/assignments/assignments_content.py b/server/planning/assignments/assignments_content.py index 8fac118a7..6bd622f2c 100644 --- a/server/planning/assignments/assignments_content.py +++ b/server/planning/assignments/assignments_content.py @@ -130,10 +130,8 @@ def get_item_from_assignment(assignment, template=None): content_profile_id = template["data"].get("profile", desk.get("default_content_profile", None)) content_profile = None if content_profile_id: - content_profiles = get_resource_service("content_types").find({"_id": content_profile_id}) - # Pop those items not in the content_profile - if content_profiles.count() > 0: - content_profile = content_profiles.next() + content_profile = get_resource_service("content_types").find_one(req=None, _id=content_profile_id) + if content_profile is not None: for key in content_profile.get("schema").keys(): if content_profile["schema"][key] is None: item.pop(key, None) diff --git a/server/planning/events/events_sync/embedded_planning.py b/server/planning/events/events_sync/embedded_planning.py index 4f69274d6..75f3f1595 100644 --- a/server/planning/events/events_sync/embedded_planning.py +++ b/server/planning/events/events_sync/embedded_planning.py @@ -40,7 +40,6 @@ def create_new_plannings_from_embedded_planning( "internal_note", "name", "place", - "subject", "anpa_category", "ednote", "language", @@ -48,6 +47,9 @@ def create_new_plannings_from_embedded_planning( ] if field in profiles.planning.enabled_fields ) + + planning_fields.add("subject") + multilingual_enabled = profiles.events.is_multilingual and profiles.planning.is_multilingual translations: List[StringFieldTranslation] = [] if multilingual_enabled and "language" in planning_fields and len(event.get("translations") or []):