setting orig location to location if unset
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 7 Dec 2005 16:33:07 +0000 (16:33 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 7 Dec 2005 16:33:07 +0000 (16:33 +0000)
checking isNaN on the depth before running a search

git-svn-id: svn://svn.open-ils.org/ILS/trunk@2259 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/init.js
Open-ILS/web/opac/skin/default/js/search_bar.js

index 0c330bf..79c2fdd 100644 (file)
@@ -13,6 +13,7 @@ try{ attachEvt("common", "unload", cleanRemoteRequests);} catch(e){}
 
 function init() {
        runEvt('common','init');
+       if( getOrigLocation() == 0 ) ORIGLOC = LOCATION;
        runEvt("common", "run");
        //checkUserSkin();
        G.ui.common.now_searching.appendChild(text(findOrgUnit(getLocation()).name()));
index d472f40..0aa23d0 100644 (file)
@@ -143,6 +143,8 @@ function searchBarSubmit() {
 
        var text = G.ui.searchbar.text.value;
        if(!text || text == "") return;
+       var d   = (newSearchDepth != null) ? newSearchDepth : parseInt(_ds.options[_ds.selectedIndex].value);
+       if(isNaN(d)) d = 0;
 
        var args = {};
        args.page                               = MRESULT;
@@ -150,7 +152,7 @@ function searchBarSubmit() {
        args[PARAM_TERM]                = text;
        args[PARAM_STYPE]               = _ts.options[_ts.selectedIndex].value;
        args[PARAM_LOCATION] = newSearchLocation;
-       args[PARAM_DEPTH]               = (newSearchDepth != null) ? newSearchDepth : parseInt(_ds.options[_ds.selectedIndex].value);
+       args[PARAM_DEPTH]               = d;
        args[PARAM_FORM]                = _fs.options[_fs.selectedIndex].value;
 
        goTo(buildOPACLink(args));