Skip to content

Commit e30697b

Browse files
committed
Corrects issue with default search not getting set
1 parent afe8a43 commit e30697b

4 files changed

Lines changed: 22 additions & 19 deletions

File tree

Koha/Plugin/EDS.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ our $MAJOR_VERSION = "21.05";
3333
our $SUB_VERSION = "001";
3434
our $VERSION = $MAJOR_VERSION . "" . $SUB_VERSION;
3535
our $SHA_ADD = "https://widgets.ebscohost.com/prod/api/koha/sha/1711.json";
36-
our $DATE_UPDATE = '2021-08-16';
36+
our $DATE_UPDATE = '2021-08-17';
3737
######################################################
3838

3939
## Here is our metadata, some keys are required, some are optional

Koha/Plugin/EDS/admin/release_notes.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<kohaplugin>
44
<latestversion>21.05.001</latestversion>
55
<download>https://github.com/ebsco/edsapi-koha-plugin</download>
6-
<lastupdated>2021/08/16</lastupdated>
6+
<lastupdated>2021/08/17</lastupdated>
77
<releasenotes>
8-
<release version="21.05.001" date="2021/08/16">
8+
<release version="21.05.001" date="2021/08/17">
99
<note id="1" author="mabrahamson@ebsco.com">Compatibility updates for 21.05.</note>
1010
</release>
1111
</releasenotes>

Koha/Plugin/EDS/js/EDSScript.tt

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ var edsOptions = "";
44
var kohaOptions = "";
55
var firstTimeSearchOptions = "";
66
var edsSelectedKnownItem = "";
7-
//var defaultSearch=""; set by configure
7+
//var defaultsearch=""; set by configure
88
var browseNextPage = "";
99
var catalogueId = "";
1010
var nocorrect = "";
11-
var defaultSearch = "[% defaultsearch %]";
11+
var defaultsearch = "[% defaultsearch %]";
1212
//-configurable in plugin config
1313
var edsSwitchText = '';
1414
var kohaSwitchText = '';
@@ -27,6 +27,7 @@ var bibListLocal = 0;
2727

2828
//Config written from template
2929
edsConfig.logerrors = "[% logerrors %]";
30+
edsConfig.defaultsearch = "[% defaultsearch %]"
3031
edsConfig.iprange = "[% iprange %]";
3132
edsConfig.cookieexpiry = "[% cookieexpiry %]";
3233
edsConfig.cataloguedbid = "[% cataloguedbid %]";
@@ -210,7 +211,7 @@ $.each($.cookie('bib_list').split("/"), function () {
210211
});
211212

212213
function StartEDS(edsLang) {
213-
//console.log("Running startEDS...");
214+
console.log("Running startEDS...");
214215
if (!edsLang) {
215216
console.error("No language files found, the plugin is broken");
216217
return;
@@ -250,6 +251,7 @@ function StartEDS(edsLang) {
250251
// ConfigDefaultData();
251252
//$.getJSON('[% PLUGIN_HTTP_PATH %]/opac/eds-raw.pl' + '?' + 'q=config', function (data) { ConfigData(data); });
252253
//}
254+
console.log("Running ConfigData");
253255
ConfigData(edsConfig);
254256

255257
//$("#masthead_search").attr("disabled","disabled");
@@ -303,18 +305,19 @@ function SearchPublication(searchinTerm, pubAction) {
303305
// }
304306

305307
function ConfigData(data) {
306-
308+
console.log("ConfigData got");
309+
console.log(data);
307310
//window.edsConfig = data;
308311
eds_sessionStorage.set('edsConfig', data);
309312

310313
catalogueId = (data.cataloguedbid == "-") ? "" : data.cataloguedbid;
311314
defaultParams = (data.defaultparams == "-") ? "" : data.defaultparams;
312315

313316

314-
if (data.defaultSearch != "off") {
315-
var currentDefaultSearchValue = eds_sessionStorage.get('defaultSearch');
317+
if (data.defaultsearch != "off") {
318+
var currentDefaultSearchValue = eds_sessionStorage.get('defaultsearch');
316319
if (!currentDefaultSearchValue) {
317-
eds_sessionStorage.set('defaultSearch', data.defaultSearch)
320+
eds_sessionStorage.set('defaultsearch', data.defaultsearch)
318321
}
319322
GoDiscovery();
320323
}
@@ -349,8 +352,8 @@ function GoDiscovery() {
349352
$('#masthead_search option[value=""]').attr("selected", "selected");
350353
$("#masthead_search").change(function () {
351354
knownItem = $(this).val();
352-
if (($(this).val() == 'eds') && (eds_sessionStorage.get('defaultSearch') != 'eds')) { SetEDS(1); }// Search EDS
353-
else if (($(this).val() == '') && (eds_sessionStorage.get('defaultSearch') != 'koha')) { SetKoha(1); }// Search Koha
355+
if (($(this).val() == 'eds') && (eds_sessionStorage.get('defaultsearch') != 'eds')) { SetEDS(1); }// Search EDS
356+
else if (($(this).val() == '') && (eds_sessionStorage.get('defaultsearch') != 'koha')) { SetKoha(1); }// Search Koha
354357
});
355358

356359
if (eds_sessionStorage.get('edsKnownItems')) {
@@ -360,7 +363,7 @@ function GoDiscovery() {
360363
$.getJSON('[% PLUGIN_HTTP_PATH %]/opac/eds-raw.pl?q=knownitems', function (data) { StoreEDSOptions(data); });
361364
}
362365

363-
if (eds_sessionStorage.get('defaultSearch') == 'eds') {
366+
if (eds_sessionStorage.get('defaultsearch') == 'eds') {
364367
SetEDS(0);
365368
}
366369

@@ -382,9 +385,9 @@ function SetEDSOptions(data) {
382385
edsOptions += '<option ' + selectedItem + ' value="' + data[i].FieldCode + '">--- ' + data[i].FieldCode + ': ' + data[i].Label + '</option>';
383386
}
384387

385-
if (eds_sessionStorage.get('defaultSearch') == "eds") {
388+
if (eds_sessionStorage.get('defaultsearch') == "eds") {
386389
SetEDS(0);
387-
} else if (eds_sessionStorage.get('defaultSearch') == "koha") { SetKoha(0); }
390+
} else if (eds_sessionStorage.get('defaultsearch') == "koha") { SetKoha(0); }
388391

389392
var date = new Date();
390393
var minutes = 30;
@@ -398,7 +401,7 @@ function SetEDS(showInfo) {
398401
$('#masthead_search option').each(function () { $(this).remove(); });
399402
if (showInfo) { ShowInfo(edsSelectInfo); }
400403
$('#masthead_search').append(edsOptions);
401-
eds_sessionStorage.set('defaultSearch', 'eds');
404+
eds_sessionStorage.set('defaultsearch', 'eds');
402405
$('#transl1').val($.cookie('QueryTerm'));
403406
$('.transl1').val($.cookie('QueryTerm')); //for 314
404407
$('#searchBread').text(edsLang.search_breadcrumb + " " + $.cookie('QueryTerm'));
@@ -429,7 +432,7 @@ function SetKoha(showInfo) {
429432
$('#masthead_search').append(kohaOptions);
430433
$('#masthead_search option[value="eds"]').remove();
431434
$('#masthead_search').prepend("<option value='eds'>" + edsSwitchText + "</option>");
432-
eds_sessionStorage.set('defaultSearch', 'koha')
435+
eds_sessionStorage.set('defaultsearch', 'koha')
433436
//advSearch
434437
if (document.URL.indexOf("[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl") != -1 && QueryString('q') == "") {
435438
$('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', kohaSwitchText);
@@ -1176,7 +1179,7 @@ function EDSAutoComp() {
11761179
idx = "holdings";
11771180
}
11781181

1179-
if (eds_sessionStorage.get('defaultSearch') != "eds") {
1182+
if (eds_sessionStorage.get('defaultsearch') != "eds") {
11801183
return;
11811184
}
11821185

@@ -1226,7 +1229,7 @@ function EDSautoSearch(event, ui) {
12261229
});
12271230
}
12281231
$('body').on('click', '#translControl1', function () {
1229-
if (eds_sessionStorage.get('defaultSearch') == "eds") {
1232+
if (eds_sessionStorage.get('defaultsearch') == "eds") {
12301233
$("#translControl1").autocomplete("search");
12311234
}
12321235
});

eds_plugin_21.05001.kpz

25 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)