forked from extern/django-helpdesk
Merge pull request #158 from digitalpbk/master
Fixing couple of bugs I encountered
This commit is contained in:
commit
b6656b30d8
@ -320,7 +320,7 @@ class TicketForm(forms.Form):
|
||||
)
|
||||
messages_sent_to.append(t.submitter_email)
|
||||
|
||||
if t.assigned_to and t.assigned_to != user and getattr(t.assigned_to.usersettings.settings, 'email_on_ticket_assign', False) and t.assigned_to.email and t.assigned_to.email not in messages_sent_to:
|
||||
if t.assigned_to and t.assigned_to != user and t.assigned_to.usersettings.settings.get('email_on_ticket_assign', False) and t.assigned_to.email and t.assigned_to.email not in messages_sent_to:
|
||||
send_templated_mail(
|
||||
'assigned_owner',
|
||||
context,
|
||||
|
@ -25,7 +25,7 @@ from django.core.files.base import ContentFile
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.conf import settings
|
||||
from helpdesk import settings
|
||||
|
||||
from helpdesk.lib import send_templated_mail, safe_template_context
|
||||
from helpdesk.models import Queue, Ticket, FollowUp, Attachment, IgnoreEmail
|
||||
@ -266,7 +266,7 @@ def ticket_from_message(message, queue, quiet):
|
||||
f.save()
|
||||
|
||||
if not quiet:
|
||||
print (" [%s-%s] %s%s" % (t.queue.slug, t.id, t.title, update)).encode('ascii', 'replace')
|
||||
print (" [%s-%s] %s" % (t.queue.slug, t.id, t.title,)).encode('ascii', 'replace')
|
||||
|
||||
for file in files:
|
||||
if file['content']:
|
||||
|
@ -885,10 +885,15 @@ def edit_ticket(request, ticket_id):
|
||||
edit_ticket = staff_member_required(edit_ticket)
|
||||
|
||||
def create_ticket(request):
|
||||
if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_OWNERS:
|
||||
assignable_users = User.objects.filter(is_active=True, is_staff=True).order_by('username')
|
||||
else:
|
||||
assignable_users = User.objects.filter(is_active=True).order_by('username')
|
||||
|
||||
if request.method == 'POST':
|
||||
form = TicketForm(request.POST, request.FILES)
|
||||
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,is_staff=True).order_by('username')]
|
||||
form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in assignable_users]
|
||||
if form.is_valid():
|
||||
ticket = form.save(user=request.user)
|
||||
return HttpResponseRedirect(ticket.get_absolute_url())
|
||||
@ -901,11 +906,7 @@ def create_ticket(request):
|
||||
|
||||
form = TicketForm(initial=initial_data)
|
||||
form.fields['queue'].choices = [('', '--------')] + [[q.id, q.title] for q in Queue.objects.all()]
|
||||
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]
|
||||
form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in assignable_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