mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
Allow Tickets status choices customization
This commit is contained in:
parent
147151a271
commit
ab2c2f79a4
@ -186,10 +186,10 @@ class EditFollowUpForm(forms.ModelForm):
|
|||||||
exclude = ('date', 'user',)
|
exclude = ('date', 'user',)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Filter not openned tickets here."""
|
"""Filter not opened tickets here."""
|
||||||
super(EditFollowUpForm, self).__init__(*args, **kwargs)
|
super(EditFollowUpForm, self).__init__(*args, **kwargs)
|
||||||
self.fields["ticket"].queryset = Ticket.objects.filter(
|
self.fields["ticket"].queryset = Ticket.objects.filter(
|
||||||
status__in=(Ticket.OPEN_STATUS, Ticket.REOPENED_STATUS))
|
status__in=Ticket.OPEN_STATUSES)
|
||||||
|
|
||||||
|
|
||||||
class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
||||||
|
@ -83,9 +83,12 @@ def escalate_tickets(queues, verbose):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print("Processing: %s" % q)
|
print("Processing: %s" % q)
|
||||||
|
|
||||||
|
Q_OPEN_STATUSES = Q()
|
||||||
|
for open_status in Ticket.OPEN_STATUSES:
|
||||||
|
q_open_statuses |= Q(status=open_status)
|
||||||
|
|
||||||
for t in q.ticket_set.filter(
|
for t in q.ticket_set.filter(
|
||||||
Q(status=Ticket.OPEN_STATUS) |
|
Q_OPEN_STATUSES
|
||||||
Q(status=Ticket.REOPENED_STATUS)
|
|
||||||
).exclude(
|
).exclude(
|
||||||
priority=1
|
priority=1
|
||||||
).filter(
|
).filter(
|
||||||
|
@ -463,19 +463,14 @@ class Ticket(models.Model):
|
|||||||
the dashboard to prompt users to take ownership of them.
|
the dashboard to prompt users to take ownership of them.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
OPEN_STATUS = 1
|
OPEN_STATUS = helpdesk_settings.OPEN_STATUS
|
||||||
REOPENED_STATUS = 2
|
REOPENED_STATUS = helpdesk_settings.REOPENED_STATUS
|
||||||
RESOLVED_STATUS = 3
|
RESOLVED_STATUS = helpdesk_settings.RESOLVED_STATUS
|
||||||
CLOSED_STATUS = 4
|
CLOSED_STATUS = helpdesk_settings.CLOSED_STATUS
|
||||||
DUPLICATE_STATUS = 5
|
DUPLICATE_STATUS = helpdesk_settings.DUPLICATE_STATUS
|
||||||
|
|
||||||
STATUS_CHOICES = (
|
STATUS_CHOICES = helpdesk_settings.TICKET_STATUS_CHOICES
|
||||||
(OPEN_STATUS, _('Open')),
|
OPEN_STATUSES = helpdesk_settings.TICKET_OPEN_STATUSES
|
||||||
(REOPENED_STATUS, _('Reopened')),
|
|
||||||
(RESOLVED_STATUS, _('Resolved')),
|
|
||||||
(CLOSED_STATUS, _('Closed')),
|
|
||||||
(DUPLICATE_STATUS, _('Duplicate')),
|
|
||||||
)
|
|
||||||
|
|
||||||
PRIORITY_CHOICES = helpdesk_settings.TICKET_PRIORITY_CHOICES
|
PRIORITY_CHOICES = helpdesk_settings.TICKET_PRIORITY_CHOICES
|
||||||
|
|
||||||
@ -771,9 +766,8 @@ class Ticket(models.Model):
|
|||||||
True = any dependencies are resolved
|
True = any dependencies are resolved
|
||||||
False = There are non-resolved dependencies
|
False = There are non-resolved dependencies
|
||||||
"""
|
"""
|
||||||
OPEN_STATUSES = (Ticket.OPEN_STATUS, Ticket.REOPENED_STATUS)
|
|
||||||
return TicketDependency.objects.filter(ticket=self).filter(
|
return TicketDependency.objects.filter(ticket=self).filter(
|
||||||
depends_on__status__in=OPEN_STATUSES).count() == 0
|
depends_on__status__in=Ticket.OPEN_STATUSES).count() == 0
|
||||||
can_be_resolved = property(_can_be_resolved)
|
can_be_resolved = property(_can_be_resolved)
|
||||||
|
|
||||||
def get_submitter_userprofile(self):
|
def get_submitter_userprofile(self):
|
||||||
|
@ -103,6 +103,29 @@ ALLOWED_URL_SCHEMES = getattr(settings, 'ALLOWED_URL_SCHEMES', (
|
|||||||
'file', 'ftp', 'ftps', 'http', 'https', 'irc', 'mailto', 'sftp', 'ssh', 'tel', 'telnet', 'tftp', 'vnc', 'xmpp',
|
'file', 'ftp', 'ftps', 'http', 'https', 'irc', 'mailto', 'sftp', 'ssh', 'tel', 'telnet', 'tftp', 'vnc', 'xmpp',
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# Ticket status choices
|
||||||
|
OPEN_STATUS = getattr(settings, 'HELPDESK_TICKET_OPEN_STATUS', 1)
|
||||||
|
REOPENED_STATUS = getattr(settings, 'HELPDESK_TICKET_REOPENED_STATUS', 2)
|
||||||
|
RESOLVED_STATUS = getattr(settings, 'HELPDESK_TICKET_RESOLVED_STATUS', 3)
|
||||||
|
CLOSED_STATUS = getattr(settings, 'HELPDESK_TICKET_CLOSED_STATUS', 4)
|
||||||
|
DUPLICATE_STATUS = getattr(settings, 'HELPDESK_TICKET_DUPLICATE_STATUS', 5)
|
||||||
|
|
||||||
|
DEFAULT_TICKET_STATUS_CHOICES = (
|
||||||
|
(OPEN_STATUS, _('Open')),
|
||||||
|
(REOPENED_STATUS, _('Reopened')),
|
||||||
|
(RESOLVED_STATUS, _('Resolved')),
|
||||||
|
(CLOSED_STATUS, _('Closed')),
|
||||||
|
(DUPLICATE_STATUS, _('Duplicate')),
|
||||||
|
)
|
||||||
|
TICKET_STATUS_CHOICES = getattr(settings,
|
||||||
|
'HELPDESK_TICKET_STATUS_CHOICES',
|
||||||
|
DEFAULT_TICKET_STATUS_CHOICES)
|
||||||
|
|
||||||
|
DEFAULT_TICKET_OPEN_STATUSES = (OPEN_STATUS, REOPENED_STATUS)
|
||||||
|
TICKET_OPEN_STATUSES = getattr(settings,
|
||||||
|
'HELPDESK_TICKET_OPEN_STATUSES',
|
||||||
|
DEFAULT_TICKET_OPEN_STATUSES)
|
||||||
|
|
||||||
# Ticket priority choices
|
# Ticket priority choices
|
||||||
DEFAULT_TICKET_PRIORITY_CHOICES = (
|
DEFAULT_TICKET_PRIORITY_CHOICES = (
|
||||||
(1, _('1. Critical')),
|
(1, _('1. Critical')),
|
||||||
|
@ -19,6 +19,11 @@ from helpdesk.models import FollowUp, Queue, Ticket
|
|||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
Q_OPEN_STATUSES = Q()
|
||||||
|
for open_status in Ticket.OPEN_STATUSES:
|
||||||
|
q_open_statuses |= Q(status=open_status)
|
||||||
|
|
||||||
|
|
||||||
class OpenTicketsByUser(Feed):
|
class OpenTicketsByUser(Feed):
|
||||||
title_template = 'helpdesk/rss/ticket_title.html'
|
title_template = 'helpdesk/rss/ticket_title.html'
|
||||||
description_template = 'helpdesk/rss/ticket_description.html'
|
description_template = 'helpdesk/rss/ticket_description.html'
|
||||||
@ -73,15 +78,12 @@ class OpenTicketsByUser(Feed):
|
|||||||
assigned_to=obj['user']
|
assigned_to=obj['user']
|
||||||
).filter(
|
).filter(
|
||||||
queue=obj['queue']
|
queue=obj['queue']
|
||||||
).filter(
|
).filter(Q_OPEN_STATUSES)
|
||||||
Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return Ticket.objects.filter(
|
return Ticket.objects.filter(
|
||||||
assigned_to=obj['user']
|
assigned_to=obj['user']
|
||||||
).filter(
|
).filter(Q_OPEN_STATUSES)
|
||||||
Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)
|
|
||||||
)
|
|
||||||
|
|
||||||
def item_pubdate(self, item):
|
def item_pubdate(self, item):
|
||||||
return item.created
|
return item.created
|
||||||
@ -104,9 +106,7 @@ class UnassignedTickets(Feed):
|
|||||||
def items(self, obj):
|
def items(self, obj):
|
||||||
return Ticket.objects.filter(
|
return Ticket.objects.filter(
|
||||||
assigned_to__isnull=True
|
assigned_to__isnull=True
|
||||||
).filter(
|
).filter(Q_OPEN_STATUSES)
|
||||||
Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)
|
|
||||||
)
|
|
||||||
|
|
||||||
def item_pubdate(self, item):
|
def item_pubdate(self, item):
|
||||||
return item.created
|
return item.created
|
||||||
@ -157,9 +157,7 @@ class OpenTicketsByQueue(Feed):
|
|||||||
def items(self, obj):
|
def items(self, obj):
|
||||||
return Ticket.objects.filter(
|
return Ticket.objects.filter(
|
||||||
queue=obj
|
queue=obj
|
||||||
).filter(
|
).filter(Q_OPEN_STATUSES)
|
||||||
Q(status=Ticket.OPEN_STATUS) | Q(status=Ticket.REOPENED_STATUS)
|
|
||||||
)
|
|
||||||
|
|
||||||
def item_pubdate(self, item):
|
def item_pubdate(self, item):
|
||||||
return item.created
|
return item.created
|
||||||
|
Loading…
Reference in New Issue
Block a user