Skip to content

Commit

Permalink
Fixed an issue when an item is sent to another MC (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
duchenean authored Dec 11, 2024
1 parent edf2a39 commit 3a91256
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 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
12 changes: 8 additions & 4 deletions src/Products/PloneMeeting/MeetingItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
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 3a91256

Please sign in to comment.