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
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.
25 use Koha::IssuingRule;
27 use base qw(Koha::Objects);
31 Koha::IssuingRules - Koha IssuingRule Object set class
39 sub get_effective_issuing_rule {
40 my ( $self, $params ) = @_;
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;
52 categorycode => $categorycode,
54 branchcode => $branchcode
57 return $rule if $rule;
61 categorycode => $default,
62 itemtype => $itemtype,
63 branchcode => $branchcode
66 return $rule if $rule;
70 categorycode => $default,
72 branchcode => $branchcode
75 return $rule if $rule;
79 categorycode => $categorycode,
80 itemtype => $itemtype,
81 branchcode => $default
84 return $rule if $rule;
88 categorycode => $categorycode,
90 branchcode => $default
93 return $rule if $rule;
97 categorycode => $default,
98 itemtype => $itemtype,
99 branchcode => $default
102 return $rule if $rule;
106 categorycode => $default,
107 itemtype => $default,
108 branchcode => $default
111 return $rule if $rule;
121 return 'Issuingrule';
125 return 'Koha::IssuingRule';