Patch de Products.CMFDefault.formlib.form._EditFormMixin._setRedirect Plinn implement...
[Plinn.git] / skins / control / getRecipients.py
1 ##parameters=object=None
2 if object is None :
3 object = context
4 roles = context.valid_roles()
5
6 # todo : sort by role
7
8 recipientIds = []
9 rolesAndMembers = []
10 for role in roles :
11 membersInRole = []
12 for member in object.getAllMembersInRole(role) :
13 if (member.id not in recipientIds) and member.getProperty('email') :
14 membersInRole.append(member)
15 recipientIds.append(member.getId())
16 if membersInRole :
17 rolesAndMembers.append( (role, membersInRole) )
18
19 return rolesAndMembers