Bug 16699: Remove requirement from borrowernumberQueryParam
[koha.git] / Koha / Biblio.pm
blob38b53f93240fc7f304c8bc75868125f455902467
1 package Koha::Biblio;
3 # Copyright ByWater Solutions 2014
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use Modern::Perl;
22 use Carp;
24 use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode );
26 use Koha::Database;
28 use base qw(Koha::Object);
30 =head1 NAME
32 Koha::Biblio - Koha Biblio Object class
34 =head1 API
36 =head2 Class Methods
38 =cut
40 =head3 subtitles
42 my @subtitles = $biblio->subtitles();
44 Returns list of subtitles for a record.
46 Keyword to MARC mapping for subtitle must be set for this method to return any possible values.
48 =cut
50 sub subtitles {
51 my ( $self ) = @_;
53 return map { $_->{subfield} } @{ GetRecordValue( 'subtitle', GetMarcBiblio( $self->id ), $self->frameworkcode ) };
56 =head3 items
58 Returns the related Koha::Items object for this biblio in scalar context,
59 or list of Koha::Item objects in list context.
61 =cut
63 sub items {
64 my ($self) = @_;
66 $self->{_items} ||= Koha::Items->search( { biblionumber => $self->biblionumber() } );
68 return wantarray ? $self->{_items}->as_list : $self->{_items};
71 =head3 type
73 =cut
75 sub _type {
76 return 'Biblio';
79 =head1 AUTHOR
81 Kyle M Hall <kyle@bywatersolutions.com>
83 =cut