Skip to content

Commit

Permalink
bugfix: when next state participant is ticket field, and handle submi…
Browse files Browse the repository at this point in the history
…t contain this field. loonflow Can not get ticket'next participant
  • Loading branch information
blackholll committed Aug 1, 2018
1 parent d3c77dd commit a019e6b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions service/ticket/ticket_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_ticket_format_custom_field_key_dict(cls, ticket_id):
custom_field_queryset = CustomField.objects.filter(is_deleted=0, workflow_id=ticket_obj.workflow_id).all()
format_field_key_dict = {}
for custom_field in custom_field_queryset:
format_field_key_dict[custom_field.field_key] = dict(field_type_id=custom_field.field_type_id, name=custom_field.field_name, placeholder=custom_field.placeholder, bool_field_display=custom_field.bool_field_display,
format_field_key_dict[custom_field.field_key] = dict(field_type_id=custom_field.field_type_id, name=custom_field.field_name, bool_field_display=custom_field.boolean_field_display,
field_choice=custom_field.field_choice, field_from='custom')

return format_field_key_dict, ''
Expand Down Expand Up @@ -385,7 +385,7 @@ def get_ticket_field_name(cls, ticket_id, field_key):
:return:
"""
if field_key in CONSTANT_SERVICE.TICKET_BASE_FIELD_LIST:
pass
return field_key, ''
else:
field_name, msg = cls.get_ticket_custom_field_name(ticket_id, field_key)

Expand All @@ -401,7 +401,8 @@ def get_ticket_custom_field_name(cls, ticket_id, field_key):
:return:
"""
format_field_key_dict, msg = cls.get_ticket_format_custom_field_key_dict(ticket_id)
field_name = format_field_key_dict['field_key']['field_name']
field_name = format_field_key_dict[field_key]['field_name']

return field_name, ''

@classmethod
Expand Down Expand Up @@ -870,9 +871,12 @@ def handle_ticket(cls, ticket_id, request_data_dict):
add_relation = ','.join(username_list)
elif destination_participant_type_id == CONSTANT_SERVICE.PARTICIPANT_TYPE_FIELD:
# 获取工单字段的值
field_value, msg = cls.get_ticket_field_value(ticket_id, destination_participant)
# 考虑到处理工单时 可能会编辑工单字段,所有优先从请求数据中获取,如果没有再去数据库中获取
field_value = request_data_dict.get('destination_participant')
if not field_value:
return False, msg
field_value, msg = cls.get_ticket_field_value(ticket_id, destination_participant)
if not field_value:
return False, msg
destination_participant = field_value
destination_participant_type_id = CONSTANT_SERVICE.PARTICIPANT_TYPE_PERSONAL
add_relation = destination_participant
Expand Down

0 comments on commit a019e6b

Please sign in to comment.