server templates continued
authorBill Erickson <berickxx@gmail.com>
Fri, 19 Apr 2019 15:02:18 +0000 (11:02 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 19 Apr 2019 17:31:22 +0000 (13:31 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html
Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts
Open-ILS/src/perlmods/lib/OpenILS/WWW/PrintTemplate.pm
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.server-print-templates.sql
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index d70568e..cd78d61 100644 (file)
@@ -12822,6 +12822,7 @@ SELECT  usr,
                        <field name="name" reporter:datatype="text" oils_obj:required="true"/>
                        <field name="label" reporter:datatype="text" oils_obj:required="true" oils_persist:i18n="true"/>
                        <field reporter:label="Owner" name="owner" oils_obj:required="true" reporter:datatype="link"/>
+                       <field reporter:label="Active" name="active" reporter:datatype="bool"/>
                        <field reporter:label="Locale" name="locale" reporter:datatype="link"/>
                        <field name="content_type" reporter:datatype="text"/>
                        <field name="template" reporter:datatype="text" oils_obj:required="true"/>
index 32cba62..9a95f61 100644 (file)
       </div>
       <div class="row mt-2">
         <div class="col-lg-6">
-         <h4 i18n>Template</h4>
+          <h4 i18n>
+            Template for "{{template.label()}}"
+            <span class="pl-2 text-warning" *ngIf="template.active() == 'f'">
+              (Inactive)
+            </span>
+          </h4>
          <textarea rows="30" class="form-control"
            spellcheck="false"
            [ngModel]="template.template()"
@@ -72,7 +77,7 @@
           </div>
           <h4 class="mt-3" i18n>Compiled Content</h4>
           <div class="border border-dark w-100">
-            <pre>{{compiledContent}}</pre>
+            <pre class="p-1">{{compiledContent}}</pre>
           </div>
         </div>
       </div>
index 13b8996..f5de489 100644 (file)
@@ -26,7 +26,7 @@ const SAMPLE_JSON_DATA: any = {
 };
 
 const SAMPLE_TEMPLATE_DATA: any = {
-    'address-label': {
+    patron_address: {
         patron: SAMPLE_JSON_DATA.patron,
         address: SAMPLE_JSON_DATA.address
     }
index f8209d4..79307ca 100644 (file)
@@ -128,7 +128,7 @@ sub find_template {
 
     if ($template_id) {
         # Requesting by ID, generally used for testing, 
-        # always pulls the latest value.
+        # always pulls the latest value and ignores the active flag
         return $e->retrieve_config_print_template($template_id);
     }
 
@@ -143,7 +143,8 @@ sub find_template {
         my $template = $e->search_config_print_template({
             name => $name, 
             locale => $locale, 
-            owner => $org->id
+            owner => $org->id,
+            active => 't'
         })->[0];
 
         if ($template) {
index a520ef9..aaa3f97 100644 (file)
@@ -20,6 +20,7 @@ CREATE TABLE config.print_template (
     name         TEXT NOT NULL, -- programatic name
     label        TEXT NOT NULL, -- i18n
     owner        INT NOT NULL REFERENCES actor.org_unit (id),
+    active       BOOLEAN NOT NULL DEFAULT FALSE,
     locale       TEXT REFERENCES config.i18n_locale(code) 
                  ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
     content_type TEXT NOT NULL DEFAULT 'text/html',
@@ -30,7 +31,7 @@ CREATE TABLE config.print_template (
 
 INSERT INTO config.print_template (id, name, locale, owner, label, template) 
 VALUES (
-    1, 'address-label', 'en-US',
+    1, 'patron_address', 'en-US',
     (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
     oils_i18n_gettext(1, 'Address Label', 'cpt', 'label'),
 $TEMPLATE$
index 08374b8..a86afae 100644 (file)
@@ -331,8 +331,7 @@ function($scope,  $q , $location , $filter , egCore , egNet , egUser , egAlertDi
     $scope.print_address = function(addr) {
         egCore.print.print({
             context : 'default', 
-            template: 'address-label',
-            server_hosted: true,
+            template: 'patron_address',
             scope : {
                 patron : patronSvc.current,
                 address : addr