From 878333baf16ba0021098f50a9263f1cce45dfbea Mon Sep 17 00:00:00 2001
From: Bill Erickson <berickxx@gmail.com>
Date: Mon, 5 Aug 2019 10:44:55 -0400
Subject: [PATCH] LP1830391 Hatch core mod import/export repairs

No need to import/export HatchService from the base common module since
it's now a core service which is exported automatically to root.

Includes minor lint repair.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Boyer <JBoyer@eoli.info>
---
 Open-ILS/src/eg2/src/app/common.module.ts               |  2 --
 Open-ILS/src/eg2/src/app/share/print/print.component.ts | 12 ++++++------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/Open-ILS/src/eg2/src/app/common.module.ts b/Open-ILS/src/eg2/src/app/common.module.ts
index ab41d5a155..56eddab1eb 100644
--- a/Open-ILS/src/eg2/src/app/common.module.ts
+++ b/Open-ILS/src/eg2/src/app/common.module.ts
@@ -14,7 +14,6 @@ They do not have to be added to the providers list.
 */
 
 // consider moving these to core...
-import {HatchService} from '@eg/share/print/hatch.service';
 import {HtmlToTxtService} from '@eg/share/util/htmltotxt.service';
 import {PrintService} from '@eg/share/print/print.service';
 
@@ -81,7 +80,6 @@ export class EgCommonModule {
             ngModule: EgCommonModule,
             providers: [
                 HtmlToTxtService,
-                HatchService,
                 PrintService,
                 ToastService
             ]
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 91341de14d..708ebf3fd6 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
@@ -28,8 +28,6 @@ export class PrintComponent implements OnInit {
 
     printQueue: PrintRequest[];
 
-    useHatch: boolean;
-
     constructor(
         private renderer: Renderer2,
         private elm: ElementRef,
@@ -50,9 +48,6 @@ export class PrintComponent implements OnInit {
 
         this.htmlContainer =
             this.renderer.selectRootElement('#eg-print-html-container');
-
-        this.serverStore.getItem('eg.hatch.enable.printing')
-            .then(use => this.useHatch = use);
     }
 
     handlePrintRequest(printReq: PrintRequest) {
@@ -171,7 +166,7 @@ export class PrintComponent implements OnInit {
             show_dialog: printReq.showDialog
         });
 
-        if (this.useHatch) {
+        if (this.useHatch()) {
             this.printViaHatch(printReq);
         } else {
             // Here the needed HTML is already in the page.
@@ -179,6 +174,11 @@ export class PrintComponent implements OnInit {
         }
     }
 
+    useHatch(): boolean {
+        return this.store.getLocalItem('eg.hatch.enable.printing')
+            && this.hatch.connect();
+    }
+
     printViaHatch(printReq: PrintRequest) {
         if (!printReq.contentType) {
             printReq.contentType = 'text/html';
-- 
2.11.0