@@ -, +, @@
- staff client list
- staff client cart
- staff client send list email
- staff client send cart email
- opac list
- opac cart
- opac send list email email
- opac send cart email
---
Koha/Biblio.pm | 19 ++++++++
basket/basket.pl | 1 +
basket/sendbasket.pl | 2 +
.../intranet-tmpl/prog/en/modules/basket/basket.tt | 28 +++++++++++
.../prog/en/modules/basket/sendbasket.tt | 14 ++++++
.../prog/en/modules/virtualshelves/sendshelf.tt | 14 ++++++
.../prog/en/xslt/MARC21slim2intranetResults.xsl | 54 ++++++++++++++++++++--
.../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 29 ++++++++++++
.../bootstrap/en/modules/opac-sendbasket.tt | 14 ++++++
.../bootstrap/en/modules/opac-sendshelf.tt | 14 ++++++
.../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 54 ++++++++++++++++++++--
opac/opac-basket.pl | 2 +
opac/opac-sendbasket.pl | 2 +
opac/opac-sendshelf.pl | 2 +
t/db_dependent/Koha/Biblio.t | 34 +++++++++++++-
virtualshelves/sendshelf.pl | 2 +
16 files changed, 274 insertions(+), 11 deletions(-)
--- a/Koha/Biblio.pm
+++ a/Koha/Biblio.pm
@@ -869,6 +869,25 @@ sub to_api {
return { %$response, %$biblioitem };
}
+=head2 get_host_item_entries
+
+ my @host_item_entries = $biblio->get_host_item_entries;
+
+Returns a list of MARC::Field objects of the 773 tag which contain host item entry information.
+Returns undef if no 773 defined.
+
+=cut
+
+sub get_host_item_entries {
+ my ( $self ) = @_;
+
+ my $record = $self->metadata->record;
+
+ my @host_item_entries = $record->field('773');
+
+ return ( @host_item_entries > 0 ) ? \@host_item_entries : undef;
+}
+
=head3 to_api_mapping
This method returns the mapping for representing a Koha::Biblio object
--- a/basket/basket.pl
+++ a/basket/basket.pl
@@ -103,6 +103,7 @@ foreach my $biblionumber ( @bibs ) {
$dat->{MARCSERIES} = $marcseriesarray;
$dat->{MARCURLS} = $marcurlsarray;
$dat->{HASAUTHORS} = $hasauthors;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
if ( C4::Context->preference("IntranetBiblioDefaultView") eq "normal" ) {
$dat->{dest} = "/cgi-bin/koha/catalogue/detail.pl";
--- a/basket/sendbasket.pl
+++ a/basket/sendbasket.pl
@@ -72,6 +72,7 @@ if ( $email_add ) {
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
embed_items => 1 });
+ my $biblio = Koha::Biblios->find($biblionumber);
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -88,6 +89,7 @@ if ( $email_add ) {
$dat->{HASAUTHORS} = $hasauthors;
$dat->{'biblionumber'} = $biblionumber;
$dat->{ITEM_RESULTS} = \@items;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
$iso2709 .= $record->as_usmarc();
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
@@ -217,6 +217,23 @@
[% END %]
+ [% IF BIBLIO_RESULT.HOSTITEMENTRIES %]
+
Location(s) (Status) |
@@ -279,6 +296,18 @@
[% IF ( TagsInputEnabled && loggedinusername ) %]
Tag status here.
[% END %]
+
+ [% IF BIBLIO_RESULT.HOSTITEMENTRIES %]
+ [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %]
+ Host item entry:
+ [% IF entry.subfield('0') %]
+ [% entry.subfield('t') | html %]
+ [% ELSE %]
+ [% entry.subfield('t') | html %]
+ [% END %]
+
+ [% END %]
+ [% END %]
|
[% BIBLIO_RESULT.author | html %] |
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt
@@ -130,6 +130,20 @@ Your cart
LCCN: [% BIBLIO_RESULT.lccn | $raw %]
[% END %]
+
+ [% IF BIBLIO_RESULT.HOSTITEMENTRIES %]
+ [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %]
+ Host item entry:
+ [% IF entry.subfield('0') %]
+ [% entry.subfield('t') | html %]
+ [% ELSE %]
+ [% entry.subfield('t') | html %]
+ [% END %]
+
+
+ [% END %]
+ [% END %]
+
[% IF ( BIBLIO_RESULT.url ) %]
URL: [% BIBLIO_RESULT.url | html %]
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt
@@ -133,6 +133,20 @@ Your list : [% shelfname | $raw %]
LCCN: [% BIBLIO_RESULT.lccn | $raw %]
[% END %]
+
+ [% IF BIBLIO_RESULT.HOSTITEMENTRIES %]
+ [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %]
+ Host item entry:
+ [% IF entry.subfield('0') %]
+ [% entry.subfield('t') | html %]
+ [% ELSE %]
+ [% entry.subfield('t') | html %]
+ [% END %]
+
+
+ [% END %]
+ [% END %]
+
[% IF ( BIBLIO_RESULT.url ) %]
URL: [% BIBLIO_RESULT.url | html %]
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
@@ -659,13 +659,57 @@
+
-
-
- Source:
-
-
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+ a_t
+
+
+
+
+
+
+ /cgi-bin/koha/opac-search.pl?q=Control-number:
+
+
+
+
+ /cgi-bin/koha/opac-detail.pl?biblionumber=
+
+
+
+
+ /cgi-bin/koha/opac-search.pl?q=ti,phr:
+
+
+
+
+
+
+
+
+
+
+
+
+
--- a/opac/opac-basket.pl
+++ a/opac/opac-basket.pl
@@ -75,6 +75,7 @@ foreach my $biblionumber ( @bibs ) {
# No filtering on the item records needed for the record itself
# since the only reason item information is grabbed is because of branchcodes.
+ my $biblio = Koha::Biblios->find($biblionumber);
my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
my $framework = &GetFrameworkCode( $biblionumber );
$record_processor->options({
@@ -150,6 +151,7 @@ foreach my $biblionumber ( @bibs ) {
$dat->{MARCSERIES} = $marcseriesarray;
$dat->{MARCURLS} = $marcurlsarray;
$dat->{HASAUTHORS} = $hasauthors;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
if ( C4::Context->preference("BiblioDefaultView") eq "normal" ) {
$dat->{dest} = "opac-detail.pl";
--- a/opac/opac-sendbasket.pl
+++ a/opac/opac-sendbasket.pl
@@ -82,6 +82,7 @@ if ( $email_add ) {
embed_items => 1,
opac => 1,
borcat => $borcat });
+ my $biblio = Koha::Biblios->find($biblionumber);
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -98,6 +99,7 @@ if ( $email_add ) {
$dat->{HASAUTHORS} = $hasauthors;
$dat->{'biblionumber'} = $biblionumber;
$dat->{ITEM_RESULTS} = \@items;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
$iso2709 .= $record->as_usmarc();
--- a/opac/opac-sendshelf.pl
+++ a/opac/opac-sendshelf.pl
@@ -86,6 +86,7 @@ if ( $email ) {
opac => 1,
borcat => $borcat });
next unless $record;
+ my $biblio = Koha::Biblios->find($biblionumber);
my $fw = GetFrameworkCode($biblionumber);
my $dat = GetBiblioData($biblionumber);
@@ -100,6 +101,7 @@ if ( $email ) {
$dat->{'biblionumber'} = $biblionumber;
$dat->{ITEM_RESULTS} = \@items;
$dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
$iso2709 .= $record->as_usmarc();
--- a/t/db_dependent/Koha/Biblio.t
+++ a/t/db_dependent/Koha/Biblio.t
@@ -17,7 +17,7 @@
use Modern::Perl;
-use Test::More tests => 14;
+use Test::More tests => 15;
use C4::Biblio;
use Koha::Database;
@@ -614,6 +614,38 @@ subtest 'get_marc_notes() UNIMARC tests' => sub {
is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
is( @$notes, 2, 'No more notes' );
+};
+
+subtest 'get_host_item_entries() tests' => sub {
+
+ plan tests => 2;
+
+ $schema->storage->txn_begin;
+
+ # Set up the host record and an item
+ my $host_biblio = $builder->build_sample_biblio;
+ my $host_item = $builder->build_sample_item({ biblionumber => $host_biblio->biblionumber });
+
+ # Set up the test record
+ my $test_biblio = $builder->build_sample_biblio;
+ my $record = $test_biblio->metadata->record;
+
+ # Link the host item to the test record
+ my $field = MARC::Field->new('245','','','a' => "Test title");
+ $record->append_fields( $field );
+ $field = MARC::Field->new('773','0','','0' => $host_biblio->biblionumber);
+ $record->append_fields( $field );
+ $field = MARC::Field->new('773','0','','9' => $host_item->itemnumber);
+ $record->append_fields( $field );
+
+ # Re-retrieve the record
+ C4::Biblio::ModBiblio( $record, $test_biblio->biblionumber );
+ $test_biblio = Koha::Biblios->find( $test_biblio->biblionumber );
+
+ my $host_items = $test_biblio->get_host_item_entries;
+ is( @{$host_items}, 1, "Correctly retrieved number of attached host item entries" );
+ my $test_host_biblionumber = @{$host_items}[0]->subfield('0');
+ is( $test_host_biblionumber, $host_biblio->biblionumber, "Correctly retrieved data about host item entry");
$schema->storage->txn_rollback;
};
--- a/virtualshelves/sendshelf.pl
+++ a/virtualshelves/sendshelf.pl
@@ -67,6 +67,7 @@ if ($to_address) {
while ( my $content = $contents->next ) {
my $biblionumber = $content->biblionumber;
+ my $biblio = Koha::Biblios->find($biblionumber);
my $dat = GetBiblioData($biblionumber);
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
@@ -82,6 +83,7 @@ if ($to_address) {
$dat->{'biblionumber'} = $biblionumber;
$dat->{ITEM_RESULTS} = \@items;
$dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray;
+ $dat->{HOSTITEMENTRIES} = $biblio->get_host_item_entries;
$iso2709 .= $record->as_usmarc();
--
|