Issue #88: Allow users to set an option to define whether their e-mail

address is used as the default submitter e-mail when they submit 
tickets. Thanks to Andreas Kotowicz for this suggestion.
This commit is contained in:
Ross Poulton 2009-08-06 08:56:02 +00:00
parent da703f3c83
commit 76f8d416c0
2 changed files with 11 additions and 1 deletions

View File

@ -337,6 +337,12 @@ class UserSettingsForm(forms.Form):
max_value=1000,
)
use_email_as_submitter = forms.BooleanField(
label=_('Use my e-mail address when submitting tickets?'),
help_text=_('When you submit a ticket, do you want to automatically use your e-mail address as the submitter address? You can type a different e-mail address when entering the ticket if needed, this option only changes the default.'),
required=False,
)
class EmailIgnoreForm(forms.ModelForm):
class Meta:
model = IgnoreEmail

View File

@ -564,7 +564,11 @@ def create_ticket(request):
ticket = form.save(user=request.user)
return HttpResponseRedirect(ticket.get_absolute_url())
else:
form = TicketForm()
initial_data = {}
if request.user.usersettings.settings.get('use_email_as_submitter', False) and request.user.email:
initial_data['submitter_email'] = request.user.email
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)]