diff --git a/README.md b/README.md index ac522c5..3773b94 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The basic generation mechanism makes the templates and routes interchangeable (i | SPONSORING_RECEIPT_MINIMUM_AMOUNT | String | "10" | The mimimum total donation amount a sponsor has to donate to be able to receive a donation receipt - used to generate pdf text. | SPONOR_LOGOS | Array | Empty png | The sponsor images you want to loop through. You can provide them via http url, local file or base64-encoded image. | API_KEY | String(min length: 64) | Random generated string | The api key you want to use for auth (query-param `key`), has to be at least 64 chars long. +| DISCLAIMER_TEXT | String | N/A | A disclaimer that will get displayed on the bottom of each sponsoring contract. R/N You can only provide the disclaimer for one language. ## Templates > The document server uses html templates to generate various pdf documents. diff --git a/src/PdfCreator.ts b/src/PdfCreator.ts index b48889e..50023e1 100644 --- a/src/PdfCreator.ts +++ b/src/PdfCreator.ts @@ -121,7 +121,7 @@ export class PdfCreator { await i18next.changeLanguage(locale); const template_source = fs.readFileSync(`${this.templateDir}/sponsoring_contract.html`, 'utf8'); const template = Handlebars.compile(template_source); - let result = template({ runners, codeformat }); + let result = template({ runners, codeformat, disclaimer: config.disclaimer_text }); result = await awaitAsyncHandlebarHelpers(result); const pdf = await this.renderPdf(result, { format: "A5", landscape: true }); return pdf diff --git a/src/config.ts b/src/config.ts index bded138..d6e2565 100644 --- a/src/config.ts +++ b/src/config.ts @@ -12,6 +12,7 @@ export const config = { codeformat: process.env.CODEFORMAT || "qrcode", sponor_logos: getSponsorLogos(), api_key: getApiKey(), + disclaimer_text: process.env.DISCLAIMER_TEXT || "", } let errors = 0 if (typeof config.internal_port !== "number") { diff --git a/src/templates/sponsoring_contract.html b/src/templates/sponsoring_contract.html index ddcad0a..13e8e15 100644 --- a/src/templates/sponsoring_contract.html +++ b/src/templates/sponsoring_contract.html @@ -68,8 +68,8 @@

{{__ "group"}}

-

{{__ "sponsoring_amount_per_distance"}}

-
+

{{__ "sponsoring_amount_per_distance"}}

+

{{__ "lastname"}}

@@ -79,9 +79,9 @@

{{__ "firstname"}}

-

{{__ "address"}} ({{__ "sponsor"}})

+

{{__ "address"}} ({{__ "sponsor"}})

({{__ "sponsoring_address_condition"}})

-
+

{{__ "street"}}

@@ -91,7 +91,7 @@

{{__ "house_number"}}

-
+

{{__ "postalcode"}}

@@ -101,8 +101,7 @@

{{__ "city"}}

-
-
+

{{__ "location"}}, {{__ "date"}}

@@ -112,6 +111,7 @@

{{__ "signature"}}

+

{{../disclaimer}}

{{/each}}