Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 32; |
20 |
use Test::More tests => 35; |
21 |
use DateTime::Duration; |
21 |
use DateTime::Duration; |
22 |
|
22 |
|
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 53-58
can_ok(
Link Here
|
53 |
) |
53 |
) |
54 |
); |
54 |
); |
55 |
|
55 |
|
|
|
56 |
use constant PI => 3.141592; |
57 |
|
56 |
#Start transaction |
58 |
#Start transaction |
57 |
my $schema = Koha::Database->schema; |
59 |
my $schema = Koha::Database->schema; |
58 |
$schema->storage->txn_begin; |
60 |
$schema->storage->txn_begin; |
Lines 207-216
$sth = $dbh->prepare($query);
Link Here
|
207 |
$sth->execute; |
209 |
$sth->execute; |
208 |
my $countaccount = $sth -> fetchrow_array; |
210 |
my $countaccount = $sth -> fetchrow_array; |
209 |
is ($countaccount,0,"0 accountline exists"); |
211 |
is ($countaccount,0,"0 accountline exists"); |
210 |
my $offset = C4::Circulation::AddIssuingCharge( $item_id1, $borrower_id1, $issue_id1, 10 ); |
212 |
my $offset = C4::Circulation::AddIssuingCharge({ |
|
|
213 |
itemnumber => $item_id1, |
214 |
borrowernumber => $borrower_id1, |
215 |
issue_id => $issue_id1, |
216 |
charge => PI, |
217 |
}); |
211 |
is( ref( $offset ), 'Koha::Account::Offset', "An issuing charge has been added" ); |
218 |
is( ref( $offset ), 'Koha::Account::Offset', "An issuing charge has been added" ); |
212 |
my $charge = Koha::Account::Lines->find( $offset->debit_id ); |
219 |
my $charge = Koha::Account::Lines->find( $offset->debit_id ); |
|
|
220 |
is( $charge->itemnumber, $item_id1, 'Item number is set correctly for issuing charge' ); |
221 |
is( $charge->borrowernumber, $borrower_id1, 'Borrower number is set correctly for issuing charge' ); |
213 |
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' ); |
222 |
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' ); |
|
|
223 |
# force typecast to keep agnostic of decimal 28,6 definition |
224 |
is( $charge->amount+0, PI, 'Charge amount is set correctly for issuing charge' ); |
214 |
my $account_id = $dbh->last_insert_id( undef, undef, 'accountlines', undef ); |
225 |
my $account_id = $dbh->last_insert_id( undef, undef, 'accountlines', undef ); |
215 |
$sth->execute; |
226 |
$sth->execute; |
216 |
$countaccount = $sth -> fetchrow_array; |
227 |
$countaccount = $sth -> fetchrow_array; |
217 |
- |
|
|