|
Lines 17-34
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Koha::DateUtils; |
20 |
use Test::More tests => 32; |
| 21 |
use DateTime::Duration; |
21 |
|
| 22 |
use t::lib::Mocks; |
22 |
use t::lib::Mocks; |
|
|
23 |
use t::lib::TestBuilder; |
| 24 |
|
| 23 |
use C4::Biblio; |
25 |
use C4::Biblio; |
| 24 |
use C4::Members; |
|
|
| 25 |
use C4::Circulation; |
26 |
use C4::Circulation; |
| 26 |
use C4::Items; |
|
|
| 27 |
use C4::Context; |
27 |
use C4::Context; |
|
|
28 |
use C4::Items; |
| 29 |
use C4::Members; |
| 28 |
use C4::Reserves; |
30 |
use C4::Reserves; |
|
|
31 |
use Koha::Database; |
| 32 |
use Koha::DateUtils; |
| 29 |
use Koha::Library; |
33 |
use Koha::Library; |
| 30 |
|
34 |
|
| 31 |
use Test::More tests => 32; |
35 |
use DateTime::Duration; |
|
|
36 |
|
| 32 |
|
37 |
|
| 33 |
BEGIN { |
38 |
BEGIN { |
| 34 |
use_ok('C4::Circulation'); |
39 |
use_ok('C4::Circulation'); |
|
Lines 50-59
can_ok(
Link Here
|
| 50 |
) |
55 |
) |
| 51 |
); |
56 |
); |
| 52 |
|
57 |
|
| 53 |
#Start transaction |
|
|
| 54 |
my $dbh = C4::Context->dbh; |
58 |
my $dbh = C4::Context->dbh; |
| 55 |
$dbh->{RaiseError} = 1; |
59 |
my $schema = Koha::Database->schema; |
| 56 |
$dbh->{AutoCommit} = 0; |
60 |
#Start transaction |
|
|
61 |
$schema->storage->txn_begin; |
| 62 |
|
| 63 |
my $builder = t::lib::TestBuilder->new(); |
| 57 |
|
64 |
|
| 58 |
$dbh->do(q|DELETE FROM issues|); |
65 |
$dbh->do(q|DELETE FROM issues|); |
| 59 |
$dbh->do(q|DELETE FROM items|); |
66 |
$dbh->do(q|DELETE FROM items|); |
|
Lines 63-69
$dbh->do(q|DELETE FROM categories|);
Link Here
|
| 63 |
$dbh->do(q|DELETE FROM accountlines|); |
70 |
$dbh->do(q|DELETE FROM accountlines|); |
| 64 |
$dbh->do(q|DELETE FROM issuingrules|); |
71 |
$dbh->do(q|DELETE FROM issuingrules|); |
| 65 |
|
72 |
|
| 66 |
#Add sample datas |
73 |
# Generate sample datas |
|
|
74 |
my $itemtype = $builder->build( |
| 75 |
{ source => 'Itemtype', |
| 76 |
value => { notforloan => undef, rentalcharge => 0 } |
| 77 |
} |
| 78 |
)->{itemtype}; |
| 67 |
|
79 |
|
| 68 |
#Add Dates |
80 |
#Add Dates |
| 69 |
|
81 |
|
|
Lines 158-164
my @sampleitem1 = C4::Items::AddItem(
Link Here
|
| 158 |
homebranch => $samplebranch1->{branchcode}, |
170 |
homebranch => $samplebranch1->{branchcode}, |
| 159 |
holdingbranch => $samplebranch1->{branchcode}, |
171 |
holdingbranch => $samplebranch1->{branchcode}, |
| 160 |
issue => 1, |
172 |
issue => 1, |
| 161 |
reserve => 1 |
173 |
reserve => 1, |
|
|
174 |
itype => $itemtype |
| 162 |
}, |
175 |
}, |
| 163 |
$biblionumber |
176 |
$biblionumber |
| 164 |
); |
177 |
); |
|
Lines 170-176
my @sampleitem2 = C4::Items::AddItem(
Link Here
|
| 170 |
homebranch => $samplebranch2->{branchcode}, |
183 |
homebranch => $samplebranch2->{branchcode}, |
| 171 |
holdingbranch => $samplebranch2->{branchcode}, |
184 |
holdingbranch => $samplebranch2->{branchcode}, |
| 172 |
notforloan => 1, |
185 |
notforloan => 1, |
| 173 |
issue => 1 |
186 |
issue => 1, |
|
|
187 |
itype => $itemtype |
| 174 |
}, |
188 |
}, |
| 175 |
$biblionumber |
189 |
$biblionumber |
| 176 |
); |
190 |
); |
|
Lines 369-375
my $itemnumber;
Link Here
|
| 369 |
itemcallnumber => 'callnumber3', |
383 |
itemcallnumber => 'callnumber3', |
| 370 |
homebranch => $samplebranch1->{branchcode}, |
384 |
homebranch => $samplebranch1->{branchcode}, |
| 371 |
holdingbranch => $samplebranch1->{branchcode}, |
385 |
holdingbranch => $samplebranch1->{branchcode}, |
| 372 |
notforloan => 1, |
386 |
notforloan => 1, |
|
|
387 |
itype => $itemtype |
| 373 |
}, |
388 |
}, |
| 374 |
$biblionumber |
389 |
$biblionumber |
| 375 |
); |
390 |
); |
|
Lines 397-400
my $reserve = GetReserve( $reserve_id );
Link Here
|
| 397 |
is( $reserve, undef, 'The reserve should have been correctly cancelled' ); |
412 |
is( $reserve, undef, 'The reserve should have been correctly cancelled' ); |
| 398 |
|
413 |
|
| 399 |
#End transaction |
414 |
#End transaction |
| 400 |
$dbh->rollback; |
415 |
$schema->storage->txn_rollback; |
| 401 |
- |
|
|