Bug 25663: Add get_lostreturn_policy method to CirculationRules
This patch adds a new get_lostreturn_policy method to Koha::CirculationRules which returns a boolean to the caller which denotes whether a refund should be applied or not on the return of a lost item. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
e234eb84e1
commit
bc882fcb13
1 changed files with 30 additions and 0 deletions
|
@ -426,6 +426,36 @@ sub get_onshelfholds_policy {
|
||||||
return $rule ? $rule->rule_value : 0;
|
return $rule ? $rule->rule_value : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head3 get_lostreturn_policy
|
||||||
|
|
||||||
|
my $refund = Koha::CirculationRules->get_lostreturn_policy( { return_branch => $return_branch, item => $item } );
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub get_lostreturn_policy {
|
||||||
|
my ( $class, $params ) = @_;
|
||||||
|
|
||||||
|
my $item = $params->{item};
|
||||||
|
|
||||||
|
my $behaviour = C4::Context->preference( 'RefundLostOnReturnControl' ) // 'CheckinLibrary';
|
||||||
|
my $behaviour_mapping = {
|
||||||
|
CheckinLibrary => $params->{'return_branch'},
|
||||||
|
ItemHomeBranch => $item->homebranch,
|
||||||
|
ItemHoldingBranch => $item->holdingbranch
|
||||||
|
};
|
||||||
|
|
||||||
|
my $branch = $behaviour_mapping->{ $behaviour };
|
||||||
|
|
||||||
|
my $rule = Koha::CirculationRules->get_effective_rule(
|
||||||
|
{
|
||||||
|
branchcode => $branch,
|
||||||
|
rule_name => 'refund',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $rule ? $rule->rule_value : 1;
|
||||||
|
}
|
||||||
|
|
||||||
=head3 article_requestable_rules
|
=head3 article_requestable_rules
|
||||||
|
|
||||||
Return rules that allow article requests, optionally filtered by
|
Return rules that allow article requests, optionally filtered by
|
||||||
|
|
Loading…
Reference in a new issue