LP various: Make more fields available in print receipts
authorDan Pearl <dpearl@cwmars.org>
Fri, 22 Mar 2019 19:16:51 +0000 (15:16 -0400)
committerJason Stephenson <jason@sigio.com>
Mon, 16 Mar 2020 16:46:51 +0000 (12:46 -0400)
Useful fields were not available in print receipts for several reasons.
a) the documentation was incorrect; b) the value wasn't defined for
the preview mechanism; c) the data wasn't accessible when rendering the
receipt for printing.

Fixes: LP 1820741
       LP 1821047
       LP 1821399
       LP 1822836
       LP 1822869
       LP 1823071
       LP 1823197

Signed-off-by: Dan Pearl <dpearl@cwmars.org>
15 files changed:
Open-ILS/src/templates/staff/share/print_templates/t_bills_current.tt2
Open-ILS/src/templates/staff/share/print_templates/t_bills_historical.tt2
Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_pull_list.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_slip.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_transit_slip.tt2
Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2
Open-ILS/src/templates/staff/share/print_templates/t_renew.tt2
Open-ILS/src/templates/staff/share/print_templates/t_transit_slip.tt2
Open-ILS/web/js/ui/default/staff/admin/workstation/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js
Open-ILS/web/js/ui/default/staff/circ/renew/app.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index cf6df66..5cf596f 100644 (file)
@@ -18,11 +18,28 @@ to this template includes:
     patron.has_email - Whether or not the patron has an email address
     patron.has_phone - Whether or not the patron has a phone number
     pref_ versions of all name fields (e.g. pref_family_name);
-* transasctions - a list of transactions, each of which
-  contains:
+* transasctions - a list of transactions, each of which contains:
+    xact.id - Bill unique id
+    xact.title - Copy title
+    xact.copy_barcode - Copy barcode
+    xact.xact_finish - Billing finish date and time
+    xact.xact_start - Billing start date and time
     xact.summary - information about the transaction
-    xact.title - Item title
-    xact.copy_barcode - Item barcode
+      xact.summary.balance_owed - Balance owed
+      xact.summary.last_billing_note - Last billing note
+      xact.summary.last_billing_type - Last billing type
+      xact.summary.last_payment_note - Last payment note
+      xact.summary.last_payment_ts - Last payment date and time
+      xact.summary.last_payment_type - Last payment type
+      xact.summary.total_owed - Total billed
+      xact.summary.total_paid - Total paid
+      xact.summary.xact_type - Billing type
+    xact.call_number - Information about the copy
+      xact.call_number.label - Copy call number
+      xact.call_number.prefix - Copy call number prefix
+      xact.call_number.suffix - Copy call number suffix
+      xact.call_number.owning_lib.name - The owning library's name
+      xact.call_number.owning_lib.shortname - The owning library's shortname
 -->
 Welcome to {{current_location.name}}!<br/>
 You have the following bills:
index 9c66cc9..e2a844b 100644 (file)
@@ -19,25 +19,27 @@ to this template includes:
     patron.has_phone - Whether or not the patron has a phone number
     pref_ versions of all name fields (e.g. pref_family_name);
 * transasctions - a list of transactions, each of which contains:
-  xact.id - Bill unique id
-  xact.copy_barcode - Item barcode
-  xact.xact_finish - Billing finish date and time
-  xact.xact_start - Billing start date and time
-  xact.summary - Information about the transaction
-    xact.summary.balance_owed - Balance owed
-    xact.summary.last_billing_note - Last billing note
-    xact.summary.last_billing_type - Last billing type
-    xact.summary.last_payment_note - Last payment note
-    xact.summary.last_payment_ts - Last payment date and time 
-    xact.summary.last_payment_type - Last payment type
-    xact.summary.total_owed - Total billed 
-    xact.summary.total_paid - Total paid
-    xact.summary.xact_type - Billing type 
-  xact.title - Item title
+    xact.id - Bill unique id
+    xact.title - Copy title
+    xact.copy_barcode - Copy barcode
+    xact.xact_finish - Billing finish date and time
+    xact.xact_start - Billing start date and time
     xact.summary - information about the transaction
-    xact.title - Item title
-    xact.copy_barcode - Item barcode
-
+      xact.summary.balance_owed - Balance owed
+      xact.summary.last_billing_note - Last billing note
+      xact.summary.last_billing_type - Last billing type
+      xact.summary.last_payment_note - Last payment note
+      xact.summary.last_payment_ts - Last payment date and time
+      xact.summary.last_payment_type - Last payment type
+      xact.summary.total_owed - Total billed
+      xact.summary.total_paid - Total paid
+      xact.summary.xact_type - Billing type
+    xact.call_number - Information about the copy
+      xact.call_number.label - Copy call number
+      xact.call_number.prefix - Copy call number prefix
+      xact.call_number.suffix - Copy call number suffix
+      xact.call_number.owning_lib.name - The owning library's name
+      xact.call_number.owning_lib.shortname - The owning library's shortname
 -->
 Welcome to {{current_location.name}}!<br/>
 You had the following bills:
index 646c383..e617d00 100644 (file)
@@ -25,10 +25,15 @@ Template for printing checkout receipts; fields available include:
 * circulations - list of loans made during this session. Each
   includes:
 
-  * title
-  * author
-  * copy.barcode
-  * circ.due_date
+  * checkout.title
+  * checkout.author
+  * checkout.copy.barcode
+  * checkout.copy.circ_modifier.name
+  * checkout.copy.call_number.label
+  * checkout.copy.call_number.owning_lib.name
+  * checkout.copy.call_number.owning_lib.shortname
+  * checkout.circ.due_date
+  * checkout.circ.renewal_remaining
 
 -->
 <div>
index bd0586f..bec957e 100644 (file)
@@ -1,14 +1,18 @@
 <!--
 Template for printing a table of holds to pull. Fields include:
 
-* holds - list of holds, each of which includes:
+* holds - list of holds, where each hold_data includes:
 
-  * title
-  * author
-  * hold.hold_type
-  * copy.location_name
-  * volume.label - call number
-  * copy.barcode
+  * hold_data.title
+  * hold_data.author
+  * hold_data.hold.hold_type
+  * hold_data.hold.pickup_lib.shortname
+  * hold_data.hold.pickup_lib.name
+  * hold_data.copy.location_name
+  * hold_data.volume.label - call number
+  * hold_data.volume.prefix
+  * hold_data.volume.suffix
+  * hold_data.copy.barcode
 -->
 <table id='pull-list-template-table'>
   <style>
index c85ce9d..2dd1061 100644 (file)
@@ -1,15 +1,27 @@
 <!--
 Template for printing hold request slips. Fields include:
 
-* call_number.label/prefix/suffix
+<<<<<<< HEAD
 * hold.behind_desk
 * copy.barcode
+* call_number.label
+* call_number.prefix
+* call_number.suffix
+=======
+* copy.barcode
+* copy.call_number.label
+* copy.call_number.prefix.name
+* copy.call_number.suffix.name
+>>>>>>> 57e65e1... Interim commit
 * title
+
 * patron.alias
 * patron.family_name
 * patron.first_given_name
 * patron.second_given_name
 * patron.card.barcode
+
+* hold.behind_desk
 * hold.request_time
 * hold.phone_notify
 * hold.sms_notify
@@ -33,7 +45,7 @@ Template for printing hold request slips. Fields include:
   [% l('Barcode: [_1]', '{{copy.barcode}}') %]</div>
   [% l('Title: [_1]', '{{title}}') %]</div>
   <br/>
-  <div>[% l('Call Number: [_1] [_2] [_3]', '{{call_number.prefix}}', '{{call_number.label}}', '{{call_number.suffix}}') %]</div>
+  <div>[% l('Call Number: [_1] [_2] [_3]', '{{copy.call_number.prefix.name}}', '{{copy.call_number.label}}', '{{copy.call_number.suffix.name}}') %]</div>
 
   <br/>
   <br/>
index 8345af0..ebf501f 100644 (file)
@@ -11,6 +11,7 @@ Template for printing hold transit slips. Fields include:
 * dest_courier_code - from lib.courier_code library setting
 * hold.behind_desk
 * copy.barcode
+* copy.status.name - Transit copy status
 * title
 * patron.family_name
 * patron.first_given_name
index 2092ad9..681450a 100644 (file)
@@ -2,7 +2,8 @@
 Template for printing a list of items that a patron has checked out.
 Fields include:
 
-* patron - has several fields from the patron object, including a financial summary
+* patron - has several fields from the patron object, including a 
+  financial summary
 
   * first_given_name
   * second_given_name
@@ -18,13 +19,19 @@ Fields include:
   * has_email - boolean value to show/hide elements on the receipt
   * has_phone - same as has_email
 
-* circulations - list of current loans, including
+* circulations - list of current loans, including for each
+  checkout
 
-  * title
-  * author
-  * call_number.label
-  * copy.barcode
-  * circ.due_date
+  * checkout.title
+  * checkout.author
+  * checkout.circ.due_date
+  * checkout.circ.renewal_remaining
+  * checkout.copy.barcode
+  * checkout.copy.circ_modifier.name
+  * checkout.copy.call_number.label
+  * checkout.copy.call_number.owning_lib.name
+  * checkout.copy.call_number.owning_lib.shortname
+  * checkout.copy.location.name  [Shelving location]
 
 -->
 <div>
index 9d4510f..c7587e7 100644 (file)
@@ -2,10 +2,19 @@
 Template for printing a renewal receipt. Fields include:
 
 * circulations - list of renewals made during the session, including
+  for each renewal:
 
-  * title
-  * copy.barcode
-  * circ.due_date
+  * renewal.title
+  * renewal.author
+  * renewal.circ.due_date
+  * renewal.circ.renewal_remaining
+  * renewal.circ.circ_lib
+  * renewal.circ.duration
+  * renewal.copy.barcode
+  * renewal.copy.circ_modifier
+  * renewal.copy.call_number.label
+  * renewal.copy.call_number.owning_lib.name
+  * renewal.copy.call_number.owning_lib.shortname
 
 -->
 <div>
index bee4573..84dc413 100644 (file)
@@ -10,6 +10,7 @@ Template for printing a transit slip. Fields include:
 * dest_address.post_code
 * dest_courier_code - from lib.courier_code library setting
 * copy.barcode
+* copy.status.name - Transit copy status
 * title
 * author
 -->
index 9dfbc9c..cba5e9e 100644 (file)
@@ -452,22 +452,47 @@ function($scope , $q , egCore , ngToast) {
 
     var seed_copy = {
         barcode : '33434322323',
+        status : {
+            name : 'In transit'
+            };
         call_number : {
             label : '636.8 JON',
             record : {
                 simple_record : {
                     'title' : 'Test Title'
                 }
+            },
+            owning_lib : {
+                name : 'Ankers Memorial Library',
+                shortname : 'Ankers'
+            },
+            prefix : {
+               name : 'DISPLAY'
+            },
+            suffix : {
+               name : 'REF'
             }
         },
+        circ_modifier : {
+          name : 'Book'
+                },
         location : {
             name : 'General Collection'
         },
+        status : {
+            name : 'In Transit'
+        },
         // flattened versions for item status template
         // TODO - make this go away
         'call_number.label' : '636.8 JON',
         'call_number.record.simple_record.title' : 'Test Title',
-        'location.name' : 'General Colleciton'
+<<<<<<< HEAD
+        'location.name' : 'General Collection',
+        'call_number.owning_lib.name' : 'Ankers Memorial Library',
+        'call_number.owning_lib.shortname' : 'Ankers'
+=======
+        'location.name' : 'General Collection'
+>>>>>>> 5a56beb... LP1823197: Provide call number prefix and suffix on hold shelf slip
     }
 
     var one_hold = {
@@ -477,7 +502,11 @@ function($scope , $q , egCore , ngToast) {
         email_notify : 'user@example.org',
         request_time : new Date().toISOString(),
         hold_type : 'T',
-        shelf_expire_time : new Date().toISOString()
+        shelf_expire_time : new Date().toISOString(),
+        pickup_lib : {
+           name : 'Holder Public Library',
+           shortname : 'Holder'
+                     }
     }
 
     var seed_transit = {
@@ -503,31 +532,49 @@ function($scope , $q , egCore , ngToast) {
                 xact_start : new Date().toISOString(),
                 xact_finish : new Date().toISOString(),
                 summary : {
-                    xact_type : 'circulation',
+                    balance_owed : 1.00,
+                    last_billing_note : 'Test Note 1',
                     last_billing_type : 'Overdue materials',
-                    total_owed : 1.50,
                     last_payment_note : 'Test Note 1',
-                    last_payment_type : 'cash_payment',
                     last_payment_ts : new Date().toISOString(),
+                    last_payment_type : 'cash_payment',
+                    total_owed : 1.50,
                     total_paid : 0.50,
-                    balance_owed : 1.00
-                }
+                    xact_type : 'circulation'
+                    },
+                call_number : {
+                    label : 'GL 510.2',
+                    prefix : 'DISPLAY',
+                    suffix : 'YA',
+                    owning_lib : {
+                       name : 'Regina Public Library'
+                       }
+                    }
             }, {
                 id : 2,
                 xact_start : new Date().toISOString(),
                 xact_finish : new Date().toISOString(),
                 summary : {
-                    xact_type : 'circulation',
+                    balance_owed : 1.00,
+                    last_billing_note : 'Test Note 2',
                     last_billing_type : 'Overdue materials',
-                    total_owed : 2.50,
                     last_payment_note : 'Test Note 2',
-                    last_payment_type : 'credit_payment',
                     last_payment_ts : new Date().toISOString(),
+                    last_payment_type : 'credit_payment',
+                    total_owed : 1.50,
                     total_paid : 0.50,
-                    balance_owed : 2.00
+                    xact_type : 'circulation'
+                    },
+                call_number : {
+                    label : 'GL 510.2',
+                    prefix : 'DISPLAY',
+                    suffix : 'YA',
+                    owning_lib : {
+                       name : 'Regina Public Library'
+                       }
+                    }
                 }
-            }
-        ],
+           ],
 
         copy : seed_copy,
         copies : [ seed_copy ],
@@ -549,12 +596,13 @@ function($scope , $q , egCore , ngToast) {
                 circ : {
                     due_date : new Date().toISOString(),
                     circ_lib : 1,
-                    duration : '7 days'
+                    duration : '7 days',
+                    renewal_remaining : 2
                 },
                 copy : seed_copy,
                 title : seed_record.title,
                 author : seed_record.author
-            },
+            }
         ],
 
         patron_money : {
@@ -590,6 +638,11 @@ function($scope , $q , egCore , ngToast) {
         transits : [ seed_transit ],
         title : seed_record.title,
         author : seed_record.author,
+        call_number : {
+           label :  '646.5',
+           prefix : 'DISPLAY',
+           suffix : 'REF'
+           },
         patron : seed_user,
         address : seed_addr,
         dest_location : egCore.idl.toHash(egCore.org.get(egCore.auth.user().ws_ou())),
index a0dd979..ac3e778 100644 (file)
@@ -572,7 +572,7 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
                 'mbt' : ['summary', 'circulation'],
                 'circ' : ['target_copy'],
                 'acp' : ['call_number'],
-                'acn' : ['record'],
+                'acn' : ['record','owning_lib','prefix','suffix'],
                 'bre' : ['simple_record']
                 }
             },
@@ -622,8 +622,17 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
                     xact_start : xact.xact_start(),
                 }
                 if (xact.circulation()) {
-                    newXact.copy_barcode = xact.circulation().target_copy().barcode(),
-                    newXact.title = xact.circulation().target_copy().call_number().record().simple_record().title()
+                    newXact.copy_barcode = xact.circulation().target_copy().barcode();
+                    newXact.title = xact.circulation().target_copy().call_number().record().simple_record().title();
+                    newXact.call_number = {
+                        label  : xact.circulation().target_copy().call_number().label(),
+                        prefix : xact.circulation().target_copy().call_number().prefix().label(),
+                        suffix : xact.circulation().target_copy().call_number().suffix().label(),
+                        owning_lib : {
+                            name : xact.circulation().target_copy().call_number().owning_lib().name(),
+                            shortname : xact.circulation().target_copy().call_number().owning_lib().shortname()
+                                     }
+                        }
                 }
                 xacts.push(newXact);
             }
@@ -1096,7 +1105,7 @@ function($scope,  $q , egCore , patronSvc , billSvc , egPromptDialog , $location
                 'mbt' : ['summary', 'circulation'],
                 'circ' : ['target_copy'],
                 'acp' : ['call_number'],
-                'acn' : ['record'],
+                'acn' : ['record','owning_lib','prefix','suffix'],
                 'bre' : ['simple_record']
                 }
             },
@@ -1147,7 +1156,16 @@ function($scope,  $q , egCore , patronSvc , billSvc , egPromptDialog , $location
                 }
                 if (xact.circulation()) {
                     newXact.copy_barcode = xact.circulation().target_copy().barcode(),
-                    newXact.title = xact.circulation().target_copy().call_number().record().simple_record().title()
+                    newXact.title = xact.circulation().target_copy().call_number().record().simple_record().title();
+                    newXact.call_number = {
+                        label  : xact.circulation().target_copy().call_number().label(),
+                        prefix : xact.circulation().target_copy().call_number().prefix().label(),
+                        suffix : xact.circulation().target_copy().call_number().suffix().label(),
+                        owning_lib : {
+                            name : xact.circulation().target_copy().call_number().owning_lib().name(),
+                            shortname : xact.circulation().target_copy().call_number().owning_lib().shortname()
+                                     }
+                        }
                 }
                 xacts.push(newXact);
             }
index 7984b79..ca5cdf9 100644 (file)
@@ -318,7 +318,10 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc ,
                     call_number : egCore.idl.toHash(co.acn),
                     title : co.title,
                     author : co.author
-                })
+                });
+               // Flesh selected fields of this circulation
+                print_data.circulations[0].copy.call_number = 
+                    egCore.idl.toHash(co.acn);
             };
         });
 
index 26341c1..ef7ebe2 100644 (file)
@@ -376,6 +376,9 @@ function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
                 title : circ.target_copy().call_number().record().wide_display_entry().title(),
                 author : circ.target_copy().call_number().record().wide_display_entry().author()
             })
+            // Flesh selected fields of this circulation
+                print_data.circulations[0].copy.call_number = 
+                    egCore.idl.toHash(circ.target_copy().call_number());
         });
 
         print_data.patron = {
index e15dd5e..d80440d 100644 (file)
@@ -249,6 +249,11 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) {
                     title : egCore.idl.toHash(renewal.title),
                     author : egCore.idl.toHash(renewal.author)
                 });
+                // Flesh selected fields of this circulation
+                print_data.circulations[0].copy.call_number =
+                   egCore.idl.toHash(renewal.acn);
+                print_data.circulations[0].copy.owning_lib = 
+                   egCore.idl.toHash(renewal.aou);
             }
         });
 
index 64a68e1..d40eedf 100644 (file)
@@ -1812,6 +1812,27 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,  egAddCopyAl
                 call_number : egCore.idl.toHash(evt.payload.volume)
             };
 
+            // Define prefix and suffix in print_context
+                 
+            if (typeof print_context.call_number.prefix == 'object') {
+                print_context.call_number.prefix = "";
+            } else {
+                egCore.pcrud.retrieve('acnp', print_context.call_number.prefix)
+                    .then(function(p) {
+                        print_context.call_number.prefix = 
+                               egCore.idl.toHash(p).label; 
+                     })
+            }
+            if (typeof print_context.call_number.suffix == 'object') {
+                print_context.call_number.suffix = "";
+            } else {
+                egCore.pcrud.retrieve('acns', print_context.call_number.suffix)
+                    .then(function(s) {
+                        print_context.call_number.suffix = 
+                               egCore.idl.toHash(s).label; 
+                     })
+            }
+
             var acn = print_context.call_number; // fix up pre/suffixes
             if (acn.prefix == -1) acn.prefix = "";
             if (acn.suffix == -1) acn.suffix = "";