From b292ebbccec91c0004642d906b42494988017a13 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 9 Aug 2021 08:30:12 +0100 Subject: [PATCH] Bug 11175: Display components in own tab This patch updates the display so that rather than displaying the components using the main XSLT and then using CSS to move them into a box on the right side for display, which causes issues with RTL records; We instead add them in a new tab beneath the rest of the record details alongside holdings and other details. Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Bug 11175: (QA follow-up) Fixes for bug 12561 Bug 12561 changed the prototype for XSLTParse4Display so this patcha accounts for the additional calls to that method introduced in this patchset. Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/XSLT.pm | 27 ++----- catalogue/detail.pl | 22 ++++++ .../prog/css/src/staff-global.scss | 9 --- .../prog/en/modules/catalogue/detail.tt | 18 +++++ .../en/xslt/MARC21slim2intranetDetail.xsl | 2 - .../prog/en/xslt/MARC21slimUtils.xsl | 72 ------------------- .../opac-tmpl/bootstrap/css/src/opac.scss | 8 --- .../bootstrap/en/modules/opac-detail.tt | 17 +++++ .../en/xslt/MARC21slim2OPACDetail.xsl | 2 - .../bootstrap/en/xslt/MARC21slimUtils.xsl | 66 ----------------- opac/opac-detail.pl | 22 ++++++ 11 files changed, 83 insertions(+), 182 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index ab7fa502a1..d133cdf675 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -281,11 +281,10 @@ sub XSLTParse4Display { } } - my $partsxml = ''; - # possibly insert component records into Detail views + # possibly show analytics link in Detail views if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) { - my $biblio //= Koha::Biblios->find( $biblionumber ); - my $components = $biblio->get_marc_components(300); + $biblio //= Koha::Biblios->find( $biblionumber ); + my $components = $biblio->get_marc_components(); $variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1; my $showcomp = C4::Context->preference('ShowComponentRecords'); @@ -296,25 +295,7 @@ sub XSLTParse4Display { || ( $showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) ) { - $variables->{show_analytics_link} = 0; - - my $search_query = $biblio->get_analytics_query; - $variables->{ComponentPartQuery} = $search_query; - - my @componentPartRecordXML = (''); - for my $cb ( @{ $components } ) { - if( ref $cb eq 'MARC::Record'){ - $cb = $cb->as_xml_record(); - } else { - $cb = decode('utf8', $cb); - } - # Remove the xml header - $cb =~ s/^<\?xml.*?\?>//; - push @componentPartRecordXML,$cb; - } - push @componentPartRecordXML, ''; - $partsxml = join "\n", @componentPartRecordXML; } } @@ -325,7 +306,7 @@ sub XSLTParse4Display { $varxml .= "\n"; my $sysxml = get_xslt_sysprefs(); - $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/; + $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs $xmlrecord =~ s/\&amp;/\&/g; $xmlrecord =~ s/\&\;lt\;/\<\;/g; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 0dc82fce9a..2495352c6b 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -211,6 +211,28 @@ foreach my $subscription (@subscriptions) { push @subs, \%cell; } +# Get component parts details +my $showcomp = C4::Context->preference('ShowComponentRecords'); +if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { + if ( my $components = $biblio->get_marc_components(300) ) { + my $parts; + for my $part ( @{$components} ) { + $part = MARC::Record->new_from_xml( $part, 'UTF-8' ); + + push @{$parts}, + XSLTParse4Display( + { + biblionumber => $biblionumber, + record => $part, + xsl_syspref => "XSLTResultsDisplay", + fix_amps => 1, + } + ); + } + $template->param( ComponentParts => $parts ); + } +} + # Get acquisition details if ( C4::Context->preference('AcquisitionDetails') ) { my $orders = Koha::Acquisition::Orders->search( diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index eb7f8b3f40..df2354cad2 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -594,7 +594,6 @@ ol { li { list-style: decimal; - list-style-position: inside; } &.bibliodetails { @@ -615,14 +614,6 @@ ol { padding: 7px 0; } -.componentPartRecordsContainer { - float: right; - overflow-y: auto; - overflow-x: hidden; - max-width: 50%; - max-height: 25em; -} - #editions { table, td { 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 b8a159197b..8b3c23aa76 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -269,6 +269,7 @@ [% END %] [% IF ( MARCNOTES || notes ) %]
  • Descriptions ([% ( MARCNOTES.size || 1 ) | html %])
  • [% END %] +[% IF ( ComponentParts ) %]
  • Components ([% ( ComponentParts.size || 1 ) %])
  • [% END %] [% IF ( subscriptionsnumber ) %]
  • Subscriptions
  • [% END %] [% IF Koha.Preference('AcquisitionDetails') %]
  • Acquisition details
  • [% END %] [% IF suggestions.count %]
  • Suggestion details
  • [% END %] @@ -674,6 +675,23 @@ Note that permanent location is a code, and location may be an authval. [% END %] +[% IF ComponentParts.size %] +
    +
    + + [% FOR PART IN ComponentParts %] + + + + [% END %] +
    + [% PART | $raw %] +
    +
    +
    + +[% END %] + [% IF ( subscriptionsnumber ) %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index 3b8ec9d2e0..d7cdb80a03 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -115,8 +115,6 @@ - -

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl index ecf01fe964..dfc9cc0186 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -578,78 +578,6 @@ - - - - - - - - [% END # / IF MARCNOTES || notes %] + [% IF ComponentParts.size %] +
    +
    + + [% FOR PART IN ComponentParts %] + + + + [% END %] +
    + [% PART | $raw %] +
    +
    +
    + [% END %] + [% IF ( SyndeticsEnabled ) %] [% IF ( SyndeticsTOC && SYNDETICS_TOC ) %]
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl index cab9b75248..a7dd374ae5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl @@ -127,8 +127,6 @@

    - -

    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl index 349bff28a0..105da508c7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl @@ -542,72 +542,6 @@ - - - - - - -