Bugzilla – Attachment 112676 Details for
Bug 17385
Add custom export formats for bibliographic records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17385: Added download option in list
Bug-17385-Added-download-option-in-list.patch (text/plain), 7.35 KB, created by
Ivan Dziuba
on 2020-10-29 20:11:58 UTC
(
hide
)
Description:
Bug 17385: Added download option in list
Filename:
MIME Type:
Creator:
Ivan Dziuba
Created:
2020-10-29 20:11:58 UTC
Size:
7.35 KB
patch
obsolete
>From 76b5b8b6b58b697884da869c17e11374430eb471 Mon Sep 17 00:00:00 2001 >From: Gabriel DeCarufel <gabriel@inlibro.com> >Date: Thu, 12 Mar 2020 16:23:42 -0400 >Subject: [PATCH] Bug 17385: Added download option in list > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/includes/cat-toolbar.inc | 2 +- > .../en/modules/admin/preferences/opac.pref | 2 +- > .../prog/en/modules/catalogue/detail.tt | 2 +- > .../en/includes/opac-detail-sidebar.inc | 2 +- > opac/opac-downloadshelf.pl | 8 +++++-- > t/db_dependent/XSLT.t | 22 +++++++++++++++++++ > 6 files changed, 32 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 64fd082012..8a1dbf308b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -98,7 +98,7 @@ CAN_user_serials_create_subscription ) %] > <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&op=export&bib=[% biblionumber | uri %]">MODS (XML)</a></li> > <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&op=export&bib=[% biblionumber | uri %]">RIS</a></li> > [% FOREACH filesOption IN filesOptions %] >- <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format | uri %]&op=exportxsl&file=[% filesOption.value | uri %]&bib=[% biblionumber | uri %]">[% filesOption.filename | html %]</a></li> >+ <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format | uri %]&op=exportxsl&file=[% filesOption.value | uri %]&bib=[% biblionumber | uri %]">XSL - [% filesOption.filename | html %]</a></li> > [% END %] > </ul> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index fda2187f1a..a916fbf975 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -313,7 +313,7 @@ OPAC: > mods: MODS > ris: RIS > isbd: ISBD >- custom: Custom >+ custom: XSL - Simple Export > - > - pref: OpacSeparateHoldings > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 60bcccd540..0c0024e010 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -949,7 +949,7 @@ Note that permanent location is a code, and location may be an authval. > <option value="marc8">MARC (non-Unicode/MARC-8)</option> > <option value="utf8">MARC (Unicode/UTF-8)</option> > [% FOREACH filesOption IN filesOptions %] >- <option value="[% filesOption.value | html %]">[% filesOption.filename | html %]</option> >+ <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option> > [% END %]</select> > <input type="submit" name="save" value="Download Record" /></td> > </tr> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >index a89ddf5bee..25112275c6 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >@@ -109,7 +109,7 @@ > </li> > [% ELSE %] > [% FOREACH filesOption IN filesOptions %] >- <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | html %]&op=exportxsl&file=[% filesOption.value | html %]&bib=[% biblionumber | html %]">[% filesOption.filename | html %]</a></li> >+ <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | html %]&op=exportxsl&file=[% filesOption.value | html %]&bib=[% biblionumber | html %]">XSL - [% filesOption.filename | html %]</a></li> > [% END %] > [% END %] > [% END %] >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 99d14a73da..7794ba784b 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -28,6 +28,7 @@ use C4::Items; > use C4::Output; > use C4::Record; > use C4::Ris; >+use C4::XSLT; > use Koha::CsvProfiles; > use Koha::RecordProcessor; > use Koha::Virtualshelves; >@@ -125,13 +126,15 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > }); > $extension = "txt"; > $type = "text/plain"; >- } >+ }elsif ($format =~ /^xsl\.(.*)$/){ >+ $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1); >+ } > } > } > > # If it was a CSV export we change the format after the export so the file extension is fine > $format = "csv" if ($format =~ m/^\d+$/); >- >+ $format = "html" if ($format =~ /^xsl\./); > print $query->header( > -type => ($type) ? $type : 'application/octet-stream', > -'Content-Transfer-Encoding' => 'binary', >@@ -158,6 +161,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > ) > ] > ); >+ $template->param(xsl_exports => CustomXSLTExportList()); > $template->param( shelf => $shelf ); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >index 5abb8b7c09..1372173b7b 100755 >--- a/t/db_dependent/XSLT.t >+++ b/t/db_dependent/XSLT.t >@@ -102,4 +102,26 @@ subtest 'buildKohaItemsNamespace status tests' => sub { > $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); > like($xml,qr{<status>Pending hold</status>},"Pending status takes precedence over all"); > }; >+subtest 'CustomXSLTExportList: Caching' => sub { >+ plan tests => 1; >+ t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); >+ $cache->clear_from_cache('CustomXSLTExportListOPAC'); >+ my $list = C4::XSLT::CustomXSLTExportList(1); >+ push @$list, { nonsense => 1 }; >+ $cache->set_in_cache('CustomXSLTExportListOPAC', $list ); >+ my $n = @$list; >+ $list = C4::XSLT::CustomXSLTExportList(1); >+ is( @$list, $n, 'This list comes from the cache and that is fine' ); >+ $cache->clear_from_cache('CustomXSLTExportListOPAC'); >+}; >+subtest 'CustomXSLTExportList: Check export options' => sub { >+ plan tests => 2; >+ t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); >+ my $list = C4::XSLT::CustomXSLTExportList(1); >+ is( $list>0, 1, 'We expect at least one result: simple export' ); >+ $cache->clear_from_cache('CustomXSLTExportListOPAC'); >+ t::lib::Mocks::mock_preference('OpacExportOptions', 'dc'); >+ $list = C4::XSLT::CustomXSLTExportList(1); >+ is( @$list, 0, 'We expect an empty list now' ); >+}; > $schema->storage->txn_rollback; >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17385
:
55961
|
58308
|
64033
|
64034
|
67357
|
67579
|
74660
|
74661
|
79055
|
79056
|
80675
|
81385
|
81386
|
84388
|
84389
|
84390
|
86875
|
86876
|
86877
|
86878
|
86879
|
86880
|
97076
|
97101
|
97102
|
97103
|
97104
|
97105
|
100289
|
100290
|
100291
|
100292
|
100293
|
100663
|
100670
|
100671
|
100672
|
100673
|
100674
|
100675
|
112671
|
112672
|
112673
|
112674
|
112675
|
112676
|
112677
|
112678
|
112679
|
112680
|
112681
|
112682
|
112956
|
112957
|
112958
|
112959
|
130283
|
130284
|
130285
|
130286
|
130287
|
130691
|
130692
|
130693
|
130694
|
130695
|
131492
|
132488
|
132489
|
132490
|
132491
|
132492
|
132493
|
132581
|
133498
|
133499
|
133500
|
133501
|
133502
|
133503
|
133504
|
138031
|
138032
|
138033
|
138034
|
138035
|
138036
|
138037
|
138082
|
138083
|
138084
|
138085
|
138086
|
138087
|
138088
|
138132
|
139277
|
139278
|
139279
|
139280
|
139281
|
139282
|
139283
|
139284
|
141157
|
141158
|
141159
|
141160
|
141161
|
141162
|
141163
|
141164
|
144335
|
144336
|
144380
|
144384
|
151095
|
151096
|
151097
|
151098
|
151099
|
151102
|
151103
|
151104
|
151105
|
151106
|
151377
|
151378
|
151379
|
151380
|
151381
|
154379
|
154380
|
154381
|
154382
|
154383
|
156815
|
156816
|
156817
|
156818
|
156819
|
159142
|
159143
|
159144
|
159145
|
159146
|
159147
|
159148
|
163623
|
170014
|
170015
|
170016
|
170017
|
170018
|
170019
|
170026
|
170027
|
170028
|
170029
|
170030
|
170031
|
170983
|
170984
|
170985
|
170986
|
170987
|
170988