From 3c2b5d62086067ac7d2124d3e4193f7ae547b25c Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 23 Mar 2017 17:03:40 -0400 Subject: [PATCH] webstaff: warning sound for empty patron search results Signed-off-by: Jason Etheridge --- Open-ILS/web/js/ui/default/staff/circ/patron/app.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 1dc380f89b..d9a4e9c380 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -822,6 +822,9 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, home_ou : egCore.org.tree() }; + // FIXME: kludgy; used to prevent sound effect on page load for empty search + var first_run = true; + // last used patron search form element var lastFormElement; @@ -981,12 +984,21 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, ).then( function() { // hide progress bar on 0-hits searches + if ($scope.show_search_progress && ! first_run) { + egCore.audio.play('warning.patron.by_search'); + } + first_run = false; $scope.show_search_progress = false; deferred.resolve(); }, - null, // onerror + function() { // onerror + egCore.audio.play('error.patron.by_search'); + }, function(user) { // hide progress bar as soon as the first result appears. + if ($scope.show_search_progress) { + egCore.audio.play('success.patron.by_search'); + } $scope.show_search_progress = false; patronSvc.localFlesh(user); // inline patronSvc.patrons.push(user); -- 2.11.0