From fcb690c56dd9dc1c7fb225e99eb482d6050c2050 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 27 Feb 2023 00:26:09 +0000 Subject: [PATCH] Bug 3150: (follow-up) Make subs to get host/related parts for notices --- Koha/Biblio.pm | 32 +++++++++++++++++++ .../bug_3150_-_add_LIST_and_CART_notices.pl | 4 +-- .../mysql/en/mandatory/sample_notices.yml | 4 +-- t/db_dependent/Koha/Biblio/host_record.t | 8 ++++- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 5bf369cd6a..5e5686a3ef 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1293,6 +1293,38 @@ sub get_marc_host { } } +=head3 get_marc_host_only + + my $host = $biblio->get_marc_host_only; + +Return host only + +=cut + +sub get_marc_host_only { + my ($self) = @_; + + my ( $host, $relatedparts ) = $self->get_marc_host; + + return $host; +} + +=head3 get_marc_relatedparts_only + + my $relatedparts = $biblio->get_marc_relatedparts_only; + +Return related parts only + +=cut + +sub get_marc_relatedparts_only { + my ($self) = @_; + + my ( $host, $relatedparts ) = $self->get_marc_host; + + return $relatedparts; +} + =head3 recalls my $recalls = $biblio->recalls; diff --git a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl index d06071af8f..c6525f7f10 100755 --- a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl +++ b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl @@ -28,7 +28,7 @@ Please note that the attached file is a MARC bibliographic records file which ca [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %]
[% END %] [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %]
[% END %] [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %]
[% END %] -[% IF ( biblio.get_marc_host ) %]In: [% FOREACH entry IN biblio.get_marc_host %][% entry.title | html %][% IF ( entry.subtitle ) %][% FOREACH subtitle IN entry.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %][% entry.part_number | html %] [% entry.part_name | html %]
[% END %][% END %] +[% IF ( biblio.get_marc_host_only ) %]In: [% FOREACH entry IN biblio.get_marc_host_only %][% entry.title | html %][% IF ( entry.subtitle ) %][% FOREACH subtitle IN entry.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %][% entry.part_number | html %] [% entry.part_name | html %]
[% END %] [% biblio.get_marc_relatedparts_only %][% END %] [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %]
[% END %] View in online catalog [% IF ( biblio.items.count > 0 ) %]
Items: