|
Lines 15-21
Link Here
|
| 15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
| 16 |
|
16 |
|
| 17 |
use Modern::Perl; |
17 |
use Modern::Perl; |
| 18 |
use Test::More tests => 6; |
18 |
use Test::More tests => 7; |
| 19 |
use C4::Context; |
19 |
use C4::Context; |
| 20 |
|
20 |
|
| 21 |
use C4::Biblio; |
21 |
use C4::Biblio; |
|
Lines 159-164
subtest '1 Issuingrule exist 0 0: no issue allowed' => sub {
Link Here
|
| 159 |
teardown(); |
159 |
teardown(); |
| 160 |
}; |
160 |
}; |
| 161 |
|
161 |
|
|
|
162 |
subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub { |
| 163 |
plan tests => 4; |
| 164 |
my $issuingrule = $builder->build({ |
| 165 |
source => 'Issuingrule', |
| 166 |
value => { |
| 167 |
branchcode => $branch->{branchcode}, |
| 168 |
categorycode => $category->{categorycode}, |
| 169 |
itemtype => '*', |
| 170 |
maxissueqty => 1, |
| 171 |
maxonsiteissueqty => undef, |
| 172 |
}, |
| 173 |
}); |
| 174 |
my $issue = C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string() ); |
| 175 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
| 176 |
is_deeply( |
| 177 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
| 178 |
{ |
| 179 |
reason => 'TOO_MANY_CHECKOUTS', |
| 180 |
count => 1, |
| 181 |
max_allowed => 1, |
| 182 |
}, |
| 183 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 184 |
); |
| 185 |
is( |
| 186 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 187 |
undef, |
| 188 |
'OSCO should be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 189 |
); |
| 190 |
|
| 191 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
| 192 |
is_deeply( |
| 193 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item ), |
| 194 |
{ |
| 195 |
reason => 'TOO_MANY_CHECKOUTS', |
| 196 |
count => 1, |
| 197 |
max_allowed => 1, |
| 198 |
}, |
| 199 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 200 |
); |
| 201 |
is_deeply( |
| 202 |
C4::Circulation::TooMany( $patron, $biblio->{biblionumber}, $item, { onsite_checkout => 1 } ), |
| 203 |
{ |
| 204 |
reason => 'TOO_MANY_CHECKOUTS', |
| 205 |
count => 1, |
| 206 |
max_allowed => 1, |
| 207 |
}, |
| 208 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 209 |
); |
| 210 |
|
| 211 |
teardown(); |
| 212 |
}; |
| 213 |
|
| 214 |
|
| 162 |
subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { |
215 |
subtest '1 Issuingrule exist 1 1: issue is allowed' => sub { |
| 163 |
plan tests => 4; |
216 |
plan tests => 4; |
| 164 |
my $issuingrule = $builder->build({ |
217 |
my $issuingrule = $builder->build({ |
| 165 |
- |
|
|