Lines 24-37
use C4::Items;
Link Here
|
24 |
use C4::Members; |
24 |
use C4::Members; |
25 |
use C4::Reserves; |
25 |
use C4::Reserves; |
26 |
use Koha::DateUtils; |
26 |
use Koha::DateUtils; |
|
|
27 |
use Koha::Database; |
27 |
|
28 |
|
28 |
use Test::More tests => 49; |
29 |
use Test::More tests => 51; |
29 |
|
30 |
|
30 |
BEGIN { |
31 |
BEGIN { |
31 |
use_ok('C4::Circulation'); |
32 |
use_ok('C4::Circulation'); |
32 |
} |
33 |
} |
33 |
|
34 |
|
34 |
my $dbh = C4::Context->dbh; |
35 |
my $dbh = C4::Context->dbh; |
|
|
36 |
my $schema = Koha::Database->new()->schema(); |
35 |
|
37 |
|
36 |
# Start transaction |
38 |
# Start transaction |
37 |
$dbh->{AutoCommit} = 0; |
39 |
$dbh->{AutoCommit} = 0; |
Lines 351-356
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
351 |
|
353 |
|
352 |
LostItem( $itemnumber, 1 ); |
354 |
LostItem( $itemnumber, 1 ); |
353 |
|
355 |
|
|
|
356 |
my $item = $schema->resultset('Item')->find( $itemnumber ); |
357 |
ok( !$item->onloan(), "Lost item marked as returned has onloan = undef" ); |
358 |
|
354 |
my $total_due = $dbh->selectrow_array( |
359 |
my $total_due = $dbh->selectrow_array( |
355 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
360 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
356 |
undef, $renewing_borrower->{borrowernumber} |
361 |
undef, $renewing_borrower->{borrowernumber} |
Lines 366-372
C4::Context->dbh->do("DELETE FROM accountlines");
Link Here
|
366 |
C4::Overdues::UpdateFine( $itemnumber2, $renewing_borrower->{borrowernumber}, |
371 |
C4::Overdues::UpdateFine( $itemnumber2, $renewing_borrower->{borrowernumber}, |
367 |
15.00, q{}, Koha::DateUtils::output_pref($datedue) ); |
372 |
15.00, q{}, Koha::DateUtils::output_pref($datedue) ); |
368 |
|
373 |
|
369 |
LostItem( $itemnumber2, 1 ); |
374 |
LostItem( $itemnumber2, 0 ); |
|
|
375 |
|
376 |
my $item2 = $schema->resultset('Item')->find( $itemnumber2 ); |
377 |
ok( $item2->onloan(), "Lost item *not* marked as returned has onloan = 1" ); |
370 |
|
378 |
|
371 |
$total_due = $dbh->selectrow_array( |
379 |
$total_due = $dbh->selectrow_array( |
372 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
380 |
'SELECT SUM( amountoutstanding ) FROM accountlines WHERE borrowernumber = ?', |
373 |
- |
|
|