#232 Payment document linkage

* adds error message on intervention view if a payment has been added but no document has been uploaded yet
* adds same check to quality checker, meaning no intervention can be recorded which has a payment but no document
* adds trigger for sending data to egon on uploading a document in case of an already existing payment
* adds translations
pull/233/head
mpeltriaux 2 years ago
parent 4e0ee7dc91
commit d7b2e933ec

@ -10,4 +10,23 @@ from konova.forms.modals import NewDocumentModalForm
class NewInterventionDocumentModalForm(NewDocumentModalForm):
document_model = InterventionDocument
document_model = InterventionDocument
def save(self, *args, **kwargs):
""" Extension of regular NewDocumentModalForm
Checks whether payments exist on the intervention and sends the data to EGON
Args:
*args ():
**kwargs ():
Returns:
"""
doc = super().save(*args, **kwargs)
if self.instance.payments.exists():
self.instance.send_data_to_egon()
return doc

@ -20,6 +20,11 @@
</div>
</div>
</div>
{% if has_payment_without_document %}
<div class="alert alert-danger mb-0">
{% trans 'You entered a payment. Please upload the legal document which defines the payment`s amount.' %}
</div>
{% endif %}
<div class="card-body scroll-300 p-2">
<table class="table table-hover">
<thead>

@ -21,8 +21,21 @@ class InterventionQualityChecker(AbstractQualityChecker):
self._check_legal_data()
self._check_compensations()
self._check_geometry()
self._check_payment_documents()
self.valid = len(self.messages) == 0
def _check_payment_documents(self):
""" Checks existence of documents in case of payments
There should be at least one legal document which defines the payment's total amount.
Returns:
"""
has_payment_without_document = self.obj.payments.exists() and not self.obj.get_documents()[1].exists()
if has_payment_without_document:
self._add_missing_attr_name(_("Documents"))
def _check_responsible_data(self):
""" Checks data quality of related Responsibility

@ -157,6 +157,8 @@ def detail_view(request: HttpRequest, id: str):
if last_checked:
last_checked_tooltip = DATA_CHECKED_PREVIOUSLY_TEMPLATE.format(last_checked.get_timestamp_str_formatted(), last_checked.user)
has_payment_without_document = intervention.payments.exists() and not intervention.get_documents()[1].exists()
context = {
"obj": intervention,
"last_checked": last_checked,
@ -168,6 +170,7 @@ def detail_view(request: HttpRequest, id: str):
"is_zb_member": in_group(_user, ZB_GROUP),
"is_ets_member": in_group(_user, ETS_GROUP),
"LANIS_LINK": intervention.get_LANIS_link(),
"has_payment_without_document": has_payment_without_document,
TAB_TITLE_IDENTIFIER: f"{intervention.identifier} - {intervention.title}",
}

Binary file not shown.

@ -43,7 +43,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-11 16:39+0200\n"
"POT-Creation-Date: 2022-11-16 13:36+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -204,7 +204,7 @@ msgstr "Geprüft"
#: compensation/templates/compensation/detail/compensation/view.html:93
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
#: compensation/templates/compensation/detail/eco_account/view.html:45
#: ema/tables.py:44 ema/templates/ema/detail/view.html:35
#: ema/tables.py:41 ema/templates/ema/detail/view.html:35
#: intervention/tables.py:44
#: intervention/templates/intervention/detail/view.html:87
#: user/models/user_action.py:22
@ -357,7 +357,7 @@ msgid "Show only unrecorded"
msgstr "Nur unverzeichnete anzeigen"
#: compensation/forms/compensation.py:30 compensation/tables/compensation.py:23
#: compensation/tables/eco_account.py:23 ema/tables.py:29
#: compensation/tables/eco_account.py:23 ema/tables.py:26
#: intervention/forms/intervention.py:29 intervention/tables.py:23
#: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier"
@ -376,12 +376,12 @@ msgstr "Automatisch generiert"
#: compensation/templates/compensation/detail/eco_account/view.html:32
#: compensation/templates/compensation/report/compensation/report.html:12
#: compensation/templates/compensation/report/eco_account/report.html:12
#: ema/tables.py:34 ema/templates/ema/detail/includes/documents.html:28
#: ema/tables.py:31 ema/templates/ema/detail/includes/documents.html:28
#: ema/templates/ema/detail/view.html:31
#: ema/templates/ema/report/report.html:12
#: intervention/forms/intervention.py:41 intervention/tables.py:28
#: intervention/templates/intervention/detail/includes/compensations.html:33
#: intervention/templates/intervention/detail/includes/documents.html:28
#: intervention/templates/intervention/detail/includes/documents.html:33
#: intervention/templates/intervention/detail/view.html:31
#: intervention/templates/intervention/report/report.html:12
#: konova/forms/modals/document_form.py:24
@ -411,7 +411,7 @@ msgstr "Kompensation XY; Flur ABC"
#: ema/templates/ema/detail/includes/documents.html:34
#: intervention/forms/intervention.py:199
#: intervention/forms/modals/revocation.py:45
#: intervention/templates/intervention/detail/includes/documents.html:34
#: intervention/templates/intervention/detail/includes/documents.html:39
#: intervention/templates/intervention/detail/includes/payments.html:34
#: intervention/templates/intervention/detail/includes/revocation.html:38
#: konova/forms/modals/document_form.py:59
@ -473,13 +473,15 @@ msgstr "Neues Ökokonto"
msgid "Eco-Account XY; Location ABC"
msgstr "Ökokonto XY; Flur ABC"
#: compensation/forms/eco_account.py:141
#: compensation/forms/eco_account.py:143
msgid "Edit Eco-Account"
msgstr "Ökokonto bearbeiten"
#: compensation/forms/eco_account.py:224
#: compensation/forms/eco_account.py:228
msgid "The account can not be removed, since there are still deductions."
msgstr "Das Ökokonto kann nicht entfernt werden, da hierzu noch Abbuchungen vorliegen."
msgstr ""
"Das Ökokonto kann nicht entfernt werden, da hierzu noch Abbuchungen "
"vorliegen."
#: compensation/forms/mixins.py:37
#: compensation/templates/compensation/detail/eco_account/view.html:63
@ -754,54 +756,42 @@ msgstr ""
"wollen. Kontaktieren Sie die für die Abbuchungen verantwortlichen Nutzer!"
#: compensation/tables/compensation.py:33 compensation/tables/eco_account.py:33
#: ema/tables.py:39 intervention/tables.py:33
#: ema/tables.py:36 intervention/tables.py:33
#: konova/filters/mixins/geo_reference.py:42
msgid "Parcel gmrkng"
msgstr "Gemarkung"
#: compensation/tables/compensation.py:50 compensation/tables/eco_account.py:54
#: ema/tables.py:50 intervention/tables.py:50
#: ema/tables.py:47 intervention/tables.py:50
msgid "Editable"
msgstr "Freigegeben"
#: compensation/tables/compensation.py:56 compensation/tables/eco_account.py:60
#: ema/tables.py:56 intervention/tables.py:56
#: ema/tables.py:53 intervention/tables.py:56
msgid "Last edit"
msgstr "Zuletzt bearbeitet"
#: compensation/tables/compensation.py:87 compensation/tables/eco_account.py:92
#: ema/tables.py:89 intervention/tables.py:87
#: ema/tables.py:86 intervention/tables.py:87
msgid "Open {}"
msgstr "Öffne {}"
#: compensation/tables/compensation.py:163
#: compensation/tables/compensation.py:141
#: compensation/templates/compensation/detail/compensation/view.html:96
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:58
#: compensation/templates/compensation/detail/eco_account/view.html:48
#: ema/tables.py:130 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:161
#: ema/tables.py:105 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:139
#: intervention/templates/intervention/detail/view.html:90
msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet"
#: compensation/tables/compensation.py:166
#: compensation/tables/eco_account.py:153 ema/tables.py:133
#: intervention/tables.py:164
#: compensation/tables/compensation.py:144
#: compensation/tables/eco_account.py:131 ema/tables.py:108
#: intervention/tables.py:142
msgid "Recorded on {} by {}"
msgstr "Am {} von {} verzeichnet worden"
#: compensation/tables/compensation.py:186
#: compensation/tables/eco_account.py:175 ema/tables.py:154
#: intervention/tables.py:185
msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: compensation/tables/compensation.py:186
#: compensation/tables/eco_account.py:175 ema/tables.py:154
#: intervention/tables.py:185
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables/eco_account.py:38
#: compensation/templates/compensation/detail/eco_account/view.html:36
#: konova/templates/konova/widgets/progressbar.html:3
@ -812,7 +802,7 @@ msgstr "Verfügbar"
msgid "Eco Accounts"
msgstr "Ökokonten"
#: compensation/tables/eco_account.py:150
#: compensation/tables/eco_account.py:128
msgid "Not recorded yet. Can not be used for deductions, yet."
msgstr ""
"Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden."
@ -861,7 +851,7 @@ msgstr "Menge"
#: ema/templates/ema/detail/includes/states-before.html:40
#: intervention/templates/intervention/detail/includes/compensations.html:38
#: intervention/templates/intervention/detail/includes/deductions.html:39
#: intervention/templates/intervention/detail/includes/documents.html:39
#: intervention/templates/intervention/detail/includes/documents.html:44
#: intervention/templates/intervention/detail/includes/payments.html:39
#: intervention/templates/intervention/detail/includes/revocation.html:43
#: templates/log.html:10 user/templates/user/team/index.html:33
@ -995,7 +985,7 @@ msgstr "Neues Dokument hinzufügen"
#: compensation/templates/compensation/detail/compensation/includes/documents.html:31
#: 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
#: intervention/templates/intervention/detail/includes/documents.html:36
#: konova/forms/modals/document_form.py:34
msgid "Created on"
msgstr "Erstellt"
@ -1003,7 +993,7 @@ msgstr "Erstellt"
#: compensation/templates/compensation/detail/compensation/includes/documents.html:63
#: 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
#: intervention/templates/intervention/detail/includes/documents.html:70
#: konova/forms/modals/document_form.py:139
msgid "Edit document"
msgstr "Dokument bearbeiten"
@ -1011,7 +1001,7 @@ msgstr "Dokument bearbeiten"
#: compensation/templates/compensation/detail/compensation/includes/documents.html:66
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:64
#: ema/templates/ema/detail/includes/documents.html:64
#: intervention/templates/intervention/detail/includes/documents.html:68
#: intervention/templates/intervention/detail/includes/documents.html:73
msgid "Remove document"
msgstr "Dokument löschen"
@ -1287,8 +1277,8 @@ msgid "Compensation {} edited"
msgstr "Kompensation {} bearbeitet"
#: compensation/views/compensation/compensation.py:185
#: compensation/views/eco_account/eco_account.py:159 ema/views/ema.py:211
#: intervention/views/intervention.py:225
#: compensation/views/eco_account/eco_account.py:159 ema/views/ema.py:210
#: intervention/views/intervention.py:228
msgid "Edit {}"
msgstr "Bearbeite {}"
@ -1314,7 +1304,7 @@ msgstr "Ökokonto {} bearbeitet"
msgid "Eco-account removed"
msgstr "Ökokonto entfernt"
#: ema/forms.py:42 ema/views/ema.py:94
#: ema/forms.py:42 ema/views/ema.py:93
msgid "New EMA"
msgstr "Neue EMA hinzufügen"
@ -1322,11 +1312,11 @@ msgstr "Neue EMA hinzufügen"
msgid "Edit EMA"
msgstr "Bearbeite EMA"
#: ema/tables.py:65 templates/navbars/navbar.html:43
#: ema/tables.py:62 templates/navbars/navbar.html:43
msgid "Payment funded compensations"
msgstr "Ersatzzahlungsmaßnahmen (EMA)"
#: ema/tables.py:66
#: ema/tables.py:63
msgid "EMA explanation"
msgstr ""
"EMA sind Kompensationen, die durch Ersatzzahlungen finanziert wurden. "
@ -1334,7 +1324,7 @@ msgstr ""
"Maßnahmen aus Ersatzzahlungen, die nach 2015 rechtskräftig wurden, werden "
"durch die Stiftung Natur und Umwelt verwaltet."
#: ema/tables.py:89 templates/navbars/navbar.html:43
#: ema/tables.py:86 templates/navbars/navbar.html:43
msgid "EMA"
msgstr ""
@ -1342,19 +1332,19 @@ msgstr ""
msgid "Payment funded compensation"
msgstr "Ersatzzahlungsmaßnahme"
#: ema/views/ema.py:51
#: ema/views/ema.py:50
msgid "EMAs - Overview"
msgstr "EMAs - Übersicht"
#: ema/views/ema.py:84
#: ema/views/ema.py:83
msgid "EMA {} added"
msgstr "EMA {} hinzugefügt"
#: ema/views/ema.py:201
#: ema/views/ema.py:200
msgid "EMA {} edited"
msgstr "EMA {} bearbeitet"
#: ema/views/ema.py:235
#: ema/views/ema.py:234
msgid "EMA removed"
msgstr "EMA entfernt"
@ -1564,6 +1554,13 @@ msgstr "Ökokonto gelöscht! Abbuchung ungültig!"
msgid "Eco-account not recorded! Deduction invalid!"
msgstr "Ökokonto nicht verzeichnet! Abbuchung ungültig!"
#: intervention/templates/intervention/detail/includes/documents.html:25
msgid ""
"You entered a payment. Please upload the legal document which defines the "
"payment`s amount."
msgstr ""
"Sie haben Ersatzzahlungen angegeben. Laden Sie bitte den Zahlungsbescheid als Dokument hoch."
#: intervention/templates/intervention/detail/includes/payments.html:8
#: intervention/templates/intervention/report/report.html:69
msgid "Payments"
@ -1648,11 +1645,11 @@ msgstr "Eingriffe - Übersicht"
msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt"
#: intervention/views/intervention.py:213
#: intervention/views/intervention.py:216
msgid "Intervention {} edited"
msgstr "Eingriff {} bearbeitet"
#: intervention/views/intervention.py:250
#: intervention/views/intervention.py:253
msgid "{} removed"
msgstr "{} entfernt"
@ -1686,7 +1683,7 @@ msgid "Search for file number"
msgstr "Nach Aktenzeichen suchen"
#: konova/filters/mixins/geo_reference.py:29
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:18
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:19
msgid "District"
msgstr "Kreis"
@ -1699,7 +1696,7 @@ msgid "Search for parcel gmrkng"
msgstr "Nach Gemarkung suchen"
#: konova/filters/mixins/geo_reference.py:55
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:39
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:40
msgid "Parcel"
msgstr "Flur"
@ -1708,7 +1705,7 @@ msgid "Search for parcel"
msgstr "Nach Flur suchen"
#: konova/filters/mixins/geo_reference.py:68
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:40
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:41
msgid "Parcel counter"
msgstr "Flurstückzähler"
@ -1717,7 +1714,7 @@ msgid "Search for parcel counter"
msgstr "Nach Flurstückzähler suchen"
#: konova/filters/mixins/geo_reference.py:82
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:41
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:42
msgid "Parcel number"
msgstr "Flurstücknenner"
@ -1873,37 +1870,37 @@ msgstr ""
msgid "English"
msgstr ""
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:5
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:6
msgid "Parcels can not be calculated, since no geometry is given."
msgstr ""
"Flurstücke können nicht berechnet werden, da keine Geometrie eingegeben "
"wurde."
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:11
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:12
msgid "Parcels found"
msgstr "Flurstücke"
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:16
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:17
msgid "Municipal"
msgstr "Gemeinde"
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:17
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:18
msgid "Municipal key"
msgstr "Gemeindeschlüssel"
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:19
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:20
msgid "District key"
msgstr "Kreisschlüssel"
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:37
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:38
msgid "Parcel group"
msgstr "Gemarkung"
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:38
#: konova/templates/konova/includes/parcels/parcel_table_frame.html:39
msgid "Parcel group key"
msgstr "Gemarkungsschlüssel"
#: konova/templates/konova/includes/parcels/parcels.html:7
#: konova/templates/konova/includes/parcels/parcels.html:9
msgid "Spatial reference"
msgstr "Raumreferenz"
@ -1951,39 +1948,39 @@ msgstr "In Zwischenablage kopiert"
msgid "Search"
msgstr "Suchen"
#: konova/utils/mailer.py:68 konova/utils/mailer.py:137
#: konova/utils/mailer.py:68 konova/utils/mailer.py:143
msgid "{} - Shared access removed"
msgstr "{} - Zugriff entzogen"
#: konova/utils/mailer.py:91 konova/utils/mailer.py:114
#: konova/utils/mailer.py:91 konova/utils/mailer.py:117
msgid "{} - Shared access given"
msgstr "{} - Zugriff freigegeben"
#: konova/utils/mailer.py:160 konova/utils/mailer.py:302
#: konova/utils/mailer.py:169 konova/utils/mailer.py:317
msgid "{} - Shared data unrecorded"
msgstr "{} - Freigegebene Daten entzeichnet"
#: konova/utils/mailer.py:183 konova/utils/mailer.py:279
#: konova/utils/mailer.py:195 konova/utils/mailer.py:294
msgid "{} - Shared data recorded"
msgstr "{} - Freigegebene Daten verzeichnet"
#: konova/utils/mailer.py:206 konova/utils/mailer.py:348
#: konova/utils/mailer.py:221 konova/utils/mailer.py:363
msgid "{} - Shared data checked"
msgstr "{} - Freigegebene Daten geprüft"
#: konova/utils/mailer.py:233 konova/utils/mailer.py:376
#: konova/utils/mailer.py:248 konova/utils/mailer.py:391
msgid "{} - Deduction changed"
msgstr "{} - Abbuchung geändert"
#: konova/utils/mailer.py:256 konova/utils/mailer.py:325
#: konova/utils/mailer.py:271 konova/utils/mailer.py:340
msgid "{} - Shared data deleted"
msgstr "{} - Freigegebene Daten gelöscht"
#: konova/utils/mailer.py:397 templates/email/api/verify_token.html:4
#: konova/utils/mailer.py:412 templates/email/api/verify_token.html:4
msgid "Request for new API token"
msgstr "Anfrage für neuen API Token"
#: konova/utils/mailer.py:420
#: konova/utils/mailer.py:435
msgid "Resubmission - {}"
msgstr "Wiedervorlage - {}"
@ -2225,7 +2222,15 @@ msgstr "{} wurde erfolgreich vom Nutzer {} geprüft! {}"
msgid "missing"
msgstr "fehlend"
#: konova/views/home.py:78 templates/navbars/navbar.html:16
#: konova/utils/tables.py:218
msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: konova/utils/tables.py:218
msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: konova/views/home.py:79 templates/navbars/navbar.html:16
msgid "Home"
msgstr "Home"
@ -2670,7 +2675,7 @@ msgstr ""
msgid "User"
msgstr "Nutzer"
#: templates/map/geom_form.html:9
#: templates/map/geom_form.html:11 templates/table/gmrkng_col.html:4
msgid "No geometry added, yet."
msgstr "Keine Geometrie vorhanden"
@ -2725,7 +2730,7 @@ msgstr ""
"vorbei. \n"
" "
#: templates/table/gmrkng_col.html:6
#: templates/table/gmrkng_col.html:12
msgid ""
"If the geometry is not empty, the parcels are currently recalculated. Please "
"refresh this page in a few moments."
@ -2897,35 +2902,27 @@ msgstr ""
" "
#: user/templates/user/index.html:42
msgid "Change default configuration for your KSP map"
msgstr "Karteneinstellungen ändern"
#: user/templates/user/index.html:45
msgid "Map settings"
msgstr "Karte"
#: user/templates/user/index.html:50
msgid "Change notification configurations"
msgstr "Benachrichtigungseinstellungen ändern"
#: user/templates/user/index.html:53
#: user/templates/user/index.html:45
msgid "Notification settings"
msgstr "Benachrichtigungen"
#: user/templates/user/index.html:58
#: user/templates/user/index.html:50
msgid "Manage teams"
msgstr ""
#: user/templates/user/index.html:61 user/templates/user/team/index.html:19
#: user/templates/user/index.html:53 user/templates/user/team/index.html:19
#: user/views.py:171
msgid "Teams"
msgstr ""
#: user/templates/user/index.html:66
#: user/templates/user/index.html:58
msgid "See or edit your API token"
msgstr "API token einsehen oder neu generieren"
#: user/templates/user/index.html:69
#: user/templates/user/index.html:61
msgid "API"
msgstr ""
@ -4508,6 +4505,12 @@ msgstr ""
msgid "Unable to connect to qpid with SASL mechanism %s"
msgstr ""
#~ msgid "Change default configuration for your KSP map"
#~ msgstr "Karteneinstellungen ändern"
#~ msgid "Map settings"
#~ msgstr "Karte"
#~ msgid "There are errors on this intervention:"
#~ msgstr "Es liegen Fehler in diesem Eingriff vor:"

Loading…
Cancel
Save