PDF Fusszeile und watermak mandantenfähig gemacht.
This commit is contained in:
+21
-4
@@ -276,7 +276,9 @@ function saas_fetch_tenant_settings(PDO $pdo, int $tenantId): ?array
|
||||
ts.negative_warning_cents,
|
||||
ts.pdf_show_empty_rows,
|
||||
ts.pdf_split_mode,
|
||||
ts.pdf_row_height_px
|
||||
ts.pdf_row_height_px,
|
||||
ts.pdf_watermark_text,
|
||||
ts.pdf_footer_text
|
||||
FROM tenants t
|
||||
LEFT JOIN tenant_settings ts ON ts.tenant_id = t.id
|
||||
WHERE t.id = ?
|
||||
@@ -312,6 +314,8 @@ function saas_fetch_tenant_settings(PDO $pdo, int $tenantId): ?array
|
||||
'pdf_show_empty_rows' => (int)$settings['pdf_show_empty_rows'],
|
||||
'pdf_split_mode' => (string)$settings['pdf_split_mode'],
|
||||
'pdf_row_height_px' => (int)$settings['pdf_row_height_px'],
|
||||
'pdf_watermark_text' => (string)$settings['pdf_watermark_text'],
|
||||
'pdf_footer_text' => (string)$settings['pdf_footer_text'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -327,6 +331,8 @@ function saas_update_tenant_settings(PDO $pdo, int $tenantId, array $input): arr
|
||||
$paypalUrlTemplate = trim((string)($input['paypal_url_template'] ?? ''));
|
||||
$pdfSplitMode = trim((string)($input['pdf_split_mode'] ?? 'drinking_behavior'));
|
||||
$pdfRowHeightPx = filter_var($input['pdf_row_height_px'] ?? null, FILTER_VALIDATE_INT);
|
||||
$pdfWatermarkText = trim((string)($input['pdf_watermark_text'] ?? ''));
|
||||
$pdfFooterText = trim((string)($input['pdf_footer_text'] ?? ''));
|
||||
|
||||
$errors = [];
|
||||
if (strlen($tenantName) < 3 || strlen($tenantName) > 255) {
|
||||
@@ -356,6 +362,12 @@ function saas_update_tenant_settings(PDO $pdo, int $tenantId, array $input): arr
|
||||
if (!in_array($pdfSplitMode, ['drinking_behavior', 'alphabetical'], true)) {
|
||||
$errors[] = 'Die Sortierung für den Ausdruck ist ungültig.';
|
||||
}
|
||||
if (strlen($pdfWatermarkText) > 500) {
|
||||
$errors[] = 'Der Wasserzeichen-Text im Ausdruck ist zu lang (max. 500 Zeichen).';
|
||||
}
|
||||
if (strlen($pdfFooterText) > 500) {
|
||||
$errors[] = 'Der Fußzeilen-Hinweis im Ausdruck ist zu lang (max. 500 Zeichen).';
|
||||
}
|
||||
if ($pdfRowHeightPx === false || $pdfRowHeightPx < 10 || $pdfRowHeightPx > 60) {
|
||||
$errors[] = 'Die Zeilenhöhe im Ausdruck muss zwischen 10 und 60 Pixel liegen.';
|
||||
}
|
||||
@@ -382,8 +394,9 @@ function saas_update_tenant_settings(PDO $pdo, int $tenantId, array $input): arr
|
||||
'INSERT INTO tenant_settings
|
||||
(tenant_id, mark_price_cents, self_entry_enabled, paypal_enabled,
|
||||
paypal_url_template, sheet_window_days, negative_warning_cents,
|
||||
pdf_show_empty_rows, pdf_split_mode, pdf_row_height_px)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
pdf_show_empty_rows, pdf_split_mode, pdf_row_height_px,
|
||||
pdf_watermark_text, pdf_footer_text)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
mark_price_cents = VALUES(mark_price_cents),
|
||||
self_entry_enabled = VALUES(self_entry_enabled),
|
||||
@@ -393,7 +406,9 @@ function saas_update_tenant_settings(PDO $pdo, int $tenantId, array $input): arr
|
||||
negative_warning_cents = VALUES(negative_warning_cents),
|
||||
pdf_show_empty_rows = VALUES(pdf_show_empty_rows),
|
||||
pdf_split_mode = VALUES(pdf_split_mode),
|
||||
pdf_row_height_px = VALUES(pdf_row_height_px)'
|
||||
pdf_row_height_px = VALUES(pdf_row_height_px),
|
||||
pdf_watermark_text = VALUES(pdf_watermark_text),
|
||||
pdf_footer_text = VALUES(pdf_footer_text)'
|
||||
);
|
||||
$stmt->execute([
|
||||
$tenantId,
|
||||
@@ -406,6 +421,8 @@ function saas_update_tenant_settings(PDO $pdo, int $tenantId, array $input): arr
|
||||
$pdfShowEmptyRows,
|
||||
$pdfSplitMode,
|
||||
(int)$pdfRowHeightPx,
|
||||
$pdfWatermarkText,
|
||||
$pdfFooterText,
|
||||
]);
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
Reference in New Issue
Block a user