Normalize invoice provision periods in PDF generation, switch admin labels between single-date and range modes, add end-to-end tests, update package and frontend bundle versions, and note the invoice lifecycle docs update.
This commit is contained in:
@@ -320,6 +320,22 @@ public class InvoiceService : IInvoiceService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts the stored Leistungsdatum / -zeitraum into the PDF admin block: German dates (legacy ISO
|
||||
/// values converted) and the label the editor shows — "Leistungsdatum" for one date,
|
||||
/// "Leistungszeitraum" for a from–to range.
|
||||
/// </summary>
|
||||
internal static void ApplyProvisionPeriod(FuchsPdf.FdsTextBlocks tb, string? provisionPeriod)
|
||||
{
|
||||
tb.ProvisionPeriod = ProvisionPeriodForDisplay(provisionPeriod).Trim();
|
||||
tb.AdminProvLabel = tb.ProvisionPeriod.Contains(" - ") || tb.ProvisionPeriod.Length == 0
|
||||
? "Leistungszeitraum" : "Leistungsdatum";
|
||||
}
|
||||
|
||||
/// <summary>Shows ISO dates (yyyy-MM-dd) saved by older editor versions as German dd.MM.yyyy.</summary>
|
||||
internal static string ProvisionPeriodForDisplay(string? period) =>
|
||||
System.Text.RegularExpressions.Regex.Replace(period ?? "", @"\b(\d{4})-(\d{2})-(\d{2})\b", "$3.$2.$1");
|
||||
|
||||
public async Task<Document> GenerateInvoicePdfAsync(FdsInvoiceData invoice, bool draft)
|
||||
{
|
||||
using var act = FuchsTelemetry.StartActivity("invoice.render");
|
||||
@@ -339,6 +355,7 @@ public class InvoiceService : IInvoiceService
|
||||
// e-invoice issue date (ERechnungMapper), see InvoiceDates / ADR 0032.
|
||||
AdminDatumValue = InvoiceDates.IssueDate(reg).ToDateTime(TimeOnly.MinValue)
|
||||
};
|
||||
ApplyProvisionPeriod(tb, reg?.getString("ProvisionPeriod"));
|
||||
var inlineImages = await ResolveInlineImagesAsync(invoice);
|
||||
var doc = await _pdf.WriteLetterAsync(tb, draft);
|
||||
doc.Info.Title = reg?.getString("InvoiceTitle") ?? "";
|
||||
|
||||
Reference in New Issue
Block a user