Skip to content

Commit 95a6e41

Browse files
Merge pull request #129 from ebsco/2211-cart-issue
Fixes Cart Issue
2 parents 8e6c12a + 97bf471 commit 95a6e41

6 files changed

Lines changed: 59 additions & 22 deletions

File tree

Koha/Plugin/EDS.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ my ($PluginDir) = grep { -f $_ . "/Koha/Plugin/EDS.pm" } @pluginsdir;
3030
$PluginDir = $PluginDir.'/Koha/Plugin/EDS';
3131

3232
################# DO NOT TOUCH - CONTROLLED BY build.py
33-
our $MAJOR_VERSION = "21.11";
34-
our $SUB_VERSION = "004";
33+
our $MAJOR_VERSION = "22.11";
34+
our $SUB_VERSION = "001";
3535
our $VERSION = $MAJOR_VERSION . "" . $SUB_VERSION;
3636
our $SHA_ADD = "https://widgets.ebscohost.com/prod/api/koha/sha/1711.json";
37-
our $DATE_UPDATE = '2023-04-04';
37+
our $DATE_UPDATE = '2023-08-02';
3838
######################################################
3939

4040
## Here is our metadata, some keys are required, some are optional
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- DO NOT TOUCH THIS FILE - controlled by build.py -->
33
<kohaplugin>
4-
<latestversion>21.11.004</latestversion>
4+
<latestversion>22.11.001</latestversion>
55
<download>https://github.com/ebsco/edsapi-koha-plugin</download>
6-
<lastupdated>2023/04/04</lastupdated>
6+
<lastupdated>2023/08/02</lastupdated>
77
<releasenotes>
8-
<release version="21.11.004" date="2023/04/04">
9-
<note id="1" author="cwolf@ebsco.com">Adds additional support for translations.</note>
8+
<release version="22.11.001" date="2023/08/02">
9+
<note id="1" author="mmohkamkar@ebsco.com">Fixes issue with cart not displaying.</note>
1010
</release>
1111
</releasenotes>
1212
</kohaplugin>
1 KB
Binary file not shown.

Koha/Plugin/EDS/js/EDSScript.tt

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ edsConfig.pluginhttppath = "[% PLUGIN_HTTP_PATH %]";
4141
var searchBlockCount = 3;
4242

4343
// DO NOT TOUCH - controlled by build.py
44-
var versionEDSKoha = "21.11004";
44+
var versionEDSKoha = "22.11001";
4545
///////////////////////////////////////
4646

4747
if (document.title == "") {
@@ -134,20 +134,32 @@ else { console.log('JS debug enabled') }// keep executing if there is an error.}
134134
///// Language data setup /////
135135
function getLanguage(code, callback) {
136136
// Use cache
137+
if (edsConfig.logerrors == "yes"){
138+
console.log("Running getLanguage()...");
139+
}
140+
137141
var sessionLang = eds_sessionStorage.get('lang_' + code);
138142
if (sessionLang) {
143+
if (edsConfig.logerrors == "yes"){
144+
console.log("sessionLang is already set...");
145+
}
139146
callback(sessionLang);
140147
return;
141148
// If custom language, and there's no language file for it
142149
} else if (code != 'default' && eds_sessionStorage.get('nolang_' + code)) {
150+
if (edsConfig.logerrors == "yes"){
151+
console.log("sessionLang is not set...");
152+
}
143153
getLanguage('default', callback);
144154
return;
145155
}
146156

147157
// Fetch the language file
148158
jQuery.ajax({ url: "[% PLUGIN_HTTP_PATH %]/bootstrap/includes/lang/" + code + ".inc", dataType: "script", cache: true })
149159
.done(function (data) {
150-
160+
if (edsConfig.logerrors == "yes"){
161+
console.log("Fetching language file...");
162+
}
151163
// Parse language file
152164
var langData = {};
153165
var lineData = data.split("var EDSLANG =")[1].split("\n");
@@ -159,12 +171,17 @@ function getLanguage(code, callback) {
159171
langData[key] = val;
160172
}
161173
}
162-
174+
if (edsConfig.logerrors == "yes"){
175+
console.log("langData: " + langData);
176+
}
163177
eds_sessionStorage.set('lang_' + code, langData);
164178
callback(langData);
165179

166180
// No language file, try default
167181
}).fail(function () {
182+
if (edsConfig.logerrors == "yes"){
183+
console.log("Failed to fetch language file...");
184+
}
168185
if (code == 'default') {
169186
callback(null);
170187
} else {
@@ -339,7 +356,13 @@ function ConfigData(data) {
339356

340357
if (data.defaultsearch != "off") {
341358
var currentDefaultSearchValue = eds_sessionStorage.get('defaultsearch');
359+
if (edsConfig.logerrors == "yes"){
360+
console.log("currentDefaultSearchValue : " + currentDefaultSearchValue);
361+
}
342362
if (!currentDefaultSearchValue) {
363+
if (edsConfig.logerrors == "yes"){
364+
console.log("No currentDefaultSearchValue!");
365+
}
343366
eds_sessionStorage.set('defaultsearch', data.defaultsearch);
344367
}
345368
GoDiscovery();
@@ -443,6 +466,9 @@ function SetEDSOptions(data) {
443466
}
444467

445468
function SetEDS(showInfo) {
469+
if (edsConfig.logerrors == "yes"){
470+
console.log("In SetEDS...");
471+
}
446472
jQuery('#searchform').submit(function () { return false; });
447473
jQuery('#searchsubmit').click(SearchEDS);
448474
jQuery('#masthead_search option').each(function () { jQuery(this).remove(); });
@@ -455,8 +481,10 @@ function SetEDS(showInfo) {
455481
jQuery('#transl1').removeClass('placeholder');
456482
//advSearch
457483
if (document.URL.indexOf("[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl") != -1 && QueryString('q') == "") {
484+
//console.log('koha switchtext');
458485
jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', kohaSwitchText);
459-
} else if (document.URL.indexOf("/cgi-bin/koha/opac-search.pl") != -1 && QueryString('q') == "") {
486+
} else if (document.URL.indexOf("/cgi-bin/koha/opac-search.pl") != -1 && QueryString('q') == "") {RTCEncodedVideoFrame
487+
console.log('eds switchtext');
460488
jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', edsSwitchText);
461489
jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('href', '[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl');
462490
} else {
@@ -467,12 +495,13 @@ function SetEDS(showInfo) {
467495
jQuery('#masthead_search option[value="JN"]').prop('selected', true);
468496
knownItem = "JN";
469497
}
470-
471-
EDSAutoComp();
498+
if (edsConfig.autocomplete == "yes") {
499+
EDSAutoComp();
500+
}
472501
}
473502

474503
function SetKoha(showInfo) {
475-
jQuery('#searchform').unbind('submit');
504+
jQuery('#searchform').unbind('submit');EDSAutoComp
476505
jQuery('#searchsubmit').unbind('click');
477506
jQuery('#masthead_search option').each(function () { jQuery(this).remove(); });
478507
if (showInfo) { ShowInfo(kohaSelectInfo); }
@@ -493,6 +522,9 @@ function SetKoha(showInfo) {
493522
}
494523

495524
function ShowInfo(msg) {
525+
if (edsConfig.logerrors == "yes"){
526+
console.log("In ShowInfo...");
527+
}
496528
var topPos = jQuery('#masthead_search').offset().top;
497529
var leftPos = jQuery('#masthead_search').offset().left;
498530
var cartMsg = jQuery("#cartDetails").html();
@@ -650,6 +682,9 @@ function QueryString(key) {
650682

651683
//BASKET START---------
652684
function InitCartWithEDS() {
685+
if (edsConfig.logerrors == "yes"){
686+
console.log("Cart initialized...");
687+
}
653688
jQuery('#addto').change(function () { CheckEDSRecordsforAddToList(); });
654689
jQuery('.addto input:submit').click(function () { CheckEDSRecordsforAddToList(); });
655690

@@ -664,14 +699,18 @@ function InitCartWithEDS() {
664699
}
665700

666701
async function PrepareItems() {
667-
702+
if (edsConfig.logerrors == "yes"){
703+
console.log("Running PrepareItems()...");
704+
}
668705
//Get Bib numbers from the url
669706
var recordList = document.URL;
670707
recordList = QueryString("bib_list").toString();
671708

672709
//Split bib list into array on /
673710
var recordId = recordList.split("/");
674-
711+
if (edsConfig.logerrors == "yes"){
712+
console.log(recordId);
713+
}
675714
//Iterate through all the record IDs
676715
for (var edsItemCount = 0; edsItemCount < recordId.length - 1; edsItemCount++) {
677716
//Check that it doesn't have the catalogue dbid
@@ -1248,7 +1287,6 @@ function EDSAutoComp() {
12481287
console.log("Running creds true...");
12491288
console.log("Running autocomplete...");
12501289
}
1251-
12521290
jQuery('#translControl1').autocomplete({
12531291
source: function (request, response) {
12541292
var promise = jQuery.ajax(creds.Autocomplete.Url, {
@@ -1262,7 +1300,6 @@ function EDSAutoComp() {
12621300
}])
12631301
}
12641302
});
1265-
12661303
promise.done(function (data) {
12671304
if (data.error) {
12681305
eds_sessionStorage.remove('autoComp');

version.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"MajorVersion": "21.11",
3-
"MinorVersion": "004",
2+
"MajorVersion": "22.11",
3+
"MinorVersion": "001",
44
"ReleaseNotes": [
55
{
6-
"author": "cwolf@ebsco.com",
7-
"note": "Adds additional support for translations."
6+
"author": "mmohkamkar@ebsco.com",
7+
"note": "Fixes issue with cart not displaying."
88
}
99
],
1010
"ShaAdd": "https://widgets.ebscohost.com/prod/api/koha/sha/1711.json"

0 commit comments

Comments
 (0)