* Improve e-mail sending when ticket is updated or resolved

This commit is contained in:
Ross Poulton 2008-01-07 20:30:55 +00:00
parent 10158056b6
commit 977d0e0aca

View File

@ -40,6 +40,7 @@ from django.db.models import Q
# Helpdesk imports # Helpdesk imports
from helpdesk.forms import TicketForm from helpdesk.forms import TicketForm
from helpdesk.models import Ticket, Queue, FollowUp, TicketChange from helpdesk.models import Ticket, Queue, FollowUp, TicketChange
from helpdesk.lib import send_multipart_mail
def dashboard(request): def dashboard(request):
tickets = Ticket.objects.filter(assigned_to=request.user).exclude(status=Ticket.CLOSED_STATUS) tickets = Ticket.objects.filter(assigned_to=request.user).exclude(status=Ticket.CLOSED_STATUS)
@ -140,10 +141,10 @@ def update_ticket(request, ticket_id):
} }
if f.new_status == Ticket.RESOLVED_STATUS: if f.new_status == Ticket.RESOLVED_STATUS:
template = 'helpdesk/emails/submitter_resolved' template = 'helpdesk/emails/submitter_resolved'
subject = '%s Ticket Resolved' subject = '%s %s (Resolved)' % (ticket.ticket, ticket.title)
else: else:
template = 'helpdesk/emails/submitter_updated' template = 'helpdesk/emails/submitter_updated'
subject = '%s Ticket Updated' subject = '%s %s (Updated)' % (ticket.ticket, ticket.title)
send_multipart_mail(template, context, subject, ticket.submitter_email, ticket.queue.from_address) send_multipart_mail(template, context, subject, ticket.submitter_email, ticket.queue.from_address)
ticket.save() ticket.save()