* Added ability for tickets to be placed on hold

This commit is contained in:
Ross Poulton 2008-01-20 23:31:27 +00:00
parent 9c2fd9e87b
commit 041272ce1b
7 changed files with 17 additions and 14 deletions

View File

@ -164,7 +164,7 @@ class Ticket(models.Model):
def _get_status(self): def _get_status(self):
held_msg = '' held_msg = ''
if self.on_hold: held_msg = ' - On Hold' if self.on_hold: held_msg = ' - On Hold'
return '%s%s' % (self.get_status_display, held_msg) return '%s%s' % (self.get_status_display(), held_msg)
get_status = property(_get_status) get_status = property(_get_status)
def _get_ticket_url(self): def _get_ticket_url(self):

View File

@ -25,7 +25,7 @@
<td><img src='{{ ticket.get_priority_img }}' alt='Priority {{ ticket.priority }}' title='Priority {{ ticket.priority }}' height='16' width='16' /></td> <td><img src='{{ ticket.get_priority_img }}' alt='Priority {{ ticket.priority }}' title='Priority {{ ticket.priority }}' height='16' width='16' /></td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th> <th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td> <td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status_display }}</td> <td>{{ ticket.get_status }}</td>
<td><span title='{{ ticket.modified|date:"r" }}'>{{ ticket.modified|timesince }}</span></td> <td><span title='{{ ticket.modified|date:"r" }}'>{{ ticket.modified|timesince }}</span></td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -51,13 +51,13 @@
{% load ticket_to_link %} {% load ticket_to_link %}
{% for followup in ticket.followup_set.public_followups %} {% for followup in ticket.followup_set.public_followups %}
<div class='followup'> <div class='followup'>
<div class='title'>{{ followup.title }} <span class='byline'>by {{ followup.user }} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|timesince }} ago</span></span></div> <div class='title'>{{ followup.title }} <span class='byline'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|timesince }} ago</span></span></div>
{{ followup.comment|num_to_link }} {{ followup.comment|num_to_link }}
{% if followup.ticketchange_set.all %}<div class='changes'> {% if followup.ticketchange_set.all %}<div class='changes'><ul>
{% for change in followup.ticketchange_set.all %} {% for change in followup.ticketchange_set.all %}
Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.<br /> <li>Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.</li>
{% endfor %} {% endfor %}
</div>{% endif %} </div></ul>{% endif %}
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@ -69,13 +69,13 @@
{% load ticket_to_link %} {% load ticket_to_link %}
{% for followup in ticket.followup_set.all %} {% for followup in ticket.followup_set.all %}
<div class='followup'> <div class='followup'>
<div class='title'>{{ followup.title }} <span class='byline'>by {{ followup.user }} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|timesince }} ago</span>{% if not followup.public %} <span class='private'>(Private)</span>{% endif %}</span></div> <div class='title'>{{ followup.title }} <span class='byline'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|timesince }} ago</span>{% if not followup.public %} <span class='private'>(Private)</span>{% endif %}</span></div>
{{ followup.comment|num_to_link }} {% if followup.comment %}{{ followup.comment|num_to_link }}{% endif %}
{% if followup.ticketchange_set.all %}<div class='changes'> {% if followup.ticketchange_set.all %}<div class='changes'><ul>
{% for change in followup.ticketchange_set.all %} {% for change in followup.ticketchange_set.all %}
Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.<br /> <li>Changed {{ change.field }} from {{ change.old_value }} to {{ change.new_value }}.</li>
{% endfor %} {% endfor %}
</div>{% endif %} </div></ul>{% endif %}
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@ -63,7 +63,7 @@
<td><img src='{{ ticket.get_priority_img }}' alt='Priority {{ ticket.priority }}' title='Priority {{ ticket.priority }}' height='16' width='16' /></td> <td><img src='{{ ticket.get_priority_img }}' alt='Priority {{ ticket.priority }}' title='Priority {{ ticket.priority }}' height='16' width='16' /></td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th> <th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td> <td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status_display }}</td> <td>{{ ticket.get_status }}</td>
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|timesince }} ago</span></td> <td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|timesince }} ago</span></td>
<td>{{ ticket.get_assigned_to }}</td> <td>{{ ticket.get_assigned_to }}</td>
</tr> </tr>

View File

@ -42,6 +42,8 @@ class ReverseProxy:
yield self.sequence[i] yield self.sequence[i]
def num_to_link(text): def num_to_link(text):
if text == '':
return text
import re import re
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse

View File

@ -309,16 +309,17 @@ def hold_ticket(request, ticket_id, unhold=False):
if unhold: if unhold:
ticket.on_hold = False ticket.on_hold = False
title = 'Ticket placed on hold' title = 'Ticket taken off hold'
else: else:
ticket.on_hold = True ticket.on_hold = True
title = 'Ticket taken off hold' title = 'Ticket placed on hold'
f = FollowUp( f = FollowUp(
ticket = ticket, ticket = ticket,
user = request.user, user = request.user,
title = title, title = title,
date = datetime.now(), date = datetime.now(),
public = True,
) )
f.save() f.save()