From aece3f0f9a5b6ed89498933c87d340d45dbb1458 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 17 Aug 2020 15:13:58 -0400 Subject: [PATCH] LP1891550 Ang print context support; no-print contexts Adds support to the Angular server template admin page for forcing a print context for a given template. Adds support to the Angular print service for looking up the context of a print template when specified by name. Adds support to And and AngJS print settings interfaces for a "No-Print" context, which bypasses printing when used. Adds a new workstation setting for the Booking Capture server print template context. Signed-off-by: Bill Erickson Signed-off-by: Terran McCanna Signed-off-by: Galen Charlton --- .../src/app/share/print/print.component.ts | 28 ++++++++++++++++--- .../server/print-template.component.html | 17 +++++++++++ .../admin/server/print-template.component.ts | 21 ++++++++++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 9 ++++++ .../XXXX.data.booking-print-context.sql | 16 +++++++++++ .../admin/workstation/t_print_templates.tt2 | 1 + .../web/js/ui/default/staff/services/print.js | 6 ++++ 7 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.booking-print-context.sql diff --git a/Open-ILS/src/eg2/src/app/share/print/print.component.ts b/Open-ILS/src/eg2/src/app/share/print/print.component.ts index 6af06bd8f9..bf0fb3a6d7 100644 --- a/Open-ILS/src/eg2/src/app/share/print/print.component.ts +++ b/Open-ILS/src/eg2/src/app/share/print/print.component.ts @@ -74,12 +74,32 @@ export class PrintComponent implements OnInit { return; } + // Load the configured print context. + let promise = Promise.resolve(); + if (printReq.templateName) { + promise = this.serverStore.getItem( + 'eg.print.template_context.' + printReq.templateName) + .then(setting => { + if (setting) { + printReq.printContext = setting; + } + }); + } + this.isPrinting = true; + promise.then(_ => { - this.applyTemplate(printReq).then(() => { - // Give templates a chance to render before printing - setTimeout(() => { - this.dispatchPrint(printReq).then(_ => this.reset()); + if (printReq.printContext === 'no-print') { + console.debug('Skipping print request with No-Print context'); + this.reset(); + return; + } + + this.applyTemplate(printReq).then(() => { + // Give templates a chance to render before printing + setTimeout(() => { + this.dispatchPrint(printReq).then(__ => this.reset()); + }); }); }); } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html index 1293bc1597..517ce6353d 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html @@ -64,6 +64,23 @@ + Force Print Context: + + + + + + + + + + + + + + + +