Bugzilla – Attachment 130695 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: Add custum export format option when saving a record
Bug-17385-Add-custum-export-format-option-when-sav.patch (text/plain), 9.67 KB, created by
The Minh Luong
on 2022-02-16 18:46:22 UTC
(
hide
)
Description:
Bug 17385: Add custum export format option when saving a record
Filename:
MIME Type:
Creator:
The Minh Luong
Created:
2022-02-16 18:46:22 UTC
Size:
9.67 KB
patch
obsolete
>From 417e8daac9d149f0b6ce261f7f9dbc9eea0ef2c5 Mon Sep 17 00:00:00 2001 >From: The Minh Luong <the-minh.luong@inlibro.com> >Date: Tue, 8 Feb 2022 08:09:15 -0500 >Subject: [PATCH] Bug 17385: Add custum export format option when saving a > record > >This patch adds "XSL-Simple Export" when saving a bibliographic >record. Previous patches are combined into this one. > >To test: >1) Search for a record in the intranet. >2) Click on the "Save" button and observe the dropdown menu. >3) Notice that "XSL- Simple Export" is not in the menu. >4) Apply the patch. >5) Repeat the steps 1 and 2. >6) Notice that "XSL - Simple Export" is in the menu. >7) Click on "XSL - Simple Export". A .html file should be downloaded. >8) Open the .html file. You should see the record's informations. >--- > C4/XSLT.pm | 13 +++++++------ > basket/downloadcart.pl | 10 +++++++++- > catalogue/detail.pl | 2 +- > catalogue/export.pl | 13 +++++++++++-- > opac/opac-detail.pl | 2 +- > opac/opac-downloadcart.pl | 10 +++++++++- > opac/opac-downloadshelf.pl | 12 ++++++++++-- > opac/opac-export.pl | 11 ++++++++++- > virtualshelves/downloadshelf.pl | 10 +++++++++- > 9 files changed, 67 insertions(+), 16 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index c4f2035392..4f1c8939cf 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -203,24 +203,24 @@ sub get_xslt_sysprefs { > } > > sub get_xsl_filename { >- my ( $xslsyspref ) = @_; >+ my ( $xslsyspref, $xslfilename ) = @_; > > my $lang = C4::Languages::getlanguage(); > >- my $xslfilename = C4::Context->preference($xslsyspref) || "default"; >+ $xslfilename ||= C4::Context->preference($xslsyspref) || "default"; > > if ($xslsyspref eq "XSLTCustomExport") { > my $dir; > $dir = C4::Context->config('intrahtdocs') . > '/' . C4::Context->preference("template") . >- '/' . C4::Languages::getlanguage() . >+ '/' . $lang . > '/xslt/biblioexport'; > $xslfilename = $dir . "/" . $xslfilename; > } elsif ($xslsyspref eq "OPACXSLTCustomExport") { > my $dir; > $dir = C4::Context->config('opachtdocs') . > '/' . C4::Context->preference("opacthemes") . >- '/' . C4::Languages::getlanguage() . >+ '/' . $lang . > '/xslt/biblioexport'; > $xslfilename = $dir . "/" . $xslfilename; > } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { >@@ -280,11 +280,12 @@ sub XSLTParse4Display { > my $hidden_items = $params->{hidden_items} || []; > my $variables = $params->{xslt_variables}; > my $items_rs = $params->{items_rs}; >+ my $xslfilename = $params->{xslfilename}; > > die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}" > if not defined $params->{xsl_syspref}; > >- my $xslfilename = get_xsl_filename( $xslsyspref); >+ $xslfilename = get_xsl_filename( $xslsyspref, $xslfilename); > > # grab the XML, run it through our stylesheet, push it out to the browser > my $record = transformMARCXML4XSLT($biblionumber, $orig_record); >@@ -297,7 +298,7 @@ sub XSLTParse4Display { > my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); > > my $biblio; >- my $variables ||= {}; >+ $variables ||= {}; > > if (C4::Context->preference('OPACShowOpenURL')) { > my @biblio_itemtypes; >diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl >index b513f7a903..1b3d3ae239 100755 >--- a/basket/downloadcart.pl >+++ b/basket/downloadcart.pl >@@ -81,7 +81,15 @@ if ($bib_list && $format) { > $output .= marc2bibtex($record, $biblio); > } > elsif ($format =~ /^xsl\.(.*)$/) { >- $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, ''); >+ $output .= XSLTParse4Display( >+ { >+ biblionumber => $biblio, >+ record => $record, >+ xsl_syspref => "XSLTCustomExport", >+ fix_amps => 1, >+ hidden_items => undef, >+ } >+ ); > } > } > } >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 06db6ed14d..69b74c411a 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -41,7 +41,7 @@ use C4::XISBN qw( get_xisbns ); > use C4::External::Amazon qw( get_amazon_tld ); > use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); > use C4::Tags qw( get_tags ); >-use C4::XSLT qw( XSLTParse4Display ); >+use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList ); > use Koha::DateUtils qw( format_sqldatetime ); > use C4::HTML5Media; > use C4::CourseReserves qw( GetItemCourseReservesInfo ); >diff --git a/catalogue/export.pl b/catalogue/export.pl >index 3393d2fc0d..8deb959352 100755 >--- a/catalogue/export.pl >+++ b/catalogue/export.pl >@@ -7,7 +7,7 @@ use C4::Output; > use C4::Biblio qw( GetMarcBiblio GetMarcControlnumber ); > use CGI qw ( -utf8 ); > use C4::Ris qw( marc2ris ); >-use C4::XSLT; >+use C4::XSLT qw( XSLTParse4Display ); > > > >@@ -97,7 +97,16 @@ if ($op eq "export") { > my $format=$query->param("format")||'txt'; > my @hiddenitems; > >- $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,''); >+ $marc = XSLTParse4Display( >+ { >+ biblionumber => $biblionumber, >+ record => $marc, >+ xsl_syspref => "XSLTCustomExport", >+ fix_amps => 1, >+ hidden_items => \@hiddenitems, >+ xslfilename => $xslFile, >+ } >+ ); > print $query->header( > -type => 'application/octet-stream', > -attachment=>"bib-$biblionumber.$format"); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index bcedb93163..97903a8da7 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -61,7 +61,7 @@ use C4::External::Syndetics qw( > get_syndetics_toc > ); > use C4::Members; >-use C4::XSLT qw( XSLTParse4Display ); >+use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList ); > use C4::ShelfBrowser qw( GetNearbyItems ); > use C4::Reserves qw( GetReserveStatus ); > use C4::Charset qw( SetUTF8Flag ); >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index c6d329eb2b..88393d1a78 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -118,7 +118,15 @@ if ($bib_list && $format) { > $type = "text/plain"; > } > elsif ($format =~ /^xsl\.(.*)$/) { >- $output .= XSLTParse4Display($biblio, $record, 'OPACXSLTCustomExport', 1, undef, undef, $1, ''); >+ $output .= XSLTParse4Display( >+ { >+ biblionumber => $biblio, >+ record => $record, >+ xsl_syspref => "OPACXSLTCustomExport", >+ fix_amps => 1, >+ hidden_items => undef, >+ } >+ ); > } > } > } >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 89f2c2dd18..5d04f17a0f 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -126,8 +126,16 @@ 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); >- } >+ $output .= XSLTParse4Display( >+ { >+ biblionumber => $biblionumber, >+ record => $record, >+ xsl_syspref => "XSLTCustomExport", >+ fix_amps => 1, >+ hidden_items => undef, >+ } >+ ); >+ } > } > } > >diff --git a/opac/opac-export.pl b/opac/opac-export.pl >index 41bfddceec..a6ae378d5d 100755 >--- a/opac/opac-export.pl >+++ b/opac/opac-export.pl >@@ -144,7 +144,16 @@ elsif ($format =~ /html/ ) { > $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber}); > my @hiddenitems; > >- $marc = XSLTParse4Display($biblionumber, $marc, 'OPACXSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef); >+ $marc = XSLTParse4Display( >+ { >+ biblionumber => $biblionumber, >+ record => $marc, >+ xsl_syspref => "OPACXSLTCustomExport", >+ fix_amps => 1, >+ hidden_items => \@hiddenitems, >+ xslfilename => $xslFile, >+ } >+ ); > } > } > else { >diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl >index 4c44bf5661..7ca3c465e1 100755 >--- a/virtualshelves/downloadshelf.pl >+++ b/virtualshelves/downloadshelf.pl >@@ -83,7 +83,15 @@ if ($shelfid && $format) { > $output .= marc2bibtex($record, $biblionumber); > } > elsif ($format =~ /^xsl\.(.*)$/){ >- $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,''); >+ $output .= XSLTParse4Display( >+ { >+ biblionumber => $biblionumber, >+ record => $record, >+ xsl_syspref => 'XSLTCustomExport', >+ fix_amps => 1, >+ hidden_items => undef, >+ } >+ ); > } > } > } >-- >2.25.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