@@ -, +, @@ - 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 | 2 + 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 | 36 ++++++++++++++- virtualshelves/sendshelf.pl | 2 + 16 files changed, 277 insertions(+), 11 deletions(-) --- a/Koha/Biblio.pm +++ a/Koha/Biblio.pm @@ -813,6 +813,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 @@ -61,6 +61,7 @@ foreach my $biblionumber ( @bibs ) { my $dat = &GetBiblioData($biblionumber); next unless $dat; + my $biblio = Koha::Biblios->find($biblionumber); my $record = &GetMarcBiblio({ biblionumber => $biblionumber }); my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); @@ -101,6 +102,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 %] + + Host item entries + + [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] +

+ [% IF entry.subfield('0') %] + [% entry.subfield('t') | html %] + [% ELSE %] + [% entry.subfield('t') | html %] + [% END %] +

+ [% END %] + + + [% END %] + Location(s) @@ -281,6 +298,17 @@ [% IF ( BIBLIO_RESULT.notes ) %]

[% BIBLIO_RESULT.notes | html %]

[% 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 %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt @@ -126,6 +126,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/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt @@ -132,6 +132,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/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl @@ -920,13 +920,57 @@ + - - - Source: - - + + + + + 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: + + + + + + + + + + + + + --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -227,6 +227,23 @@ [% END %] + [% IF BIBLIO_RESULT.HOSTITEMENTRIES %] + + Host item entries + + [% FOREACH entry IN BIBLIO_RESULT.HOSTITEMENTRIES %] +

+ [% IF entry.subfield('0') %] + [% entry.subfield('t') | html %] + [% ELSE %] + [% entry.subfield('t') | html %] + [% END %] +

+ [% END %] + + + [% END %] + Location(s) (Status) @@ -278,6 +295,18 @@ [% IF ( TagsInputEnabled && loggedinusername ) %] [% 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 @@ -657,13 +657,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 @@ -73,6 +73,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({ @@ -148,6 +149,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 => 12; +use Test::More tests => 13; use C4::Biblio; use Koha::Database; @@ -551,3 +551,37 @@ subtest 'subscriptions() tests' => sub { $schema->storage->txn_rollback; }; + +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(); --