From 9863ac34283910326a69638e527bf85765086903 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 12 May 2014 09:54:50 -0400 Subject: [PATCH] handle no-default printer scenario in print config Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/staff/admin/workstation/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index c07417620c..b0ec9aa574 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -188,7 +188,15 @@ function($scope , egCore) { .then(function(config) { $scope.printConfig = config; - if (!$scope.defaultPrinter) return; + var pname = ''; + if ($scope.defaultPrinter) { + pname = $scope.defaultPrinter.name; + + } else if ($scope.printers.length == 1) { + // if the OS does not report a default printer, but only + // one printer is available, treat it as the default. + pname = $scope.printers[0].name; + } // apply the default printer to every context which has // no printer configured. @@ -198,7 +206,7 @@ function($scope , egCore) { if (!$scope.printConfig[ctx]) { $scope.printConfig[ctx] = { context : ctx, - printer : $scope.defaultPrinter.name + printer : pname } } } -- 2.11.0