Bug 17578: GetMemberDetails - Remove amountoutstanding
[koha.git] / Koha / IssuingRules.pm
blob3c588f7d442a495f2e52664800d5812e4059dd1c
1 package Koha::IssuingRules;
3 # Copyright Vaara-kirjastot 2015
4 # Copyright Koha Development Team 2016
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 3 of the License, or (at your option) any later
11 # version.
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 use Modern::Perl;
23 use Koha::Database;
25 use Koha::IssuingRule;
27 use base qw(Koha::Objects);
29 =head1 NAME
31 Koha::IssuingRules - Koha IssuingRule Object set class
33 =head1 API
35 =head2 Class Methods
37 =cut
39 sub get_effective_issuing_rule {
40 my ( $self, $params ) = @_;
42 my $default = '*';
43 my $categorycode = $params->{categorycode};
44 my $itemtype = $params->{itemtype};
45 my $branchcode = $params->{branchcode};
47 my $rule = $self->find($params);
48 return $rule if $rule;
50 $rule = $self->find(
52 categorycode => $categorycode,
53 itemtype => $default,
54 branchcode => $branchcode
57 return $rule if $rule;
59 $rule = $self->find(
61 categorycode => $default,
62 itemtype => $itemtype,
63 branchcode => $branchcode
66 return $rule if $rule;
68 $rule = $self->find(
70 categorycode => $default,
71 itemtype => $default,
72 branchcode => $branchcode
75 return $rule if $rule;
77 $rule = $self->find(
79 categorycode => $categorycode,
80 itemtype => $itemtype,
81 branchcode => $default
84 return $rule if $rule;
86 $rule = $self->find(
88 categorycode => $categorycode,
89 itemtype => $default,
90 branchcode => $default
93 return $rule if $rule;
95 $rule = $self->find(
97 categorycode => $default,
98 itemtype => $itemtype,
99 branchcode => $default
102 return $rule if $rule;
104 $rule = $self->find(
106 categorycode => $default,
107 itemtype => $default,
108 branchcode => $default
111 return $rule if $rule;
113 return;
116 =head3 type
118 =cut
120 sub _type {
121 return 'Issuingrule';
124 sub object_class {
125 return 'Koha::IssuingRule';