mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-07-01 19:26:53 +02:00
feat: add template creation timestamps
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
"OpenDocument-Templates mit Platzhaltern, lokaler PDF-Erzeugung, Audit-Verknüpfung und Dokumentöffnung aus der Mitgliederakte ergänzt.",
|
||||
"Zentrale Vereins- und Absenderdaten sowie getrennte Mitgliedsbereiche für Anschrift, Telefon und validierte Bank-/SEPA-Daten ergänzt.",
|
||||
"Wiederholbare OpenDocument-Tabellenzeilen für beliebig viele Forderungspositionen eingeführt.",
|
||||
"Eindeutige Templatefelder für Dokument-, aktuelle und Forderungs-Erstellungszeit ergänzt.",
|
||||
"Dropdowns zeigen deutsche Begriffe bei weiterhin englischen Speicher-Keys; der Hausmeisterstatus liegt einheitlich in housekeeper.json.",
|
||||
"Mehrstufiger Mahnworkflow mit Hausmeister-Regel, Entwurf, Versandbestätigung, Zahlungsfrist, optionaler Gebühr und Mahnsperre ergänzt.",
|
||||
"Splash-Screen auf das eingebettete CCMA-Hintergrundmotiv umgestellt und redundante Titeltexte entfernt.",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<office:text>
|
||||
<text:p text:style-name="Title">{{organization.name}}</text:p>
|
||||
<text:p>{{organization.address_line}} · {{organization.email}}</text:p>
|
||||
<text:p>Erstellt am {{document.date}}</text:p>
|
||||
<text:p>Erstellt am {{document.created_date}}</text:p>
|
||||
<text:p text:style-name="Heading">Forderung: {{claim.title}}</text:p>
|
||||
<text:p>Mitglied: {{member.full_name}} ({{member.number}})</text:p>
|
||||
<text:p>E-Mail: {{member.email}}</text:p>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<office:text>
|
||||
<text:p text:style-name="Title">{{organization.name}}</text:p>
|
||||
<text:p>{{organization.address_line}} · {{organization.email}}</text:p>
|
||||
<text:p>{{document.date}}</text:p>
|
||||
<text:p>{{document.created_date}}</text:p>
|
||||
<text:p>An {{member.full_name}} ({{member.number}})</text:p>
|
||||
<text:p>{{member.address_line}}</text:p>
|
||||
<text:p text:style-name="Heading">{{reminder.name}}</text:p>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<office:body>
|
||||
<office:text>
|
||||
<text:p text:style-name="Title">{{organization.name}}</text:p>
|
||||
<text:p>Erstellt am {{document.date}}</text:p>
|
||||
<text:p>Erstellt am {{document.created_date}}</text:p>
|
||||
<text:p text:style-name="Heading">Mitgliedsdaten</text:p>
|
||||
<text:p>Name: {{member.full_name}}</text:p>
|
||||
<text:p>Mitgliedsnummer: {{member.number}}</text:p>
|
||||
|
||||
@@ -182,6 +182,9 @@ def _template_values(
|
||||
organization: dict | None = None,
|
||||
) -> tuple[dict[str, str], dict[str, list[dict[str, str]]]]:
|
||||
organization = organization or {}
|
||||
created_at = datetime.now().astimezone()
|
||||
created_date = format_date_for_display(created_at.date().isoformat())
|
||||
created_timestamp = created_at.strftime("%d.%m.%Y %H:%M")
|
||||
organization_address = " ".join(
|
||||
part
|
||||
for part in (
|
||||
@@ -192,8 +195,12 @@ def _template_values(
|
||||
if part
|
||||
)
|
||||
values = {
|
||||
"document.date": format_date_for_display(date.today().isoformat()),
|
||||
"document.datetime": datetime.now().astimezone().strftime("%d.%m.%Y %H:%M"),
|
||||
"document.date": created_date,
|
||||
"document.datetime": created_timestamp,
|
||||
"document.created_date": created_date,
|
||||
"document.created_at": created_timestamp,
|
||||
"current_date": created_date,
|
||||
"current_datetime": created_timestamp,
|
||||
"member.id": member.member_id,
|
||||
"member.number": member.member_number,
|
||||
"member.first_name": member.first_name,
|
||||
@@ -246,6 +253,10 @@ def _template_values(
|
||||
"claim.id": claim_id,
|
||||
"claim.title": str(claim.get("title", "")),
|
||||
"claim.due_date": format_date_for_display(str(claim.get("due_date", ""))),
|
||||
"claim.created_date": _display_date_from_timestamp(
|
||||
str(claim.get("created_at", ""))
|
||||
),
|
||||
"claim.created_at": _display_timestamp(str(claim.get("created_at", ""))),
|
||||
"claim.total": f"{money_text(claim_total(claim))} EUR",
|
||||
"claim.paid": f"{money_text(allocated_total(data, claim_id))} EUR",
|
||||
"claim.balance": f"{money_text(claim_balance(data, claim))} EUR",
|
||||
@@ -516,5 +527,14 @@ def _display_timestamp(value: str) -> str:
|
||||
return value[:16]
|
||||
|
||||
|
||||
def _display_date_from_timestamp(value: str) -> str:
|
||||
if not value:
|
||||
return ""
|
||||
try:
|
||||
return format_date_for_display(datetime.fromisoformat(value).date().isoformat())
|
||||
except ValueError:
|
||||
return value[:10]
|
||||
|
||||
|
||||
def _local_name(tag: str) -> str:
|
||||
return tag.rsplit("}", 1)[-1]
|
||||
|
||||
Reference in New Issue
Block a user