Skip to content

Commit dd1f060

Browse files
authored
Merge pull request #138 from ebsco/OM-cart-issues-2311-rework
Update carts for 23.11 template
2 parents 2baa556 + e3c0713 commit dd1f060

15 files changed

Lines changed: 357 additions & 35 deletions

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 = "22.11";
34-
our $SUB_VERSION = "004";
33+
our $MAJOR_VERSION = "23.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 = '2024-10-07';
37+
our $DATE_UPDATE = '2024-12-11';
3838
######################################################
3939

4040
## Here is our metadata, some keys are required, some are optional
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- DO NOT TOUCH THIS FILE - controlled by build.py -->
33
<kohaplugin>
4-
<latestversion>22.11.004</latestversion>
4+
<latestversion>23.11.001</latestversion>
55
<download>https://github.com/ebsco/edsapi-koha-plugin</download>
6-
<lastupdated>2024/10/07</lastupdated>
6+
<lastupdated>2024/12/11</lastupdated>
77
<releasenotes>
8-
<release version="22.11.004" date="2024/10/07">
9-
<note id="1" author="omuzzy@ebsco.com">fixes issues where facets drop upon new selection.</note>
8+
<release version="23.11.001" date="2024/12/11">
9+
<note id="1" author="omuzzy@ebsco.com">fixes issue where EDS items cannot be sent from cart</note>
10+
<note id="2" author="omuzzy@ebsco.com">fixes issue where EDS items cannot be downloaded from cart</note>
11+
<note id="3" author="omuzzy@ebsco.com">fixes other minor 23.11 errors</note>
1012
</release>
1113
</releasenotes>
1214
</kohaplugin>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[% USE Koha %]
22
[% USE KohaDates %]
33
[% USE AuthorisedValues %]
4+
[% USE Asset %]
45
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
56
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
67

@@ -1287,7 +1288,9 @@
12871288
[% END %]
12881289
[% IF ( OpacStarRatings != 'disable' ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.rating.js"></script>[% END %]
12891290

1290-
[% IF ( OpacHighlightedWords ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.highlight-3.js"></script>[% END %]
1291+
[% IF ( OpacHighlightedWords ) %]
1292+
[% Asset.js("lib/jquery/plugins/jquery.highlight-5.js") | $raw %]
1293+
[% END %]
12911294

12921295
<script type="text/javascript">
12931296
//<![CDATA[

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@
483483
[% Asset.js("js/authtoresults.js") | $raw %]
484484
[% Asset.js("lib/hc-sticky.js") | $raw %]
485485
[% IF ( OpacHighlightedWords ) %]
486-
[% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %]
486+
[% Asset.js("lib/jquery/plugins/jquery.highlight-5.js") | $raw %]
487487
[% END %]
488488
[% IF OpenLibraryCovers || OpenLibrarySearch %]
489489
[% Asset.js("js/openlibrary.js") | $raw %]

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[% #USE Dumper %]
22
[% #Dumper.dump(theme) %]
3-
3+
[% USE Asset %]
44
[% USE Koha %]
55
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
66
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
@@ -412,8 +412,10 @@
412412
[% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.rating.js"></script>[% END %]
413413
[% IF ( OverDriveEnabled ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/js/overdrive.js"></script>[% END %]
414414
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
415-
[% IF ( OpacHighlightedWords ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
416-
[% END %]<script type="text/javascript">
415+
[% IF ( OpacHighlightedWords ) %]
416+
[% Asset.js("lib/jquery/plugins/jquery.highlight-5.js") | $raw %]
417+
[% END %]
418+
<script type="text/javascript">
417419
//<![CDATA[
418420
[% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %]
419421
function holdMultiple() {

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 = "22.11004";
44+
var versionEDSKoha = "23.11001";
4545
///////////////////////////////////////
4646

4747
if (document.title == "") {
@@ -723,7 +723,7 @@ async function PrepareItems() {
723723

724724
//If we have any EDS items, we need to add the loader
725725
if (EDSItems > 0) {
726-
jQuery('#download_cart').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2111/opac-downloadcart.pl');
726+
jQuery('#download_cart').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2311/opac-downloadcart.pl');
727727
jQuery('.print-large, .print').attr('onclick', ''); // .print for prog
728728
jQuery('.print-large, .print').attr('href', 'javascript:window.print();location.reload();'); // .print for prog
729729
jQuery('#itemst').append('<tr id="EDSBasketLoader"><td>&nbsp;</td><td nowrap="nowrap"><img src="/opac-tmpl/bootstrap/images/loading.gif" width="15"> ' + edsLang.basket_loading + '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>');
@@ -853,7 +853,7 @@ function SetEDSCartField() {
853853
//Use the EDS version of sendbasket
854854

855855
if (jQuery('#sendbasketform')) {
856-
jQuery('#sendbasketform').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2111/opac-sendbasket.pl');
856+
jQuery('#sendbasketform').prop('action', '[% PLUGIN_HTTP_PATH %]/opac/2311/opac-sendbasket.pl');
857857
}
858858
//GET record list from URL and split into array on /
859859
var recordList = document.URL;
@@ -892,7 +892,7 @@ function sendBasket() { // override function in basket.js
892892
var valCookie = readCookie(nameCookie);
893893
var strCookie = nameCookie + "=" + valCookie;
894894

895-
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2111/opac-sendbasket.pl?" + strCookie;
895+
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2311/opac-sendbasket.pl?" + strCookie;
896896

897897
var optWin = "scrollbars=yes,resizable=yes,height=600,width=900,top=50,left=100";
898898
var win_form = open(loc, "win_form", optWin);
@@ -903,7 +903,7 @@ function downloadBasket() { // override function in basket.js
903903
var valCookie = readCookie(nameCookie);
904904
var strCookie = nameCookie + "=" + valCookie;
905905

906-
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2111/opac-downloadcart.pl?" + strCookie;
906+
var loc = "[% PLUGIN_HTTP_PATH %]/opac/2311/opac-downloadcart.pl?" + strCookie;
907907

908908
open(loc, "win_form", 'scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
909909
}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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+
my $patron = Koha::Patrons->find($borrowernumber);
55+
my @bibs = split( /\//, $bib_list );
56+
57+
my $marcflavour = C4::Context->preference('marcflavour');
58+
my $output;
59+
my $extension;
60+
my $type;
61+
62+
# CSV
63+
if ($format =~ /^\d+$/) {
64+
my $csv_profile = Koha::CsvProfiles->find($format);
65+
if ( not $csv_profile or $csv_profile->staff_only ) {
66+
print $query->redirect('/cgi-bin/koha/errors/404.pl');
67+
exit;
68+
}
69+
70+
$output = marc2csv(\@bibs, $format);
71+
# Other formats
72+
} else {
73+
my $record_processor = Koha::RecordProcessor->new({
74+
filters => 'ViewPolicy'
75+
});
76+
foreach my $biblionumber (@bibs) {
77+
my $biblio = '';
78+
my $record = '';
79+
if($biblionumber =~m/\_\_/){
80+
my $dat = '';
81+
($record,$dat)= ProcessEDSCartItems($biblionumber,$eds_data,$record,$dat); #EDS patch
82+
} else {
83+
$biblio = Koha::Biblios->find($biblionumber);
84+
$record = $biblio->metadata->record(
85+
{
86+
embed_items => 1,
87+
opac => 1,
88+
patron => $patron,
89+
}
90+
);
91+
}
92+
my $framework = &GetFrameworkCode( $biblio );
93+
$record_processor->options({
94+
interface => 'opac',
95+
frameworkcode => $framework
96+
});
97+
$record_processor->process($record);
98+
99+
next unless $record;
100+
101+
if ($format eq 'iso2709') {
102+
#NOTE: If we don't explicitly UTF-8 encode the output,
103+
#the browser will guess the encoding, and it won't always choose UTF-8.
104+
$output .= encode("UTF-8", $record->as_usmarc()) // q{};
105+
}
106+
elsif ($format eq 'ris') {
107+
$output .= marc2ris($record);
108+
}
109+
elsif ($format eq 'bibtex') {
110+
$output .= marc2bibtex($record, $biblionumber);
111+
}
112+
elsif ( $format eq 'isbd' ) {
113+
my $framework = GetFrameworkCode( $biblionumber );
114+
$output .= GetISBDView({
115+
'record' => $record,
116+
'template' => 'opac',
117+
'framework' => $framework,
118+
});
119+
$extension = "txt";
120+
$type = "text/plain";
121+
}
122+
}
123+
}
124+
125+
# If it was a CSV export we change the format after the export so the file extension is fine
126+
$format = "csv" if ($format =~ m/^\d+$/);
127+
128+
print $query->header(
129+
-type => ($type) ? $type : 'application/octet-stream',
130+
-'Content-Transfer-Encoding' => 'binary',
131+
-attachment => ($extension) ? "cart.$format.$extension" : "cart.$format");
132+
print $output;
133+
} else {
134+
$template->param(
135+
csv_profiles => Koha::CsvProfiles->search(
136+
{
137+
type => 'marc',
138+
used_for => 'export_records',
139+
staff_only => 0
140+
}
141+
),
142+
bib_list => $bib_list,
143+
);
144+
output_html_with_http_headers $query, $cookie, $template->output;
145+
}

0 commit comments

Comments
 (0)