mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-16 02:48:00 +02:00
Assign KBItems to teams
This allows you to only show on the dashboard those tickets which belong to a given user's team.
This commit is contained in:
@ -103,6 +103,7 @@ def dashboard(request):
|
||||
showing ticket counts by queue/status, and a list of unassigned tickets
|
||||
with options for them to 'Take' ownership of said tickets.
|
||||
"""
|
||||
huser = HelpdeskUser(request.user)
|
||||
active_tickets = Ticket.objects.select_related('queue').exclude(
|
||||
status__in=[Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS],
|
||||
)
|
||||
@ -117,13 +118,16 @@ def dashboard(request):
|
||||
assigned_to=request.user,
|
||||
status__in=[Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS])
|
||||
|
||||
user_queues = HelpdeskUser(request.user).get_queues()
|
||||
user_queues = huser.get_queues()
|
||||
|
||||
unassigned_tickets = active_tickets.filter(
|
||||
assigned_to__isnull=True,
|
||||
kbitem__isnull=True,
|
||||
queue__in=user_queues
|
||||
)
|
||||
|
||||
kbitems = huser.get_assigned_kb_items()
|
||||
|
||||
# all tickets, reported by current user
|
||||
all_tickets_reported_by_current_user = ''
|
||||
email_current_user = request.user.email
|
||||
@ -157,6 +161,7 @@ def dashboard(request):
|
||||
'user_tickets': tickets,
|
||||
'user_tickets_closed_resolved': tickets_closed_resolved,
|
||||
'unassigned_tickets': unassigned_tickets,
|
||||
'kbitems': kbitems,
|
||||
'all_tickets_reported_by_current_user': all_tickets_reported_by_current_user,
|
||||
'basic_ticket_stats': basic_ticket_stats,
|
||||
})
|
||||
@ -706,6 +711,13 @@ def mass_update(request):
|
||||
parts = action.split('_')
|
||||
user = User.objects.get(id=parts[1])
|
||||
action = 'assign'
|
||||
if action == 'kbitem_none':
|
||||
kbitem = None
|
||||
action = 'set_kbitem'
|
||||
if action.startswith('kbitem_'):
|
||||
parts = action.split('_')
|
||||
kbitem = KBItem.objects.get(id=parts[1])
|
||||
action = 'set_kbitem'
|
||||
elif action == 'take':
|
||||
user = request.user
|
||||
action = 'assign'
|
||||
@ -735,6 +747,15 @@ def mass_update(request):
|
||||
public=True,
|
||||
user=request.user)
|
||||
f.save()
|
||||
elif action == 'set_kbitem':
|
||||
t.kbitem = kbitem
|
||||
t.save()
|
||||
f = FollowUp(ticket=t,
|
||||
date=timezone.now(),
|
||||
title=_('KBItem set in bulk update'),
|
||||
public=False,
|
||||
user=request.user)
|
||||
f.save()
|
||||
elif action == 'close' and t.status != Ticket.CLOSED_STATUS:
|
||||
t.status = Ticket.CLOSED_STATUS
|
||||
t.save()
|
||||
@ -917,6 +938,7 @@ def ticket_list(request):
|
||||
context,
|
||||
default_tickets_per_page=request.user.usersettings_helpdesk.tickets_per_page,
|
||||
user_choices=User.objects.filter(is_active=True, is_staff=True),
|
||||
kb_items=KBItem.objects.all(),
|
||||
queue_choices=huser.get_queues(),
|
||||
status_choices=Ticket.STATUS_CHOICES,
|
||||
kbitem_choices=kbitem_choices,
|
||||
|
Reference in New Issue
Block a user