Lines 87-92
subtest 'GetReserveFee' => sub {
Link Here
|
87 |
plan tests => 5; |
87 |
plan tests => 5; |
88 |
|
88 |
|
89 |
C4::Circulation::AddIssue( $patron1, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
89 |
C4::Circulation::AddIssue( $patron1, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
|
|
90 |
C4::Circulation::AddIssue( $patron3, $item2->barcode, '2015-12-31', 0, undef, 0, {} ); # the date does not really matter |
90 |
my $acc2 = acctlines( $patron2->{borrowernumber} ); |
91 |
my $acc2 = acctlines( $patron2->{borrowernumber} ); |
91 |
my $res1 = addreserve( $patron1->{borrowernumber} ); |
92 |
my $res1 = addreserve( $patron1->{borrowernumber} ); |
92 |
|
93 |
|
Lines 138-145
subtest 'Integration with AddReserve' => sub {
Link Here
|
138 |
}; |
139 |
}; |
139 |
|
140 |
|
140 |
subtest 'Items are issued' => sub { |
141 |
subtest 'Items are issued' => sub { |
141 |
plan tests => 3; |
142 |
plan tests => 4; |
142 |
|
143 |
|
|
|
144 |
$dbh->do( "DELETE FROM issues WHERE itemnumber=?", undef, $item1->itemnumber); |
145 |
$dbh->do( "DELETE FROM issues WHERE itemnumber=?", undef, $item2->itemnumber); |
143 |
C4::Circulation::AddIssue( $patron2, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); |
146 |
C4::Circulation::AddIssue( $patron2, $item1->barcode, '2015-12-31', 0, undef, 0, {} ); |
144 |
|
147 |
|
145 |
t::lib::Mocks::mock_preference('HoldFeeMode', 'not_always'); |
148 |
t::lib::Mocks::mock_preference('HoldFeeMode', 'not_always'); |
Lines 152-165
subtest 'Integration with AddReserve' => sub {
Link Here
|
152 |
$dbh->do( "DELETE FROM accountlines WHERE borrowernumber=?", undef, $patron1->{borrowernumber} ); |
155 |
$dbh->do( "DELETE FROM accountlines WHERE borrowernumber=?", undef, $patron1->{borrowernumber} ); |
153 |
addreserve( $patron3->{borrowernumber} ); |
156 |
addreserve( $patron3->{borrowernumber} ); |
154 |
addreserve( $patron1->{borrowernumber} ); |
157 |
addreserve( $patron1->{borrowernumber} ); |
155 |
# FIXME Are we sure it's the expected behavior? |
158 |
is( acctlines( $patron1->{borrowernumber} ), 0, 'not_always - Patron should not be charged if all the items are not checked out, even if 1 hold is already placed' ); |
156 |
is( acctlines( $patron1->{borrowernumber} ), 1, 'not_always - Patron should be charged if all the items are not checked out and at least 1 hold is already placed' ); |
|
|
157 |
|
159 |
|
158 |
C4::Circulation::AddIssue( $patron3, $item2->barcode, '2015-12-31', 0, undef, 0, {} ); |
160 |
C4::Circulation::AddIssue( $patron3, $item2->barcode, '2015-12-31', 0, undef, 0, {} ); |
159 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, $biblio->biblionumber ); |
161 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, $biblio->biblionumber ); |
160 |
$dbh->do( "DELETE FROM accountlines WHERE borrowernumber=?", undef, $patron1->{borrowernumber} ); |
162 |
$dbh->do( "DELETE FROM accountlines WHERE borrowernumber=?", undef, $patron1->{borrowernumber} ); |
161 |
addreserve( $patron1->{borrowernumber} ); |
163 |
addreserve( $patron1->{borrowernumber} ); |
162 |
is( acctlines( $patron1->{borrowernumber} ), 1, 'not_always - Patron should be charged if all items are checked out' ); |
164 |
is( acctlines( $patron1->{borrowernumber} ), 0, 'not_always - Patron should not be charged if all items are checked out but no holds are placed' ); |
|
|
165 |
|
166 |
$dbh->do( "DELETE FROM reserves WHERE biblionumber=?", undef, $biblio->biblionumber ); |
167 |
$dbh->do( "DELETE FROM accountlines WHERE borrowernumber=?", undef, $patron1->{borrowernumber} ); |
168 |
addreserve( $patron3->{borrowernumber} ); |
169 |
addreserve( $patron1->{borrowernumber} ); |
170 |
is( acctlines( $patron1->{borrowernumber} ), 1, 'not_always - Patron should only be charged if all items are checked out and at least 1 hold is already placed' ); |
163 |
}; |
171 |
}; |
164 |
}; |
172 |
}; |
165 |
|
173 |
|
166 |
- |
|
|