diff --git a/helpdesk/forms.py b/helpdesk/forms.py
index eb77c2e6..3124f281 100644
--- a/helpdesk/forms.py
+++ b/helpdesk/forms.py
@@ -239,17 +239,18 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
label=_('Due on'),
)
- attachment = forms.FileField(
- widget=forms.FileInput(attrs={'class': 'form-control-file'}),
- required=False,
- label=_('Attach File'),
- help_text=_('You can attach a file to this ticket. '
- 'Only file types such as plain text (.txt), '
- 'a document (.pdf, .docx, or .odt), '
- 'or screenshot (.png or .jpg) may be uploaded.'),
- validators=[validate_file_extension]
- )
-
+ if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS:
+ attachment = forms.FileField(
+ widget=forms.FileInput(attrs={'class': 'form-control-file'}),
+ required=False,
+ label=_('Attach File'),
+ help_text=_('You can attach a file to this ticket. '
+ 'Only file types such as plain text (.txt), '
+ 'a document (.pdf, .docx, or .odt), '
+ 'or screenshot (.png or .jpg) may be uploaded.'),
+ validators=[validate_file_extension]
+ )
+
class Media:
js = ('helpdesk/js/init_due_date.js',
'helpdesk/js/init_datetime_classes.js')
diff --git a/helpdesk/settings.py b/helpdesk/settings.py
index 2235e7d5..6d83ed63 100644
--- a/helpdesk/settings.py
+++ b/helpdesk/settings.py
@@ -56,6 +56,11 @@ HELPDESK_STAFF_VIEW_PROTECTOR = getattr(settings,
'HELPDESK_STAFF_VIEW_PROTECTOR',
lambda _: None)
+# Enable ticket and Email attachments
+HELPDESK_ENABLE_ATTACHMENTS = getattr(settings,
+ 'HELPDESK_ENABLE_ATTACHMENTS',
+ False)
+
# Enable the Dependencies field on ticket view
HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET = getattr(settings,
'HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET',
diff --git a/helpdesk/templates/helpdesk/public_view_ticket.html b/helpdesk/templates/helpdesk/public_view_ticket.html
index 77de5af1..ee36e304 100644
--- a/helpdesk/templates/helpdesk/public_view_ticket.html
+++ b/helpdesk/templates/helpdesk/public_view_ticket.html
@@ -122,7 +122,8 @@
-
+
+{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
{% trans "Attach File(s) »" %}
@@ -140,7 +141,7 @@
-
+{% endif %}
{% trans "Update This Ticket" %}
diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html
index b61743f7..652988e0 100644
--- a/helpdesk/templates/helpdesk/ticket.html
+++ b/helpdesk/templates/helpdesk/ticket.html
@@ -54,14 +54,16 @@
{% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}
{% if forloop.last %}{% endif %}
{% endfor %}
- {% for attachment in followup.followupattachment_set.all %}{% if forloop.first %}{% trans "Attachments" %}:{% endif %}
+ {% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
+ {% for attachment in followup.followupattachment_set.all %}{% if forloop.first %}{% trans "Attachments" %}:{% endif %}
{{ attachment.filename }} ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
- {% if followup.user and request.user == followup.user %}
+ {% if followup.user and request.user == followup.user %}
- {% endif %}
+ {% endif %}
- {% if forloop.last %} {% endif %}
- {% endfor %}
+ {% if forloop.last %} {% endif %}
+ {% endfor %}
+ {% endif %}
{% with possible=helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
@@ -105,10 +107,10 @@
{% trans "Comment / Resolution" %}
- {% url "helpdesk:help_context" as context_help_url %}
- {% blocktrans %}
- You can insert ticket and queue details in your message. For more information, see the context help page .
- {% endblocktrans %}
+ {% url "helpdesk:help_context" as context_help_url %}
+ {% blocktrans %}
+ You can insert ticket and queue details in your message. For more information, see the context help page .
+ {% endblocktrans %}
{% trans "New Status" %}
{% if not ticket.can_be_resolved %}{% trans "This ticket cannot be resolved or closed until the tickets it depends on are resolved." %} {% endif %}
@@ -197,7 +199,9 @@
{% endif %}
+ {% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
{% trans "Attach File(s) »" %}
+ {% endif %}
@@ -257,7 +261,7 @@
{% block helpdesk_js %}
diff --git a/helpdesk/templates/helpdesk/ticket_desc_table.html b/helpdesk/templates/helpdesk/ticket_desc_table.html
index 8cf00829..21a46e5a 100644
--- a/helpdesk/templates/helpdesk/ticket_desc_table.html
+++ b/helpdesk/templates/helpdesk/ticket_desc_table.html
@@ -149,7 +149,8 @@
{% trans "Knowlegebase item" %}
{{ticket.kbitem}}
- {% endif %}
+ {% endif %}
+ {% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %}
{% trans "Attachments" %}
@@ -171,6 +172,7 @@
+ {% endif %}
{% trans "Checklists" %}