Bug 36453: effective_BlockExpiredPatronOpacActions_contains method

effective_BlockExpiredPatronOpacActions
is now
effective_BlockExpiredPatronOpacActions_contains

This method has been updated to now consider an action param.
Returns true if the given action is to be blocked to expired
patrons or not.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Pedro Amorim 2024-03-26 17:12:49 +00:00 committed by Martin Renvoize
parent d7cfb68eed
commit 679281e4ef
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -36,18 +36,60 @@ Koha::Patron;;Category - Koha Patron;;Category Object class
=cut
=head3 effective_BlockExpiredPatronOpacActions
=head3 effective_BlockExpiredPatronOpacActions_contains
my $BlockExpiredPatronOpacActions = $category->effective_BlockExpiredPatronOpacActions
my $actionBlocked = $category->effective_BlockExpiredPatronOpacActions_contains('hold');
Return the effective BlockExpiredPatronOpacActions value.
Return if the provided action is blocked by BlockExpiredPatronOpacActions, accounting for the syspref.
=over
=item action
Action, can be one of: ['hold', 'renew']
=back
=cut
sub effective_BlockExpiredPatronOpacActions {
my( $self) = @_;
return C4::Context->preference('BlockExpiredPatronOpacActions') if $self->BlockExpiredPatronOpacActions == -1;
return $self->BlockExpiredPatronOpacActions
sub effective_BlockExpiredPatronOpacActions_contains {
my ( $self, $action ) = @_;
my $blocked_actions = {
map { ( $_, 1 ); } split /\s*\,\s*/,
C4::Context->preference('BlockExpiredPatronOpacActions')
};
return $blocked_actions->{$action} if $self->BlockExpiredPatronOpacActions_contains('follow_syspref_BlockExpiredPatronOpacActions');
return $self->BlockExpiredPatronOpacActions_contains($action)
}
=head3 BlockExpiredPatronOpacActions_contains
my $actionBlocked = $self->BlockExpiredPatronOpacActions_contains('hold');
Return if the provided action is blocked by this category's BlockExpiredPatronOpacActions value.
=over
=item action
Action, can be one of: ['hold', 'renew']
=back
=cut
sub BlockExpiredPatronOpacActions_contains {
my ( $self, $action ) = @_;
my $blocked_actions = {
map { ( $_, 1 ); } split /\s*\,\s*/,
$self->BlockExpiredPatronOpacActions
};
return unless $blocked_actions->{$action};
return 1;
}
=head3 store