diff --git a/CHANGES.rst b/CHANGES.rst index 5a4c82fb3..c3c6338e5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,9 @@ Changelog when using `BaseDGHV.print_attendees` and `BaseDGHV.print_attendees_by_type` using a special parameter `short_title_kwargs`. [gbastien] +- Completed `AnnexTypeDescriptors` and `ToolInitializer` to manage + attribute `after_scan_change_annex_type_to`. + [gbastien] 4.2.11 (2024-09-25) ------------------- diff --git a/src/Products/PloneMeeting/exportimport/content.py b/src/Products/PloneMeeting/exportimport/content.py index 6f4b63baf..6d81db086 100644 --- a/src/Products/PloneMeeting/exportimport/content.py +++ b/src/Products/PloneMeeting/exportimport/content.py @@ -201,6 +201,7 @@ def run(self): # manage other_mc_correspondences for created_cfg in created_cfgs: self._manageOtherMCCorrespondences(created_cfg) + self._manage_after_scan_change_annex_type_to(created_cfg) # now that every meetingConfigs have been created, we can manage the meetingConfigsToCloneTo # and orgs advice states related fields @@ -341,6 +342,22 @@ def _convert_to_real_other_mc_correspondences(annex_type): for subType in annex_type.objectValues(): _convert_to_real_other_mc_correspondences(subType) + def _manage_after_scan_change_annex_type_to(self, cfg): + """We have the new annex type path, we need it's UID.""" + def _convert_to_real_after_scan_change_annex_type_to(annex_type): + # get the annex_type and replaced it by it's UID + other_annex_type = cfg.annexes_types.unrestrictedTraverse( + annex_type.after_scan_change_annex_type_to) + annex_type.after_scan_change_annex_type_to = other_annex_type.UID() + import ipdb; ipdb.set_trace() + for annex_group in cfg.annexes_types.objectValues(): + for annex_type in annex_group.objectValues(): + if annex_type.after_scan_change_annex_type_to: + _convert_to_real_after_scan_change_annex_type_to(annex_type) + for sub_type in annex_type.objectValues(): + if sub_type.after_scan_change_annex_type_to: + _convert_to_real_after_scan_change_annex_type_to(sub_type) + def createMeetingConfig(self, configData, source): '''Creates a new meeting configuration from p_configData which is a MeetingConfigDescriptor instance. p_source is a string that @@ -440,8 +457,8 @@ def createMeetingConfig(self, configData, source): # manage MeetingManagers groupsTool = self.portal.portal_groups for userId in configData.meetingManagers: - groupsTool.addPrincipalToGroup(userId, '{0}_{1}'.format(cfg.getId(), - MEETINGMANAGERS_GROUP_SUFFIX)) + groupsTool.addPrincipalToGroup(userId, '{0}_{1}'.format( + cfg.getId(), MEETINGMANAGERS_GROUP_SUFFIX)) # manage annex confidentiality, enable it on relevant CategoryGroup if configData.itemAnnexConfidentialVisibleFor: cfg.annexes_types.item_annexes.confidentiality_activated = True @@ -548,6 +565,7 @@ def addAnnexType(self, cfg, at, source): enabled=at.enabled, show_preview=at.show_preview, description=at.description, + after_scan_change_annex_type_to=at.after_scan_change_annex_type_to, only_pdf=at.only_pdf, ) # store an empty set in other_mc_correspondences for validation @@ -569,11 +587,12 @@ def addAnnexType(self, cfg, at, source): container=annexType, to_print=subType.to_print, confidential=subType.confidential, - to_sign=at.to_sign, - signed=at.signed, + to_sign=subType.to_sign, + signed=subType.signed, enabled=subType.enabled, - show_preview=at.show_preview, - description=at.description, + show_preview=subType.show_preview, + after_scan_change_annex_type_to=subType.after_scan_change_annex_type_to, + description=subType.description, ) if sub_portal_type == 'ItemAnnexContentSubcategory': annexSubType.other_mc_correspondences = set() diff --git a/src/Products/PloneMeeting/profiles/__init__.py b/src/Products/PloneMeeting/profiles/__init__.py index e4a7f5318..538348766 100644 --- a/src/Products/PloneMeeting/profiles/__init__.py +++ b/src/Products/PloneMeeting/profiles/__init__.py @@ -127,6 +127,7 @@ def __init__(self, to_print=False, show_preview=0, description=u'', + after_scan_change_annex_type_to=None, only_pdf=False): self.id = id self.title = title @@ -143,6 +144,7 @@ def __init__(self, self.show_preview = show_preview self.enabled = enabled self.description = description + self.after_scan_change_annex_type_to = after_scan_change_annex_type_to self.only_pdf = only_pdf @@ -163,6 +165,7 @@ def __init__(self, to_print=False, show_preview=0, description=u'', + after_scan_change_annex_type_to=None, only_for_meeting_managers=False, only_pdf=False): super(ItemAnnexTypeDescriptor, self).__init__( @@ -179,6 +182,7 @@ def __init__(self, to_print=to_print, show_preview=show_preview, description=description, + after_scan_change_annex_type_to=after_scan_change_annex_type_to, only_pdf=only_pdf) self.other_mc_correspondences = other_mc_correspondences self.only_for_meeting_managers = only_for_meeting_managers @@ -195,6 +199,7 @@ def __init__(self, enabled=True, confidential=False, to_print=False, + after_scan_change_annex_type_to=None, only_pdf=False): self.id = id self.title = title @@ -204,6 +209,7 @@ def __init__(self, self.to_sign = to_sign self.signed = signed self.enabled = enabled + self.after_scan_change_annex_type_to = after_scan_change_annex_type_to self.only_pdf = only_pdf @@ -219,6 +225,7 @@ def __init__(self, enabled=True, confidential=False, to_print=False, + after_scan_change_annex_type_to=None, only_for_meeting_managers=False, only_pdf=False): super(ItemAnnexSubTypeDescriptor, self).__init__( @@ -230,6 +237,7 @@ def __init__(self, enabled=enabled, confidential=confidential, to_print=to_print, + after_scan_change_annex_type_to=after_scan_change_annex_type_to, only_pdf=only_pdf) self.other_mc_correspondences = other_mc_correspondences self.only_for_meeting_managers = only_for_meeting_managers