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..6670177b4 100644 --- a/src/Products/PloneMeeting/MeetingItem.py +++ b/src/Products/PloneMeeting/MeetingItem.py @@ -3299,12 +3299,16 @@ def setProposingGroupWithGroupInCharge(self, value, **kwargs): field = self.getField('proposingGroupWithGroupInCharge') current_value = field.get(self, **kwargs) if not value == current_value: - # value may be empty if used on an itemTemplate - proposingGroup = groupInCharge = '' + proposingGroup = self.getProposingGroup() + groupsInCharge = self.getGroupsInCharge() + if self.isDefinedInTool(item_type='itemtemplate'): + # value may be empty if used on an itemTemplate + proposingGroup = groupsInCharge = '' if value: - proposingGroup, groupInCharge = value.split('__groupincharge__') + proposingGroup, groupsInCharge = value.split('__groupincharge__') + groupsInCharge = [groupsInCharge] self.setProposingGroup(proposingGroup) - self.setGroupsInCharge([groupInCharge]) + self.setGroupsInCharge(groupsInCharge) field.set(self, value, **kwargs) def _adaptLinesValueToBeCompared(self, value): 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