Bug 33954: Koha::Biblio->opac_summary_html
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
3b68039351
commit
b1dcab3077
1 changed files with 30 additions and 0 deletions
|
@ -1565,6 +1565,36 @@ sub ratings {
|
|||
return Koha::Ratings->_new_from_dbic($rs);
|
||||
}
|
||||
|
||||
=head3 opac_summary_html
|
||||
|
||||
my $summary_html = $biblio->opac_summary_html
|
||||
|
||||
Based on the syspref OPACMySummaryHTML, returns a string representing the
|
||||
summary of this bibliographic record.
|
||||
{AUTHOR}, {TITLE}, {ISBN} and {BIBLIONUMBER} will be replaced.
|
||||
|
||||
=cut
|
||||
|
||||
sub opac_summary_html {
|
||||
my ($self) = @_;
|
||||
|
||||
my $summary_html = C4::Context->preference('OPACMySummaryHTML');
|
||||
return q{} unless $summary_html;
|
||||
my $author = $self->author || q{};
|
||||
my $title = $self->title || q{};
|
||||
$title =~ s/\/+$//; # remove trailing slash
|
||||
$title =~ s/\s+$//; # remove trailing space
|
||||
my $normalized_isbn = $self->normalized_isbn || q{};
|
||||
my $biblionumber = $self->biblionumber;
|
||||
|
||||
$summary_html =~ s/{AUTHOR}/$author/g;
|
||||
$summary_html =~ s/{TITLE}/$title/g;
|
||||
$summary_html =~ s/{ISBN}/$normalized_isbn/g;
|
||||
$summary_html =~ s/{BIBLIONUMBER}/$biblionumber/g;
|
||||
|
||||
return $summary_html;
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
||||
=head3 type
|
||||
|
|
Loading…
Reference in a new issue