From c0af4a6bb80429febd7fc12b04763f16d251a59a Mon Sep 17 00:00:00 2001
From: mariusrklein <47218379+mariusrklein@users.noreply.github.com>
Date: Sun, 6 Apr 2025 17:34:31 +0200
Subject: [PATCH] feat(excursion/ljp): added check for proof on bills, fixed
finance overview
---
jdav_web/finance/models.py | 5 +++++
.../admin/overview_submitted_statement.html | 1 +
jdav_web/members/admin.py | 6 ++++++
.../members/locale/de/LC_MESSAGES/django.po | 20 +++++++++++++++----
.../admin/freizeit_finance_overview.html | 15 +++++++++++++-
5 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/jdav_web/finance/models.py b/jdav_web/finance/models.py
index 86d369a..4b8c6ba 100644
--- a/jdav_web/finance/models.py
+++ b/jdav_web/finance/models.py
@@ -289,6 +289,11 @@ class Statement(CommonModel):
"""Returns the bills that are marked for reimbursement by the finance officer"""
return [bill for bill in self.bill_set.all() if bill.costs_covered]
+ @property
+ def bills_without_proof(self):
+ """Returns the bills that lack a proof file"""
+ return [bill for bill in self.bill_set.all() if not bill.proof]
+
@property
def total_bills_theoretic(self):
return sum([bill.amount for bill in self.bill_set.all()])
diff --git a/jdav_web/finance/templates/admin/overview_submitted_statement.html b/jdav_web/finance/templates/admin/overview_submitted_statement.html
index 309fa36..34d69f8 100644
--- a/jdav_web/finance/templates/admin/overview_submitted_statement.html
+++ b/jdav_web/finance/templates/admin/overview_submitted_statement.html
@@ -134,6 +134,7 @@ Once their proposal was approved, the ljp contributions of should be paid to:{%
{% endif %}
+
{% trans "Summary" %}
diff --git a/jdav_web/members/admin.py b/jdav_web/members/admin.py
index e4822df..c61fb6b 100644
--- a/jdav_web/members/admin.py
+++ b/jdav_web/members/admin.py
@@ -1230,6 +1230,12 @@ class FreizeitAdmin(CommonAdminMixin, nested_admin.NestedModelAdmin):
messages.error(request,
_("The configured recipients of the allowance don't match the regulations. Please correct this and try again."))
return HttpResponseRedirect(reverse('admin:%s_%s_change' % (self.opts.app_label, self.opts.model_name), args=(memberlist.pk,)))
+
+ if memberlist.statement.ljp_to and len(memberlist.statement.bills_without_proof) > 0:
+ messages.error(request,
+ _("The excursion is configured to claim LJP contributions. In that case, for all bills, a proof must be uploaded. Please correct this and try again."))
+ return HttpResponseRedirect(reverse('admin:%s_%s_change' % (self.opts.app_label, self.opts.model_name), args=(memberlist.pk,)))
+
memberlist.statement.submit(get_member(request))
messages.success(request,
_("Successfully submited statement. The finance department will notify you as soon as possible."))
diff --git a/jdav_web/members/locale/de/LC_MESSAGES/django.po b/jdav_web/members/locale/de/LC_MESSAGES/django.po
index c232828..ee41cf5 100644
--- a/jdav_web/members/locale/de/LC_MESSAGES/django.po
+++ b/jdav_web/members/locale/de/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2025-04-06 14:02+0200\n"
+"POT-Creation-Date: 2025-04-06 17:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -417,6 +417,14 @@ msgstr ""
"Die ausgewählten Empfänger*innen der Aufwandsentschädigung stimmen nicht mit "
"den Richtlinien überein. Bitte korrigiere das und versuche es erneut. "
+#: members/admin.py
+msgid ""
+"The excursion is configured to claim LJP contributions. In that case, for "
+"all bills, a proof must be uploaded. Please correct this and try again."
+msgstr ""
+"Für die Ausfahrt werden LJP-Zuschüsse beantragt. Dafür müssen für alle Ausgaben Belege hochgeladen werden. "
+"Bitte lade für alle Ausgaben einen Beleg hoch und versuche es erneut. "
+
#: members/admin.py
msgid ""
"Successfully submited statement. The finance department will notify you as "
@@ -1357,7 +1365,7 @@ msgid ""
" submit the LJP-Proposal within 3 weeks after your excursion and have it "
"approved by the finance office. "
msgstr ""
-"Wenn du den erstellten LJP-Antrag einreichst, erhältst du LJP-Zuschüsse.Du "
+"Wenn du den erstellten LJP-Antrag einreichst, erhältst du LJP-Zuschüsse. Du "
"hast Lehreinheiten für insgesamt %(total_seminar_days)s Seminartage und für "
"%(participant_count)s Teilnehmende dokumentiert.\n"
" Daraus ergibt sich ein auszahlbarer LJP-Zuschuss von "
@@ -1365,6 +1373,10 @@ msgstr ""
"innerhalb von 3 Wochen nach de Ausfahrt beim Jugendreferat einreichen und "
"formal genehmigt bekommen."
+#: members/templates/admin/freizeit_finance_overview.html
+msgid "The LJP contributions are configured to be paid to:"
+msgstr "Die LJP-Zuschüsse werden ausgezahlt an:"
+
#: members/templates/admin/freizeit_finance_overview.html
#, python-format
msgid ""
@@ -1381,8 +1393,8 @@ msgstr ""
"Tage für %(participant_count)s Teilnehmende, aber nicht mehr als 90%% der "
"Gesamtausgaben erhalten. Das resultiert in einem Gesamtzuschuss von "
"%(ljp_contributions)s€. Wenn du schon einen Seminarbericht erstellt hast, "
-"musst du im Tab 'Abrechnungen' noch angeben, an wen die LJP-Zuschüsse ausgezahlt "
-"werden sollen."
+"musst du im Tab 'Abrechnungen' noch angeben, an wen die LJP-Zuschüsse "
+"ausgezahlt werden sollen."
#: members/templates/admin/freizeit_finance_overview.html
msgid "Summary"
diff --git a/jdav_web/members/templates/admin/freizeit_finance_overview.html b/jdav_web/members/templates/admin/freizeit_finance_overview.html
index a7fd43c..d3dca14 100644
--- a/jdav_web/members/templates/admin/freizeit_finance_overview.html
+++ b/jdav_web/members/templates/admin/freizeit_finance_overview.html
@@ -130,9 +130,9 @@ cost plan!
{% endif %}
-{% trans "LJP contributions" %}
{% if memberlist.statement.ljp_to %}
+{% trans "LJP contributions" %}
{% blocktrans %}By submitting the given seminar report, you will receive LJP contributions. You have
@@ -141,6 +141,19 @@ cost plan!
submit the LJP-Proposal within 3 weeks after your excursion and have it approved by the finance office. {% endblocktrans %}
+
+ {% blocktrans %}The LJP contributions are configured to be paid to:{% endblocktrans %}
+
+ |
+ | {% trans "IBAN valid" %} |
+
+
+ | {{ memberlist.statement.ljp_to.name }} |
+ {{ memberlist.statement.ljp_to.iban_valid|render_bool }} |
+
+
+
+
{% else %}
{% blocktrans %}By submitting a seminar report, you may apply for LJP contributions. In this case,