From: Jason Etheridge Date: Fri, 2 Mar 2012 16:45:53 +0000 (-0500) Subject: lp944947, receipt template per hold list interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a0fdeb77d15a979d80d3f4ea2e83c3e46cfe4157;p=contrib%2FConifer.git lp944947, receipt template per hold list interface 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%!
\r\nYou have the following titles on hold:
    ', 'line_item' : '
  1. %title%\r\n', 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\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 Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index d6e79a71b0..cf31b799b7 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -444,6 +444,22 @@ OpenILS.data.prototype = { 'line_item' : '
  • %title%\r\n', 'footer' : '
    %SHORTNAME% %TODAY_TRIM%
    \r\nYou were helped by %STAFF_FIRSTNAME%
    \r\n
    \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 %route_to%:
    \r\nBarcode: %item_barcode%
    \r\nTitle: %item_title%
    \r\n
    \r\n%hold_for_msg%
    \r\nBarcode: %PATRON_BARCODE%
    \r\nNotify by phone: %notify_by_phone%
    \r\nNotified by text: %notify_by_text%
    \r\nNotified by email: %notify_by_email%
    \r\n', diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index f62e10fdbe..605bc44101 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -1408,6 +1408,10 @@ util.list.prototype = { } 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( diff --git a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js index c4d461f33c..bdb72790fb 100644 --- a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js +++ b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js @@ -105,6 +105,10 @@ circ.print_list_template_editor.prototype = { 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; @@ -307,6 +311,10 @@ circ.print_list_template_editor.prototype = { '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; @@ -397,6 +405,7 @@ circ.print_list_template_editor.prototype = { '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; diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index 9ba18a63be..ccee8c9167 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -395,9 +395,23 @@ patron.holds.prototype = { 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);