Bug 32711: Add 'public_read_list' appropriately
We're exposing biblio (and thus biblioitem) to the public API now and as such we need to explisitely list which fields to include in the response when called on the public api. Signed-off-by: Silvia Meakins <smeakins@eso.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
050c173f6c
commit
61cacd8985
|
|
@ -1264,6 +1264,22 @@ sub normalized_isbn {
|
|||
return C4::Koha::GetNormalizedISBN($self->biblioitem->isbn);
|
||||
}
|
||||
|
||||
=head3 public_read_list
|
||||
|
||||
This method returns the list of publicly readable database fields for both API and UI output purposes
|
||||
|
||||
=cut
|
||||
|
||||
sub public_read_list {
|
||||
return [
|
||||
'biblionumber', 'frameworkcode', 'author',
|
||||
'title', 'medium', 'subtitle',
|
||||
'part_number', 'part_name', 'unititle',
|
||||
'notes', 'serial', 'seriestitle',
|
||||
'copyrightdate', 'abstract'
|
||||
];
|
||||
}
|
||||
|
||||
=head3 to_api
|
||||
|
||||
my $json = $biblio->to_api;
|
||||
|
|
@ -1278,7 +1294,7 @@ sub to_api {
|
|||
my ($self, $args) = @_;
|
||||
|
||||
my $response = $self->SUPER::to_api( $args );
|
||||
my $biblioitem = $self->biblioitem->to_api;
|
||||
my $biblioitem = $self->biblioitem->to_api( $args );
|
||||
|
||||
return { %$response, %$biblioitem };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,26 @@ Koha::Biblioitem - Koha Biblioitem Object class
|
|||
|
||||
=head2 Class methods
|
||||
|
||||
=head3 public_read_list
|
||||
|
||||
This method returns the list of publicly readable database fields for both API and UI output purposes
|
||||
|
||||
=cut
|
||||
|
||||
sub public_read_list {
|
||||
return [
|
||||
'volume', 'number', 'isbn',
|
||||
'issn', 'ean', 'publicationyear',
|
||||
'publishercode', 'volumedate', 'columedesc',
|
||||
'collectiontitle', 'collectionissn', 'collectionvolume',
|
||||
'editionstatement', 'editionresponsibility', 'pages',
|
||||
'place', 'lccn', 'url',
|
||||
'cn_source', 'cn_class', 'cn)item',
|
||||
'cn_suffix', 'cn_sort', 'agerestriction',
|
||||
'totalissues'
|
||||
];
|
||||
}
|
||||
|
||||
=head3 to_api_mapping
|
||||
|
||||
This method returns the mapping for representing a Koha::Biblioitem object
|
||||
|
|
@ -57,7 +77,6 @@ sub to_api_mapping {
|
|||
totalissues => 'serial_total_issues',
|
||||
volumedate => 'volume_date',
|
||||
volumedesc => 'volume_description',
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue