Spec as follows:
Individual screens use its own settings for receipt templates
There are several XUL-based holds list that are all implemented with the same
holds.js file:
Actions for this Record -> View Holds
Patron Display -> Holds
Circulation -> Browse Hold Shelf
Circulation -> Pull List for Hold Requests
The main Print action (from the “Print” button next to the List Actions menu)
uses the same template, “holds”, for all incarnations of the interface. We will
change this behavior in holds.js (specifically in the cmd_holds_print method)
such that each interface variation will use its own template. The new templates
will be:
holds_on_bib
holds_for_patron
holds_shelf
holds_pull_list
We will keep the “holds” template for backwards compatibility and as a fallback
for when these new templates have not yet been configured. These new templates
will be stubbed in data.js (in the print_list_defaults method) so that they will
appear in the Receipt Template Editor, but by default they will not have any
defined content for their headers, footers, and line items. Instead, we will
use a new field called “inherit”, and have each new template use “holds”
(referring to the original template) as the value for their inherit fields.
So, for example, the current default ‘holds’ template is defined like this:
'holds' : {
'type' : 'holds',
'header' : 'Welcome to %LIBRARY%!<br/>\r\nYou have the following titles on hold:<hr/><ol>',
'line_item' : '<li>%title%\r\n',
'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n'
},
The new ‘holds_for_patron’ template will be defined as a peer like this:
'holds_for_patron' : {
'type' : 'holds',
'inherit' : 'holds'
},
We will modify the _print_tree method in list.js and the post_init method in
print_list_template_editor.js such that they will react to any value in a
template’s inherit field and allow it to redirect them to use the contents of
the inherited template. For this particular use-case, we only need to support
one level of indirection, but we may opt to support chains of inheritance for
future use.
We will modify the save_template method in print_list_template_editor.js so that
the inherit field for a given template will be cleared if that specific template
is saved, breaking the link and associating the displayed (and possibly edited)
header, footer, and line item with the template.
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
'line_item' : '<li>%title%\r\n',
'footer' : '</ol><hr />%SHORTNAME% %TODAY_TRIM%<br/>\r\nYou were helped by %STAFF_FIRSTNAME%<br/>\r\n<br/>\r\n'
},
+ 'holds_on_bib' : {
+ 'type' : 'holds',
+ 'inherit' : 'holds'
+ },
+ 'holds_for_patron' : {
+ 'type' : 'holds',
+ 'inherit' : 'holds'
+ },
+ 'holds_shelf' : {
+ 'type' : 'holds',
+ 'inherit' : 'holds'
+ },
+ 'holds_pull_list' : {
+ 'type' : 'holds',
+ 'inherit' : 'holds'
+ },
'hold_slip' : {
'type' : 'holds',
'header' : 'This item needs to be routed to <b>%route_to%</b>:<br/>\r\nBarcode: %item_barcode%<br/>\r\nTitle: %item_title%<br/>\r\n<br/>\r\n%hold_for_msg%<br/>\r\nBarcode: %PATRON_BARCODE%<br/>\r\nNotify by phone: %notify_by_phone%<br/>\r\nNotified by text: %notify_by_text%<br/>\r\nNotified by email: %notify_by_email%<br/>\r\n',
}
if (params.template && data.print_list_templates[ params.template ]) {
var template = data.print_list_templates[ params.template ];
+ if (template.inherit) {
+ template = data.print_list_templates[ template.inherit ];
+ // if someone wants to implement recursion later, feel free
+ }
for (var i in template) params[i] = template[i];
}
obj.wrap_in_full_retrieve(
setTimeout(
function() {
var tmp = obj.data.print_list_templates[ obj.controller.view.template_name_menu.value ];
+ if (tmp.inherit) {
+ tmp = obj.data.print_list_templates[ tmp.inherit ];
+ // if someone wants to implement recursion later, feel free
+ }
obj.controller.view.template_type_menu.value = tmp.type;
obj.controller.view.header.value = tmp.header;
obj.controller.view.line_item.value = tmp.line_item;
'command',
function(ev) {
var tmp = obj.data.print_list_templates[ ev.target.value ];
+ if (tmp.inherit) {
+ tmp = obj.data.print_list_templates[ tmp.inherit ];
+ // if someone wants to implement recursion later, feel free
+ }
obj.controller.view.template_type_menu.value = tmp.type;
obj.controller.view.header.value = tmp.header;
obj.controller.view.line_item.value = tmp.line_item;
'save_template' : function(name) {
var obj = this;
+ obj.data.print_list_templates[name].inherit = null;
obj.data.print_list_templates[name].header = obj.controller.view.header.value;
obj.data.print_list_templates[name].line_item = obj.controller.view.line_item.value;
obj.data.print_list_templates[name].footer = obj.controller.view.footer.value;
try {
JSAN.use('patron.util');
var params = {
- 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id),
- 'template' : 'holds'
+ 'patron' : patron.util.retrieve_au_via_id(ses(),obj.patron_id)
};
+ switch(obj.hold_interface_type) {
+ case 'patron':
+ params.template = 'holds_for_patron';
+ break;
+ case 'record':
+ params.template = 'holds_on_bib';
+ break;
+ case 'shelf':
+ params.template = 'holds_shelf';
+ break;
+ case 'pull':
+ default:
+ params.template = 'holds_pull_list';
+ break;
+ }
obj.list.print(params);
} catch(E) {
obj.error.standard_unexpected_error_alert('print 1',E);