From 5c6bfab3fb7f4f1841f380de9134a871a5536879 Mon Sep 17 00:00:00 2001 From: silvia Date: Wed, 7 Apr 2021 16:32:31 +0200 Subject: [PATCH 01/15] :lipstick: [#58] Updated templates --- .../destruction/management/__init__.py | 0 .../management/commands/__init__.py | 0 .../commands/convert_log_templates.py | 18 ++++++++++++++++ .../destruction/tasks.py | 10 ++++----- .../templates/destruction/logs/aborted.html | 14 +++++++++++++ .../templates/destruction/logs/aborted.txt | 14 ------------- .../templates/destruction/logs/created.html | 14 +++++++++++++ .../templates/destruction/logs/created.txt | 14 ------------- .../logs/item_destruction_failed.html | 14 +++++++++++++ .../logs/item_destruction_failed.txt | 13 ------------ .../logs/item_destruction_succeeded.html | 8 +++++++ .../logs/item_destruction_succeeded.txt | 7 ------- .../destruction/logs/item_update_failed.html | 14 +++++++++++++ .../destruction/logs/item_update_failed.txt | 13 ------------ .../logs/item_update_succeeded.html | 8 +++++++ .../logs/item_update_succeeded.txt | 7 ------- .../destruction/logs/review_created.html | 20 ++++++++++++++++++ .../destruction/logs/review_created.txt | 14 ------------- .../templates/destruction/logs/updated.html | 21 +++++++++++++++++++ .../templates/destruction/logs/updated.txt | 14 ------------- .../tests/test_destruction_list_create.py | 2 +- .../tests/test_destruction_list_detail.py | 6 +++--- .../destruction/tests/test_review_create.py | 8 +++---- .../destruction/tests/test_tasks.py | 4 ++-- .../destruction/views.py | 8 +++---- .../sass/components/_log-item.scss | 12 +++-------- 26 files changed, 153 insertions(+), 124 deletions(-) create mode 100644 src/archiefvernietigingscomponent/destruction/management/__init__.py create mode 100644 src/archiefvernietigingscomponent/destruction/management/commands/__init__.py create mode 100644 src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.txt create mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html delete mode 100644 src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.txt diff --git a/src/archiefvernietigingscomponent/destruction/management/__init__.py b/src/archiefvernietigingscomponent/destruction/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/archiefvernietigingscomponent/destruction/management/commands/__init__.py b/src/archiefvernietigingscomponent/destruction/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py b/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py new file mode 100644 index 00000000..d38490e8 --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py @@ -0,0 +1,18 @@ +from django.core.management.base import BaseCommand +from django.db import transaction + +from timeline_logger.models import TimelineLog + + +class Command(BaseCommand): + help = "Change the extension of the log templates from .txt to .html" + + def handle(self, *args, **options): + logs = TimelineLog.objects.all() + + with transaction.atomic(): + for log in logs: + template_name = log.template + if ".txt" in template_name: + log.template = template_name.replace(".txt", ".html") + log.save() diff --git a/src/archiefvernietigingscomponent/destruction/tasks.py b/src/archiefvernietigingscomponent/destruction/tasks.py index d60d5cd7..54f64f9c 100644 --- a/src/archiefvernietigingscomponent/destruction/tasks.py +++ b/src/archiefvernietigingscomponent/destruction/tasks.py @@ -69,7 +69,7 @@ def process_list_item(list_item_id): list_item.save() TimelineLog.objects.create( content_object=list_item, - template="destruction/logs/item_destruction_failed.txt", + template="destruction/logs/item_destruction_failed.html", extra_data={"zaak": None, "error": traceback.format_exc(),}, ) return @@ -98,7 +98,7 @@ def process_list_item(list_item_id): list_item.fail() TimelineLog.objects.create( content_object=list_item, - template="destruction/logs/item_destruction_failed.txt", + template="destruction/logs/item_destruction_failed.html", extra_data={ "zaak": zaak["identificatie"], "error": traceback.format_exc(), @@ -108,7 +108,7 @@ def process_list_item(list_item_id): list_item.complete() TimelineLog.objects.create( content_object=list_item, - template="destruction/logs/item_destruction_succeeded.txt", + template="destruction/logs/item_destruction_succeeded.html", extra_data={"zaak": zaak["identificatie"]}, ) @@ -229,12 +229,12 @@ def update_zaak_from_list_item(list_item_id: str, archive_data: dict): TimelineLog.objects.create( content_object=list_item, - template="destruction/logs/item_update_failed.txt", + template="destruction/logs/item_update_failed.html", extra_data={"zaak": None, "error": traceback.format_exc()}, ) else: TimelineLog.objects.create( content_object=list_item, - template="destruction/logs/item_update_succeeded.txt", + template="destruction/logs/item_update_succeeded.html", extra_data={"zaak": zaak["identificatie"]}, ) diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.html new file mode 100644 index 00000000..4706ceca --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.html @@ -0,0 +1,14 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with list=log.content_object role=log.user.role count counter=log.extra_data.n_items trimmed %} + User with role {{ role }} has aborted the list {{ list }} + with {{ counter }} case. + {% plural %} + User with role {{ role }} has aborted the list {{ list }} + with {{ counter }} cases. + {% endblocktrans %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.txt deleted file mode 100644 index 5615f9ae..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.txt +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n %} - - -
- {% blocktrans with list=log.content_object user=log.user count counter=log.extra_data.n_items trimmed %} - {{ user }} has aborted the list {{ list }} - with {{ counter }} zaak. - {% plural %} - {{ user }} has aborted the list {{ list }} - with {{ counter }} zaken. - {% endblocktrans %} -
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html new file mode 100644 index 00000000..6002f30b --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html @@ -0,0 +1,14 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with list=log.content_object role=log.user.role count counter=log.extra_data.n_items trimmed %} + User with role {{ role }} created the list {{ list }} + with {{ counter }} case. + {% plural %} + User with role {{ role }} created the list {{ list }} + with {{ counter }} cases. + {% endblocktrans %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.txt deleted file mode 100644 index 13026e6c..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.txt +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n %} - - -
- {% blocktrans with list=log.content_object user=log.user count counter=log.extra_data.n_items trimmed %} - {{ user }} heeft de lijst {{ list }} - met {{ counter }} zaak aangemaakt. - {% plural %} - {{ user }} heeft de lijst {{ list }} - met {{ counter }} zaken aangemaakt. - {% endblocktrans %} -
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html new file mode 100644 index 00000000..a574952d --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html @@ -0,0 +1,14 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with zaak=log.extra_data.zaak %}Case {{ zaak }} was not deleted.{% endblocktrans %} + +

+ + {{ log.extra_data.error|linebreaksbr|linenumbers }} + +

+
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.txt deleted file mode 100644 index ac7b5dd8..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.txt +++ /dev/null @@ -1,13 +0,0 @@ - - -
- Zaak {{ log.extra_data.zaak }} is niet vernietigd. - -

- - {{ log.extra_data.error|linebreaksbr|linenumbers }} - -

-
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.html new file mode 100644 index 00000000..4a8ae067 --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.html @@ -0,0 +1,8 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with zaak=log.extra_data.zaak %}Case {{ zaak }} was deleted.{% endblocktrans %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.txt deleted file mode 100644 index 2ddbb47e..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.txt +++ /dev/null @@ -1,7 +0,0 @@ - - -
- Zaak {{ log.extra_data.zaak }} is vernietigd. -
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.html new file mode 100644 index 00000000..dc85412e --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.html @@ -0,0 +1,14 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with zaak=log.extra_data.zaak %}Case {{ zaak }} was not updated.{% endblocktrans %} + +

+ + {{ log.extra_data.error|linebreaksbr|linenumbers }} + +

+
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.txt deleted file mode 100644 index e57d83f4..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.txt +++ /dev/null @@ -1,13 +0,0 @@ - - -
- Zaak {{ log.extra_data.zaak }} is not updated. - -

- - {{ log.extra_data.error|linebreaksbr|linenumbers }} - -

-
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html new file mode 100644 index 00000000..58913262 --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html @@ -0,0 +1,8 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% blocktrans with zaak=log.extra_data.zaak %}Case {{ zaak }} was updated.{% endblocktrans %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.txt deleted file mode 100644 index 1ad5916c..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.txt +++ /dev/null @@ -1,7 +0,0 @@ - - -
- Zaak {{ log.extra_data.zaak }} is updated. -
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html new file mode 100644 index 00000000..480efd0e --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html @@ -0,0 +1,20 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% if log.extra_data.n_items %} + {% blocktrans with list=log.content_object.destruction_list role=log.user.role count counter=log.extra_data.n_items trimmed %} + User with role {{ role }} has reviewed the list {{ list }} + and requested changes for {{ counter }} item. + {% plural %} + User with role {{ role }} has reviewed the list {{ list }} + and requested changes for {{ counter }} items. + {% endblocktrans %} + {% else %} + {% blocktrans with list=log.content_object.destruction_list role=log.user.role %} + User with role {{ role }} has approved the list {{ list }}. + {% endblocktrans %} + {% endif %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.txt deleted file mode 100644 index 8f9180d2..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.txt +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n %} - - -
- {% blocktrans with review=log.content_object user=log.user count counter=log.extra_data.n_items trimmed %} - {{ user }} has created the review {{ review }} - and requested changes for {{ counter }} item. - {% plural %} - {{ user }} has created the review {{ review }} - and requested changes for {{ counter }} items. - {% endblocktrans %} -
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html new file mode 100644 index 00000000..3f920673 --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html @@ -0,0 +1,21 @@ +{% load i18n %} + + [{{ log.timestamp|date:'Y-m-d H:i' }}]: + + +
+ {% if log.extra_data.n_items %} + {% blocktrans with list=log.content_object role=log.user.role count counter=log.extra_data.n_items trimmed %} + User with role {{ role }} has updated the list {{ list }} + and removed {{ counter }} case. + {% plural %} + User with role {{ role }} has updated the list {{ list }} + and removed {{ counter }} cases. + {% endblocktrans %} + {% else %} + {% blocktrans with list=log.content_object role=log.user.role trimmed %} + User with role {{ role }} has resubmitted the list {{ list }} + for review. + {% endblocktrans %} + {% endif %} +
diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.txt b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.txt deleted file mode 100644 index b32c1bb9..00000000 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.txt +++ /dev/null @@ -1,14 +0,0 @@ -{% load i18n %} - - -
- {% blocktrans with list=log.content_object user=log.user count counter=log.extra_data.n_items trimmed %} - {{ user }} has updated the list {{ list }} - with {{ counter }} zaak removed. - {% plural %} - {{ user }} has updated the list {{ list }} - with {{ counter }} zaken removed. - {% endblocktrans %} -
diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py index 55cd7d68..420e3bcc 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py @@ -59,7 +59,7 @@ def test_create_list(self): # check that a log entry was created timeline_log = destruction_list.logs.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/created.txt") + self.assertEqual(timeline_log.template, "destruction/logs/created.html") # check that notifications were sent notification = Notification.objects.get() diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py index 75063b22..5f12f808 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py @@ -90,7 +90,7 @@ def test_update_destruction_list(self, m): # check log timeline_log = TimelineLog.objects.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/updated.txt") + self.assertEqual(timeline_log.template, "destruction/logs/updated.html") # check notification notification = Notification.objects.get() @@ -150,7 +150,7 @@ def test_abort_destruction_list(self, m): # check log timeline_log = TimelineLog.objects.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/aborted.txt") + self.assertEqual(timeline_log.template, "destruction/logs/aborted.html") # Check notification # Since the User is both the author and the assignee, no notification is sent @@ -204,7 +204,7 @@ def test_abort_destruction_list_notify_assignee(self, m): # check log timeline_log = TimelineLog.objects.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/aborted.txt") + self.assertEqual(timeline_log.template, "destruction/logs/aborted.html") # Check notification notifications = Notification.objects.filter(destruction_list=destruction_list) diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py b/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py index f2a4f8f2..3115b741 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py @@ -100,7 +100,7 @@ def test_create_review_approve(self): # check logs timeline_log = review.logs.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.txt") + self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") # check notifications notifications = Notification.objects.all() @@ -160,7 +160,7 @@ def test_create_review_change(self): # check logs timeline_log = review.logs.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.txt") + self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") # check notifications notifications = Notification.objects.order_by("created").all() @@ -215,7 +215,7 @@ def test_create_review_reject(self): # check logs timeline_log = review.logs.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.txt") + self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") # check notifications notifications = Notification.objects.order_by("created").all() @@ -258,7 +258,7 @@ def test_create_review_approve_last(self, m): # check logs timeline_log = review.logs.get() self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.txt") + self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") # check notification notification = Notification.objects.get() diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_tasks.py b/src/archiefvernietigingscomponent/destruction/tests/test_tasks.py index 7aa218ad..61ca07e7 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_tasks.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_tasks.py @@ -566,7 +566,7 @@ def test_update_zaak_from_list_item(self, mock_update_zaak): log = TimelineLog.objects.get() self.assertEqual(log.content_object, list_item) self.assertEqual(log.extra_data, {"zaak": "foobar"}) - self.assertEqual(log.template, "destruction/logs/item_update_succeeded.txt") + self.assertEqual(log.template, "destruction/logs/item_update_succeeded.html") mock_update_zaak.assert_called_once_with( list_item.zaak, archive_data, "Change archive params" @@ -590,6 +590,6 @@ def test_update_zaak_from_list_item_fail(self, mock_update_zaak): extra_data = log.extra_data self.assertEqual(extra_data["zaak"], None) self.assertTrue("something went wrong" in extra_data["error"]) - self.assertEqual(log.template, "destruction/logs/item_update_failed.txt") + self.assertEqual(log.template, "destruction/logs/item_update_failed.html") mock_update_zaak.assert_called_once_with(list_item.zaak, archive_data, None) diff --git a/src/archiefvernietigingscomponent/destruction/views.py b/src/archiefvernietigingscomponent/destruction/views.py index 7365eea3..6b23aeed 100644 --- a/src/archiefvernietigingscomponent/destruction/views.py +++ b/src/archiefvernietigingscomponent/destruction/views.py @@ -152,7 +152,7 @@ def form_valid(self, form): TimelineLog.log_from_request( self.request, destruction_list, - template="destruction/logs/created.txt", + template="destruction/logs/created.html", n_items=destruction_list.items.count(), reviewers=list( destruction_list.assignees.values("assignee__id", "assignee__username") @@ -221,7 +221,7 @@ def abort_destruction_list(self, destruction_list): TimelineLog.log_from_request( self.request, destruction_list, - template="destruction/logs/aborted.txt", + template="destruction/logs/aborted.html", n_items=destruction_list.items.count(), ) @@ -256,7 +256,7 @@ def forms_valid(self, form, inlines): TimelineLog.log_from_request( self.request, destruction_list, - template="destruction/logs/updated.txt", + template="destruction/logs/updated.html", n_items=destruction_list.items.filter( status=ListItemStatus.removed ).count(), @@ -415,7 +415,7 @@ def forms_valid(self, form, inlines): TimelineLog.log_from_request( self.request, list_review, - template="destruction/logs/review_created.txt", + template="destruction/logs/review_created.html", n_items=list_review.item_reviews.count(), ) # send notification diff --git a/src/archiefvernietigingscomponent/sass/components/_log-item.scss b/src/archiefvernietigingscomponent/sass/components/_log-item.scss index f03435d5..02a84468 100644 --- a/src/archiefvernietigingscomponent/sass/components/_log-item.scss +++ b/src/archiefvernietigingscomponent/sass/components/_log-item.scss @@ -3,8 +3,10 @@ .log-item { - padding: 1em; + padding: 0 1em; border-radius: 3px; + display: flex; + margin: 0.25em 0; &:hover { background: #fedede; @@ -12,8 +14,6 @@ @include element("title") { display: block; - margin-bottom: 0.5em; - text-decoration: underline; } @include element("body") { @@ -25,10 +25,4 @@ padding: 0.5em; } } - - @include element("user") { - font-weight: bold; - color: $color-primary; - } - } From 46716f0b43284e996d28d803d728727acb4c95a7 Mon Sep 17 00:00:00 2001 From: silvia Date: Wed, 7 Apr 2021 18:27:36 +0200 Subject: [PATCH 02/15] :sparkles: [#58] Audit trail report --- .../report/audittrail/audittrail.html | 32 +++++++++++++++++++ .../report/utils.py | 19 ++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/archiefvernietigingscomponent/report/templates/report/audittrail/audittrail.html diff --git a/src/archiefvernietigingscomponent/report/templates/report/audittrail/audittrail.html b/src/archiefvernietigingscomponent/report/templates/report/audittrail/audittrail.html new file mode 100644 index 00000000..913d9266 --- /dev/null +++ b/src/archiefvernietigingscomponent/report/templates/report/audittrail/audittrail.html @@ -0,0 +1,32 @@ +{% load i18n %} + + + + +

Audit trail

+ +{% for log in logs %} +
{{ log.get_message }}
+{% endfor %} diff --git a/src/archiefvernietigingscomponent/report/utils.py b/src/archiefvernietigingscomponent/report/utils.py index 486d8e81..d7ac7de7 100644 --- a/src/archiefvernietigingscomponent/report/utils.py +++ b/src/archiefvernietigingscomponent/report/utils.py @@ -1,6 +1,7 @@ import csv import io from datetime import date, datetime +from itertools import chain from typing import ByteString, List, Optional from django.conf import settings @@ -225,6 +226,7 @@ def create_destruction_report(destruction_list: DestructionList) -> DestructionR report_content_html = create_html_report_content( zaken_data_for_report, destruction_list.contains_sensitive_info ) + audittrail_html = create_audittrail_report(destruction_list) report_content_csv = create_csv_report_content( zaken_data_for_report, destruction_list.contains_sensitive_info ) @@ -243,7 +245,8 @@ def create_destruction_report(destruction_list: DestructionList) -> DestructionR title=report_subject, process_owner=process_owner_review.author if process_owner_review else None, content_pdf=ContentFile( - content=convert_to_pdf(report_content_html), name=f"{report_filename}.pdf" + content=convert_to_pdf(report_content_html + audittrail_html), + name=f"{report_filename}.pdf", ), content_csv=ContentFile( content=report_content_csv.read(), name=f"{report_filename}.csv" @@ -261,3 +264,17 @@ def get_absolute_url(path: str, request: Optional[HttpRequest] = None) -> str: site = Site.objects.get_current() protocol = "https" if settings.IS_HTTPS else "http" return f"{protocol}://{site.domain}{path}" + + +def create_audittrail_report(destruction_list: DestructionList): + list_logs = destruction_list.logs.all() + reviews_logs = [review.logs.all() for review in destruction_list.reviews.all()] + all_logs = sorted( + chain(*reviews_logs, list_logs), key=lambda instance: instance.timestamp + ) + + return render( + request=None, + template_name="report/audittrail/audittrail.html", + context={"logs": all_logs}, + ).content.decode("utf8") From 31ad62cede1f2afeb14cd62f35250c3ee62124f3 Mon Sep 17 00:00:00 2001 From: silvia Date: Wed, 7 Apr 2021 18:28:06 +0200 Subject: [PATCH 03/15] :white_check_mark: [#58] Audit trail tests --- .../report/tests/test_utils.py | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/src/archiefvernietigingscomponent/report/tests/test_utils.py b/src/archiefvernietigingscomponent/report/tests/test_utils.py index 42d03123..012f1e4c 100644 --- a/src/archiefvernietigingscomponent/report/tests/test_utils.py +++ b/src/archiefvernietigingscomponent/report/tests/test_utils.py @@ -3,6 +3,8 @@ from django.test import TestCase, override_settings from freezegun import freeze_time +from lxml.html import document_fromstring +from timeline_logger.models import TimelineLog from archiefvernietigingscomponent.accounts.tests.factories import UserFactory from archiefvernietigingscomponent.constants import RoleTypeChoices @@ -17,6 +19,7 @@ DestructionListReviewFactory, ) from archiefvernietigingscomponent.report.utils import ( + create_audittrail_report, get_destruction_list_archivaris_comments, get_destruction_report_data, get_looptijd, @@ -707,3 +710,95 @@ def test_failed_destruction_not_in_report_content(self, m_vcs, m_zaaktype): self.assertEqual(1, len(report_data)) self.assertEqual("ZAAK-2", report_data[0]["identificatie"]) + + def test_logs_from_right_list_are_shown(self): + record_manager = UserFactory.create(role__type=RoleTypeChoices.record_manager) + archivaris = UserFactory.create(role__type=RoleTypeChoices.archivist) + + destruction_list_1 = DestructionListFactory.create(author=record_manager) + review_1 = DestructionListReviewFactory.create( + destruction_list=destruction_list_1, author=archivaris + ) + destruction_list_2 = DestructionListFactory.create(author=record_manager) + review_2 = DestructionListReviewFactory.create( + destruction_list=destruction_list_2, author=archivaris + ) + + TimelineLog.objects.create( + content_object=destruction_list_1, + template="destruction/logs/created.html", + extra_data={"n_items": 3}, + user=record_manager, + ) + TimelineLog.objects.create( + content_object=review_1, + template="destruction/logs/review_created.html", + user=archivaris, + ) + # These should not appear in the audit trail report, because they are not related to the right list + TimelineLog.objects.create( + content_object=destruction_list_2, + template="destruction/logs/created.html", + extra_data={"n_items": 3}, + user=record_manager, + ) + TimelineLog.objects.create( + content_object=review_2, + template="destruction/logs/review_created.html", + user=archivaris, + ) + + report = create_audittrail_report(destruction_list_1) + html_report = document_fromstring(report) + + self.assertEqual(2, len(html_report.find_class("log-item"))) + self.assertIn(destruction_list_1.name, report) + self.assertNotIn(destruction_list_2.name, report) + + def test_logs_are_in_correct_order(self): + record_manager = UserFactory.create(role__type=RoleTypeChoices.record_manager) + archivaris = UserFactory.create(role__type=RoleTypeChoices.archivist) + + destruction_list = DestructionListFactory.create(author=record_manager) + review = DestructionListReviewFactory.create( + destruction_list=destruction_list, author=archivaris + ) + + with freeze_time("2012-01-14 12:00"): + TimelineLog.objects.create( + content_object=destruction_list, + template="destruction/logs/created.html", + extra_data={"n_items": 3}, + user=record_manager, + ) + with freeze_time("2012-01-14 12:05"): + TimelineLog.objects.create( + content_object=review, + template="destruction/logs/review_created.html", + user=archivaris, + ) + with freeze_time("2012-01-14 12:10"): + TimelineLog.objects.create( + content_object=destruction_list, + template="destruction/logs/updated.html", + extra_data={"n_items": 1}, + user=record_manager, + ) + with freeze_time("2012-01-14 12:15"): + TimelineLog.objects.create( + content_object=destruction_list, + template="destruction/logs/aborted.html", + extra_data={"n_items": 3}, + user=record_manager, + ) + + report = create_audittrail_report(destruction_list) + html_report = document_fromstring(report) + + self.assertEqual(4, len(html_report.find_class("log-item"))) + + titles = html_report.find_class("log-item__title") + times = [title.text_content() for title in titles] + sorted_times = sorted(times) + + self.assertEqual(times, sorted_times) From 882fa8bc6f074ac52ffabd83d57c8728849c2db9 Mon Sep 17 00:00:00 2001 From: silvia Date: Thu, 8 Apr 2021 09:39:32 +0200 Subject: [PATCH 04/15] :memo: [#58] Document audit trail --- doc/installation/configuration.rst | 22 ++++++++++++++++++++++ doc/manual/destruction.rst | 3 +++ 2 files changed, 25 insertions(+) diff --git a/doc/installation/configuration.rst b/doc/installation/configuration.rst index c201addf..c860ecdc 100644 --- a/doc/installation/configuration.rst +++ b/doc/installation/configuration.rst @@ -419,3 +419,25 @@ This feature will load the following reasons (in this order): - Bescheiden die vervangen wat door een calamiteit verloren is gegaan. - Precedenten: individuele zaken die leiden tot algemene regels. - Bescheiden waarbij de vernietiging de logische samenhang zou verstoren. + +Audit trails +============ + +In version ``1.0``, the templates used for the audit trail have been renamed. Their extension was changed from +``.txt`` to ``.html``. A management command was added to change the template name in all existing logs. +This can be executed as follows: + + .. tabs:: + + .. group-tab:: Docker + + .. code:: shell + + $ docker-compose exec web src/manage.py convert_log_templates + + .. group-tab:: Python + + .. code:: shell + + $ source env/bin/activate + $ python src/manage.py convert_log_templates diff --git a/doc/manual/destruction.rst b/doc/manual/destruction.rst index 33e8df58..b309f220 100644 --- a/doc/manual/destruction.rst +++ b/doc/manual/destruction.rst @@ -145,6 +145,9 @@ filtering for lists that have already been reviewed. All lists with an associate :width: 100% :alt: Download destruction report +In addition, the PDF of the destruction report contains the audit trail of the destruction process. +It shows in chronological order which actions have been performed and the role of the user who performed +the action. Audit trails, logs and notifications ==================================== From 6a7eef289d01f54b1756eefaa22e0965c6f4e2c8 Mon Sep 17 00:00:00 2001 From: silvia Date: Thu, 8 Apr 2021 10:46:40 +0200 Subject: [PATCH 05/15] :dizzy: [#58] Translations --- .../conf/locale/nl/LC_MESSAGES/django.mo | Bin 18477 -> 20369 bytes .../conf/locale/nl/LC_MESSAGES/django.po | 140 ++++++++++++------ 2 files changed, 94 insertions(+), 46 deletions(-) diff --git a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo index ffabd9e4bcd6e2d3723aa8e507cfadaf7ece2659..f9b45a1658772978206a3928fa346ab75ad9194c 100644 GIT binary patch delta 6912 zcmb`~33OD|9mnw-!6;!Ti^`&7Bq4#25I_Oh5_W+Iq96(a1M?V$Br{ ze=p`!KZsqhIgR9CA8P=0e4NqZHOu5XMnV5?b!|16Sq^8u1o za|S!$rET4TrK1L%gIbC_yb;Ht2Cxn_fla6ZzJyweT5OE(U^I=waSBCvQ9Jj+kaa$4 z2^OO|ScYn#3Y%dyYDu;t**6DJ13H0P>re0^{3q)9FEI}jNZ&*p)t>xoWL4bI4_-q( zSc~f52sXz*Bg`7jq~vY zjw2m@%X!^wt>k*4fGCFO6Q~2 zdLe4BJb-FvoxT4o>US?=W897@I{$kp=z*iwPf;_EC$CCTy0tg5yk;ae#elU8wS@Pe z+F63?_zC-cHL~%|7F4F+LQb+dg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ent/conf/locale/nl/LC_MESSAGES/django.po b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po index 7633f172..4b3b3c08 100644 --- a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po +++ b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po @@ -544,59 +544,107 @@ msgstr "De vernietigingslijst is nog niet beoordeeld." msgid "Download destruction report: " msgstr "Download verklaring van vernietiging" -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.txt:7 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/aborted.html:7 #, python-format msgid "" -"%(user)s has aborted the list " -"%(list)s with %(counter)s zaak." +"User with role %(role)s has aborted the list " +"%(list)s with %(counter)s case." msgid_plural "" -"%(user)s has aborted the list " -"%(list)s with %(counter)s zaken." +"User with role %(role)s has aborted the list " +"%(list)s with %(counter)s cases." msgstr[0] "" -"%(user)s heeft de vernietigingslijst " -"%(list)s met %(counter)s zaak geannuleerd." +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s met %(counter)s zaak geannuleerd." msgstr[1] "" -"%(user)s heeft de vernietigingslijst " -"%(list)s met %(counter)s zakem geannuleerd." +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s met %(counter)s zaken geannuleerd." -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/created.txt:7 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html:7 #, python-format msgid "" -"%(user)s heeft de lijst " -"%(list)s met %(counter)s zaak aangemaakt." +"User with role %(role)s created the list %(list)s with %(counter)s case." msgid_plural "" -"%(user)s heeft de lijst " -"%(list)s met %(counter)s zaken aangemaakt." +"User with role %(role)s created the list %(list)s with %(counter)s cases." msgstr[0] "" +"Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaak aangemaakt." msgstr[1] "" +"Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaken aangemaakt." -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.txt:7 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html:7 +#, python-format +msgid "Case %(zaak)s was not deleted." +msgstr "Zaak %(zaak)s is niet verwijderd." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_succeeded.html:7 +#, python-format +msgid "Case %(zaak)s was deleted." +msgstr "Zaak %(zaak)s is verwijderd." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_failed.html:7 +#, python-format +msgid "Case %(zaak)s was not updated." +msgstr "Zaak %(zaak)s is niet aangepast." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html:7 +#, python-format +#, python-format +msgid "Case %(zaak)s was updated." +msgstr "Zaak %(zaak)s is aangepast." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:8 #, python-format msgid "" -"%(user)s has created the review " -"%(review)s and requested changes for %(counter)s item." +"User with role %(role)s has reviewed the list " +"%(list)s and requested changes for %(counter)s item." msgid_plural "" -"%(user)s has created the review " -"%(review)s and requested changes for %(counter)s items." +"User with role %(role)s has reviewed the list " +"%(list)s and requested changes for %(counter)s items." msgstr[0] "" -"%(user)s heeft de review " -"%(review)s opgevoerd. Er zijn aanpassingen gevraagd voor " -"%(counter)s record." +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaak vereist." msgstr[1] "" -"%(user)s heeft de review " -"%(review)s opgevoerd. Er zijn aanpassingen gevraagd voor " -"%(counter)s records." +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaken vereist." -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.txt:7 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:16 #, python-format msgid "" -"%(user)s has updated the list " -"%(list)s with %(counter)s zaak removed." +"\n" +" User with role %(role)s has approved the list " +"%(list)s.\n" +" " +msgstr "" +"\n" +" Gebruiker met rol %(role)s heeft de lijst " +"%(list)s goedgekeurd.\n" +" " +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:8 +#, python-format +msgid "" +"User with role %(role)s has updated the list " +"%(list)s and removed %(counter)s case." msgid_plural "" -"%(user)s has updated the list " -"%(list)s with %(counter)s zaken removed." +"User with role %(role)s has updated the list " +"%(list)s and removed %(counter)s cases." msgstr[0] "" +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s aangepast en heeft %(counter)s zaak weggehaald." msgstr[1] "" +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s aangepast en heeft %(counter)s zaken weggehaald." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:16 +#, python-format +msgid "" +"User with role %(role)s has resubmitted the list " +"%(list)s for review." +msgstr "" +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s opnieuw ingediend." #: archiefvernietigingscomponent/destruction/templates/destruction/recordmanager_list.html:13 #: archiefvernietigingscomponent/destruction/templates/destruction/reviewer_list.html:14 @@ -842,79 +890,79 @@ msgstr "" "vernietiging" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:32 -#: archiefvernietigingscomponent/report/utils.py:169 +#: archiefvernietigingscomponent/report/utils.py:170 msgid "Unique ID" msgstr "Uniek kenmerk" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:34 -#: archiefvernietigingscomponent/report/utils.py:170 +#: archiefvernietigingscomponent/report/utils.py:171 msgid "Description" msgstr "Beschrijving" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:36 -#: archiefvernietigingscomponent/report/utils.py:171 +#: archiefvernietigingscomponent/report/utils.py:172 msgid "Duration" msgstr "Looptijd" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:37 -#: archiefvernietigingscomponent/report/utils.py:172 +#: archiefvernietigingscomponent/report/utils.py:173 msgid "Destruction category Selectielijst" msgstr "Vernietigings-Categorie Selectielijst" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:38 -#: archiefvernietigingscomponent/report/utils.py:173 +#: archiefvernietigingscomponent/report/utils.py:174 msgid "Explanation" msgstr "Toelichting" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:40 -#: archiefvernietigingscomponent/report/utils.py:174 +#: archiefvernietigingscomponent/report/utils.py:175 msgid "Remarks SAD" msgstr "Opmerkingen SAD" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:42 -#: archiefvernietigingscomponent/report/utils.py:175 +#: archiefvernietigingscomponent/report/utils.py:176 msgid "Reaction caretaker" msgstr "Reactie zorgdrager" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:43 -#: archiefvernietigingscomponent/report/utils.py:176 +#: archiefvernietigingscomponent/report/utils.py:177 msgid "Case type" msgstr "Zaaktype" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:44 -#: archiefvernietigingscomponent/report/utils.py:177 +#: archiefvernietigingscomponent/report/utils.py:178 msgid "Archive action period" msgstr "Archiefactietermijn" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:45 -#: archiefvernietigingscomponent/report/utils.py:178 +#: archiefvernietigingscomponent/report/utils.py:179 msgid "Result type" msgstr "Resultaattype" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:46 -#: archiefvernietigingscomponent/report/utils.py:179 +#: archiefvernietigingscomponent/report/utils.py:180 msgid "Organisation responsible" msgstr "Verantwoordelijke organisatie" #: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:47 -#: archiefvernietigingscomponent/report/utils.py:180 +#: archiefvernietigingscomponent/report/utils.py:181 msgid "Relations" msgstr "Relaties" -#: archiefvernietigingscomponent/report/utils.py:121 +#: archiefvernietigingscomponent/report/utils.py:122 #, python-format msgid "%(looptijd)s days" msgstr "%(looptijd)s dagen" -#: archiefvernietigingscomponent/report/utils.py:143 +#: archiefvernietigingscomponent/report/utils.py:144 msgid "Yes" msgstr "Ja" -#: archiefvernietigingscomponent/report/utils.py:145 +#: archiefvernietigingscomponent/report/utils.py:146 msgid "No" msgstr "Nee" -#: archiefvernietigingscomponent/report/utils.py:210 +#: archiefvernietigingscomponent/report/utils.py:211 #, python-format msgid "Declaration of destruction - %(name)s (%(date)s)" msgstr "Verklaring van vernietiging - %(name)s (%(date)s)" From f8c3eeab141f918b6cda88ceb80c54e8e91f1e6c Mon Sep 17 00:00:00 2001 From: silvia Date: Mon, 12 Apr 2021 11:38:03 +0200 Subject: [PATCH 06/15] :loud_sound: [#58] Added comments to audittrail --- .../destruction/logs/review_created.html | 10 +++++++- .../templates/destruction/logs/updated.html | 8 ++++++ .../destruction/views.py | 25 +++++++++++-------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html index 480efd0e..a97c4b87 100644 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html @@ -13,8 +13,16 @@ and requested changes for {{ counter }} items. {% endblocktrans %} {% else %} - {% blocktrans with list=log.content_object.destruction_list role=log.user.role %} + {% blocktrans with list=log.content_object.destruction_list role=log.user.role trimmed %} User with role {{ role }} has approved the list {{ list }}. {% endblocktrans %} {% endif %} + + {% if log.extra_data.text %} +
+ {% blocktrans with text=log.extra_data.text trimmed %} + Reviewer's comment: {{ text }} + {% endblocktrans %} +
+ {% endif %} diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html index 3f920673..676f606e 100644 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html @@ -18,4 +18,12 @@ for review. {% endblocktrans %} {% endif %} + + {% if log.extra_data.text %} +
+ {% blocktrans with text=log.extra_data.text trimmed %} + Author's comment: {{ text }} + {% endblocktrans %} +
+ {% endif %} diff --git a/src/archiefvernietigingscomponent/destruction/views.py b/src/archiefvernietigingscomponent/destruction/views.py index 6b23aeed..905342a9 100644 --- a/src/archiefvernietigingscomponent/destruction/views.py +++ b/src/archiefvernietigingscomponent/destruction/views.py @@ -252,17 +252,8 @@ def forms_valid(self, form, inlines): self.abort_destruction_list(destruction_list) return response - # log - TimelineLog.log_from_request( - self.request, - destruction_list, - template="destruction/logs/updated.html", - n_items=destruction_list.items.filter( - status=ListItemStatus.removed - ).count(), - ) - # Check if there are comments from the author + comment_text = None if self.request.POST.get("text"): comment = DestructionListReviewComment( review=destruction_list.last_review() @@ -273,6 +264,19 @@ def forms_valid(self, form, inlines): else: super().forms_invalid(form, inlines) + comment_text = comment_form.cleaned_data["text"] + + # log + TimelineLog.log_from_request( + self.request, + destruction_list, + template="destruction/logs/updated.html", + n_items=destruction_list.items.filter( + status=ListItemStatus.removed + ).count(), + text=comment_text if comment_text else "", + ) + # assign a reviewer destruction_list.assign(destruction_list.next_assignee()) destruction_list.save() @@ -417,6 +421,7 @@ def forms_valid(self, form, inlines): list_review, template="destruction/logs/review_created.html", n_items=list_review.item_reviews.count(), + text=list_review.text, ) # send notification message = _("{author} has reviewed the destruction list.").format( From aa079cd9352a020733e58cd2165e7b408eba4ebc Mon Sep 17 00:00:00 2001 From: silvia Date: Mon, 12 Apr 2021 11:38:48 +0200 Subject: [PATCH 07/15] :white_check_mark: [#58] Updated tests --- .../report/tests/test_utils.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/archiefvernietigingscomponent/report/tests/test_utils.py b/src/archiefvernietigingscomponent/report/tests/test_utils.py index 012f1e4c..6647ba0c 100644 --- a/src/archiefvernietigingscomponent/report/tests/test_utils.py +++ b/src/archiefvernietigingscomponent/report/tests/test_utils.py @@ -13,6 +13,9 @@ ListStatus, ReviewStatus, ) +from archiefvernietigingscomponent.destruction.models import ( + DestructionListReviewComment, +) from archiefvernietigingscomponent.destruction.tests.factories import ( DestructionListFactory, DestructionListItemFactory, @@ -802,3 +805,57 @@ def test_logs_are_in_correct_order(self): sorted_times = sorted(times) self.assertEqual(times, sorted_times) + + def test_logs_contain_comments(self): + record_manager = UserFactory.create(role__type=RoleTypeChoices.record_manager) + archivaris = UserFactory.create(role__type=RoleTypeChoices.archivist) + + destruction_list = DestructionListFactory.create(author=record_manager) + review_1 = DestructionListReviewFactory.create( + destruction_list=destruction_list, + author=archivaris, + text="This is a comment for the author.", + ) + author_comment = DestructionListReviewComment.objects.create( + text="This is a comment for the reviewer.", review=review_1 + ) + + review_2 = DestructionListReviewFactory.create( + destruction_list=destruction_list, author=archivaris, text="" + ) + + TimelineLog.objects.create( + content_object=destruction_list, + template="destruction/logs/created.html", + extra_data={"n_items": 3}, + user=record_manager, + ) + TimelineLog.objects.create( + content_object=review_1, + template="destruction/logs/review_created.html", + user=archivaris, + extra_data={"n_items": 1, "text": review_1.text}, + ) + TimelineLog.objects.create( + content_object=destruction_list, + template="destruction/logs/updated.html", + user=record_manager, + extra_data={"n_items": 1, "text": author_comment.text}, + ) + TimelineLog.objects.create( + content_object=review_2, + template="destruction/logs/review_created.html", + user=archivaris, + extra_data={"n_items": 1, "text": review_2.text}, + ) + + report = create_audittrail_report(destruction_list) + html_report = document_fromstring(report) + + self.assertEqual(4, len(html_report.find_class("log-item"))) + + # The second review should not have this tag, because the review text was empty + self.assertEqual(1, len(html_report.find_class("log-item__review-text"))) + self.assertIn("This is a comment for the author.", report) + self.assertEqual(1, len(html_report.find_class("log-item__author-comment"))) + self.assertIn("This is a comment for the reviewer.", report) From 0e337bb9df19d7ebe007c6c4b8a1cc8904d52923 Mon Sep 17 00:00:00 2001 From: silvia Date: Mon, 12 Apr 2021 11:47:21 +0200 Subject: [PATCH 08/15] :dizzy: [#58] Updated translations --- .../conf/locale/nl/LC_MESSAGES/django.mo | Bin 20369 -> 20551 bytes .../conf/locale/nl/LC_MESSAGES/django.po | 53 ++++++++++-------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo index f9b45a1658772978206a3928fa346ab75ad9194c..ca6aaae000ec565b9a6b9fc4e586d971331f9bcc 100644 GIT binary patch delta 5166 zcmaLZdwh@A0mt!^h>VmKCBH(+<#uVW89gE4p?L$O_y zF&!`tIkic{x;P!VgkzqgQiqNlY=F7g6jx$H+=`8GC)UG#s1qMV4d}S-{|u99e}NiM zb50VE!>oCz{?f7H^9#&I|kHGopo4Sawa;7Qa{RHG9_E8H zWf+WyQ8RcNnSFBsHK04FwSIts_#f2o1DUp=7}bXPPp2}44vnk~^@X#jA6BC-a1EPa z4YFG1p>2mT4XL!-VMp|$W@;n$!Ck0*d>%Ce*HKIOSJcehZ_E5^q^6xa_2H;BPegrT zply#pEyXyD#TQU_T!xy#k8JxiPN01O+hZp_I%5iIK#Ooc?nYf_wBvCrX{aepN1bps zK7n3L!OA*Q=c&sysXqei>G^L>C5Vm=$RlgIpni~Kos61+g{YZ&*}4l^W>bcZ@tn09>(jo8 zI?vxx7p@cQelHAp5KJ2kdx+9Fn(>1 zKe7hKx&8IA3CE*Q=kI{Jp{}UwB%zjIR2=iKFHWRGYc|^+$h7UH$bK_Lr~&Lm4QMaw z#P6U6QjVIDhmlyu~<$b}3t5k6%DfcPX2pUPwJr?~fEr#3JOMdDr1nGjJ94Jl3Et7|OSG zCrzzwP$TY$jj=0gO%qXfG!ivKlTg2V79(&T>U%|~Gl9 zPo@|(1Mi`p=VKU&HCEk*?lcND)iJ1n^+f${F!sk()Fxevypv1`4#ZQ)y*lPG6|G@H zA7kFe!T3Dh#B`kYr2BWh9M{tR2BR^rum1&Nc3=wa0A6=`tWr@=O9pnrwWtB@#SkpR za6FDr>-n#uqLH^{xcXuYHpO13fsI5>{S?#%p21u!M4j+1YG%GeO>yu5x7`fY?uI%~ zBI?4)sPj+4P_A#XsA$cXqn=L(Bk)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nkO(#?f4{W{2b~rnS**S6yY>1 zM@`@#ZXA|s4_JgOY_koycykd|fzUL&+T(Bm{q^SJ;4G<2FyaUENg~+$UZv z|3m$GjNxd#_(3vf>57w`Mc9RL8LARB*b47r1b&Y^iKg2)Tftn^s-K1-I16=Q3sJ}Q zte~S(S39?&uCxv#@ho=6Z{7B`S@v&5BI0E=|+5Qe{jqFD~9Vf7d zp8tzwd5t_pv`E#~k)yi*bsD*L0#}g+Qco_E8RU7ghg=|W+KQe|KAZLl%<77Pf zSOeM+QcUz-7)-{JUz00D?Gz~|`tMIupe?kG$rMsZlF5TM&UMy2xN#cK zCNGl>WIg#Qd4;HTB~|1Z5=+#EkpS|92DCHeLvPQ%XVvXXv^2J9Kyj%%>uWN%xA{K`!UwMa diff --git a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po index 4b3b3c08..c1e2524b 100644 --- a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po +++ b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.po @@ -553,11 +553,11 @@ msgid_plural "" "User with role %(role)s has aborted the list " "%(list)s with %(counter)s cases." msgstr[0] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s met %(counter)s zaak geannuleerd." +"Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaak geannuleerd." msgstr[1] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s met %(counter)s zaken geannuleerd." +"Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaken geannuleerd." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html:7 #, python-format @@ -591,7 +591,6 @@ msgstr "Zaak %(zaak)s is niet aangepast." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_update_succeeded.html:7 #, python-format -#, python-format msgid "Case %(zaak)s was updated." msgstr "Zaak %(zaak)s is aangepast." @@ -604,24 +603,25 @@ msgid_plural "" "User with role %(role)s has reviewed the list " "%(list)s and requested changes for %(counter)s items." msgstr[0] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaak vereist." +"Gebruiker met rol %(role)s heeft de lijst %(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaak vereist." msgstr[1] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaken vereist." +"Gebruiker met rol %(role)s heeft de lijst %(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaken vereist." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:16 -#, python-format msgid "" -"\n" -" User with role %(role)s has approved the list " -"%(list)s.\n" -" " +"User with role %(role)s has approved the list " +"%(list)s." msgstr "" -"\n" -" Gebruiker met rol %(role)s heeft de lijst " -"%(list)s goedgekeurd.\n" -" " +"Gebruiker met rol %(role)s heeft de lijst " +"%(list)s goedgekeurd." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:23 +#, python-format +msgid "Reviewer's comment: %(text)s" +msgstr "Opmerking van de reviewer: %(text)s" + #: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:8 #, python-format msgid "" @@ -631,11 +631,11 @@ msgid_plural "" "User with role %(role)s has updated the list " "%(list)s and removed %(counter)s cases." msgstr[0] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s aangepast en heeft %(counter)s zaak weggehaald." +"Gebruiker met rol %(role)s heeft de lijst %(list)s aangepast en heeft %(counter)s zaak weggehaald." msgstr[1] "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s aangepast en heeft %(counter)s zaken weggehaald." +"Gebruiker met rol %(role)s heeft de lijst %(list)s aangepast en heeft %(counter)s zaken weggehaald." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:16 #, python-format @@ -643,8 +643,13 @@ msgid "" "User with role %(role)s has resubmitted the list " "%(list)s for review." msgstr "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s opnieuw ingediend." +"Gebruiker met rol %(role)s heeft de lijst %(list)s opnieuw ingediend." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:24 +#, python-format +msgid "Author's comment: %(text)s" +msgstr "Opmerking van de auteur: %(text)s" #: archiefvernietigingscomponent/destruction/templates/destruction/recordmanager_list.html:13 #: archiefvernietigingscomponent/destruction/templates/destruction/reviewer_list.html:14 From 60db9660613f3dbeca5c8b6dd856d759dbaf3886 Mon Sep 17 00:00:00 2001 From: silvia Date: Tue, 13 Apr 2021 11:13:25 +0200 Subject: [PATCH 09/15] :recycle: [#58] Replaced management command with data migration --- .../destruction/management/__init__.py | 0 .../management/commands/__init__.py | 0 .../commands/convert_log_templates.py | 18 ------------- .../migrations/0016_auto_20210413_1049.py | 25 +++++++++++++++++++ 4 files changed, 25 insertions(+), 18 deletions(-) delete mode 100644 src/archiefvernietigingscomponent/destruction/management/__init__.py delete mode 100644 src/archiefvernietigingscomponent/destruction/management/commands/__init__.py delete mode 100644 src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py create mode 100644 src/archiefvernietigingscomponent/destruction/migrations/0016_auto_20210413_1049.py diff --git a/src/archiefvernietigingscomponent/destruction/management/__init__.py b/src/archiefvernietigingscomponent/destruction/management/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/archiefvernietigingscomponent/destruction/management/commands/__init__.py b/src/archiefvernietigingscomponent/destruction/management/commands/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py b/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py deleted file mode 100644 index d38490e8..00000000 --- a/src/archiefvernietigingscomponent/destruction/management/commands/convert_log_templates.py +++ /dev/null @@ -1,18 +0,0 @@ -from django.core.management.base import BaseCommand -from django.db import transaction - -from timeline_logger.models import TimelineLog - - -class Command(BaseCommand): - help = "Change the extension of the log templates from .txt to .html" - - def handle(self, *args, **options): - logs = TimelineLog.objects.all() - - with transaction.atomic(): - for log in logs: - template_name = log.template - if ".txt" in template_name: - log.template = template_name.replace(".txt", ".html") - log.save() diff --git a/src/archiefvernietigingscomponent/destruction/migrations/0016_auto_20210413_1049.py b/src/archiefvernietigingscomponent/destruction/migrations/0016_auto_20210413_1049.py new file mode 100644 index 00000000..731d94cb --- /dev/null +++ b/src/archiefvernietigingscomponent/destruction/migrations/0016_auto_20210413_1049.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.18 on 2021-04-13 08:49 + +from django.db import migrations +from django.db.models import Value +from django.db.models.functions import Replace + + +def convert_log_templates(apps, schema_editor): + TimelineLog = apps.get_model("timeline_logger", "TimelineLog") + + TimelineLog.objects.filter(template__endswith=".txt").update( + template=Replace("template", Value(".txt"), Value(".html")) + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ("destruction", "0015_auto_20210326_1603"), + ("timeline_logger", "0004_alter_fields"), + ] + + operations = [ + migrations.RunPython(convert_log_templates), + ] From 38e4b098b17f2896eab880d533810f3110e6ddb6 Mon Sep 17 00:00:00 2001 From: silvia Date: Tue, 13 Apr 2021 13:33:00 +0200 Subject: [PATCH 10/15] :construction: [#58] Added identificaties to log when creating list --- src/archiefvernietigingscomponent/destruction/forms.py | 2 ++ .../templates/destruction/logs/created.html | 10 ++++++++-- src/archiefvernietigingscomponent/destruction/views.py | 1 + .../components/destruction-list-create/create-modal.js | 9 ++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/archiefvernietigingscomponent/destruction/forms.py b/src/archiefvernietigingscomponent/destruction/forms.py index f7fb5506..eb64ee7e 100644 --- a/src/archiefvernietigingscomponent/destruction/forms.py +++ b/src/archiefvernietigingscomponent/destruction/forms.py @@ -54,6 +54,7 @@ class DestructionListForm(forms.ModelForm): reviewer_2 = forms.ModelChoiceField( queryset=User.objects.reviewers().all(), required=False ) + zaken_identificaties = SimpleArrayField(forms.CharField(max_length=250)) class Meta: model = DestructionList @@ -62,6 +63,7 @@ class Meta: "zaken", "reviewer_1", "reviewer_2", + "zaken_identificaties", "contains_sensitive_info", ) diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html index 6002f30b..346573f5 100644 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html @@ -6,9 +6,15 @@
{% blocktrans with list=log.content_object role=log.user.role count counter=log.extra_data.n_items trimmed %} User with role {{ role }} created the list {{ list }} - with {{ counter }} case. + with {{ counter }} case: {% plural %} User with role {{ role }} created the list {{ list }} - with {{ counter }} cases. + with {{ counter }} cases: {% endblocktrans %} + +
+ {% for item in log.extra_data.items %} + {{ item }}{% if forloop.last %}. {% else %}, {% endif %} + {% endfor %} +
diff --git a/src/archiefvernietigingscomponent/destruction/views.py b/src/archiefvernietigingscomponent/destruction/views.py index 905342a9..c362fe00 100644 --- a/src/archiefvernietigingscomponent/destruction/views.py +++ b/src/archiefvernietigingscomponent/destruction/views.py @@ -157,6 +157,7 @@ def form_valid(self, form): reviewers=list( destruction_list.assignees.values("assignee__id", "assignee__username") ), + items=form.cleaned_data["zaken_identificaties"], ) return response diff --git a/src/archiefvernietigingscomponent/js/components/destruction-list-create/create-modal.js b/src/archiefvernietigingscomponent/js/components/destruction-list-create/create-modal.js index 38261f8c..c63a28c2 100644 --- a/src/archiefvernietigingscomponent/js/components/destruction-list-create/create-modal.js +++ b/src/archiefvernietigingscomponent/js/components/destruction-list-create/create-modal.js @@ -2,7 +2,7 @@ import React, {useContext, useState} from "react"; import Modal from 'react-modal'; import { CsrfInput } from "../../forms/csrf"; -import {CheckboxInput, Input, TextInput} from "../../forms/inputs"; +import {CheckboxInput, HiddenInput, Input, TextInput} from "../../forms/inputs"; import { SelectInput } from "../../forms/select"; import {Label} from "../../forms/label"; import {ShortReviewZaaktypesContext} from "./context"; @@ -59,6 +59,13 @@ const CreateModal = ({ zaken, checkboxes, modalIsOpen, setIsOpen, reviewers, url name={"zaken"} initial={selectedUrls} /> + {/* Used to log the ID of the cases that are selected, so that the backend doesnt need to + fetch the zaken again. */} + checkboxes[zaak.url]).map(zaak => zaak.identificatie)} + />
Date: Tue, 13 Apr 2021 14:27:59 +0200 Subject: [PATCH 11/15] :construction: [#58] Added identificaties to log of list updated --- .../destruction/forms.py | 3 ++- .../templates/destruction/logs/updated.html | 10 ++++++++-- .../destruction/views.py | 12 +++++++++--- .../destruction-list-detail/list-item-form.js | 5 +++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/archiefvernietigingscomponent/destruction/forms.py b/src/archiefvernietigingscomponent/destruction/forms.py index eb64ee7e..2687b52e 100644 --- a/src/archiefvernietigingscomponent/destruction/forms.py +++ b/src/archiefvernietigingscomponent/destruction/forms.py @@ -132,9 +132,10 @@ class ListItemForm(forms.ModelForm): archiefnominatie = forms.CharField(required=False) # used charfield for easy conversion into json archiefactiedatum = forms.CharField(required=False) + identificatie = forms.CharField() class Meta: - fields = ("action", "archiefnominatie", "archiefactiedatum") + fields = ("action", "archiefnominatie", "archiefactiedatum", "identificatie") def save(self, commit=True): list_item = super().save(commit) diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html index 676f606e..392a62eb 100644 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html @@ -7,11 +7,17 @@ {% if log.extra_data.n_items %} {% blocktrans with list=log.content_object role=log.user.role count counter=log.extra_data.n_items trimmed %} User with role {{ role }} has updated the list {{ list }} - and removed {{ counter }} case. + and removed {{ counter }} case: {% plural %} User with role {{ role }} has updated the list {{ list }} - and removed {{ counter }} cases. + and removed {{ counter }} cases: {% endblocktrans %} + +
+ {% for item in log.extra_data.items %} + {{ item }}{% if forloop.last %}. {% else %}, {% endif %} + {% endfor %} +
{% else %} {% blocktrans with list=log.content_object role=log.user.role trimmed %} User with role {{ role }} has resubmitted the list {{ list }} diff --git a/src/archiefvernietigingscomponent/destruction/views.py b/src/archiefvernietigingscomponent/destruction/views.py index c362fe00..199d0509 100644 --- a/src/archiefvernietigingscomponent/destruction/views.py +++ b/src/archiefvernietigingscomponent/destruction/views.py @@ -267,15 +267,21 @@ def forms_valid(self, form, inlines): comment_text = comment_form.cleaned_data["text"] + # Get the identificaties of the removed zaken + removed_zaken = [] + for list_item_form in inlines[0]: + action = list_item_form.cleaned_data.get("action") + if action: + removed_zaken.append(list_item_form.cleaned_data["identificatie"]) + # log TimelineLog.log_from_request( self.request, destruction_list, template="destruction/logs/updated.html", - n_items=destruction_list.items.filter( - status=ListItemStatus.removed - ).count(), + n_items=len(removed_zaken), text=comment_text if comment_text else "", + items=removed_zaken, ) # assign a reviewer diff --git a/src/archiefvernietigingscomponent/js/components/destruction-list-detail/list-item-form.js b/src/archiefvernietigingscomponent/js/components/destruction-list-detail/list-item-form.js index e615478f..ec8cec5f 100644 --- a/src/archiefvernietigingscomponent/js/components/destruction-list-detail/list-item-form.js +++ b/src/archiefvernietigingscomponent/js/components/destruction-list-detail/list-item-form.js @@ -88,6 +88,11 @@ const ListItemForm = ({ index, data }) => { name={name_prefix("archiefactiedatum")} value={archiefactiedatum} /> + Date: Tue, 13 Apr 2021 17:01:19 +0200 Subject: [PATCH 12/15] :construction: [#58] Added identificaties to log of review --- .../destruction/forms.py | 15 +++++++++------ .../destruction/logs/review_created.html | 16 +++++++++++++--- .../destruction/views.py | 17 +++++++++++++---- .../components/review-list/review-item-form.js | 5 +++++ 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/archiefvernietigingscomponent/destruction/forms.py b/src/archiefvernietigingscomponent/destruction/forms.py index 2687b52e..acd1bf71 100644 --- a/src/archiefvernietigingscomponent/destruction/forms.py +++ b/src/archiefvernietigingscomponent/destruction/forms.py @@ -3,7 +3,6 @@ from django import forms from django.contrib.postgres.forms import SimpleArrayField -from django.forms.models import BaseInlineFormSet from archiefvernietigingscomponent.accounts.models import User @@ -117,14 +116,18 @@ class Meta: fields = ("text",) -class ReviewItemBaseFormset(BaseInlineFormSet): +class ReviewItemBaseForm(forms.ModelForm): + identificatie = forms.CharField() + + class Meta: + fields = ["destruction_list_item", "text", "suggestion", "identificatie"] + def save(self, commit=True): # save only items with suggestions - instances = super().save(commit=False) + instance = super().save(commit=False) - for instance in instances: - if instance.suggestion: - instance.save() + if instance.suggestion: + instance.save() class ListItemForm(forms.ModelForm): diff --git a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html index a97c4b87..871760a4 100644 --- a/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html +++ b/src/archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html @@ -4,14 +4,24 @@
- {% if log.extra_data.n_items %} + {% if log.content_object.status == "rejected" %} + {% blocktrans with list=log.content_object.destruction_list role=log.user.role trimmed %} + User with role {{ role }} has rejected the list {{ list }}. + {% endblocktrans %} + {% elif log.extra_data.n_items and log.content_object.status == "changes_requested" %} {% blocktrans with list=log.content_object.destruction_list role=log.user.role count counter=log.extra_data.n_items trimmed %} User with role {{ role }} has reviewed the list {{ list }} - and requested changes for {{ counter }} item. + and requested changes for {{ counter }} item: {% plural %} User with role {{ role }} has reviewed the list {{ list }} - and requested changes for {{ counter }} items. + and requested changes for {{ counter }} items: {% endblocktrans %} + +
+ {% for item in log.extra_data.items %} + {{ item }}{% if forloop.last %}. {% else %}, {% endif %} + {% endfor %} +
{% else %} {% blocktrans with list=log.content_object.destruction_list role=log.user.role trimmed %} User with role {{ role }} has approved the list {{ list }}. diff --git a/src/archiefvernietigingscomponent/destruction/views.py b/src/archiefvernietigingscomponent/destruction/views.py index 199d0509..788668cc 100644 --- a/src/archiefvernietigingscomponent/destruction/views.py +++ b/src/archiefvernietigingscomponent/destruction/views.py @@ -34,7 +34,7 @@ ListItemForm, ReviewCommentForm, ReviewForm, - ReviewItemBaseFormset, + ReviewItemBaseForm, get_reviewer_choices, get_zaaktype_choices, ) @@ -337,8 +337,7 @@ def get_queryset(self): class ReviewItemInline(InlineFormSetFactory): model = DestructionListItemReview - fields = ["destruction_list_item", "text", "suggestion"] - formset_class = ReviewItemBaseFormset + form_class = ReviewItemBaseForm class ReviewCreateView(RoleRequiredMixin, UserPassesTestMixin, CreateWithInlinesView): @@ -421,14 +420,24 @@ def form_valid(self, form): def forms_valid(self, form, inlines): response = super().forms_valid(form, inlines) + # Get the identificaties of the zaken with suggestions + zaken_with_suggestions = [] + for list_item_form in inlines[0]: + suggestion = list_item_form.cleaned_data.get("suggestion") + if suggestion: + zaken_with_suggestions.append( + list_item_form.cleaned_data["identificatie"] + ) + # log review list_review = form.instance TimelineLog.log_from_request( self.request, list_review, template="destruction/logs/review_created.html", - n_items=list_review.item_reviews.count(), + n_items=len(zaken_with_suggestions), text=list_review.text, + items=zaken_with_suggestions, ) # send notification message = _("{author} has reviewed the destruction list.").format( diff --git a/src/archiefvernietigingscomponent/js/components/review-list/review-item-form.js b/src/archiefvernietigingscomponent/js/components/review-list/review-item-form.js index ec22d77c..3f7ce2ff 100644 --- a/src/archiefvernietigingscomponent/js/components/review-list/review-item-form.js +++ b/src/archiefvernietigingscomponent/js/components/review-list/review-item-form.js @@ -64,6 +64,11 @@ const ReviewItemForm = ({ index, data }) => { name={name_prefix("text")} value={comment} /> + From 51ebc4987ea142c3b3f33e482c735d4ceb7fe769 Mon Sep 17 00:00:00 2001 From: silvia Date: Tue, 13 Apr 2021 17:01:44 +0200 Subject: [PATCH 13/15] :lipstick: [#58] Modified Report title --- .../report/templates/report/vernietigings_rapport.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html b/src/archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html index be29b3ed..84ff7701 100644 --- a/src/archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html +++ b/src/archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html @@ -26,8 +26,8 @@ +

{% trans "Destruction report" %}

- {% if not contains_sensitive_info %} From f5f749b04acf6f71ff6aa1d581c21dbb0c1c73c7 Mon Sep 17 00:00:00 2001 From: silvia Date: Tue, 13 Apr 2021 17:02:29 +0200 Subject: [PATCH 14/15] :white_check_mark: [#58] Updated tests --- .../tests/test_destruction_list_create.py | 13 ++++ .../tests/test_destruction_list_detail.py | 46 ++++++++++++++- .../destruction/tests/test_review_create.py | 59 ++++++++++++++++--- 3 files changed, 106 insertions(+), 12 deletions(-) diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py index 420e3bcc..cb0e5151 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_create.py @@ -2,6 +2,8 @@ from django.urls import reverse from django.utils.translation import gettext as _ +from timeline_logger.models import TimelineLog + from archiefvernietigingscomponent.accounts.tests.factories import UserFactory from archiefvernietigingscomponent.notifications.models import Notification @@ -21,6 +23,7 @@ def setUp(self): def test_create_list(self): reviewers = UserFactory.create_batch(2, role__can_review_destruction=True) zaken = [f"http://some.zaken.nl/api/v1/zaken/{i}" for i in range(1, 3)] + zaken_identificaties = ["ZAAK-1", "ZAAK-2", "ZAAK-3"] url = reverse("destruction:record-manager-create") data = { @@ -28,6 +31,7 @@ def test_create_list(self): "zaken": ",".join(zaken), "reviewer_1": reviewers[0].id, "reviewer_2": reviewers[1].id, + "zaken_identificaties": ",".join(zaken_identificaties), } response = self.client.post(url, data) @@ -66,6 +70,15 @@ def test_create_list(self): self.assertEqual(notification.user, destruction_list.assignee) self.assertEqual(notification.message, _("You are assigned for review.")) + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertIn("items", log.extra_data) + self.assertEqual(zaken_identificaties, sorted(log.extra_data["items"])) + def test_list_with_short_review_process(self): archive_config = ArchiveConfig.get_solo() archive_config.short_review_zaaktypes = ["http://example.com/zaak/uuid-1"] diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py index 5f12f808..089ff41e 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_destruction_list_detail.py @@ -57,14 +57,17 @@ def test_update_destruction_list(self, m): "items-0-action": Suggestion.change_and_remove, "items-0-archiefnominatie": "blijvend_bewaren", "items-0-archiefactiedatum": "2020-06-17", + "items-0-identificatie": "ZAAK-01", "items-1-id": list_items[1].id, "items-1-action": Suggestion.remove, "items-1-archiefnominatie": "vernietigen", "items-1-archiefactiedatum": "2020-06-16", + "items-1-identificatie": "ZAAK-02", "items-2-id": list_items[2].id, "items-2-action": "", "items-2-archiefnominatie": "vernietigen", "items-2-archiefactiedatum": "2020-06-15", + "items-2-identificatie": "ZAAK-03", } data.update(MANAGEMENT_FORM_DATA) @@ -88,9 +91,20 @@ def test_update_destruction_list(self, m): self.assertEqual(destruction_list.assignee, assignee.assignee) # check log - timeline_log = TimelineLog.objects.get() - self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/updated.html") + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertEqual(log.user, self.user) + self.assertEqual(log.template, "destruction/logs/updated.html") + self.assertIn("n_items", log.extra_data) + self.assertIn("items", log.extra_data) + self.assertIn("text", log.extra_data) + self.assertEqual(2, log.extra_data["n_items"]) + self.assertEqual(["ZAAK-01", "ZAAK-02"], sorted(log.extra_data["items"])) + self.assertEqual("", log.extra_data["text"]) # check notification notification = Notification.objects.get() @@ -129,6 +143,7 @@ def test_abort_destruction_list(self, m): f"items-{i}-action": "", f"items-{i}-archiefnominatie": "blijvend_bewaren", f"items-{i}-archiefactiedatum": "2020-06-17", + f"items-{i}-identificatie": f"ZAAK-{i}", } ) @@ -183,6 +198,7 @@ def test_abort_destruction_list_notify_assignee(self, m): f"items-{i}-action": "", f"items-{i}-archiefnominatie": "blijvend_bewaren", f"items-{i}-archiefactiedatum": "2020-06-17", + f"items-{i}-identificatie": f"ZAAK-{i}", } ) @@ -242,6 +258,7 @@ def test_cant_abort_completed_destruction_list(self, m): f"items-{i}-action": "", f"items-{i}-archiefnominatie": "blijvend_bewaren", f"items-{i}-archiefactiedatum": "2020-06-17", + f"items-{i}-identificatie": f"ZAAK-{i}", } ) @@ -288,6 +305,7 @@ def test_list_author_can_comment_on_review(self, m): "items-0-action": "", "items-0-archiefnominatie": "blijvend_bewaren", "items-0-archiefactiedatum": "2020-06-17", + "items-0-identificatie": "ZAAK-01", } self.client.force_login(record_manager) @@ -308,6 +326,17 @@ def test_list_author_can_comment_on_review(self, m): self.assertEqual(record_manager, comment.review.destruction_list.author) self.assertEqual(destruction_list.last_review(), comment.review) + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertIn("items", log.extra_data) + self.assertIn("text", log.extra_data) + self.assertEqual([], log.extra_data["items"]) + self.assertEqual("I disagree with these comments!", log.extra_data["text"]) + def test_list_author_can_leave_comment_empty(self, m): record_manager = UserFactory( role__can_start_destruction=True, role__type=RoleTypeChoices.archivist @@ -340,6 +369,7 @@ def test_list_author_can_leave_comment_empty(self, m): "items-0-action": "", "items-0-archiefnominatie": "blijvend_bewaren", "items-0-archiefactiedatum": "2020-06-17", + "items-0-identificatie": "ZAAK-01", } self.client.force_login(record_manager) @@ -354,6 +384,15 @@ def test_list_author_can_leave_comment_empty(self, m): self.assertEqual(0, comments.count()) + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertIn("text", log.extra_data) + self.assertEqual("", log.extra_data["text"]) + def test_empty_comment_is_not_saved(self, m): record_manager = UserFactory( role__can_start_destruction=True, role__type=RoleTypeChoices.archivist @@ -386,6 +425,7 @@ def test_empty_comment_is_not_saved(self, m): "items-0-action": "", "items-0-archiefnominatie": "blijvend_bewaren", "items-0-archiefactiedatum": "2020-06-17", + "items-0-identificatie": "ZAAK-01", "text": "", } diff --git a/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py b/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py index 3115b741..0a47e6a4 100644 --- a/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py +++ b/src/archiefvernietigingscomponent/destruction/tests/test_review_create.py @@ -5,6 +5,7 @@ from django.utils.translation import gettext as _ from django_capture_on_commit_callbacks import capture_on_commit_callbacks +from timeline_logger.models import TimelineLog from archiefvernietigingscomponent.accounts.tests.factories import UserFactory from archiefvernietigingscomponent.notifications.models import Notification @@ -78,6 +79,7 @@ def test_create_review_approve(self): f"item_reviews-{i}-destruction_list_item": item.id, f"item_reviews-{i}-suggestion": "", f"item_reviews-{i}-text": "", + f"item_reviews-{i}-identificatie": f"ZAAK-{i}", } ) @@ -98,9 +100,20 @@ def test_create_review_approve(self): self.assertEqual(review.destruction_list.assignee, next_assignee.assignee) # check logs - timeline_log = review.logs.get() - self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertEqual(log.user, self.user) + self.assertEqual(log.template, "destruction/logs/review_created.html") + self.assertIn("n_items", log.extra_data) + self.assertIn("items", log.extra_data) + self.assertIn("text", log.extra_data) + self.assertEqual(0, log.extra_data["n_items"]) + self.assertEqual([], log.extra_data["items"]) + self.assertEqual("some comment", log.extra_data["text"]) # check notifications notifications = Notification.objects.all() @@ -129,12 +142,15 @@ def test_create_review_change(self): "item_reviews-0-destruction_list_item": items[0].id, "item_reviews-0-suggestion": Suggestion.change_and_remove, "item_reviews-0-text": "some comment", + "item_reviews-0-identificatie": "ZAAK-00", "item_reviews-1-destruction_list_item": items[1].id, "item_reviews-1-suggestion": Suggestion.remove, "item_reviews-1-text": "", + "item_reviews-1-identificatie": "ZAAK-01", "item_reviews-2-destruction_list_item": items[2].id, "item_reviews-2-suggestion": "", "item_reviews-2-text": "", + "item_reviews-2-identificatie": "ZAAK-02", } data.update(MANAGEMENT_FORM_DATA) @@ -158,9 +174,20 @@ def test_create_review_change(self): self.assertEqual(review.destruction_list.assignee, destruction_list.author) # check logs - timeline_log = review.logs.get() - self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertEqual(log.user, self.user) + self.assertEqual(log.template, "destruction/logs/review_created.html") + self.assertIn("n_items", log.extra_data) + self.assertIn("items", log.extra_data) + self.assertIn("text", log.extra_data) + self.assertEqual(2, log.extra_data["n_items"]) + self.assertEqual(["ZAAK-00", "ZAAK-01"], sorted(log.extra_data["items"])) + self.assertEqual("", log.extra_data["text"]) # check notifications notifications = Notification.objects.order_by("created").all() @@ -189,12 +216,15 @@ def test_create_review_reject(self): "item_reviews-0-destruction_list_item": items[0].id, "item_reviews-0-suggestion": "", "item_reviews-0-text": "", + "item_reviews-0-identificatie": "ZAAK-00", "item_reviews-1-destruction_list_item": items[1].id, "item_reviews-1-suggestion": "", "item_reviews-1-text": "", + "item_reviews-1-identificatie": "ZAAK-01", "item_reviews-2-destruction_list_item": items[2].id, "item_reviews-2-suggestion": "", "item_reviews-2-text": "", + "item_reviews-2-identificatie": "ZAAK-02", } data.update(MANAGEMENT_FORM_DATA) @@ -213,9 +243,20 @@ def test_create_review_reject(self): self.assertEqual(review.destruction_list.assignee, destruction_list.author) # check logs - timeline_log = review.logs.get() - self.assertEqual(timeline_log.user, self.user) - self.assertEqual(timeline_log.template, "destruction/logs/review_created.html") + logs = TimelineLog.objects.all() + + self.assertEqual(1, logs.count()) + + log = logs.first() + + self.assertEqual(log.user, self.user) + self.assertEqual(log.template, "destruction/logs/review_created.html") + self.assertIn("n_items", log.extra_data) + self.assertIn("items", log.extra_data) + self.assertIn("text", log.extra_data) + self.assertEqual(0, log.extra_data["n_items"]) + self.assertEqual([], log.extra_data["items"]) + self.assertEqual("", log.extra_data["text"]) # check notifications notifications = Notification.objects.order_by("created").all() From b32eccbcf7ad7620a4b71c099b267c2515649abe Mon Sep 17 00:00:00 2001 From: silvia Date: Tue, 13 Apr 2021 17:05:58 +0200 Subject: [PATCH 15/15] :dizzy: [#58] Updated translations --- .../conf/locale/nl/LC_MESSAGES/django.mo | Bin 20551 -> 20753 bytes .../conf/locale/nl/LC_MESSAGES/django.po | 60 ++++++++++-------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo b/src/archiefvernietigingscomponent/conf/locale/nl/LC_MESSAGES/django.mo index ca6aaae000ec565b9a6b9fc4e586d971331f9bcc..796ca2a2f51c65c8198b2fa133c20780da0af6ca 100644 GIT binary patch delta 4744 zcmYk<33OG(9mnwrBt$~?g(W-7BMC{9AW#V+VNcQsNy;XOv_V2b5|y<%Mau(Qu|TMV zYeW`VVj=7Tsg|k)a06v;C?XaxfSlq1sXbOLtav4B<6TQD{rU0=y5O#TZOagX8 zO>8h~!Ud?MnS`UU8a08pP}dznP4F~oDQ=+GpTbuZJopV(V|<)@;}UB2H1(} zpc#Yl15^fEknEeQs0n?CTI=?tsSSpq?vKR5*dw0&KSH652F#N(@;j3Y41mrdDG=+=<%9S5O)F3bllHP?_;hB>$Rec%qy7uBbI1j=G@G z)+eBrVhUzp9qNgjQ5igG>n&JJ{VFD5U;gyOv8V|>jazXqYMe>lWVcX?N@)eE! z=V1x1!d`d-$6_=m)!__$2sdClUPLWHdp1&kOvDF%EUU< zCfkK%$s9)Aa2bc-iO7g zekP*&dCJ%B$~m)QeF4 zOu%4#0(ISdjAMMWn1WK@fV|?S3H5|0P&fV!^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rrWNDuc6Z|0?up zptV%=MRHK7+k@&qhPvS=)-$LlxnPf9!Z6x5P&fFuJ?@$4{$>PWIQ>JAJ?k%}{4F6~ zC-(BsLifYsKji+ev#ReC9}-&MON5GE!wb&#u%wvt)J~|2!s44>5XYQzVQGn9P*d^m z54=L?L-QMAvlADd6xT#eQ~o0{k5J+3WZrR#!=rpZqn1iE5GubVULjs29wAZ)l`X{Y zh*~vl`8~c&93*~CDD#gKvx$15nMfy265ENZ#0P}R9O6Cwqc4}r9wL)iMd;Pl%DhUb z+($f1WD`e-KM*Sj6>TMz(ZmK~F!2+jkr+y-^d$~Eg%R;F=cs9I^s2G({lD=aJIf;C z6RT-y-$xKCZ@c)n)Ou%cL~Ptqdd}EhZM+AGLuxx$BVv88QCX)JVB3AzdYur#BpLdae(+MF^2eyGuWHv zd=?qleHN{S#5Q6pF_&0GsB|TM?mX{JO8k`CesxjwMNr8gDv8}rgEzK#AGJDSClN@L z5pNJGeTXXJEkZ@Fuu4Z_6!9(*O%xC+pA(nsQ=*!^PIGEs=Wxnsryy-W{g%|>9w(#s zAy0<0Fg?SGOP}hmE#ah0=dJYofJGVgkM(&a-YL$X>SX124lXO3KfC met %(counter)s zaken geannuleerd." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/created.html:7 -#, python-format msgid "" "User with role %(role)s created the list %(list)s with %(counter)s case." +"strong> with %(counter)s case:" msgid_plural "" "User with role %(role)s created the list %(list)s with %(counter)s cases." +"strong> with %(counter)s cases:" msgstr[0] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaak aangemaakt." +"strong> met %(counter)s zaak aangemaakt:" msgstr[1] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s met %(counter)s zaken aangemaakt." +"strong> met %(counter)s zaken aangemaakt:" #: archiefvernietigingscomponent/destruction/templates/destruction/logs/item_destruction_failed.html:7 #, python-format @@ -595,49 +594,56 @@ msgid "Case %(zaak)s was updated." msgstr "Zaak %(zaak)s is aangepast." #: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:8 -#, python-format +msgid "" +"User with role %(role)s has rejected the list " +"%(list)s." +msgstr "" +"Gebruiker met rol %(role)s heeft de lijst %(list)s afgewezen." + +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:12 msgid "" "User with role %(role)s has reviewed the list " -"%(list)s and requested changes for %(counter)s item." +"%(list)s and requested changes for %(counter)s item:" msgid_plural "" "User with role %(role)s has reviewed the list " -"%(list)s and requested changes for %(counter)s items." +"%(list)s and requested changes for %(counter)s items:" msgstr[0] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaak vereist." +"strong> beoordeeld en heeft wijzigingen voor %(counter)s zaak vereist:" msgstr[1] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s beoordeeld en heeft wijzigingen voor %(counter)s zaken vereist." +"strong> beoordeeld en heeft wijzigingen voor %(counter)s zaken vereist:" -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:16 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:26 +#, python-format msgid "" "User with role %(role)s has approved the list " "%(list)s." msgstr "" -"Gebruiker met rol %(role)s heeft de lijst " -"%(list)s goedgekeurd." +"Gebruiker met rol %(role)s heeft de lijst %(list)s goedgekeurd." -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:23 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/review_created.html:33 #, python-format msgid "Reviewer's comment: %(text)s" msgstr "Opmerking van de reviewer: %(text)s" #: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:8 -#, python-format msgid "" "User with role %(role)s has updated the list " -"%(list)s and removed %(counter)s case." +"%(list)s and removed %(counter)s case:" msgid_plural "" "User with role %(role)s has updated the list " -"%(list)s and removed %(counter)s cases." +"%(list)s and removed %(counter)s cases:" msgstr[0] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s aangepast en heeft %(counter)s zaak weggehaald." +"strong> aangepast en heeft %(counter)s zaak weggehaald:" msgstr[1] "" "Gebruiker met rol %(role)s heeft de lijst %(list)s aangepast en heeft %(counter)s zaken weggehaald." +"strong> aangepast en heeft %(counter)s zaken weggehaald:" -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:16 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:22 #, python-format msgid "" "User with role %(role)s has resubmitted the list " @@ -646,7 +652,7 @@ msgstr "" "Gebruiker met rol %(role)s heeft de lijst %(list)s opnieuw ingediend." -#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:24 +#: archiefvernietigingscomponent/destruction/templates/destruction/logs/updated.html:30 #, python-format msgid "Author's comment: %(text)s" msgstr "Opmerking van de auteur: %(text)s" @@ -880,7 +886,7 @@ msgid "Destruction list for which the report was created." msgstr "Vernietingslijst waarvoor de verklaring van vernietiging is gemaakt." #: archiefvernietigingscomponent/report/models.py:52 -#: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:30 +#: archiefvernietigingscomponent/report/templates/report/vernietigings_rapport.html:29 msgid "Destruction report" msgstr "Verklaring van vernietiging"
{% trans "Destruction report" %}
{% trans "Unique ID" %}