mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 23:43:11 +01:00
adding HELPDESK_STAFF_ONLY_TICKET_OWNERS and HELPDESK_STAFF_ONLY_TICKET_CC settings
This commit is contained in:
parent
eb74f807d8
commit
949179ec2e
@ -19,6 +19,7 @@ from django.utils.translation import ugettext as _
|
||||
from helpdesk.lib import send_templated_mail, safe_template_context
|
||||
from helpdesk.models import Ticket, Queue, FollowUp, Attachment, IgnoreEmail, TicketCC, CustomField, TicketCustomFieldValue, TicketDependency
|
||||
from helpdesk.settings import HAS_TAG_SUPPORT
|
||||
from helpdesk import settings as helpdesk_settings
|
||||
|
||||
class EditTicketForm(forms.ModelForm):
|
||||
class Meta:
|
||||
@ -572,7 +573,11 @@ class EmailIgnoreForm(forms.ModelForm):
|
||||
class TicketCCForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TicketCCForm, self).__init__(*args, **kwargs)
|
||||
self.fields['user'].queryset = User.objects.filter(is_active=True).order_by('username')
|
||||
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC:
|
||||
users = User.objects.filter(is_active=True, is_staff=True).order_by('username')
|
||||
else:
|
||||
users = User.objects.filter(is_active=True).order_by('username')
|
||||
self.fields['user'].queryset = users
|
||||
class Meta:
|
||||
model = TicketCC
|
||||
exclude = ('ticket',)
|
||||
|
@ -100,6 +100,12 @@ HELPDESK_SHOW_HOLD_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_HOLD_BUT
|
||||
# make all updates public by default? this will hide the 'is this update public' checkbox
|
||||
HELPDESK_UPDATE_PUBLIC_DEFAULT = getattr(settings, 'HELPDESK_UPDATE_PUBLIC_DEFAULT', True)
|
||||
|
||||
# only show staff users in ticket owner drop-downs
|
||||
HELPDESK_STAFF_ONLY_TICKET_OWNERS = getattr(settings, 'HELPDESK_STAFF_ONLY_TICKET_OWNERS', False)
|
||||
|
||||
# only show staff users in ticket cc drop-down
|
||||
HELPDESK_STAFF_ONLY_TICKET_CC = getattr(settings, 'HELPDESK_STAFF_ONLY_TICKET_CC', False)
|
||||
|
||||
|
||||
|
||||
''' options for staff.create_ticket view '''
|
||||
|
@ -216,10 +216,15 @@ def view_ticket(request, ticket_id):
|
||||
|
||||
return update_ticket(request, ticket_id)
|
||||
|
||||
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS:
|
||||
users = User.objects.filter(is_active=True, is_staff=True).order_by('username')
|
||||
else:
|
||||
users = User.objects.filter(is_active=True).order_by('username')
|
||||
|
||||
return render_to_response('helpdesk/ticket.html',
|
||||
RequestContext(request, {
|
||||
'ticket': ticket,
|
||||
'active_users': User.objects.filter(is_active=True).order_by('username'),
|
||||
'active_users': users,
|
||||
'priorities': Ticket.PRIORITY_CHOICES,
|
||||
'preset_replies': PreSetReply.objects.filter(Q(queues=ticket.queue) | Q(queues__isnull=True)),
|
||||
'tags_enabled': HAS_TAG_SUPPORT,
|
||||
@ -749,7 +754,11 @@ def create_ticket(request):
|
||||
|
||||
form = TicketForm(initial=initial_data)
|
||||
form.fields['queue'].choices = [('', '--------')] + [[q.id, q.title] for q in Queue.objects.all()]
|
||||
form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in User.objects.filter(is_active=True).order_by('username')]
|
||||
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS:
|
||||
users = User.objects.filter(is_active=True, is_staff=True).order_by('username')
|
||||
else:
|
||||
users = User.objects.filter(is_active=True).order_by('username')
|
||||
form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in users]
|
||||
if helpdesk_settings.HELPDESK_CREATE_TICKET_HIDE_ASSIGNED_TO:
|
||||
form.fields['assigned_to'].widget = forms.HiddenInput()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user