mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 01:13:31 +01:00
Fix AttributeError
while staff user does a mass update in some tickets using the Close (Send E-mail)
action.
This commit is contained in:
parent
1b00086d6e
commit
f931dd4dba
@ -191,6 +191,38 @@ def apply_query(queryset, params):
|
||||
return queryset
|
||||
|
||||
|
||||
def ticket_template_context(ticket):
|
||||
context = {}
|
||||
|
||||
for field in ('title', 'created', 'modified', 'submitter_email',
|
||||
'status', 'get_status_display', 'on_hold', 'description',
|
||||
'resolution', 'priority', 'get_priority_display',
|
||||
'last_escalation', 'ticket', 'ticket_for_url',
|
||||
'get_status', 'ticket_url', 'staff_url', '_get_assigned_to'
|
||||
):
|
||||
attr = getattr(ticket, field, None)
|
||||
if callable(attr):
|
||||
context[field] = '%s' % attr()
|
||||
else:
|
||||
context[field] = attr
|
||||
context['assigned_to'] = context['_get_assigned_to']
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def queue_template_context(queue):
|
||||
context = {}
|
||||
|
||||
for field in ('title', 'slug', 'email_address', 'from_address', 'locale'):
|
||||
attr = getattr(queue, field, None)
|
||||
if callable(attr):
|
||||
context[field] = attr()
|
||||
else:
|
||||
context[field] = attr
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def safe_template_context(ticket):
|
||||
"""
|
||||
Return a dictionary that can be used as a template context to render
|
||||
@ -207,32 +239,10 @@ def safe_template_context(ticket):
|
||||
"""
|
||||
|
||||
context = {
|
||||
'queue': {},
|
||||
'ticket': {}
|
||||
'queue': queue_template_context(ticket.queue),
|
||||
'ticket': ticket_template_context(ticket),
|
||||
}
|
||||
queue = ticket.queue
|
||||
|
||||
for field in ('title', 'slug', 'email_address', 'from_address', 'locale'):
|
||||
attr = getattr(queue, field, None)
|
||||
if callable(attr):
|
||||
context['queue'][field] = attr()
|
||||
else:
|
||||
context['queue'][field] = attr
|
||||
|
||||
for field in ('title', 'created', 'modified', 'submitter_email',
|
||||
'status', 'get_status_display', 'on_hold', 'description',
|
||||
'resolution', 'priority', 'get_priority_display',
|
||||
'last_escalation', 'ticket', 'ticket_for_url',
|
||||
'get_status', 'ticket_url', 'staff_url', '_get_assigned_to'
|
||||
):
|
||||
attr = getattr(ticket, field, None)
|
||||
if callable(attr):
|
||||
context['ticket'][field] = '%s' % attr()
|
||||
else:
|
||||
context['ticket'][field] = attr
|
||||
|
||||
context['ticket']['queue'] = context['queue']
|
||||
context['ticket']['assigned_to'] = context['ticket']['_get_assigned_to']
|
||||
|
||||
return context
|
||||
|
||||
|
@ -31,7 +31,7 @@ from helpdesk.forms import (
|
||||
)
|
||||
from helpdesk.lib import (
|
||||
send_templated_mail, query_to_dict, apply_query, safe_template_context,
|
||||
process_attachments,
|
||||
process_attachments, queue_template_context,
|
||||
)
|
||||
from helpdesk.models import (
|
||||
Ticket, Queue, FollowUp, TicketChange, PreSetReply, Attachment, SavedSearch,
|
||||
@ -696,7 +696,7 @@ def mass_update(request):
|
||||
# Send email to Submitter, Owner, Queue CC
|
||||
context = safe_template_context(t)
|
||||
context.update(resolution=t.resolution,
|
||||
queue=t.queue)
|
||||
queue=queue_template_context(t.queue))
|
||||
|
||||
messages_sent_to = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user