From de9c5a709e02d03412cf010006c9f813a16f0d50 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Wed, 20 Apr 2022 16:36:37 +0200 Subject: [PATCH] feat(fields): no time spent --- docs/settings.rst | 8 ++++++++ helpdesk/settings.py | 10 ++++++++++ helpdesk/templates/helpdesk/followup_edit.html | 2 ++ helpdesk/templates/helpdesk/report_index.html | 2 +- helpdesk/templates/helpdesk/ticket.html | 4 +++- helpdesk/templates/helpdesk/ticket_desc_table.html | 5 +++++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 246ce4b6..86d2b446 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -94,6 +94,14 @@ These changes are visible throughout django-helpdesk **Default:** ``HELPDESK_ANON_ACCESS_RAISES_404 = False`` +- **HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET** If False, disable the fields on ticket. + + **Default:** ``HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET = True`` + +- **HELPDESK_ENABLE_TIME_SPENT_ON_TICKET** If False, disable the fields on ticket. + + **Default:** ``HELPDESK_ENABLE_TIME_SPENT_ON_TICKET = True`` + Options shown on public pages ----------------------------- diff --git a/helpdesk/settings.py b/helpdesk/settings.py index a46af953..66f8039a 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -41,6 +41,16 @@ HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = getattr(settings, 'HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT', False) +# Enable the Dependencies field on ticket view +HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET = getattr(settings, + 'HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET', + True) + +# Enable the Time spent on field on ticket view +HELPDESK_ENABLE_TIME_SPENT_ON_TICKET = getattr(settings, + 'HELPDESK_ENABLE_TIME_SPENT_ON_TICKET', + True) + # raises a 404 to anon users. It's like it was invisible HELPDESK_ANON_ACCESS_RAISES_404 = getattr(settings, 'HELPDESK_ANON_ACCESS_RAISES_404', diff --git a/helpdesk/templates/helpdesk/followup_edit.html b/helpdesk/templates/helpdesk/followup_edit.html index e74e3203..af61e6e1 100644 --- a/helpdesk/templates/helpdesk/followup_edit.html +++ b/helpdesk/templates/helpdesk/followup_edit.html @@ -46,8 +46,10 @@
{{ form.new_status }}

If the status was changed, what was it changed to?

+ {% if helpdesk_settings.HELPDESK_ENABLE_TIME_SPENT_ON_TICKET %}
{{ form.time_spent }}
+ {% endif %}

{% csrf_token %} diff --git a/helpdesk/templates/helpdesk/report_index.html b/helpdesk/templates/helpdesk/report_index.html index 4d82f40c..055243a7 100644 --- a/helpdesk/templates/helpdesk/report_index.html +++ b/helpdesk/templates/helpdesk/report_index.html @@ -55,7 +55,7 @@ {% if queue.open %}{% endif %}{{ queue.open }}{% if queue.open %}{% endif %} {% if queue.resolved %}{% endif %}{{ queue.resolved }}{% if queue.resolved %}{% endif %} {% if queue.closed %}{% endif %}{{ queue.closed }}{% if queue.closed %}{% endif %} - {{ queue.time_spent }}{% if queue.dedicated_time %} / {{ queue.dedicated_time }}{% endif %} + {% if helpdesk_settings.HELPDESK_ENABLE_TIME_SPENT_ON_TICKET %}{{ queue.time_spent }}{% if queue.dedicated_time %} / {{ queue.dedicated_time }}{% endif %}{% endif %} {% empty %} {% trans "There are no unassigned tickets." %} diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html index 5eade600..ff0a3fa8 100644 --- a/helpdesk/templates/helpdesk/ticket.html +++ b/helpdesk/templates/helpdesk/ticket.html @@ -46,7 +46,7 @@
{{ followup.title|num_to_link }}
-   +  

{% if followup.comment %} @@ -156,12 +156,14 @@

{% trans "If this is public, the submitter will be e-mailed your comment or resolution." %}
{% endif %} + {% if helpdesk_settings.HELPDESK_ENABLE_TIME_SPENT_ON_TICKET %} {% if user.is_staff %}
{% trans "(Optional)" %}
{% endif %} + {% endif %}

diff --git a/helpdesk/templates/helpdesk/ticket_desc_table.html b/helpdesk/templates/helpdesk/ticket_desc_table.html index 36df46fb..07fadee4 100644 --- a/helpdesk/templates/helpdesk/ticket_desc_table.html +++ b/helpdesk/templates/helpdesk/ticket_desc_table.html @@ -82,8 +82,13 @@ {% trans "This ticket has no dependencies." %} {% endfor %} + {% if helpdesk_settings.HELPDESK_ENABLE_TIME_SPENT_ON_TICKET %} {% trans "Total time spent" %} {{ ticket.time_spent_formated }} + {% else %} + + + {% endif %} {% if ticket.kbitem %}