Skip to content

Commit

Permalink
Fixed an issue when an item is sent to another MC
Browse files Browse the repository at this point in the history
  • Loading branch information
duchenean committed Dec 11, 2024
1 parent edf2a39 commit 1887a92
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-------------------
Expand Down
6 changes: 6 additions & 0 deletions src/Products/PloneMeeting/MeetingItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions src/Products/PloneMeeting/tests/testMeetingItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1887a92

Please sign in to comment.