|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 16; |
22 |
use Test::More tests => 18; |
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
| 24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
| 25 |
|
25 |
|
|
Lines 98-103
Koha::CirculationRules->set_rules(
Link Here
|
| 98 |
rules => { |
98 |
rules => { |
| 99 |
reservesallowed => 1, |
99 |
reservesallowed => 1, |
| 100 |
holds_per_record => 1, |
100 |
holds_per_record => 1, |
|
|
101 |
holds_per_day => 1, |
| 101 |
} |
102 |
} |
| 102 |
} |
103 |
} |
| 103 |
); |
104 |
); |
|
Lines 115-120
Koha::CirculationRules->set_rules(
Link Here
|
| 115 |
rules => { |
116 |
rules => { |
| 116 |
reservesallowed => 2, |
117 |
reservesallowed => 2, |
| 117 |
holds_per_record => 2, |
118 |
holds_per_record => 2, |
|
|
119 |
holds_per_day => 2, |
| 118 |
} |
120 |
} |
| 119 |
} |
121 |
} |
| 120 |
); |
122 |
); |
|
Lines 130-135
Koha::CirculationRules->set_rules(
Link Here
|
| 130 |
rules => { |
132 |
rules => { |
| 131 |
reservesallowed => 3, |
133 |
reservesallowed => 3, |
| 132 |
holds_per_record => 3, |
134 |
holds_per_record => 3, |
|
|
135 |
holds_per_day => 3, |
| 133 |
} |
136 |
} |
| 134 |
} |
137 |
} |
| 135 |
); |
138 |
); |
|
Lines 145-150
Koha::CirculationRules->set_rules(
Link Here
|
| 145 |
rules => { |
148 |
rules => { |
| 146 |
reservesallowed => 4, |
149 |
reservesallowed => 4, |
| 147 |
holds_per_record => 4, |
150 |
holds_per_record => 4, |
|
|
151 |
holds_per_day => 4, |
| 148 |
} |
152 |
} |
| 149 |
} |
153 |
} |
| 150 |
); |
154 |
); |
|
Lines 152-157
Koha::CirculationRules->set_rules(
Link Here
|
| 152 |
$max = GetMaxPatronHoldsForRecord( $patron->{borrowernumber}, $biblio->biblionumber ); |
156 |
$max = GetMaxPatronHoldsForRecord( $patron->{borrowernumber}, $biblio->biblionumber ); |
| 153 |
is( $max, 4, 'GetMaxPatronHoldsForRecord returns max of 4' ); |
157 |
is( $max, 4, 'GetMaxPatronHoldsForRecord returns max of 4' ); |
| 154 |
|
158 |
|
|
|
159 |
my $patron_obj = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 160 |
my $holds_per_day = $biblio->allowed_holds( $patron_obj ); |
| 161 |
is( $holds_per_day, 4, "GetAllowedHoldsForPatronToday returns max of 4" ); |
| 162 |
|
| 155 |
Koha::CirculationRules->set_rules( |
163 |
Koha::CirculationRules->set_rules( |
| 156 |
{ |
164 |
{ |
| 157 |
categorycode => $category->{categorycode}, |
165 |
categorycode => $category->{categorycode}, |
|
Lines 160-165
Koha::CirculationRules->set_rules(
Link Here
|
| 160 |
rules => { |
168 |
rules => { |
| 161 |
reservesallowed => 5, |
169 |
reservesallowed => 5, |
| 162 |
holds_per_record => 5, |
170 |
holds_per_record => 5, |
|
|
171 |
holds_per_day => 5, |
| 163 |
} |
172 |
} |
| 164 |
} |
173 |
} |
| 165 |
); |
174 |
); |
|
Lines 167-172
Koha::CirculationRules->set_rules(
Link Here
|
| 167 |
$max = GetMaxPatronHoldsForRecord( $patron->{borrowernumber}, $biblio->biblionumber ); |
176 |
$max = GetMaxPatronHoldsForRecord( $patron->{borrowernumber}, $biblio->biblionumber ); |
| 168 |
is( $max, 5, 'GetMaxPatronHoldsForRecord returns max of 5' ); |
177 |
is( $max, 5, 'GetMaxPatronHoldsForRecord returns max of 5' ); |
| 169 |
|
178 |
|
|
|
179 |
$holds_per_day = $biblio->allowed_holds( $patron_obj ); |
| 180 |
is( $holds_per_day, 5, "GetAllowedHoldsForPatronToday returns max of 4" ); |
| 181 |
|
| 170 |
Koha::CirculationRules->set_rules( |
182 |
Koha::CirculationRules->set_rules( |
| 171 |
{ |
183 |
{ |
| 172 |
categorycode => undef, |
184 |
categorycode => undef, |
|
Lines 175-180
Koha::CirculationRules->set_rules(
Link Here
|
| 175 |
rules => { |
187 |
rules => { |
| 176 |
reservesallowed => 9, |
188 |
reservesallowed => 9, |
| 177 |
holds_per_record => 9, |
189 |
holds_per_record => 9, |
|
|
190 |
holds_per_day => 9, |
| 178 |
} |
191 |
} |
| 179 |
} |
192 |
} |
| 180 |
); |
193 |
); |
|
Lines 216-221
Koha::CirculationRules->set_rules(
Link Here
|
| 216 |
rules => { |
229 |
rules => { |
| 217 |
reservesallowed => 3, |
230 |
reservesallowed => 3, |
| 218 |
holds_per_record => 2, |
231 |
holds_per_record => 2, |
|
|
232 |
holds_per_day => 3, |
| 219 |
} |
233 |
} |
| 220 |
} |
234 |
} |
| 221 |
); |
235 |
); |
| 222 |
- |
|
|