mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 09:23:39 +01:00
* Add ability to place a ticket on hold, stopping automatic escalation.
This commit is contained in:
parent
1524c37941
commit
379f68ed4b
@ -125,6 +125,8 @@ class Ticket(models.Model):
|
||||
assigned_to = models.ForeignKey(User, related_name='assigned_to', blank=True, null=True)
|
||||
status = models.IntegerField(choices=STATUS_CHOICES, default=OPEN_STATUS)
|
||||
|
||||
on_hold = models.BooleanField(blank=True, null=True)
|
||||
|
||||
description = models.TextField(blank=True, null=True)
|
||||
resolution = models.TextField(blank=True, null=True)
|
||||
|
||||
@ -159,6 +161,12 @@ class Ticket(models.Model):
|
||||
return "%s/helpdesk/priorities/priority%s.png" % (settings.MEDIA_URL, self.priority)
|
||||
get_priority_img = property(_get_priority_img)
|
||||
|
||||
def _get_status(self):
|
||||
held_msg = ''
|
||||
if self.on_hold: held_msg = ' (Held)'
|
||||
return '%s%s' % (self.get_status_display, held_msg)
|
||||
get_status = property(_get_status)
|
||||
|
||||
def _get_ticket_url(self):
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.urlresolvers import reverse
|
||||
|
@ -44,7 +44,7 @@ def escalate_tickets():
|
||||
q.last_escalation = datetime.now()
|
||||
q.save()
|
||||
|
||||
for t in q.ticket_set.filter(Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)).exclude(priority=1):
|
||||
for t in q.ticket_set.filter(Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)).exclude(priority=1).exclude(on_hold=True):
|
||||
t.priority -= 1
|
||||
t.save()
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
{% block helpdesk_body %}
|
||||
|
||||
<table width='100%'>
|
||||
<tr class='row_tablehead'><td>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status_display }}]</td><td align='right'><a href='#edit'><img src='{{ MEDIA_URL }}/helpdesk/buttons/edit.png' alt='Edit' title='Edit' width='60' height='15' /></a><a href='{% url helpdesk_delete ticket.id %}'><img src='{{ MEDIA_URL }}/helpdesk/buttons/delete.png' alt='Delete' title='Delete' width='60' height='15' /></a></td></tr>
|
||||
<tr class='row_tablehead'><td>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}]</td><td align='right'><a href='#edit'><img src='{{ MEDIA_URL }}/helpdesk/buttons/edit.png' alt='Edit' title='Edit' width='60' height='15' /></a><a href='{% url helpdesk_delete ticket.id %}'><img src='{{ MEDIA_URL }}/helpdesk/buttons/delete.png' alt='Delete' title='Delete' width='60' height='15' /></a>{% if ticket.on_hold %}<a href='unhold/'>Unhold</a>{% else %}<a href='hold/'>Hold</a>{% endif %}</td></tr>
|
||||
<tr class='row_columnheads'><th colspan='2'>Queue: {{ ticket.queue }}</th></tr>
|
||||
|
||||
<tr class='row_odd'>
|
||||
|
7
urls.py
7
urls.py
@ -53,7 +53,14 @@ urlpatterns = patterns('helpdesk.views',
|
||||
url(r'^tickets/(?P<ticket_id>[0-9]+)/delete/$',
|
||||
'delete_ticket',
|
||||
name='helpdesk_delete'),
|
||||
|
||||
url(r'^tickets/(?P<ticket_id>[0-9]+)/hold/$',
|
||||
'hold_ticket',
|
||||
name='helpdesk_hold'),
|
||||
|
||||
url(r'^tickets/(?P<ticket_id>[0-9]+)/unhold/$',
|
||||
'unhold_ticket',
|
||||
name='helpdesk_unhold'),
|
||||
|
||||
url(r'^raw/(?P<type>\w+)/$',
|
||||
'raw_details',
|
||||
|
28
views.py
28
views.py
@ -303,3 +303,31 @@ def public_view(request):
|
||||
'email': email,
|
||||
'error_message': error_message,
|
||||
}))
|
||||
|
||||
def hold_ticket(request, ticket_id, unhold=False):
|
||||
ticket = get_object_or_404(Ticket, id=ticket_id)
|
||||
|
||||
if unhold:
|
||||
ticket.on_hold = False
|
||||
title = 'Ticket placed on hold'
|
||||
else:
|
||||
ticket.on_hold = True
|
||||
title = 'Ticket taken off hold'
|
||||
|
||||
f = FollowUp(
|
||||
ticket = ticket,
|
||||
user = request.user,
|
||||
title = title,
|
||||
date = datetime.now(),
|
||||
)
|
||||
f.save()
|
||||
|
||||
ticket.save()
|
||||
|
||||
return HttpResponseRedirect(ticket.get_absolute_url())
|
||||
hold_ticket = login_required(hold_ticket)
|
||||
|
||||
def unhold_ticket(request, ticket_id):
|
||||
return hold_ticket(request, ticket_id, unhold=True)
|
||||
unhold_ticket = login_required(unhold_ticket)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user