From 46e689f771b29bbdfe0b6c2b47ab2af8dd30b678 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 16 Nov 2016 00:34:06 -0500 Subject: [PATCH] webstaff: fix support of the disabled automatic print attempt type list This patch ensures that the disabled automatic print attempt type list setting is now honored. In addition, if bill payment receipts are disabled via the setting, the "Receipt on Pay" and "# Copies" widgets are not displayed on the bill payment page. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../templates/staff/circ/patron/t_bills.tt2 | 2 +- .../js/ui/default/staff/circ/patron/bills.js | 10 ++++- .../ui/default/staff/circ/patron/checkout.js | 4 +- .../js/ui/default/staff/circ/services/circ.js | 40 ++++++++++++++----- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 index 4378e32f53..fcf8012c99 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills.tt2 @@ -103,7 +103,7 @@ -
+
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js index 37c2a1845a..7c869b37e6 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js @@ -13,7 +13,7 @@ function($q , egCore , egWorkLog , patronSvc) { service.fetchBillSettings = function() { if (service.settings) return $q.when(service.settings); return egCore.org.settings( - ['ui.circ.billing.uncheck_bills_and_unfocus_payment_box','ui.circ.billing.amount_warn','ui.circ.billing.amount_limit'] + ['ui.circ.billing.uncheck_bills_and_unfocus_payment_box','ui.circ.billing.amount_warn','ui.circ.billing.amount_limit','circ.staff_client.do_not_auto_attempt_print'] ).then(function(s) {return service.settings = s}); } @@ -151,6 +151,7 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, $scope.warn_amount = 1000; $scope.max_amount = 100000; $scope.amount_verified = false; + $scope.disable_auto_print = false; // pre-define list-returning funcs in case we access them // before the grid instantiates @@ -303,7 +304,7 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, $scope.payment_type, make_payments, note, $scope.check_number) .then(function(payment_ids) { - if ($scope.receipt_on_pay) { + if (!$scope.disable_auto_print && $scope.receipt_on_pay) { printReceipt( $scope.payment_type, payment_ids, make_payments, note); } @@ -409,6 +410,11 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location, if (s['ui.circ.billing.amount_limit']) { $scope.max_amount = Number(s['ui.circ.billing.amount_limit']); } + if (s['circ.staff_client.do_not_auto_attempt_print'] && angular.isArray(s['circ.staff_client.do_not_auto_attempt_print'])) { + $scope.disable_auto_print = Boolean( + s['circ.staff_client.do_not_auto_attempt_print'].indexOf('Bill Pay') > -1 + ); + } }); $scope.gridControls.allItemsRetrieved = function() { diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index cf3c8f1104..82d6e82117 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -76,7 +76,9 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , 'circ.staff_client.do_not_auto_attempt_print' ]).then(function(settings) { printOnComplete = !Boolean( - settings['circ.staff_client.do_not_auto_attempt_print']); + angular.isArray(settings['circ.staff_client.do_not_auto_attempt_print']) && + (settings['circ.staff_client.do_not_auto_attempt_print'].indexOf('Checkout') > -1) + ); }); egCirc.get_noncat_types().then(function(list) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 753f54b5f2..a2692ead1c 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -13,16 +13,30 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, var service = { // auto-override these events after the first override auto_override_checkout_events : {}, - require_initials : false + require_initials : false, + never_auto_print : { + hold_shelf_slip : false, + hold_transit_slip : false, + transit_slip : false + } }; egCore.startup.go().finally(function() { egCore.org.settings([ 'ui.staff.require_initials.patron_standing_penalty', 'ui.admin.work_log.max_entries', - 'ui.admin.patron_log.max_entries' + 'ui.admin.patron_log.max_entries', + 'circ.staff_client.do_not_auto_attempt_print' ]).then(function(set) { service.require_initials = Boolean(set['ui.staff.require_initials.patron_standing_penalty']); + if (angular.isArray(set['circ.staff_client.do_not_auto_attempt_print'])) { + if (set['circ.staff_client.do_not_auto_attempt_print'].indexOf('Hold Slip') > 1) + service.never_auto_print['hold_shelf_slip'] = true; + if (set['circ.staff_client.do_not_auto_attempt_print'].indexOf('Hold/Transit Slip') > 1) + service.never_auto_print['hold_transit_slip'] = true; + if (set['circ.staff_client.do_not_auto_attempt_print'].indexOf('Transit Slip') > 1) + service.never_auto_print['transit_slip'] = true; + } }); }); @@ -1358,7 +1372,17 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, return service.collect_route_data(tmpl, evt, params, options) .then(function(data) { - + + var template = data.transit ? + (data.patron ? 'hold_transit_slip' : 'transit_slip') : + 'hold_shelf_slip'; + if (service.never_auto_print[template]) { + // do not show the dialog or print if the + // disabled automatic print attempt type list includes + // the specified template + return; + } + // All actions flow from the print data var print_context = { @@ -1385,11 +1409,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, if (evt.payload.hold) sound += '.hold'; egCore.audio.play(sound); - function print_transit() { - var template = data.transit ? - (data.patron ? 'hold_transit_slip' : 'transit_slip') : - 'hold_shelf_slip'; - + function print_transit(template) { return egCore.print.print({ context : 'default', template : template, @@ -1400,7 +1420,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, // when auto-print is on, skip the dialog and go straight // to printing. if (options.auto_print_holds_transits) - return print_transit(); + return print_transit(template); return $uibModal.open({ templateUrl: tmpl, @@ -1419,7 +1439,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, $scope.print = function() { $uibModalInstance.close(); - print_transit(); + print_transit(template); } }] -- 2.43.2