Bugzilla – Attachment 141161 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.63 KB, created by
Shi Yao Wang
on 2022-09-30 14:12:22 UTC
(
hide
)
Description:
Bug 17385: Add custum export format option when saving a record
Filename:
MIME Type:
Creator:
Shi Yao Wang
Created:
2022-09-30 14:12:22 UTC
Size:
9.63 KB
patch
obsolete
>From 76478d1466c24f50565c484c1066349116a9035c 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 7aee6c6a2f..8b52b4e545 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -131,24 +131,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 ) { >@@ -209,11 +209,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); > > my $frameworkcode = GetFrameworkCode($biblionumber) || ''; > my $record_processor = Koha::RecordProcessor->new( >@@ -237,7 +238,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 07527e897a..7c0df55bc3 100755 >--- a/basket/downloadcart.pl >+++ b/basket/downloadcart.pl >@@ -80,7 +80,15 @@ if ($bib_list && $format) { > $output .= marc2bibtex($record, $biblionumber); > } > 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 50078ccb00..68d2671326 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -40,7 +40,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 e023a55e71..541000b037 100755 >--- a/catalogue/export.pl >+++ b/catalogue/export.pl >@@ -7,7 +7,7 @@ use C4::Output; > use C4::Biblio qw( GetMarcControlnumber ); > use CGI qw ( -utf8 ); > use C4::Ris qw( marc2ris ); >-use C4::XSLT; >+use C4::XSLT qw( XSLTParse4Display ); > > > >@@ -96,7 +96,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 43a398724c..0af60dee6c 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -58,7 +58,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 e16204c53b..bb6ceece24 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -117,7 +117,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 7090a31734..58b792b4d3 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -125,8 +125,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 610d5d27e5..f818cd86a4 100755 >--- a/opac/opac-export.pl >+++ b/opac/opac-export.pl >@@ -145,7 +145,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 d9939c5cb0..fa2b8b7fc7 100755 >--- a/virtualshelves/downloadshelf.pl >+++ b/virtualshelves/downloadshelf.pl >@@ -82,7 +82,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