From 0b9319a732c91cf54486647d1eb5fba5ddc87056 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 5 Oct 2012 18:42:11 -0400 Subject: [PATCH] Acq: When invoice-building with embedded search, allow control of results list Previously, a results list could accumulate under inconsistent conditions. You'd get an accumulating results list if you were pressing enter after successful searches, but your results lists would clear if you actually clicked the Search button. Worse, searches yielding empty result sets would *appear* to clear your result list, but subsequent sucessful searches would restore what was there before. This is the "missing commit" that makes the behavior consistent and togglable. Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/templates/acq/invoice/view.tt2 | 16 +++++++++++----- Open-ILS/src/templates/acq/search/unified.tt2 | 3 +-- Open-ILS/web/js/ui/default/acq/invoice/view.js | 14 ++++++++++++-- Open-ILS/web/js/ui/default/acq/search/unified.js | 16 ++++++++++++---- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/templates/acq/invoice/view.tt2 b/Open-ILS/src/templates/acq/invoice/view.tt2 index 27f2916ae8..71708ef2e5 100644 --- a/Open-ILS/src/templates/acq/invoice/view.tt2 +++ b/Open-ILS/src/templates/acq/invoice/view.tt2 @@ -195,8 +195,14 @@ + of the following terms + ( + + ) + +
@@ -241,15 +247,15 @@
- + - [% l('Previous') %] + [% l('Previous') %] - [% l('Next') %] + [% l('Next') %] diff --git a/Open-ILS/src/templates/acq/search/unified.tt2 b/Open-ILS/src/templates/acq/search/unified.tt2 index 41b3a6018e..2e3edf724e 100644 --- a/Open-ILS/src/templates/acq/search/unified.tt2 +++ b/Open-ILS/src/templates/acq/search/unified.tt2 @@ -82,8 +82,7 @@
-
diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js index 2036f6f5ff..1add6890ac 100644 --- a/Open-ILS/web/js/ui/default/acq/invoice/view.js +++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js @@ -250,8 +250,10 @@ function doAttachPo(idx) { ); } -function performSearch(pageDir) { - clearSearchResTable(); +function performSearch(pageDir, clearFirst) { + if (clearFirst) + clearSearchResTable(); + var searchObject = termManager.buildSearchObject(); dojo.cookie('invs', base64Encode(searchObject)); dojo.cookie('invc', dojo.byId("acq-unified-conjunction").getValue()); @@ -331,8 +333,12 @@ function renderUnifiedSearch() { "no_results": { "revealer": function() { } } + }; + resultManager.no_results_popup = true; + resultManager.submitter = smartSearchSubmitter; + var searchObject = dojo.cookie('invs'); console.log('loaded ' + searchObject); if (searchObject) { @@ -1053,6 +1059,10 @@ function createExtraCopies(oncomplete) { } +function smartSearchSubmitter() { + performSearch(0, !dojo.byId('acq-unified-build-progressively').checked); +} + openils.Util.addOnLoad(init); diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js index 0dfac0a574..a6be3f0937 100644 --- a/Open-ILS/web/js/ui/default/acq/search/unified.js +++ b/Open-ILS/web/js/ui/default/acq/search/unified.js @@ -175,7 +175,7 @@ function TermSelectorFactory(terms) { dojo.connect(wStore[widgetKey], 'onkeyup', function(e) { if(e.keyCode == dojo.keys.ENTER) { - resultManager.go(termManager.buildSearchObject()); + resultManager.submitter(); } } ); @@ -204,7 +204,7 @@ function TermSelectorFactory(terms) { dojo.connect(w.domNode, 'onkeyup', function(e) { if(e.keyCode == dojo.keys.ENTER) { - resultManager.go(termManager.buildSearchObject()); + resultManager.submitter(); } } ); @@ -807,8 +807,12 @@ function ResultManager(liPager, poGrid, plGrid, invGrid) { this.liPager.focusLi(); } - if (!this.count_results) - this.show("no_results"); + if (!this.count_results) { + if (this.no_results_popup) + alert(localeStrings.NO_RESULTS); + else + this.show("no_results"); + } else this.finish(this.result_type); }; @@ -979,6 +983,10 @@ openils.Util.addOnLoad( dijit.byId("acq-unified-inv-grid") ); + resultManager.submitter = function() { + resultManager.go(termManager.buildSearchObject()); + }; + uriManager = new URIManager(); if (uriManager.search_object) { if (!uriManager.half_search) -- 2.11.0