From: Bill Erickson Date: Thu, 8 Nov 2018 19:43:54 +0000 (-0500) Subject: JBAS-2101 Lost/paid show dialog on re-prints X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=16d846c579ea8c6f53ff99ef7ed98ff7e380be4a;p=working%2FEvergreen.git JBAS-2101 Lost/paid show dialog on re-prints Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 243ea9c4c6..fe8b696c5a 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -937,10 +937,33 @@ function handle_printlostpaid() { JSAN.use('util.print'); var print = new util.print('default'); + // Temporarily override the forced silent print option for lost & + // paid receipts where we /always/ want to show the print dialog. + var prefs = Components.classes['@mozilla.org/preferences-service;1'] + .getService(Components.interfaces['nsIPrefBranch']); + + var silentPrintApplied = ( + prefs.prefHasUserValue('print.always_print_silent') + && prefs.getBoolPref('print.always_print_silent') + ); + + if (silentPrintApplied) { + // Note setting the value to 'false' does not work. + prefs.clearUserPref('print.always_print_silent'); + } + print.simple(html , { no_prompt: false, content_type: 'text/html' }); + + if (silentPrintApplied) { + // Re-apply the silent print preference after the + // current thread is done. + setTimeout(function() { + prefs.setBoolPref('print.always_print_silent', true); + }); + } } } diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.js b/Open-ILS/xul/staff_client/server/patron/bill_history.js index 248eee14cc..3bd942190d 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.js @@ -440,10 +440,33 @@ function print_lostpaid_from_history() { JSAN.use('util.print'); var print = new util.print('default'); + // Temporarily override the forced silent print option for lost & + // paid receipts where we /always/ want to show the print dialog. + var prefs = Components.classes['@mozilla.org/preferences-service;1'] + .getService(Components.interfaces['nsIPrefBranch']); + + var silentPrintApplied = ( + prefs.prefHasUserValue('print.always_print_silent') + && prefs.getBoolPref('print.always_print_silent') + ); + + if (silentPrintApplied) { + // Note setting the value to 'false' does not work. + prefs.clearUserPref('print.always_print_silent'); + } + print.simple(html , { no_prompt: false, // always prompt for lost payment receipts content_type: 'text/html' }); + + if (silentPrintApplied) { + // Re-apply the silent print preference after the + // current thread is done. + setTimeout(function() { + prefs.setBoolPref('print.always_print_silent', true); + }); + } } }