Bugzilla – Attachment 86067 Details for
Bug 22455
Add Koha::Biblio::hidden_in_opac method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22455: Add Koha::Biblio::hidden_in_opac method
Bug-22455-Add-KohaBibliohiddeninopac-method.patch (text/plain), 1.66 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-03-05 14:05:09 UTC
(
hide
)
Description:
Bug 22455: Add Koha::Biblio::hidden_in_opac method
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-03-05 14:05:09 UTC
Size:
1.66 KB
patch
obsolete
>From 39e24c79821c0028bc132751a599cba95cf2c3f7 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 5 Mar 2019 11:00:44 -0300 >Subject: [PATCH] Bug 22455: Add Koha::Biblio::hidden_in_opac method > >This patch adds a hidden_in_opac method that does the same calculation >done in places like opac-tags.pl. The condition that is checked is that >all items belonging to the biblio are hidden. This is the current >behaviour in the code. > >To test: >- Apply this patches >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Biblio.t >=> SUCCESS: Tests pass! >--- > Koha/Biblio.pm | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index d2e4d4d321..56f91859d5 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -20,6 +20,7 @@ package Koha::Biblio; > use Modern::Perl; > > use Carp; >+use List::MoreUtils qw(any); > > use C4::Biblio qw(); > >@@ -186,6 +187,30 @@ sub can_be_transferred { > return 0; > } > >+=head3 hidden_in_opac >+ >+my $bool = $biblio->hidden_in_opac({ [ rules => $rules ] }) >+ >+Returns true if the biblio matches the hidding criteria defined in $rules. >+Returns false otherwise. >+ >+Takes HASHref that can have the following parameters: >+ OPTIONAL PARAMETERS: >+ $rules : { <field> => [ value_1, ... ], ... } >+ >+Note: $rules inherits its structure from the parsed YAML from reading >+the I<OpacHiddenItems> system preference. >+ >+=cut >+ >+sub hidden_in_opac { >+ my ( $self, $params ) = @_; >+ >+ my $rules = $params->{rules} // {}; >+ >+ return !(any { !$_->hidden_in_opac({ rules => $rules }) } $self->items); >+} >+ > =head3 article_request_type > > my $type = $biblio->article_request_type( $borrower ); >-- >2.21.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22455
:
86066
|
86067
|
86502
|
86503
|
86511
|
86512