From a1c9966d025946644b85eef0c47c0381b39cb46d Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Apr 2022 09:43:36 +0200 Subject: [PATCH 1/3] #140 Block edit on recorded * adds new modal form content template recorded_no_edit.html * adds modal content change, such that no data can be edited on any form as long as the entry is recorded -> instead, users are informed on the form, that the recording state prohibits editing * adds translations --- compensation/models/compensation.py | 12 +++ compensation/views/compensation.py | 17 ++++- compensation/views/eco_account.py | 10 ++- ema/views.py | 9 ++- intervention/views.py | 10 ++- konova/forms.py | 29 ++++++- konova/models/object.py | 9 +++ konova/utils/message_templates.py | 1 + locale/de/LC_MESSAGES/django.mo | Bin 41223 -> 41898 bytes locale/de/LC_MESSAGES/django.po | 109 ++++++++++++++++----------- templates/form/recorded_no_edit.html | 19 +++++ 11 files changed, 177 insertions(+), 48 deletions(-) create mode 100644 templates/form/recorded_no_edit.html diff --git a/compensation/models/compensation.py b/compensation/models/compensation.py index ea69cefc..3deff50a 100644 --- a/compensation/models/compensation.py +++ b/compensation/models/compensation.py @@ -418,6 +418,18 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin): super().set_status_messages(request) return request + @property + def is_recorded(self): + """ Getter for record status as property + + Since compensations inherit their record status from their intervention, the intervention's status is being + returned + + Returns: + + """ + return self.intervention.is_recorded + class CompensationDocument(AbstractDocument): """ diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index 4068e6bb..9c82c885 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -22,7 +22,7 @@ from konova.utils.message_templates import FORM_INVALID, IDENTIFIER_REPLACED, DA CHECKED_RECORDED_RESET, COMPENSATION_ADDED_TEMPLATE, COMPENSATION_REMOVED_TEMPLATE, DOCUMENT_ADDED, \ COMPENSATION_STATE_REMOVED, COMPENSATION_STATE_ADDED, COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_ADDED, \ DEADLINE_ADDED, DEADLINE_REMOVED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, \ - DEADLINE_EDITED + DEADLINE_EDITED, RECORDED_BLOCKS_EDIT from konova.utils.user_checks import in_group @@ -69,6 +69,14 @@ def new_view(request: HttpRequest, intervention_id: str = None): """ template = "compensation/form/view.html" + intervention = get_object_or_404(Intervention, id=intervention_id) + if intervention.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("intervention:detail", id=intervention_id) + data_form = NewCompensationForm(request.POST or None, intervention_id=intervention_id) geom_form = SimpleGeomForm(request.POST or None, read_only=False) if request.method == "POST": @@ -134,6 +142,13 @@ def edit_view(request: HttpRequest, id: str): template = "compensation/form/view.html" # Get object from db comp = get_object_or_404(Compensation, id=id) + if comp.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("compensation:detail", id=id) + # Create forms, initialize with values from db/from POST request data_form = EditCompensationForm(request.POST or None, instance=comp) geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=comp) diff --git a/compensation/views/eco_account.py b/compensation/views/eco_account.py index 68a5536a..ecaccbe6 100644 --- a/compensation/views/eco_account.py +++ b/compensation/views/eco_account.py @@ -35,7 +35,8 @@ from konova.utils.generators import generate_qr_code from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID, DATA_UNSHARED, DATA_UNSHARED_EXPLANATION, \ CANCEL_ACC_RECORDED_OR_DEDUCTED, DEDUCTION_REMOVED, DEDUCTION_ADDED, DOCUMENT_ADDED, COMPENSATION_STATE_REMOVED, \ COMPENSATION_STATE_ADDED, COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_ADDED, DEADLINE_ADDED, DEADLINE_REMOVED, \ - DEDUCTION_EDITED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, DEADLINE_EDITED + DEDUCTION_EDITED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, DEADLINE_EDITED, \ + RECORDED_BLOCKS_EDIT from konova.utils.user_checks import in_group @@ -145,6 +146,13 @@ def edit_view(request: HttpRequest, id: str): template = "compensation/form/view.html" # Get object from db acc = get_object_or_404(EcoAccount, id=id) + if acc.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("compensation:acc:detail", id=id) + # Create forms, initialize with values from db/from POST request data_form = EditEcoAccountForm(request.POST or None, instance=acc) geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=acc) diff --git a/ema/views.py b/ema/views.py index debd31da..ce0d68f5 100644 --- a/ema/views.py +++ b/ema/views.py @@ -26,7 +26,7 @@ from konova.utils.generators import generate_qr_code from konova.utils.message_templates import IDENTIFIER_REPLACED, FORM_INVALID, DATA_UNSHARED, DATA_UNSHARED_EXPLANATION, \ DOCUMENT_ADDED, COMPENSATION_STATE_REMOVED, COMPENSATION_STATE_ADDED, COMPENSATION_ACTION_REMOVED, \ COMPENSATION_ACTION_ADDED, DEADLINE_ADDED, DEADLINE_REMOVED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, \ - COMPENSATION_ACTION_EDITED, DEADLINE_EDITED + COMPENSATION_ACTION_EDITED, DEADLINE_EDITED, RECORDED_BLOCKS_EDIT from konova.utils.user_checks import in_group @@ -213,6 +213,13 @@ def edit_view(request: HttpRequest, id: str): template = "compensation/form/view.html" # Get object from db ema = get_object_or_404(Ema, id=id) + if ema.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("ema:detail", id=id) + # Create forms, initialize with values from db/from POST request data_form = EditEmaForm(request.POST or None, instance=ema) geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=ema) diff --git a/intervention/views.py b/intervention/views.py index b2b78eee..f882f214 100644 --- a/intervention/views.py +++ b/intervention/views.py @@ -18,7 +18,8 @@ from konova.utils.documents import remove_document, get_document from konova.utils.generators import generate_qr_code from konova.utils.message_templates import INTERVENTION_INVALID, FORM_INVALID, IDENTIFIER_REPLACED, \ CHECKED_RECORDED_RESET, DEDUCTION_REMOVED, DEDUCTION_ADDED, REVOCATION_ADDED, REVOCATION_REMOVED, \ - COMPENSATION_REMOVED_TEMPLATE, DOCUMENT_ADDED, DEDUCTION_EDITED, REVOCATION_EDITED, DOCUMENT_EDITED + COMPENSATION_REMOVED_TEMPLATE, DOCUMENT_ADDED, DEDUCTION_EDITED, REVOCATION_EDITED, DOCUMENT_EDITED, \ + RECORDED_BLOCKS_EDIT from konova.utils.user_checks import in_group @@ -302,6 +303,13 @@ def edit_view(request: HttpRequest, id: str): template = "intervention/form/view.html" # Get object from db intervention = get_object_or_404(Intervention, id=id) + if intervention.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("intervention:detail", id=id) + # Create forms, initialize with values from db/from POST request data_form = EditInterventionForm(request.POST or None, instance=intervention) geom_form = SimpleGeomForm(request.POST or None, read_only=False, instance=intervention) diff --git a/konova/forms.py b/konova/forms.py index fd359cb8..cde31294 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -57,6 +57,8 @@ class BaseForm(forms.Form): self.has_required_fields = True break + self.check_for_recorded_instance() + @abstractmethod def save(self): # To be implemented in subclasses! @@ -136,6 +138,22 @@ class BaseForm(forms.Form): set_class = set_class.replace(cls, "") self.fields[field].widget.attrs["class"] = set_class + def check_for_recorded_instance(self): + """ Checks if the instance is recorded and runs some special logic if yes + + If the instance is recorded, the form shall not display any possibility to + edit any data. Instead, the users should get some information about why they can not edit anything + + Returns: + + """ + if self.instance is None or not isinstance(self.instance, BaseObject): + # Do nothing + return + + if self.instance.is_recorded: + self.template = "form/recorded_no_edit.html" + class RemoveForm(BaseForm): check = forms.BooleanField( @@ -410,7 +428,6 @@ class NewDocumentModalForm(BaseModalForm): super().__init__(*args, **kwargs) self.form_title = _("Add new document") self.form_caption = _("") - self.template = "modal/modal_form.html" self.form_attrs = { "enctype": "multipart/form-data", # important for file upload } @@ -597,4 +614,12 @@ class RecordModalForm(BaseModalForm): self.instance.set_unrecorded(self.user) else: self.instance.set_recorded(self.user) - return self.instance \ No newline at end of file + return self.instance + + def check_for_recorded_instance(self): + """ Overwrite the check method for doing nothing on the RecordModalForm + + Returns: + + """ + pass diff --git a/konova/models/object.py b/konova/models/object.py index 59c68860..a1cff71b 100644 --- a/konova/models/object.py +++ b/konova/models/object.py @@ -337,6 +337,15 @@ class RecordableObjectMixin(models.Model): """ raise NotImplementedError("Implement this in the subclass!") + @property + def is_recorded(self): + """ Getter for record status as property + + Returns: + + """ + return self.recorded is not None + class CheckableObjectMixin(models.Model): # Checks - Refers to "Genehmigen" but optional diff --git a/konova/utils/message_templates.py b/konova/utils/message_templates.py index 64b7eab1..e062005a 100644 --- a/konova/utils/message_templates.py +++ b/konova/utils/message_templates.py @@ -17,6 +17,7 @@ IDENTIFIER_REPLACED = _("The identifier '{}' had to be changed to '{}' since ano ENTRY_REMOVE_MISSING_PERMISSION = _("Only conservation or registration office users are allowed to remove entries.") MISSING_GROUP_PERMISSION = _("You need to be part of another user group.") CHECKED_RECORDED_RESET = _("Status of Checked and Recorded reseted") +RECORDED_BLOCKS_EDIT = _("Entry is recorded. To edit data, the entry first needs to be unrecorded.") # SHARE DATA_UNSHARED = _("This data is not shared with you") diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 68305e78437c38918613b70d5d18bddc67804d89..b8d66ac2c09709318888f9b08576695960a98706 100644 GIT binary patch delta 12332 zcmZA737k#!|Htt&Gnlc=Fk=`q2G<_OWN7T!8nT4!vd@@1OUxb3+_4Ng(qboM-i708;=J$Hv?{~`oe;$22Ki}^;=X<`}IhWt#H=`){*(1U3xu_CL z91c&gnicyZ^I=_*GQ&F~Apu&m8Qj`<0EH<AtB zz>C%&QTGMk!YsgVC{{J)ER;G@F6UT%Q2DXJ8MaF!*LA3v&if^7f>@%fqC18F{q9m zLUrgQY6iZ*%J@CTU}y`+DUCId)pQ!5+G&HjuamVmx@D*sW-Br=hO*z5=b~<0fh@nX z9~Lo@Oqg8+MkPB`&FoRceG;u<46utQ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@@ -18,15 +18,15 @@ #: konova/filters/mixins.py:277 konova/filters/mixins.py:323 #: konova/filters/mixins.py:361 konova/filters/mixins.py:362 #: konova/filters/mixins.py:393 konova/filters/mixins.py:394 -#: konova/forms.py:143 konova/forms.py:244 konova/forms.py:315 -#: konova/forms.py:359 konova/forms.py:369 konova/forms.py:382 -#: konova/forms.py:394 konova/forms.py:412 user/forms.py:42 +#: konova/forms.py:163 konova/forms.py:264 konova/forms.py:335 +#: konova/forms.py:379 konova/forms.py:389 konova/forms.py:402 +#: konova/forms.py:414 konova/forms.py:432 user/forms.py:42 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-13 15:13+0200\n" +"POT-Creation-Date: 2022-04-19 09:31+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -77,7 +77,7 @@ msgstr "Bericht generieren" msgid "Select a timespan and the desired conservation office" msgstr "Wählen Sie die Zeitspanne und die gewünschte Eintragungsstelle" -#: analysis/forms.py:69 konova/forms.py:191 +#: analysis/forms.py:69 konova/forms.py:211 msgid "Continue" msgstr "Weiter" @@ -342,7 +342,7 @@ msgstr "Automatisch generiert" #: intervention/templates/intervention/detail/includes/documents.html:28 #: intervention/templates/intervention/detail/view.html:31 #: intervention/templates/intervention/report/report.html:12 -#: konova/forms.py:358 +#: konova/forms.py:378 msgid "Title" msgstr "Bezeichnung" @@ -369,7 +369,7 @@ msgstr "Kompensation XY; Flur ABC" #: intervention/templates/intervention/detail/includes/documents.html:34 #: intervention/templates/intervention/detail/includes/payments.html:34 #: intervention/templates/intervention/detail/includes/revocation.html:38 -#: konova/forms.py:393 konova/templates/konova/includes/comment_card.html:16 +#: konova/forms.py:413 konova/templates/konova/includes/comment_card.html:16 msgid "Comment" msgstr "Kommentar" @@ -493,7 +493,7 @@ msgid "Due on which date" msgstr "Zahlung wird an diesem Datum erwartet" #: compensation/forms/modalForms.py:64 compensation/forms/modalForms.py:359 -#: intervention/forms/modalForms.py:177 konova/forms.py:395 +#: intervention/forms/modalForms.py:177 konova/forms.py:415 msgid "Additional comment, maximum {} letters" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" @@ -538,7 +538,7 @@ msgstr "Neuer Zustand" msgid "Insert data for the new state" msgstr "Geben Sie die Daten des neuen Zustandes ein" -#: compensation/forms/modalForms.py:217 konova/forms.py:193 +#: compensation/forms/modalForms.py:217 konova/forms.py:213 msgid "Object removed" msgstr "Objekt entfernt" @@ -871,7 +871,7 @@ msgstr "Dokumente" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:14 #: ema/templates/ema/detail/includes/documents.html:14 #: intervention/templates/intervention/detail/includes/documents.html:14 -#: konova/forms.py:411 +#: konova/forms.py:431 msgid "Add new document" msgstr "Neues Dokument hinzufügen" @@ -879,7 +879,7 @@ msgstr "Neues Dokument hinzufügen" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:31 #: ema/templates/ema/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/documents.html:31 -#: konova/forms.py:368 +#: konova/forms.py:388 msgid "Created on" msgstr "Erstellt" @@ -887,7 +887,7 @@ msgstr "Erstellt" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:61 #: ema/templates/ema/detail/includes/documents.html:61 #: intervention/templates/intervention/detail/includes/documents.html:65 -#: konova/forms.py:474 +#: konova/forms.py:493 msgid "Edit document" msgstr "Dokument bearbeiten" @@ -1149,17 +1149,17 @@ msgstr "Kompensationen - Übersicht" msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" -#: compensation/views/compensation.py:161 compensation/views/eco_account.py:165 +#: compensation/views/compensation.py:161 compensation/views/eco_account.py:172 #: ema/views.py:233 intervention/views.py:327 msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:240 compensation/views/eco_account.py:351 +#: compensation/views/compensation.py:240 compensation/views/eco_account.py:358 #: ema/views.py:194 intervention/views.py:531 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:584 compensation/views/eco_account.py:719 +#: compensation/views/compensation.py:584 compensation/views/eco_account.py:726 #: ema/views.py:551 intervention/views.py:677 msgid "Report {}" msgstr "Bericht {}" @@ -1172,40 +1172,46 @@ msgstr "Ökokonten - Übersicht" msgid "Eco-Account {} added" msgstr "Ökokonto {} hinzugefügt" -#: compensation/views/eco_account.py:155 +#: compensation/views/eco_account.py:151 +msgid "" +"Entry is recorded. To edit data, the entry first needs to be unrecorded." +msgstr "" +"Eintrag ist verzeichnet. Um Daten zu bearbeiten, muss der Eintrag erst entzeichnet werden." + +#: compensation/views/eco_account.py:162 msgid "Eco-Account {} edited" msgstr "Ökokonto {} bearbeitet" -#: compensation/views/eco_account.py:268 +#: compensation/views/eco_account.py:275 msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account.py:372 ema/views.py:275 +#: compensation/views/eco_account.py:379 ema/views.py:275 #: intervention/views.py:630 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account.py:372 ema/views.py:275 +#: compensation/views/eco_account.py:379 ema/views.py:275 #: intervention/views.py:630 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account.py:796 ema/views.py:621 +#: compensation/views/eco_account.py:803 ema/views.py:621 #: intervention/views.py:428 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: compensation/views/eco_account.py:801 ema/views.py:626 +#: compensation/views/eco_account.py:808 ema/views.py:626 #: intervention/views.py:433 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: compensation/views/eco_account.py:808 ema/views.py:633 +#: compensation/views/eco_account.py:815 ema/views.py:633 #: intervention/views.py:440 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: compensation/views/eco_account.py:831 ema/views.py:656 +#: compensation/views/eco_account.py:838 ema/views.py:656 #: intervention/views.py:463 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" @@ -1392,7 +1398,7 @@ msgstr "Kompensationen und Zahlungen geprüft" msgid "Run check" msgstr "Prüfung vornehmen" -#: intervention/forms/modalForms.py:264 konova/forms.py:515 +#: intervention/forms/modalForms.py:264 konova/forms.py:534 msgid "" "I, {} {}, confirm that all necessary control steps have been performed by " "myself." @@ -1633,65 +1639,65 @@ msgstr "Nch Eintragungsstelle suchen" msgid "Save" msgstr "Speichern" -#: konova/forms.py:71 +#: konova/forms.py:74 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:142 konova/forms.py:314 +#: konova/forms.py:162 konova/forms.py:334 msgid "Confirm" msgstr "Bestätige" -#: konova/forms.py:154 konova/forms.py:323 +#: konova/forms.py:174 konova/forms.py:343 msgid "Remove" msgstr "Löschen" -#: konova/forms.py:156 +#: konova/forms.py:176 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" -#: konova/forms.py:243 konova/utils/quality.py:44 konova/utils/quality.py:46 +#: konova/forms.py:263 konova/utils/quality.py:44 konova/utils/quality.py:46 #: templates/form/collapsable/form.html:45 msgid "Geometry" msgstr "Geometrie" -#: konova/forms.py:324 +#: konova/forms.py:344 msgid "Are you sure?" msgstr "Sind Sie sicher?" -#: konova/forms.py:370 +#: konova/forms.py:390 msgid "When has this file been created? Important for photos." msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" -#: konova/forms.py:381 +#: konova/forms.py:401 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 msgid "File" msgstr "Datei" -#: konova/forms.py:383 +#: konova/forms.py:403 msgid "Allowed formats: pdf, jpg, png. Max size 15 MB." msgstr "Formate: pdf, jpg, png. Maximal 15 MB." -#: konova/forms.py:449 +#: konova/forms.py:468 msgid "Added document" msgstr "Dokument hinzugefügt" -#: konova/forms.py:506 +#: konova/forms.py:525 msgid "Confirm record" msgstr "Verzeichnen bestätigen" -#: konova/forms.py:514 +#: konova/forms.py:533 msgid "Record data" msgstr "Daten verzeichnen" -#: konova/forms.py:521 +#: konova/forms.py:540 msgid "Confirm unrecord" msgstr "Entzeichnen bestätigen" -#: konova/forms.py:522 +#: konova/forms.py:541 msgid "Unrecord data" msgstr "Daten entzeichnen" -#: konova/forms.py:523 +#: konova/forms.py:542 msgid "I, {} {}, confirm that this data must be unrecorded." msgstr "" "Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen." @@ -2358,6 +2364,25 @@ msgstr "Allgemeine Daten" msgid "Cancel" msgstr "Abbrechen" +#: templates/form/recorded_no_edit.html:9 +msgid "This data is recorded" +msgstr "Daten sind verzeichnet" + +#: templates/form/recorded_no_edit.html:14 +msgid "" +"\n" +" Whilst recorded the data is published publicly. If you wish to edit " +"any information on this data, the data needs\n" +" to be unrecorded first. Do not forget to record it afterwards, " +"again.\n" +" " +msgstr "" +"\n" +"Verzeichnete Daten sind öffentlich einsehbar. Wenn Sie Informationen " +"überarbeiten möchten muss dieser Datensatz zunächst entzeichnet werden. " +"Vergessen Sie nicht ihn anschließend wieder zu verzeichnen.\n" +" " + #: templates/form/table/generic_table_form_body.html:24 msgid "Fields with * are required." msgstr "* sind Pflichtfelder." @@ -2546,11 +2571,11 @@ msgstr "Administratoren verwalten die Teamdaten und Mitglieder" msgid "Selected admin ({}) needs to be a member of this team." msgstr "Gewählter Administrator ({}) muss ein Mitglied des Teams sein." -#: user/forms.py:291 user/templates/user/team/index.html:51 +#: user/forms.py:291 user/templates/user/team/index.html:54 msgid "Edit team" msgstr "Team bearbeiten" -#: user/forms.py:323 user/templates/user/team/index.html:58 +#: user/forms.py:323 user/templates/user/team/index.html:50 msgid "Leave team" msgstr "Team verlassen" @@ -2640,7 +2665,7 @@ msgstr "Neues Team hinzufügen" msgid "Members" msgstr "Mitglieder" -#: user/templates/user/team/index.html:54 +#: user/templates/user/team/index.html:57 msgid "Remove team" msgstr "Team entfernen" diff --git a/templates/form/recorded_no_edit.html b/templates/form/recorded_no_edit.html new file mode 100644 index 00000000..45fd08df --- /dev/null +++ b/templates/form/recorded_no_edit.html @@ -0,0 +1,19 @@ +{% load i18n fontawesome_5 %} + +
+

+ + {% fa5_icon 'bookmark' %} + + + {% trans 'This data is recorded' %} + +

+
+
+ {% blocktrans %} + Whilst recorded the data is published publicly. If you wish to edit any information on this data, the data needs + to be unrecorded first. Do not forget to record it afterwards, again. + {% endblocktrans %} +
+
\ No newline at end of file -- 2.45.2 From a9555f7bda39298759f0aed74fdbde2779359b25 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Apr 2022 13:37:29 +0200 Subject: [PATCH 2/3] #140 Enhancements * fixes InterventionAutocomplete bug, where team-shared entries would not pop up as valid option * fixes bug where form opening for new compensation without direct intervention link resulted in 404 * adds intervention-recorded check on deduction forms: Form is invalid if intervention is currently recorded and therefore blocked for any editing * extends basic check_for_recorded_instance() method to let some forms pass, e.g. deduction related forms on ecoaccounts which only have a reason to be rendered IF the entry is recorded * adds/updates translations --- compensation/views/compensation.py | 22 +-- intervention/forms/modalForms.py | 13 +- konova/autocompletes.py | 10 +- konova/forms.py | 20 ++- locale/de/LC_MESSAGES/django.mo | Bin 41898 -> 42105 bytes locale/de/LC_MESSAGES/django.po | 221 +++++++++++++++-------------- 6 files changed, 164 insertions(+), 122 deletions(-) diff --git a/compensation/views/compensation.py b/compensation/views/compensation.py index 9c82c885..c3d3e2b5 100644 --- a/compensation/views/compensation.py +++ b/compensation/views/compensation.py @@ -1,4 +1,5 @@ from django.contrib.auth.decorators import login_required +from django.core.exceptions import ObjectDoesNotExist from django.db.models import Sum from django.http import HttpRequest, JsonResponse from django.shortcuts import render @@ -22,7 +23,7 @@ from konova.utils.message_templates import FORM_INVALID, IDENTIFIER_REPLACED, DA CHECKED_RECORDED_RESET, COMPENSATION_ADDED_TEMPLATE, COMPENSATION_REMOVED_TEMPLATE, DOCUMENT_ADDED, \ COMPENSATION_STATE_REMOVED, COMPENSATION_STATE_ADDED, COMPENSATION_ACTION_REMOVED, COMPENSATION_ACTION_ADDED, \ DEADLINE_ADDED, DEADLINE_REMOVED, DOCUMENT_EDITED, COMPENSATION_STATE_EDITED, COMPENSATION_ACTION_EDITED, \ - DEADLINE_EDITED, RECORDED_BLOCKS_EDIT + DEADLINE_EDITED, RECORDED_BLOCKS_EDIT, PARAMS_INVALID from konova.utils.user_checks import in_group @@ -69,13 +70,18 @@ def new_view(request: HttpRequest, intervention_id: str = None): """ template = "compensation/form/view.html" - intervention = get_object_or_404(Intervention, id=intervention_id) - if intervention.is_recorded: - messages.info( - request, - RECORDED_BLOCKS_EDIT - ) - return redirect("intervention:detail", id=intervention_id) + if intervention_id is not None: + try: + intervention = Intervention.objects.get(id=intervention_id) + except ObjectDoesNotExist: + messages.error(request, PARAMS_INVALID) + return redirect("home") + if intervention.is_recorded: + messages.info( + request, + RECORDED_BLOCKS_EDIT + ) + return redirect("intervention:detail", id=intervention_id) data_form = NewCompensationForm(request.POST or None, intervention_id=intervention_id) geom_form = SimpleGeomForm(request.POST or None, read_only=False) diff --git a/intervention/forms/modalForms.py b/intervention/forms/modalForms.py index 6a02962e..07911be9 100644 --- a/intervention/forms/modalForms.py +++ b/intervention/forms/modalForms.py @@ -427,13 +427,22 @@ class NewDeductionModalForm(BaseModalForm): """ super_result = super().is_valid() acc = self.cleaned_data["account"] + intervention = self.cleaned_data["intervention"] + objects_valid = True if not acc.recorded: self.add_error( "account", _("Eco-account {} is not recorded yet. You can only deduct from recorded accounts.").format(acc.identifier) ) - return False + objects_valid = False + + if intervention.is_recorded: + self.add_error( + "intervention", + _("Intervention {} is currently recorded. To change any data on it, the entry must be unrecorded.").format(intervention.identifier) + ) + objects_valid = False rest_surface = self._get_available_surface(acc) form_surface = float(self.cleaned_data["surface"]) @@ -447,7 +456,7 @@ class NewDeductionModalForm(BaseModalForm): format_german_float(rest_surface), ), ) - return is_valid_surface and super_result + return is_valid_surface and objects_valid and super_result def __create_deduction(self): """ Creates the deduction diff --git a/konova/autocompletes.py b/konova/autocompletes.py index 9f60d54f..e6036f02 100644 --- a/konova/autocompletes.py +++ b/konova/autocompletes.py @@ -52,14 +52,16 @@ class InterventionAutocomplete(Select2QuerySetView): """ def get_queryset(self): - if self.request.user.is_anonymous: + user = self.request.user + if user.is_anonymous: return Intervention.objects.none() qs = Intervention.objects.filter( - deleted=None, - users__in=[self.request.user], + Q(deleted=None) & + Q(users__in=[user]) | + Q(teams__in=user.teams.all()) ).order_by( "identifier" - ) + ).distinct() if self.q: qs = qs.filter( Q(identifier__icontains=self.q) | diff --git a/konova/forms.py b/konova/forms.py index cde31294..a1e14478 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -142,12 +142,28 @@ class BaseForm(forms.Form): """ Checks if the instance is recorded and runs some special logic if yes If the instance is recorded, the form shall not display any possibility to - edit any data. Instead, the users should get some information about why they can not edit anything + edit any data. Instead, the users should get some information about why they can not edit anything. + + There are situations where the form should be rendered regularly, + e.g deduction forms for (recorded) eco accounts. Returns: """ - if self.instance is None or not isinstance(self.instance, BaseObject): + from intervention.forms.modalForms import NewDeductionModalForm, EditEcoAccountDeductionModalForm, \ + RemoveEcoAccountDeductionModalForm + is_none = self.instance is None + is_other_data_type = not isinstance(self.instance, BaseObject) + is_deduction_form = isinstance( + self, + ( + NewDeductionModalForm, + EditEcoAccountDeductionModalForm, + RemoveEcoAccountDeductionModalForm, + ) + ) + + if is_none or is_other_data_type or is_deduction_form: # Do nothing return diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index b8d66ac2c09709318888f9b08576695960a98706..9626e763ea04a135d76675baf28ba22d85ea7eea 100644 GIT binary patch delta 11533 zcmYk=2V7RwAII?vB7)*z3y3_Zh$x`ASK`*hZH_btB8mer#67M%%}ntzBdr{%Im$G% z+?k`aa-^vZv*jLXW#+8^=lk5_|J8l<>wV6-=bn8p$cE3n?;rNI&jatlXJTwk z%ZkReSQigs06xSZ%d#!MS~N&O6jER%pf5JY64=6&cS1cl5XWFH>bXl;3hx+;)OMZ= z!itoaN8N9ZA=m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SE!Fiv21gRXg z18^SYmq>$2he;t;lk|}FRnn&D-RE6}L0?3SqQX+3csmA>Dslf;d+$~9x?aLQ_yQ(th2J1}#@@Wejkd%kHvhPuu-7ZL z>`!X|jo%}Fm~@UhKiPVR$@`Lak$#};DCsI`2Kn*$BreB5@8I>7;2KSOjT<9K<-H~5 z51Q-5Rj3$-zmU3;9;ME8(ngZ5=kYHSI`eH=7xLwahbdp)GdL}5?}mEIqV_IsdnRk| J(K-97{|{i9Z@&Nl diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 0ec797a8..2a78deb7 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -18,15 +18,15 @@ #: konova/filters/mixins.py:277 konova/filters/mixins.py:323 #: konova/filters/mixins.py:361 konova/filters/mixins.py:362 #: konova/filters/mixins.py:393 konova/filters/mixins.py:394 -#: konova/forms.py:163 konova/forms.py:264 konova/forms.py:335 -#: konova/forms.py:379 konova/forms.py:389 konova/forms.py:402 -#: konova/forms.py:414 konova/forms.py:432 user/forms.py:42 +#: konova/forms.py:177 konova/forms.py:278 konova/forms.py:349 +#: konova/forms.py:393 konova/forms.py:403 konova/forms.py:416 +#: konova/forms.py:428 konova/forms.py:446 user/forms.py:42 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-19 09:31+0200\n" +"POT-Creation-Date: 2022-04-19 13:28+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -77,7 +77,7 @@ msgstr "Bericht generieren" msgid "Select a timespan and the desired conservation office" msgstr "Wählen Sie die Zeitspanne und die gewünschte Eintragungsstelle" -#: analysis/forms.py:69 konova/forms.py:211 +#: analysis/forms.py:69 konova/forms.py:225 msgid "Continue" msgstr "Weiter" @@ -342,7 +342,7 @@ msgstr "Automatisch generiert" #: intervention/templates/intervention/detail/includes/documents.html:28 #: intervention/templates/intervention/detail/view.html:31 #: intervention/templates/intervention/report/report.html:12 -#: konova/forms.py:378 +#: konova/forms.py:392 msgid "Title" msgstr "Bezeichnung" @@ -369,7 +369,7 @@ msgstr "Kompensation XY; Flur ABC" #: intervention/templates/intervention/detail/includes/documents.html:34 #: intervention/templates/intervention/detail/includes/payments.html:34 #: intervention/templates/intervention/detail/includes/revocation.html:38 -#: konova/forms.py:413 konova/templates/konova/includes/comment_card.html:16 +#: konova/forms.py:427 konova/templates/konova/includes/comment_card.html:16 msgid "Comment" msgstr "Kommentar" @@ -441,7 +441,7 @@ msgstr "kompensiert Eingriff" msgid "Select the intervention for which this compensation compensates" msgstr "Wählen Sie den Eingriff, für den diese Kompensation bestimmt ist" -#: compensation/forms/forms.py:202 compensation/views/compensation.py:96 +#: compensation/forms/forms.py:202 compensation/views/compensation.py:110 msgid "New compensation" msgstr "Neue Kompensation" @@ -467,7 +467,7 @@ msgstr "Vereinbarungsdatum" msgid "When did the parties agree on this?" msgstr "Wann wurde dieses Ökokonto offiziell vereinbart?" -#: compensation/forms/forms.py:373 compensation/views/eco_account.py:107 +#: compensation/forms/forms.py:373 compensation/views/eco_account.py:108 msgid "New Eco-Account" msgstr "Neues Ökokonto" @@ -493,7 +493,7 @@ msgid "Due on which date" msgstr "Zahlung wird an diesem Datum erwartet" #: compensation/forms/modalForms.py:64 compensation/forms/modalForms.py:359 -#: intervention/forms/modalForms.py:177 konova/forms.py:415 +#: intervention/forms/modalForms.py:177 konova/forms.py:429 msgid "Additional comment, maximum {} letters" msgstr "Zusätzlicher Kommentar, maximal {} Zeichen" @@ -538,7 +538,7 @@ msgstr "Neuer Zustand" msgid "Insert data for the new state" msgstr "Geben Sie die Daten des neuen Zustandes ein" -#: compensation/forms/modalForms.py:217 konova/forms.py:213 +#: compensation/forms/modalForms.py:217 konova/forms.py:227 msgid "Object removed" msgstr "Objekt entfernt" @@ -871,7 +871,7 @@ msgstr "Dokumente" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:14 #: ema/templates/ema/detail/includes/documents.html:14 #: intervention/templates/intervention/detail/includes/documents.html:14 -#: konova/forms.py:431 +#: konova/forms.py:445 msgid "Add new document" msgstr "Neues Dokument hinzufügen" @@ -879,7 +879,7 @@ msgstr "Neues Dokument hinzufügen" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:31 #: ema/templates/ema/detail/includes/documents.html:31 #: intervention/templates/intervention/detail/includes/documents.html:31 -#: konova/forms.py:388 +#: konova/forms.py:402 msgid "Created on" msgstr "Erstellt" @@ -887,7 +887,7 @@ msgstr "Erstellt" #: compensation/templates/compensation/detail/eco_account/includes/documents.html:61 #: ema/templates/ema/detail/includes/documents.html:61 #: intervention/templates/intervention/detail/includes/documents.html:65 -#: konova/forms.py:493 +#: konova/forms.py:507 msgid "Edit document" msgstr "Dokument bearbeiten" @@ -1067,7 +1067,7 @@ msgid "Recorded on" msgstr "Verzeichnet am" #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:65 -#: intervention/forms/modalForms.py:481 +#: intervention/forms/modalForms.py:490 #: intervention/templates/intervention/detail/includes/deductions.html:60 msgid "Edit Deduction" msgstr "Abbuchung bearbeiten" @@ -1141,78 +1141,72 @@ msgstr "" msgid "Responsible data" msgstr "Daten zu den verantwortlichen Stellen" -#: compensation/views/compensation.py:52 +#: compensation/views/compensation.py:53 msgid "Compensations - Overview" msgstr "Kompensationen - Übersicht" -#: compensation/views/compensation.py:151 konova/utils/message_templates.py:35 +#: compensation/views/compensation.py:172 konova/utils/message_templates.py:36 msgid "Compensation {} edited" msgstr "Kompensation {} bearbeitet" -#: compensation/views/compensation.py:161 compensation/views/eco_account.py:172 -#: ema/views.py:233 intervention/views.py:327 +#: compensation/views/compensation.py:182 compensation/views/eco_account.py:173 +#: ema/views.py:240 intervention/views.py:335 msgid "Edit {}" msgstr "Bearbeite {}" -#: compensation/views/compensation.py:240 compensation/views/eco_account.py:358 -#: ema/views.py:194 intervention/views.py:531 +#: compensation/views/compensation.py:261 compensation/views/eco_account.py:359 +#: ema/views.py:194 intervention/views.py:539 msgid "Log" msgstr "Log" -#: compensation/views/compensation.py:584 compensation/views/eco_account.py:726 -#: ema/views.py:551 intervention/views.py:677 +#: compensation/views/compensation.py:605 compensation/views/eco_account.py:727 +#: ema/views.py:558 intervention/views.py:685 msgid "Report {}" msgstr "Bericht {}" -#: compensation/views/eco_account.py:64 +#: compensation/views/eco_account.py:65 msgid "Eco-account - Overview" msgstr "Ökokonten - Übersicht" -#: compensation/views/eco_account.py:97 +#: compensation/views/eco_account.py:98 msgid "Eco-Account {} added" msgstr "Ökokonto {} hinzugefügt" -#: compensation/views/eco_account.py:151 -msgid "" -"Entry is recorded. To edit data, the entry first needs to be unrecorded." -msgstr "" -"Eintrag ist verzeichnet. Um Daten zu bearbeiten, muss der Eintrag erst entzeichnet werden." - -#: compensation/views/eco_account.py:162 +#: compensation/views/eco_account.py:163 msgid "Eco-Account {} edited" msgstr "Ökokonto {} bearbeitet" -#: compensation/views/eco_account.py:275 +#: compensation/views/eco_account.py:276 msgid "Eco-account removed" msgstr "Ökokonto entfernt" -#: compensation/views/eco_account.py:379 ema/views.py:275 -#: intervention/views.py:630 +#: compensation/views/eco_account.py:380 ema/views.py:282 +#: intervention/views.py:638 msgid "{} unrecorded" msgstr "{} entzeichnet" -#: compensation/views/eco_account.py:379 ema/views.py:275 -#: intervention/views.py:630 +#: compensation/views/eco_account.py:380 ema/views.py:282 +#: intervention/views.py:638 msgid "{} recorded" msgstr "{} verzeichnet" -#: compensation/views/eco_account.py:803 ema/views.py:621 -#: intervention/views.py:428 +#: compensation/views/eco_account.py:804 ema/views.py:628 +#: intervention/views.py:436 msgid "{} has already been shared with you" msgstr "{} wurde bereits für Sie freigegeben" -#: compensation/views/eco_account.py:808 ema/views.py:626 -#: intervention/views.py:433 +#: compensation/views/eco_account.py:809 ema/views.py:633 +#: intervention/views.py:441 msgid "{} has been shared with you" msgstr "{} ist nun für Sie freigegeben" -#: compensation/views/eco_account.py:815 ema/views.py:633 -#: intervention/views.py:440 +#: compensation/views/eco_account.py:816 ema/views.py:640 +#: intervention/views.py:448 msgid "Share link invalid" msgstr "Freigabelink ungültig" -#: compensation/views/eco_account.py:838 ema/views.py:656 -#: intervention/views.py:463 +#: compensation/views/eco_account.py:839 ema/views.py:663 +#: intervention/views.py:471 msgid "Share settings updated" msgstr "Freigabe Einstellungen aktualisiert" @@ -1252,11 +1246,11 @@ msgstr "EMAs - Übersicht" msgid "EMA {} added" msgstr "EMA {} hinzugefügt" -#: ema/views.py:223 +#: ema/views.py:230 msgid "EMA {} edited" msgstr "EMA {} bearbeitet" -#: ema/views.py:256 +#: ema/views.py:263 msgid "EMA removed" msgstr "EMA entfernt" @@ -1318,7 +1312,7 @@ msgstr "Datum Zulassung bzw. Satzungsbeschluss" msgid "Binding on" msgstr "Datum Bestandskraft" -#: intervention/forms/forms.py:211 intervention/views.py:94 +#: intervention/forms/forms.py:211 intervention/views.py:95 msgid "New intervention" msgstr "Neuer Eingriff" @@ -1398,7 +1392,7 @@ msgstr "Kompensationen und Zahlungen geprüft" msgid "Run check" msgstr "Prüfung vornehmen" -#: intervention/forms/modalForms.py:264 konova/forms.py:534 +#: intervention/forms/modalForms.py:264 konova/forms.py:548 msgid "" "I, {} {}, confirm that all necessary control steps have been performed by " "myself." @@ -1422,7 +1416,7 @@ msgstr "Neue Abbuchung" msgid "Enter the information for a new deduction from a chosen eco-account" msgstr "Geben Sie die Informationen für eine neue Abbuchung ein." -#: intervention/forms/modalForms.py:434 +#: intervention/forms/modalForms.py:436 msgid "" "Eco-account {} is not recorded yet. You can only deduct from recorded " "accounts." @@ -1430,7 +1424,15 @@ msgstr "" "Ökokonto {} ist noch nicht verzeichnet. Abbuchungen können nur von " "verzeichneten Ökokonten erfolgen." -#: intervention/forms/modalForms.py:444 +#: intervention/forms/modalForms.py:443 +msgid "" +"Intervention {} is currently recorded. To change any data on it, the entry " +"must be unrecorded." +msgstr "" +"Eingriff {} ist verzeichnet. Der Eintrag muss erst entzeichnet werden um " +"fortfahren zu können." + +#: intervention/forms/modalForms.py:453 msgid "" "The account {} has not enough surface for a deduction of {} m². There are " "only {} m² left" @@ -1530,27 +1532,27 @@ msgstr "" "Kein Ausgleich jeglicher Art gefunden (Kompensation, Ersatzzahlung, " "Abbuchung)" -#: intervention/views.py:51 +#: intervention/views.py:52 msgid "Interventions - Overview" msgstr "Eingriffe - Übersicht" -#: intervention/views.py:84 +#: intervention/views.py:85 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt" -#: intervention/views.py:315 +#: intervention/views.py:323 msgid "Intervention {} edited" msgstr "Eingriff {} bearbeitet" -#: intervention/views.py:351 +#: intervention/views.py:359 msgid "{} removed" msgstr "{} entfernt" -#: intervention/views.py:484 +#: intervention/views.py:492 msgid "Check performed" msgstr "Prüfung durchgeführt" -#: intervention/views.py:635 +#: intervention/views.py:643 msgid "There are errors on this intervention:" msgstr "Es liegen Fehler in diesem Eingriff vor:" @@ -1639,65 +1641,65 @@ msgstr "Nch Eintragungsstelle suchen" msgid "Save" msgstr "Speichern" -#: konova/forms.py:74 +#: konova/forms.py:73 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:162 konova/forms.py:334 +#: konova/forms.py:176 konova/forms.py:348 msgid "Confirm" msgstr "Bestätige" -#: konova/forms.py:174 konova/forms.py:343 +#: konova/forms.py:188 konova/forms.py:357 msgid "Remove" msgstr "Löschen" -#: konova/forms.py:176 +#: konova/forms.py:190 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" -#: konova/forms.py:263 konova/utils/quality.py:44 konova/utils/quality.py:46 +#: konova/forms.py:277 konova/utils/quality.py:44 konova/utils/quality.py:46 #: templates/form/collapsable/form.html:45 msgid "Geometry" msgstr "Geometrie" -#: konova/forms.py:344 +#: konova/forms.py:358 msgid "Are you sure?" msgstr "Sind Sie sicher?" -#: konova/forms.py:390 +#: konova/forms.py:404 msgid "When has this file been created? Important for photos." msgstr "Wann wurde diese Datei erstellt oder das Foto aufgenommen?" -#: konova/forms.py:401 +#: konova/forms.py:415 #: venv/lib/python3.7/site-packages/django/db/models/fields/files.py:231 msgid "File" msgstr "Datei" -#: konova/forms.py:403 +#: konova/forms.py:417 msgid "Allowed formats: pdf, jpg, png. Max size 15 MB." msgstr "Formate: pdf, jpg, png. Maximal 15 MB." -#: konova/forms.py:468 +#: konova/forms.py:482 msgid "Added document" msgstr "Dokument hinzugefügt" -#: konova/forms.py:525 +#: konova/forms.py:539 msgid "Confirm record" msgstr "Verzeichnen bestätigen" -#: konova/forms.py:533 +#: konova/forms.py:547 msgid "Record data" msgstr "Daten verzeichnen" -#: konova/forms.py:540 +#: konova/forms.py:554 msgid "Confirm unrecord" msgstr "Entzeichnen bestätigen" -#: konova/forms.py:541 +#: konova/forms.py:555 msgid "Unrecord data" msgstr "Daten entzeichnen" -#: konova/forms.py:542 +#: konova/forms.py:556 msgid "I, {} {}, confirm that this data must be unrecorded." msgstr "" "Ich, {} {}, bestätige, dass diese Daten wieder entzeichnet werden müssen." @@ -1895,11 +1897,18 @@ msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" msgid "Status of Checked and Recorded reseted" msgstr "'Geprüft'/'Verzeichnet' wurde zurückgesetzt" -#: konova/utils/message_templates.py:22 +#: konova/utils/message_templates.py:20 +msgid "" +"Entry is recorded. To edit data, the entry first needs to be unrecorded." +msgstr "" +"Eintrag ist verzeichnet. Um Daten zu bearbeiten, muss der Eintrag erst " +"entzeichnet werden." + +#: konova/utils/message_templates.py:23 msgid "This data is not shared with you" msgstr "Diese Daten sind für Sie nicht freigegeben" -#: konova/utils/message_templates.py:23 +#: konova/utils/message_templates.py:24 msgid "" "Remember: This data has not been shared with you, yet. This means you can " "only read but can not edit or perform any actions like running a check or " @@ -1909,15 +1918,15 @@ msgstr "" "bedeutet, dass Sie nur lesenden Zugriff hierauf haben und weder bearbeiten, " "noch Prüfungen durchführen oder verzeichnen können." -#: konova/utils/message_templates.py:26 +#: konova/utils/message_templates.py:27 msgid "Unsupported file type" msgstr "Dateiformat nicht unterstützt" -#: konova/utils/message_templates.py:27 +#: konova/utils/message_templates.py:28 msgid "File too large" msgstr "Datei zu groß" -#: konova/utils/message_templates.py:30 +#: konova/utils/message_templates.py:31 msgid "" "Action canceled. Eco account is recorded or deductions exist. Only " "conservation office member can perform this action." @@ -1925,119 +1934,119 @@ msgstr "" "Aktion abgebrochen. Ökokonto ist bereits verzeichnet oder Abbuchungen liegen " "vor. Nur Eintragungsstellennutzer können diese Aktion jetzt durchführen." -#: konova/utils/message_templates.py:33 +#: konova/utils/message_templates.py:34 msgid "Compensation {} added" msgstr "Kompensation {} hinzugefügt" -#: konova/utils/message_templates.py:34 +#: konova/utils/message_templates.py:35 msgid "Compensation {} removed" msgstr "Kompensation {} entfernt" -#: konova/utils/message_templates.py:36 +#: konova/utils/message_templates.py:37 msgid "Added compensation action" msgstr "Maßnahme hinzugefügt" -#: konova/utils/message_templates.py:37 +#: konova/utils/message_templates.py:38 msgid "Added compensation state" msgstr "Zustand hinzugefügt" -#: konova/utils/message_templates.py:40 +#: konova/utils/message_templates.py:41 msgid "State removed" msgstr "Zustand gelöscht" -#: konova/utils/message_templates.py:41 +#: konova/utils/message_templates.py:42 msgid "State edited" msgstr "Zustand bearbeitet" -#: konova/utils/message_templates.py:42 +#: konova/utils/message_templates.py:43 msgid "State added" msgstr "Zustand hinzugefügt" -#: konova/utils/message_templates.py:45 +#: konova/utils/message_templates.py:46 msgid "Action added" msgstr "Maßnahme hinzugefügt" -#: konova/utils/message_templates.py:46 +#: konova/utils/message_templates.py:47 msgid "Action edited" msgstr "Maßnahme bearbeitet" -#: konova/utils/message_templates.py:47 +#: konova/utils/message_templates.py:48 msgid "Action removed" msgstr "Maßnahme entfernt" -#: konova/utils/message_templates.py:50 +#: konova/utils/message_templates.py:51 msgid "Deduction added" msgstr "Abbuchung hinzugefügt" -#: konova/utils/message_templates.py:51 +#: konova/utils/message_templates.py:52 msgid "Deduction edited" msgstr "Abbuchung bearbeitet" -#: konova/utils/message_templates.py:52 +#: konova/utils/message_templates.py:53 msgid "Deduction removed" msgstr "Abbuchung entfernt" -#: konova/utils/message_templates.py:55 +#: konova/utils/message_templates.py:56 msgid "Deadline added" msgstr "Frist/Termin hinzugefügt" -#: konova/utils/message_templates.py:56 +#: konova/utils/message_templates.py:57 msgid "Deadline edited" msgstr "Frist/Termin bearbeitet" -#: konova/utils/message_templates.py:57 +#: konova/utils/message_templates.py:58 msgid "Deadline removed" msgstr "Frist/Termin gelöscht" -#: konova/utils/message_templates.py:60 +#: konova/utils/message_templates.py:61 msgid "Payment added" msgstr "Zahlung hinzugefügt" -#: konova/utils/message_templates.py:61 +#: konova/utils/message_templates.py:62 msgid "Payment edited" msgstr "Zahlung bearbeitet" -#: konova/utils/message_templates.py:62 +#: konova/utils/message_templates.py:63 msgid "Payment removed" msgstr "Zahlung gelöscht" -#: konova/utils/message_templates.py:65 +#: konova/utils/message_templates.py:66 msgid "Revocation added" msgstr "Widerspruch hinzugefügt" -#: konova/utils/message_templates.py:66 +#: konova/utils/message_templates.py:67 msgid "Revocation edited" msgstr "Widerspruch bearbeitet" -#: konova/utils/message_templates.py:67 +#: konova/utils/message_templates.py:68 msgid "Revocation removed" msgstr "Widerspruch entfernt" -#: konova/utils/message_templates.py:70 +#: konova/utils/message_templates.py:71 msgid "Document '{}' deleted" msgstr "Dokument '{}' gelöscht" -#: konova/utils/message_templates.py:71 +#: konova/utils/message_templates.py:72 msgid "Document added" msgstr "Dokument hinzugefügt" -#: konova/utils/message_templates.py:72 +#: konova/utils/message_templates.py:73 msgid "Document edited" msgstr "Dokument bearbeitet" -#: konova/utils/message_templates.py:75 +#: konova/utils/message_templates.py:76 msgid "Edited general data" msgstr "Allgemeine Daten bearbeitet" -#: konova/utils/message_templates.py:76 +#: konova/utils/message_templates.py:77 msgid "Added deadline" msgstr "Frist/Termin hinzugefügt" -#: konova/utils/message_templates.py:79 +#: konova/utils/message_templates.py:80 msgid "Geometry conflict detected with {}" msgstr "Geometriekonflikt mit folgenden Einträgen erkannt: {}" -#: konova/utils/message_templates.py:82 +#: konova/utils/message_templates.py:83 msgid "This intervention has {} revocations" msgstr "Dem Eingriff liegen {} Widersprüche vor" -- 2.45.2 From 5f1f2a933e50f2121de36feb46a46568c38893b3 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 19 Apr 2022 14:04:20 +0200 Subject: [PATCH 3/3] #140 Tests * adds workflow tests for major datatypes --- .../tests/compensation/test_workflow.py | 26 ++++++++++++++++++- .../tests/ecoaccount/test_workflow.py | 24 +++++++++++++++++ ema/tests/test_workflow.py | 26 +++++++++++++++++++ intervention/tests/test_workflow.py | 24 +++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/compensation/tests/compensation/test_workflow.py b/compensation/tests/compensation/test_workflow.py index 5b7decff..570045f2 100644 --- a/compensation/tests/compensation/test_workflow.py +++ b/compensation/tests/compensation/test_workflow.py @@ -60,8 +60,9 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase): # Preserve the current number of intervention's compensations num_compensations = self.intervention.compensations.count() - self.client_user.post(new_url, post_data) + response = self.client_user.post(new_url, post_data) + self.assertEqual(302, response.status_code) self.intervention.refresh_from_db() self.assertEqual(num_compensations + 1, self.intervention.compensations.count()) new_compensation = self.intervention.compensations.get(identifier=test_id) @@ -261,3 +262,26 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase): self.assertIn(recorded, self.compensation.log.all()) self.assertEqual(pre_record_log_count + 1, self.compensation.log.count()) + def test_non_editable_after_recording(self): + """ Tests that the compensation can not be edited after being recorded + + User must be redirected to another page + + Returns: + + """ + self.assertIsNotNone(self.compensation) + self.assertFalse(self.compensation.is_recorded) + edit_url = reverse("compensation:edit", args=(self.compensation.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertFalse(has_redirect) + + self.compensation.intervention.set_recorded(self.user) + self.assertTrue(self.compensation.is_recorded) + + edit_url = reverse("compensation:edit", args=(self.compensation.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertTrue(has_redirect) + self.compensation.intervention.set_unrecorded(self.user) diff --git a/compensation/tests/ecoaccount/test_workflow.py b/compensation/tests/ecoaccount/test_workflow.py index 03b4996a..bd6894ae 100644 --- a/compensation/tests/ecoaccount/test_workflow.py +++ b/compensation/tests/ecoaccount/test_workflow.py @@ -302,3 +302,27 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase): self.assertEqual(pre_edit_account_log_count + 1, account.log.count()) self.assertEqual(intervention.log.first().action, UserAction.EDITED) self.assertEqual(account.log.first().action, UserAction.EDITED) + + def test_non_editable_after_recording(self): + """ Tests that the eco_account can not be edited after being recorded + + User must be redirected to another page + + Returns: + + """ + self.assertIsNotNone(self.eco_account) + self.assertFalse(self.eco_account.is_recorded) + edit_url = reverse("compensation:acc:edit", args=(self.eco_account.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertFalse(has_redirect) + + self.eco_account.set_recorded(self.user) + self.assertTrue(self.eco_account.is_recorded) + + edit_url = reverse("compensation:acc:edit", args=(self.eco_account.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertTrue(has_redirect) + self.eco_account.set_unrecorded(self.user) diff --git a/ema/tests/test_workflow.py b/ema/tests/test_workflow.py index 3306a21f..ecc3f195 100644 --- a/ema/tests/test_workflow.py +++ b/ema/tests/test_workflow.py @@ -117,6 +117,32 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase): self.assertEqual(pre_edit_log_count + 1, self.ema.log.count()) self.assertEqual(self.ema.log.first().action, UserAction.EDITED) + def test_non_editable_after_recording(self): + """ Tests that the EMA can not be edited after being recorded + + User must be redirected to another page + + Returns: + + """ + self.superuser.groups.add(self.groups.get(name=ETS_GROUP)) + self.assertIsNotNone(self.ema) + self.ema.share_with_user(self.superuser) + self.assertFalse(self.ema.is_recorded) + edit_url = reverse("ema:edit", args=(self.ema.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertFalse(has_redirect) + + self.ema.set_recorded(self.superuser) + self.assertTrue(self.ema.is_recorded) + + edit_url = reverse("ema:edit", args=(self.ema.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertTrue(has_redirect) + self.ema.set_unrecorded(self.superuser) + def test_recordability(self): """ This tests if the recordability of the Ema is triggered by the quality of it's data (e.g. not all fields filled) diff --git a/intervention/tests/test_workflow.py b/intervention/tests/test_workflow.py index c5290503..66770977 100644 --- a/intervention/tests/test_workflow.py +++ b/intervention/tests/test_workflow.py @@ -89,6 +89,30 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase): self.assertIn(self.superuser, obj.users.all()) self.assertEqual(1, obj.users.count()) + def test_non_editable_after_recording(self): + """ Tests that the intervention can not be edited after being recorded + + User must be redirected to another page + + Returns: + + """ + self.assertIsNotNone(self.intervention) + self.assertFalse(self.intervention.is_recorded) + edit_url = reverse("intervention:edit", args=(self.intervention.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertFalse(has_redirect) + + self.intervention.set_recorded(self.user) + self.assertTrue(self.intervention.is_recorded) + + edit_url = reverse("intervention:edit", args=(self.intervention.id,)) + response = self.client_user.get(edit_url) + has_redirect = response.status_code == 302 + self.assertTrue(has_redirect) + self.intervention.set_unrecorded(self.user) + def test_checkability(self): """ Tests that the intervention can only be checked if all required data has been added -- 2.45.2