Skip to content

Commit 8f5f828

Browse files
authored
Merge pull request #143 from ebsco/upgrade-to-24.11
Upgrade to 24.11
2 parents 6b61c4c + 6d89363 commit 8f5f828

11 files changed

Lines changed: 341 additions & 29 deletions

File tree

Koha/Plugin/EDS.pm

Lines changed: 2 additions & 2 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 = "24.05";
33+
our $MAJOR_VERSION = "24.11";
3434
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 = '2025-03-24';
37+
our $DATE_UPDATE = '2025-04-03';
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>24.05.001</latestversion>
4+
<latestversion>24.11.001</latestversion>
55
<download>https://github.com/ebsco/edsapi-koha-plugin</download>
6-
<lastupdated>2025/03/24</lastupdated>
6+
<lastupdated>2025/04/03</lastupdated>
77
<releasenotes>
8-
<release version="24.05.001" date="2025/03/24">
9-
<note id="1" author="omuzzy@ebsco.com">Upgrading EDS API Koha plugin to support Koha 24.05</note>
8+
<release version="24.11.001" date="2025/04/03">
9+
<note id="1" author="omuzzy@ebsco.com">Upgrading EDS API Koha plugin to support Koha 24.11</note>
1010
</release>
1111
</releasenotes>
1212
</kohaplugin>

Koha/Plugin/EDS/bootstrap/includes/eds-publicationexactmatch.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ function SearchWithinPublication(searchinTerm){
6060
}
6161
function checkChar(e)
6262
{
63-
var charCode;
63+
var charCode;
6464
if(e && e.which)
6565
{
6666
charCode = e.which;
6767
}
68-
console.log(charCode);
6968
if (charCode == 13)
7069
{
71-
SearchWithinPublication(jQuery('#search-within-publication').val());
70+
e.preventDefault();
71+
SearchWithinPublication(jQuery('#search-within-publication').val());
7272
}
7373
}
7474
</script>

Koha/Plugin/EDS/bootstrap/modules/eds-detail.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@
10451045
[% END # / IF Babeltheque %]
10461046
</div> <!-- /.span8 -->
10471047

1048-
<div class="span3">
1048+
<div class="col-lg-3">
10491049
<div id="ulactioncontainer">
10501050

10511051
[% IF ( OpacBrowseResults && busc ) %]

Koha/Plugin/EDS/bootstrap/modules/eds-results.tt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
[% query_error %]
137137
</div>
138138
[% END %]
139-
<div id="floating">
139+
<div id="floating" class="sticky">
140140
<div id="toolbar" class="toolbar row align-items-center">
141141
<div id="top-pages" class="col">[% INCLUDE "$plugin_dir/includes/eds-page-numbers.inc" %]</div>
142142
</div> <!-- / #selections-toolbar -->
@@ -476,7 +476,6 @@
476476
[% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") | $raw %][% END %]
477477
[% IF ( RecordedBooksEnabled ) %][% Asset.js("js/recordedbooks.js") | $raw %][% END %]
478478
[% Asset.js("js/authtoresults.js") | $raw %]
479-
[% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %]
480479
[% IF ( OpacHighlightedWords ) %]
481480
[% Asset.js("lib/jquery/plugins/jquery.highlight-5.js") | $raw %]
482481
[% END %]
@@ -626,7 +625,7 @@
626625
param1 += "<select class=\"disabled\" name=\"addto\" id=\"addto\">";
627626

628627
[% IF Koha.Preference( 'opacbookbag' ) == 1 %]
629-
param1 += "<option value=\"addtocart\">"+_("[%EDSLANG.results_cart%]")+"<\/option>";
628+
param1 += "<option value=\"addtocart\">"+_("[%EDSLANG.eds_results_TT_add_cart%]")+"<\/option>";
630629
[% END %]
631630
/*
632631
[% IF Koha.Preference('virtualshelves') %]
@@ -881,15 +880,6 @@
881880
$("input.newtag").on('keydown', function(e){
882881
if (e.keyCode == 13) { e.preventDefault(); }
883882
});
884-
885-
if (document.querySelector('.searchresults')){
886-
Sticky = $("#floating");
887-
Sticky.hcSticky({
888-
stickTo: ".searchresults",
889-
stickyClass: "floating"
890-
});
891-
}
892-
893883
});
894884
</script>
895885
[% END %]

Koha/Plugin/EDS/css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,9 @@ searchlink {
315315

316316
div.results_summary.actions.links{
317317
white-space: normal;
318+
}
319+
320+
#published-date::placeholder {
321+
font-style: normal;
322+
text-align: center;
318323
}

Koha/Plugin/EDS/js/EDSScript.tt

Lines changed: 5 additions & 5 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 = "24.05001";
44+
var versionEDSKoha = "24.11001";
4545
///////////////////////////////////////
4646

4747
if (document.title == "") {
@@ -735,7 +735,7 @@ async function PrepareItems() {
735735
//If we have any EDS items, we need to add the loader
736736
if (EDSItems > 0) {
737737
jQuery('.send').hide();
738-
jQuery('#download_cart').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2405/opac-downloadcart.pl');
738+
jQuery('#download_cart').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2411/opac-downloadcart.pl');
739739
jQuery('#download_cart').prop('method', 'POST');
740740
jQuery('#download-cart').hide();
741741
jQuery('.print-large, .print').attr('onclick', ''); // .print for prog
@@ -885,7 +885,7 @@ function SetEDSCartField() {
885885
//Use the EDS version of sendbasket
886886

887887
if (jQuery('#sendbasketform')) {
888-
jQuery('#sendbasketform').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2405/opac-sendbasket.pl');
888+
jQuery('#sendbasketform').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2411/opac-sendbasket.pl');
889889
}
890890
//GET record list from URL and split into array on /
891891
var recordList = document.URL;
@@ -924,7 +924,7 @@ function sendBasket() { // override function in basket.js
924924
var valCookie = readCookie(nameCookie);
925925
var strCookie = nameCookie + "=" + valCookie;
926926

927-
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2405/opac-sendbasket.pl?" + strCookie;
927+
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2411/opac-sendbasket.pl?" + strCookie;
928928

929929
var optWin = "scrollbars=yes,resizable=yes,height=600,width=900,top=50,left=100";
930930
var win_form = open(loc, "win_form", optWin);
@@ -935,7 +935,7 @@ function downloadBasket() { // override function in basket.js
935935
var valCookie = readCookie(nameCookie);
936936
var strCookie = nameCookie + "=" + valCookie;
937937

938-
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2405/opac-downloadcart.pl?" + strCookie;
938+
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2411/opac-downloadcart.pl?" + strCookie;
939939

940940
open(loc, "win_form", 'scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
941941
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/usr/bin/perl
2+
3+
# Copyright 2009 BibLibre
4+
#
5+
# This file is part of Koha.
6+
#
7+
# Koha is free software; you can redistribute it and/or modify it
8+
# under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation; either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# Koha is distributed in the hope that it will be useful, but
13+
# WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19+
20+
use Modern::Perl;
21+
22+
use CGI qw ( -utf8 );
23+
use Encode qw( encode );
24+
25+
use C4::Auth qw( get_template_and_user );
26+
use C4::Biblio qw( GetFrameworkCode GetISBDView );
27+
use C4::Output qw( output_html_with_http_headers );
28+
use C4::Record;
29+
use C4::Ris qw( marc2ris );
30+
use Koha::Biblios;
31+
use Koha::CsvProfiles;
32+
use Koha::RecordProcessor;
33+
34+
use utf8;
35+
my $query = CGI->new();
36+
do '../eds-methods.pl';
37+
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
38+
{
39+
template_name => "opac-downloadcart.tt",
40+
query => $query,
41+
type => "opac",
42+
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
43+
}
44+
);
45+
my $eds_data = "";
46+
my $bib_list = $query->param('bib_list');
47+
#convert _dot_ to . to properly search for items
48+
$bib_list =~s/\_dot\_/\./g;
49+
my $format = $query->param('format');
50+
my $dbh = C4::Context->dbh;
51+
$eds_data = $query->param('eds_data'); #EDS Patch
52+
53+
if ($bib_list && $format) {
54+
55+
my $patron = Koha::Patrons->find($borrowernumber);
56+
57+
my @bibs = split( /\//, $bib_list );
58+
59+
my $marcflavour = C4::Context->preference('marcflavour');
60+
my $output;
61+
my $extension;
62+
my $type;
63+
64+
# CSV
65+
if ($format =~ /^\d+$/) {
66+
67+
my $csv_profile = Koha::CsvProfiles->find($format);
68+
if ( not $csv_profile or $csv_profile->staff_only ) {
69+
print $query->redirect('/cgi-bin/koha/errors/404.pl');
70+
exit;
71+
}
72+
73+
$output = marc2csv(\@bibs, $format);
74+
75+
# Other formats
76+
} else {
77+
my $record_processor = Koha::RecordProcessor->new({
78+
filters => 'ViewPolicy'
79+
});
80+
foreach my $biblionumber (@bibs) {
81+
my $biblio = '';
82+
my $record = '';
83+
if($biblionumber =~m/\_\_/){
84+
my $dat = '';
85+
($record,$dat)= ProcessEDSCartItems($biblionumber,$eds_data,$record,$dat); #EDS patch
86+
} else {
87+
$biblio = Koha::Biblios->find($biblionumber);
88+
$record = $biblio->metadata->record(
89+
{
90+
embed_items => 1,
91+
opac => 1,
92+
patron => $patron,
93+
}
94+
);
95+
}
96+
my $framework = &GetFrameworkCode( $biblio );
97+
$record_processor->options({
98+
interface => 'opac',
99+
frameworkcode => $framework
100+
});
101+
$record_processor->process($record);
102+
103+
next unless $record;
104+
105+
if ($format eq 'iso2709') {
106+
#NOTE: If we don't explicitly UTF-8 encode the output,
107+
#the browser will guess the encoding, and it won't always choose UTF-8.
108+
$output .= encode("UTF-8", $record->as_usmarc()) // q{};
109+
}
110+
elsif ($format eq 'ris') {
111+
$output .= marc2ris($record);
112+
}
113+
elsif ($format eq 'bibtex') {
114+
$output .= marc2bibtex($record, $biblionumber);
115+
}
116+
elsif ( $format eq 'isbd' ) {
117+
my $framework = GetFrameworkCode( $biblionumber );
118+
$output .= GetISBDView({
119+
'record' => $record,
120+
'template' => 'opac',
121+
'framework' => $framework,
122+
});
123+
$extension = "txt";
124+
$type = "text/plain";
125+
}
126+
}
127+
}
128+
129+
# If it was a CSV export we change the format after the export so the file extension is fine
130+
$format = "csv" if ($format =~ m/^\d+$/);
131+
132+
print $query->header(
133+
-type => ($type) ? $type : 'application/octet-stream',
134+
-'Content-Transfer-Encoding' => 'binary',
135+
-attachment => ($extension) ? "cart.$format.$extension" : "cart.$format");
136+
print $output;
137+
138+
} else {
139+
$template->param(
140+
csv_profiles => Koha::CsvProfiles->search(
141+
{
142+
type => 'marc',
143+
used_for => 'export_records',
144+
staff_only => 0
145+
}
146+
),
147+
bib_list => $bib_list,
148+
);
149+
output_html_with_http_headers $query, $cookie, $template->output;
150+
}

0 commit comments

Comments
 (0)