Commit a1f35136 authored by Jérome Perrin's avatar Jérome Perrin

crm: fix Ticket_getArrowItemList returning same persons multiple times

Fixes [#20161227-D1FA4](https://nexedi.erp5.net/bug_module/20161227-D1FA4)

Also modernize code by using set() and not using
ERP5Site_getAuthenticatedMemberPersonValue
parent c45f1572
portal = context.getPortalObject() portal = context.getPortalObject()
arrow = portal.portal_property_sheets.get("Arrow") arrow = portal.portal_property_sheets.get("Arrow")
result = [('', ''),] result = set([('', ''),])
result_append = result.append
# add current user # add current user
user = portal.ERP5Site_getAuthenticatedMemberPersonValue() user = portal.portal_membership.getAuthenticatedMember().getUserValue()
if user is not None: if user is not None:
result_append((user.getTitle(), user.getRelativeUrl())) result.add((user.getTitle(), user.getRelativeUrl()))
for property_value in arrow.contentValues(): for property_value in arrow.contentValues():
value_list = context.getProperty("%s_value_list" %property_value.getReference(), None) value_list = context.getProperty("%s_value_list" %property_value.getReference(), None)
if value_list is not None: if value_list is not None:
for value in value_list: for value in value_list:
if value and value.getPortalType() in portal.getPortalNodeTypeList(): if value is not None and value.getPortalType() in portal.getPortalNodeTypeList():
value = (value.getTitle(), value.getRelativeUrl()) result.add((value.getTitle(), value.getRelativeUrl()))
if value not in value_list:
result_append(value)
result.sort(key=lambda x: x[0]) return sorted(result)
return result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment