From 1887a92ac3449e411e67748444b709c2ad4e606c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Duch=C3=AAne?= Date: Wed, 11 Dec 2024 12:30:16 +0100 Subject: [PATCH] Fixed an issue when an item is sent to another MC --- CHANGES.rst | 5 ++-- src/Products/PloneMeeting/MeetingItem.py | 6 +++++ .../PloneMeeting/tests/testMeetingItem.py | 23 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 074095dfa..f6a7bf9ad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,8 +5,9 @@ Changelog 4.2.14 (unreleased) ------------------- -- Nothing changed yet. - +- Fixed an issue when `MeetingItem.proposingGroupWithGroupInCharge` is used in a `MeetingConfig` + but not in another one when an item is sent to it. + [aduchene] 4.2.13 (2024-12-06) ------------------- diff --git a/src/Products/PloneMeeting/MeetingItem.py b/src/Products/PloneMeeting/MeetingItem.py index 86253a2f5..9690c9cec 100644 --- a/src/Products/PloneMeeting/MeetingItem.py +++ b/src/Products/PloneMeeting/MeetingItem.py @@ -7823,6 +7823,12 @@ def cloneToOtherMeetingConfig(self, destMeetingConfigId, automatically=False): newCat = getattr(destMeetingConfig.categories, destCat.split('.')[1]) newItem.setCategory(newCat.getId()) break + if 'proposingGroupWithGroupInCharge' in cfg.getUsedItemAttributes() and \ + 'proposingGroupWithGroupInCharge' not in destUsedItemAttributes and \ + not newItem.getProposingGroup(): + # Handle an edge case when 'proposingGroupWithGroupInCharge' is not used in destMeetingConfig + # to avoid an empty proposingGroups + newItem.setProposingGroup(self.getProposingGroupWithGroupInCharge().split("__groupincharge__")[0]) # find meeting to present the item in and set it as preferred # this way if newItem needs to be presented in a frozen meeting, it works diff --git a/src/Products/PloneMeeting/tests/testMeetingItem.py b/src/Products/PloneMeeting/tests/testMeetingItem.py index 32b408b51..0dbda4b4f 100755 --- a/src/Products/PloneMeeting/tests/testMeetingItem.py +++ b/src/Products/PloneMeeting/tests/testMeetingItem.py @@ -324,6 +324,29 @@ def test_pm_ItemProposingGroupsWithGroupsInChargeVocabulary(self): self.assertEqual(item1.validate_proposingGroupWithGroupInCharge(wrong_value), required_msg) self.failIf(item1.validate_proposingGroupWithGroupInCharge(original_value)) + def test_pm_ItemProposingGroupsWithGroupsInChargeSentToOtherMC(self): + '''Check MeetingItem.proposingGroupWithGroupInCharge when sent to another MC.''' + self.changeUser('siteadmin') + self._enableField('proposingGroupWithGroupInCharge') + org1 = self.create('organization', id='org1', title='Org 1', acronym='O1') + org1_uid = org1.UID() + cfg = self.meetingConfig + cfg2_id = self.meetingConfig2.getId() + cfg.setMeetingConfigsToCloneTo( + ({'meeting_config': '%s' % cfg2_id, + 'trigger_workflow_transitions_until': NO_TRIGGER_WF_TRANSITION_UNTIL}, )) + cfg.setItemManualSentToOtherMCStates((self._stateMappingFor('itemcreated'), )) + self._select_organization(org1_uid) + self.developers.groups_in_charge = (org1_uid, ) + + item = self.create('MeetingItem') + developers_gic = '{0}__groupincharge__{1}'.format(self.developers_uid, org1_uid) + item.setProposingGroupWithGroupInCharge(developers_gic) + item.setOtherMeetingConfigsClonableTo((cfg2_id,)) + item.cloneToOtherMeetingConfig(cfg2_id) + new_item = item.get_successor() + self.assertEqual(new_item.getProposingGroup(), self.developers_uid) + def test_pm_CloneItemRemovesAnnotations(self): '''Annotations relative to item sent to other MC are correctly cleaned.''' # create a third meetingConfig with special characters in it's title