Merge bugfixes from 0.2.23-devel

This commit is contained in:
Garret Wassermann 2020-10-12 03:19:46 -04:00
commit 6b335590e6
6 changed files with 115 additions and 32 deletions

View File

@ -1,12 +1,12 @@
Configuration Configuration
============= =============
**IMPORTANT NOTE**: Any tickets created via POP3 or IMAP mailboxes will DELETE the original e-mail from the mail server.
Before django-helpdesk will be much use, you need to do some basic configuration. Most of this is done via the Django admin screens. Before django-helpdesk will be much use, you need to do some basic configuration. Most of this is done via the Django admin screens.
1. Visit ``http://yoursite/admin/`` and add a Helpdesk Queue. If you wish, enter your POP3 or IMAP server details. 1. Visit ``http://yoursite/admin/`` and add a Helpdesk Queue. If you wish, enter your POP3 or IMAP server details.
**IMPORTANT NOTE**: Any tickets created via POP3 or IMAP mailboxes will DELETE the original e-mail from the mail server.
2. Visit ``http://yoursite/helpdesk/`` (or whatever path as defined in your ``urls.py``) 2. Visit ``http://yoursite/helpdesk/`` (or whatever path as defined in your ``urls.py``)
3. If you wish to automatically create tickets from the contents of an e-mail inbox, set up a cronjob to run the management command on a regular basis. (Or use Celery, see below) 3. If you wish to automatically create tickets from the contents of an e-mail inbox, set up a cronjob to run the management command on a regular basis. (Or use Celery, see below)
@ -17,7 +17,7 @@ Before django-helpdesk will be much use, you need to do some basic configuration
This will run the e-mail import every 5 minutes This will run the e-mail import every 5 minutes
**IMPORTANT NOTE**: Any tickets created via POP3 or IMAP mailboxes will DELETE the original e-mail from the mail server. You will need to create a support queue, and associated login/host values, in the Django admin interface, in order for mail to be picked-up from the mail server and placed in the tickets table of your database. The values in the settings file alone, will not create the necessary values to trigger the get_email function.
If you wish to use `celery` instead of cron, you must add 'django_celery_beat' to `INSTALLED_APPS` and add a periodic celery task through the Django admin. If you wish to use `celery` instead of cron, you must add 'django_celery_beat' to `INSTALLED_APPS` and add a periodic celery task through the Django admin.
@ -46,3 +46,31 @@ Before django-helpdesk will be much use, you need to do some basic configuration
8. If you wish to use SOCKS4/5 proxy with Helpdesk Queue email operations, install PySocks manually. Please note that mixing both SOCKS and non-SOCKS email sources for different queues is only supported under Python 2; on Python 3, SOCKS proxy support is all-or-nothing: either all queue email sources must use SOCKS or none may use it. If you need this functionality on Python 3 please `let us know <https://github.com/django-helpdesk/django-helpdesk/issues/new>`_. 8. If you wish to use SOCKS4/5 proxy with Helpdesk Queue email operations, install PySocks manually. Please note that mixing both SOCKS and non-SOCKS email sources for different queues is only supported under Python 2; on Python 3, SOCKS proxy support is all-or-nothing: either all queue email sources must use SOCKS or none may use it. If you need this functionality on Python 3 please `let us know <https://github.com/django-helpdesk/django-helpdesk/issues/new>`_.
You're now up and running! Happy ticketing. You're now up and running! Happy ticketing.
Queue settings via admin interface
----------------------------------
Locale
^^^^^^
The *Locale* value must match the value in the ``locale`` column in the ``helpdesk_emailtemplate`` table if you wish to use those templates. For default installations/templates those values are ``cs``, ``de``, ``en``, ``es``, ``fi``, ``fr``, ``it``, ``pl``, ``ru`` and ``zh``.
If you want to use a different *Local* then you will need to generate/edit the necessary templates (and set the value in the ``locale`` column) for those locales. This includes when using language variants, such as ``de-CH``, ``en-GB`` or ``fr-CA`` for example.
E-Mail Check Interval
^^^^^^^^^^^^^^^^^^^^^
This setting does not trigger e-mail collection, it merely throttles it. In order to trigger e-mail collection you must run a crontab to trigger ``manage.py get_email``. The setting in *E-Mail Check Interval* prevents your crontab from running the e-mail trigger more often than the interval set.
For example, setting *E-Mail Check Interval* to ``5`` will limit the collection of e-mail to once every five minutes, even if your crontab is firing every five seconds. If your cron job is set to fire once every hour, then e-mail will only be collected once every hour.
The cron job triggers the collection of e-mail, *E-Mail Check Interval* restricts how often the trigger is effective.
To remove this limit, set *E-Mail Check Interval* to ``0``.
Potential problems
""""""""""""""""""
There is potential for a timing clash to prevent triggering of mail collection if *E-Mail Check Interval* and your crontab interval are identical. Because the crontab runs fractionally before, or at exactly the same time as *E-Mail Check Interval* is run, if the timings for both are identical then every second call by the crontab will be ignored by *E-Mail Check Interval* because its interval has yet to expire.
The result is that if both crontab and *E-Mail Check Interval* are set to run at five minute intervals, then mail may actually only be collected every ten minutes. You will see the evidence of this in the helpdesk mail log, or in the logs of your mail server.
To avoid this problem set the crontab and *E-Mail Check Interval* to marginally different values (or set *E-Mail Check Interval* to ``0``). *E-Mail Check Interval* will only take an integer value, in minutes, so if you want a five minute interval between mail checks, then you will either have to set *E-Mail Check Interval* to ``4`` and the crontab interval to ``300 seconds``, or the *E-Mail Check Interval* to ``5`` and the crontab interval to ``305 seconds``.
The crontab interval overrides the *E-Mail Check Interval*, and resets the *E-Mail Check Interval* each time it fires, as long as the crontab interval is greater than *E-Mail Check Interval*.

View File

@ -0,0 +1,58 @@
# Generated by Django 2.2.16 on 2020-10-10 12:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0017_default_owner_on_delete_null'),
]
operations = [
migrations.AlterField(
model_name='followup',
name='public',
field=models.BooleanField(blank=True, default=False, help_text='Public tickets are viewable by the submitter and all staff, but non-public tickets can only be seen by staff.', verbose_name='Public'),
),
migrations.AlterField(
model_name='ignoreemail',
name='keep_in_mailbox',
field=models.BooleanField(blank=True, default=False, help_text='Do you want to save emails from this address in the mailbox? If this is unticked, emails from this address will be deleted.', verbose_name='Save Emails in Mailbox?'),
),
migrations.AlterField(
model_name='queue',
name='allow_email_submission',
field=models.BooleanField(blank=True, default=False, help_text='Do you want to poll the e-mail box below for new tickets?', verbose_name='Allow E-Mail Submission?'),
),
migrations.AlterField(
model_name='queue',
name='allow_public_submission',
field=models.BooleanField(blank=True, default=False, help_text='Should this queue be listed on the public submission form?', verbose_name='Allow Public Submission?'),
),
migrations.AlterField(
model_name='queue',
name='email_box_ssl',
field=models.BooleanField(blank=True, default=False, help_text='Whether to use SSL for IMAP or POP3 - the default ports when using SSL are 993 for IMAP and 995 for POP3.', verbose_name='Use SSL for E-Mail?'),
),
migrations.AlterField(
model_name='savedsearch',
name='shared',
field=models.BooleanField(blank=True, default=False, help_text='Should other users see this query?', verbose_name='Shared With Other Users?'),
),
migrations.AlterField(
model_name='ticket',
name='on_hold',
field=models.BooleanField(blank=True, default=False, help_text='If a ticket is on hold, it will not automatically be escalated.', verbose_name='On Hold'),
),
migrations.AlterField(
model_name='ticketcc',
name='can_update',
field=models.BooleanField(blank=True, default=False, help_text='Can this CC login and update the ticket?', verbose_name='Can Update Ticket?'),
),
migrations.AlterField(
model_name='ticketcc',
name='can_view',
field=models.BooleanField(blank=True, default=False, help_text='Can this CC login to view the ticket details?', verbose_name='Can View Ticket?'),
),
]

View File

@ -1,27 +0,0 @@
# Generated by Django 2.0.1 on 2018-09-07 21:22
from django.db import migrations, models
import helpdesk.models
def clear_secret_keys(apps, schema_editor):
Ticket = apps.get_model("helpdesk", "Ticket")
db_alias = schema_editor.connection.alias
for ticket in Ticket.objects.using(db_alias).all():
ticket.secret_key=''
ticket.save()
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0017_default_owner_on_delete_null'),
]
operations = [
migrations.AddField(
model_name='ticket',
name='secret_key',
field=models.CharField(default=helpdesk.models.mk_secret, max_length=36, null=True, verbose_name='Secret key needed for viewing/editing ticket by non-logged in users'),
),
migrations.RunPython(clear_secret_keys),
]

View File

@ -3,16 +3,25 @@ from django.db import migrations, models
import helpdesk.models import helpdesk.models
def clear_secret_keys(apps, schema_editor):
Ticket = apps.get_model("helpdesk", "Ticket")
db_alias = schema_editor.connection.alias
for ticket in Ticket.objects.using(db_alias).all():
ticket.secret_key=''
ticket.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('helpdesk', '0018_ticket_secret_key'), ('helpdesk', '0018_fix_migrations'),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AddField(
model_name='ticket', model_name='ticket',
name='secret_key', name='secret_key',
field=models.CharField(default=helpdesk.models.mk_secret, max_length=36, verbose_name='Secret key needed for viewing/editing ticket by non-logged in users'), field=models.CharField(default=helpdesk.models.mk_secret, max_length=36, verbose_name='Secret key needed for viewing/editing ticket by non-logged in users'),
), ),
migrations.RunPython(clear_secret_keys),
] ]

View File

@ -60,6 +60,9 @@
{% for f in d %}<td class='report'>{{ f }}</td>{% endfor %} {% for f in d %}<td class='report'>{{ f }}</td>{% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
<tr>
{% for f in total_data %}<td class='report'>{{ f }}</td>{% endfor %}
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -1350,11 +1350,17 @@ def run_report(request, report):
column_headings = [col1heading] + possible_options column_headings = [col1heading] + possible_options
# Prepare a dict to store totals for each possible option
totals = {}
# Pivot the data so that 'header1' fields are always first column # Pivot the data so that 'header1' fields are always first column
# in the row, and 'possible_options' are always the 2nd - nth columns. # in the row, and 'possible_options' are always the 2nd - nth columns.
for item in header1: for item in header1:
data = [] data = []
for hdr in possible_options: for hdr in possible_options:
if hdr not in totals.keys():
totals[hdr] = summarytable[item, hdr]
else:
totals[hdr] += summarytable[item, hdr]
data.append(summarytable[item, hdr]) data.append(summarytable[item, hdr])
table.append([item] + data) table.append([item] + data)
@ -1373,10 +1379,16 @@ def run_report(request, report):
for series in table: for series in table:
series_names.append(series[0]) series_names.append(series[0])
# Add total row to table
total_data = ['Total']
for hdr in possible_options:
total_data.append(str(totals[hdr]))
return render(request, 'helpdesk/report_output.html', { return render(request, 'helpdesk/report_output.html', {
'title': title, 'title': title,
'charttype': charttype, 'charttype': charttype,
'data': table, 'data': table,
'total_data': total_data,
'headings': column_headings, 'headings': column_headings,
'series_names': series_names, 'series_names': series_names,
'morrisjs_data': morrisjs_data, 'morrisjs_data': morrisjs_data,