LP1996423 restore templated patron note printing collab/phasefx/lp1996423-print-note
authorJason Etheridge <jason@EquinoxOLI.org>
Fri, 11 Nov 2022 18:14:42 +0000 (13:14 -0500)
committerJason Etheridge <jason@EquinoxOLI.org>
Fri, 11 Nov 2022 18:55:55 +0000 (13:55 -0500)
Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Open-ILS/src/templates/staff/circ/patron/t_messages.tt2
Open-ILS/src/templates/staff/share/t_patron_note.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 5bc5246..e66e890 100644 (file)
@@ -15,6 +15,8 @@
     handler="editPenalty"></eg-grid-action>
   <eg-grid-action label="[% l('Archive Note') %]" 
     handler="archivePenalty"></eg-grid-action>
+  <eg-grid-action label="[% l('Print Note') %]" 
+    handler="printNote"></eg-grid-action>
 
   <eg-grid-field path="read_date"></eg-grid-field>
   <eg-grid-field path="deleted" required hidden></eg-grid-field>
@@ -59,6 +61,8 @@
 
   <eg-grid-action label="[% l('Unarchive Note') %]"
     handler="unarchivePenalty"></eg-grid-action>
+  <eg-grid-action label="[% l('Print Note') %]" 
+    handler="printNote"></eg-grid-action>
 
   <eg-grid-field path="read_date"></eg-grid-field>
   <eg-grid-field path="deleted" required hidden></eg-grid-field>
diff --git a/Open-ILS/src/templates/staff/share/t_patron_note.tt2 b/Open-ILS/src/templates/staff/share/t_patron_note.tt2
new file mode 100644 (file)
index 0000000..765343d
--- /dev/null
@@ -0,0 +1,28 @@
+<!--
+Template for printing a patron note. Fields include:
+
+* note.usr.family_name
+* note.usr.first_name
+* note.usr.second_given_name
+* note.usr.card.barcode
+* note.standing_penalty.name
+* note.staff.usrname
+* note.pub
+* note.title
+* note.message
+* note.read_date
+* note.org_unit.shortname
+* note.create_date
+
+-->
+<h3>[% l(
+  'Pertaining to [_1], [_2] [_3] : [_4]',
+  '{{note.usr.family_name}}',
+  '{{note.usr.first_given_name}}',
+  '{{note.usr.second_given_name}}',
+  '{{note.usr.card.barcode}}') %]</h3>
+
+<p>[% l('Created on [_1]', '{{note.create_date | date:$root.egDateAndTimeFormat}}') %]</p>
+<b>{{note.title}}</b>
+<br/>
+<p>{{note.message}}</p>
index fec6e90..e22a744 100644 (file)
@@ -1113,6 +1113,24 @@ function($scope , $q , $routeParams,  egCore , $uibModal , egConfirmDialog , pat
             });
         });
     }
+
+    // print the selected note
+    $scope.printNote = function(selected) {
+        if (selected.length !== 1) return;
+
+        var hash = egCore.idl.toHash(selected[0]);
+        hash.usr = egCore.idl.toHash($scope.patron());
+
+        // for backwards compatability with original stock template
+        hash.value = hash.message;
+
+        egCore.print.print({
+            context : 'default',
+            template : 'patron_note',
+            scope : {note : hash}
+        });
+    }
+
 }])