From 468d94ded336883fc7dfcb2112428e6f164178e4 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 1 Jul 2022 10:28:31 +1200 Subject: [PATCH] Bug 16522: (follow-up) MARC display templates and get_marc_host fixes Also: - Show related parts 773$g - Normalise using 'Host item entry' as title - Remove 'foreach' because non-xslt views only return first - If no $w, use $atg, and related tests in t/db_dependent/Koha/Biblio/host_record.t Signed-off-by: Heather Hernandez Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit adad3a9e2244623b40bf07aeb5e95a0cc9b0d58c) Signed-off-by: Jacob O'Mara --- Koha/Biblio.pm | 6 ++ basket/basket.pl | 4 +- basket/sendbasket.pl | 4 +- .../prog/en/modules/basket/basket.tt | 20 ++--- .../prog/en/modules/basket/sendbasket.tt | 12 +-- .../en/modules/virtualshelves/sendshelf.tt | 12 +-- .../en/xslt/MARC21slim2intranetDetail.xsl | 75 +------------------ .../en/xslt/MARC21slim2intranetResults.xsl | 57 +------------- .../prog/en/xslt/MARC21slimUtils.xsl | 74 ++++++++++++++++++ .../bootstrap/en/modules/opac-basket.tt | 26 ++++--- .../bootstrap/en/modules/opac-sendbasket.tt | 12 +-- .../bootstrap/en/modules/opac-sendshelf.tt | 8 +- .../en/xslt/MARC21slim2OPACDetail.xsl | 75 +------------------ .../en/xslt/MARC21slim2OPACResults.xsl | 57 +------------- .../bootstrap/en/xslt/MARC21slimUtils.xsl | 74 ++++++++++++++++++ opac/opac-basket.pl | 4 +- opac/opac-sendbasket.pl | 4 +- opac/opac-sendshelf.pl | 4 +- t/db_dependent/Koha/Biblio/host_record.t | 8 +- virtualshelves/sendshelf.pl | 4 +- 20 files changed, 243 insertions(+), 297 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 5b7541a36e..4b0c14aec9 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1237,6 +1237,12 @@ sub get_marc_host { last; } } + if ( !$hostfld and $record->subfield('773','t') ) { + # not linked using $w so just return plaintext + my $unlinkedf = $record->field('773'); + my $host = join( ", ", $unlinkedf->subfield('a'), $unlinkedf->subfield('t'), $unlinkedf->subfield('g') ); + return wantarray ? ( $host, $unlinkedf->subfield('g') ) : $host; + } return if !$hostfld; my $rcn = $hostfld->subfield('w'); diff --git a/basket/basket.pl b/basket/basket.pl index c1e76ebb2a..54fabe44d4 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -96,7 +96,9 @@ foreach my $biblionumber ( @bibs ) { $dat->{MARCSERIES} = $marcseriesarray; $dat->{MARCURLS} = $marcurlsarray; $dat->{HASAUTHORS} = $hasauthors; - $dat->{HOSTITEMENTRIES} = $biblio->get_marc_host; + my ( $host, $relatedparts ) = $biblio->get_marc_host; + $dat->{HOSTITEMENTRIES} = $host; + $dat->{RELATEDPARTS} = $relatedparts; push( @results, $dat ); } diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl index f6740eb1b3..af47302d5c 100755 --- a/basket/sendbasket.pl +++ b/basket/sendbasket.pl @@ -86,7 +86,9 @@ if ( $email_add ) { $dat->{HASAUTHORS} = $hasauthors; $dat->{'biblionumber'} = $biblionumber; $dat->{ITEM_RESULTS} = $biblio->items->search_ordered; - $dat->{HOSTITEMENTRIES} = $biblio->get_marc_host; + my ( $host, $relatedparts ) = $biblio->get_marc_host; + $dat->{HOSTITEMENTRIES} = $host; + $dat->{RELATEDPARTS} = $relatedparts; $iso2709 .= $record->as_usmarc(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt index 9f8453b98d..a6886790ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt @@ -221,12 +221,12 @@ [% IF BIBLIO_RESULT.HOSTITEMENTRIES %] - Host item entries + Host item entry - [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] -

- [% INCLUDE 'biblio-title.inc' link = 1 biblio=entry %] -

+ [% IF BIBLIO_RESULT.HOSTITEMENTRIES.biblionumber %] +

[% INCLUDE 'biblio-title.inc' link = 1 biblio=BIBLIO_RESULT.HOSTITEMENTRIES %] [% BIBLIO_RESULT.RELATEDPARTS | html %]

+ [% ELSE %] +

[% BIBLIO_RESULT.HOSTITEMENTRIES | html %]

[% END %] @@ -299,11 +299,13 @@

[% BIBLIO_RESULT.notes | html %]

[% END %] [% IF BIBLIO_RESULT.HOSTITEMENTRIES %] - [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] -

Host item entry: - [% INCLUDE 'biblio-title.inc' link = 1 biblio=entry %] -

+

Host item entry: + [% IF BIBLIO_RESULT.HOSTITEMENTRIES.biblionumber %] + [% INCLUDE 'biblio-title.inc' link = 1 biblio=BIBLIO_RESULT.HOSTITEMENTRIES %] [% BIBLIO_RESULT.RELATEDPARTS | html %] + [% ELSE %] + [% BIBLIO_RESULT.HOSTITEMENTRIES | html %] [% END %] +

[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt index 88ec0af752..03b703f932 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt @@ -129,12 +129,14 @@ Your cart [% END %] [% IF BIBLIO_RESULT.HOSTITEMENTRIES %] - [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] - Host item entry: - [% INCLUDE 'biblio-title.inc' link = 1 biblio=entry %] - -
+ Host item entry: + [% IF BIBLIO_RESULT.HOSTITEMENTRIES.biblionumber %] + [% INCLUDE 'biblio-title.inc' link = 1 biblio=BIBLIO_RESULT.HOSTITEMENTRIES %] [% BIBLIO_RESULT.RELATEDPARTS | $raw %] + [% ELSE %] + [% BIBLIO_RESULT.HOSTITEMENTRIES %] [% END %] + +
[% END %] [% IF ( BIBLIO_RESULT.url ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt index a05dfe7a47..d46591b28b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt @@ -136,12 +136,14 @@ Your list: [% shelfname | $raw %] [% END %] [% IF BIBLIO_RESULT.HOSTITEMENTRIES %] - [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] - Host item entry: - [% INCLUDE 'biblio-title.inc' link = 1 biblio=entry %] - -
+ Host item entry: + [% IF BIBLIO_RESULT.HOSTITEMENTRIES.biblionumber %] + [% INCLUDE 'biblio-title.inc' link = 1 biblio=BIBLIO_RESULT.HOSTITEMENTRIES %] [% BIBLIO_RESULT.RELATEDPARTS | $raw %] + [% ELSE %] + [% BIBLIO_RESULT.HOSTITEMENTRIES %] [% END %] + +
[% END %] [% IF ( BIBLIO_RESULT.url ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index dd3cda470a..c5fd064e63 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -1053,78 +1053,9 @@ - - - - - - - - In: - - - - - - - - - - - - - a_t - - - - - - - /cgi-bin/koha/catalogue/search.pl?q=Control-number: - - - - - /cgi-bin/koha/catalogue/detail.pl?biblionumber= - - - - - - ti,phr:( - - - - ) - - AND au:( - - - - - - ) - - - - /cgi-bin/koha/catalogue/search.pl?q= - - - - - - - - - - - - - - - - - + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl index d8091ce483..bc3a0ed760 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl @@ -929,60 +929,9 @@ - - - - - - - - Source: - - - - - - - - - - - - - a_t - - - - - - - /cgi-bin/koha/catalogue/search.pl?q=Control-number: - - - - - /cgi-bin/koha/catalogue/detail.pl?biblionumber= - - - - - /cgi-bin/koha/catalogue/search.pl?q=ti,phr: - - - - - - - - - - - - - - - - + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl index 109d1ad75e..0fa279abe1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -615,6 +615,80 @@ + + + + + + + + + + Host item entry: + + + + + + + + + + + + + a_t + + + + + + + /cgi-bin/koha/catalogue/search.pl?q=Control-number: + + + + + /cgi-bin/koha/catalogue/detail.pl?biblionumber= + + + + + + ti,phr:( + + + + ) + + AND au:( + + + + + + ) + + + + /cgi-bin/koha/catalogue/search.pl?q= + + + + + + + + + + + + + + + + + - - - - - - - In: - - - - - - - - - - - - - a_t - - - - - - - /cgi-bin/koha/opac-search.pl?q=Control-number: - - - - - /cgi-bin/koha/opac-detail.pl?biblionumber= - - - - - - ti,phr:( - - - - ) - - AND au:( - - - - - - ) - - - - /cgi-bin/koha/opac-search.pl?q= - - - - - - - - - - - - - - - - - + + + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index 4dc2a2ea27..23b04636ae 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -660,60 +660,9 @@ - - - - - - - -
-
- -
-
-
+ + +
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl index b1afb43616..5b08c73c76 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl @@ -578,6 +578,80 @@ + + + + + + + + + + Host item entry: + + + + + + + + + + + + + a_t + + + + + + + /cgi-bin/koha/opac-search.pl?q=Control-number: + + + + + /cgi-bin/koha/opac-detail.pl?biblionumber= + + + + + + ti,phr:( + + + + ) + + AND au:( + + + + + + ) + + + + /cgi-bin/koha/opac-search.pl?q= + + + + + + + + + + + + + + + + +