mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-27 18:33:12 +01:00
Fix: Saving tickets with attachments disabled raises error
Exclude code where followups add their attachments to a new ticket. Make helper function _attach_files_to_follow_up() more robust.
This commit is contained in:
parent
20cd08fe28
commit
80ae20d1ac
@ -327,7 +327,7 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
|||||||
return followup
|
return followup
|
||||||
|
|
||||||
def _attach_files_to_follow_up(self, followup):
|
def _attach_files_to_follow_up(self, followup):
|
||||||
files = self.cleaned_data['attachment']
|
files = self.cleaned_data.get('attachment')
|
||||||
if files:
|
if files:
|
||||||
files = process_attachments(followup, [files])
|
files = process_attachments(followup, [files])
|
||||||
return files
|
return files
|
||||||
@ -419,7 +419,10 @@ class TicketForm(AbstractTicketForm):
|
|||||||
followup = self._create_follow_up(ticket, title=title, user=user)
|
followup = self._create_follow_up(ticket, title=title, user=user)
|
||||||
followup.save()
|
followup.save()
|
||||||
|
|
||||||
files = self._attach_files_to_follow_up(followup)
|
if settings.HELPDESK_ENABLE_ATTACHMENTS:
|
||||||
|
files = self._attach_files_to_follow_up(followup)
|
||||||
|
else:
|
||||||
|
files = None
|
||||||
|
|
||||||
# emit signal when the TicketForm.save is done
|
# emit signal when the TicketForm.save is done
|
||||||
new_ticket_done.send(sender="TicketForm", ticket=ticket)
|
new_ticket_done.send(sender="TicketForm", ticket=ticket)
|
||||||
|
Loading…
Reference in New Issue
Block a user