Lines 18-30
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 83; |
21 |
use Test::More tests => 84; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use Email::Sender::Failure; |
25 |
use Email::Sender::Failure; |
26 |
|
26 |
|
27 |
use MARC::Record; |
27 |
use MARC::Record; |
|
|
28 |
use Locale::Currency::Format; |
28 |
|
29 |
|
29 |
use utf8; |
30 |
use utf8; |
30 |
|
31 |
|
Lines 57-62
use Koha::Libraries;
Link Here
|
57 |
use Koha::Notice::Templates; |
58 |
use Koha::Notice::Templates; |
58 |
use Koha::Patrons; |
59 |
use Koha::Patrons; |
59 |
use Koha::Subscriptions; |
60 |
use Koha::Subscriptions; |
|
|
61 |
use Koha::Account; |
62 |
use Koha::Account::Lines; |
60 |
my $schema = Koha::Database->schema; |
63 |
my $schema = Koha::Database->schema; |
61 |
$schema->storage->txn_begin(); |
64 |
$schema->storage->txn_begin(); |
62 |
|
65 |
|
Lines 366-371
is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $ye
Link Here
|
366 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
369 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
367 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('orderacquisition','TESTACQORDER','Acquisition Order','Order','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
370 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('orderacquisition','TESTACQORDER','Acquisition Order','Order','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
368 |
|
371 |
|
|
|
372 |
# Test borrowers.account_balance |
373 |
my $account = Koha::Account->new({ patron_id => $borrowernumber }); |
374 |
$account->add_debit({ amount => 10, interface => 'test', type => 'OVERDUE'})->store; |
375 |
$account->add_debit({ amount => 15, interface => 'test', type => 'OVERDUE'})->store; |
376 |
|
377 |
my $lines = Koha::Account::Lines->search({ borrowernumber => $borrowernumber }); |
378 |
my $totalfine = $lines->total_outstanding; |
379 |
my $active_currency = Koha::Acquisition::Currencies->get_active; |
380 |
my $currency_format = $active_currency->currency if defined($active_currency); |
381 |
my $totalfine_formatted = currency_format($currency_format, "$totalfine", FMT_SYMBOL); |
382 |
$totalfine_formatted = sprintf("%.2f", $totalfine) unless $totalfine_formatted; |
383 |
|
384 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test_fines','TEST_FINES','Test total of fines','','Total of fines is: <<borrowers.account_balance>>.');}); |
385 |
$prepared_letter = GetPreparedLetter(( |
386 |
module => 'test_fines', |
387 |
branchcode => '', |
388 |
letter_code => 'test_fines', |
389 |
tables => $tables, |
390 |
substitute => $substitute, |
391 |
repeat => $repeat, |
392 |
)); |
393 |
is( $prepared_letter->{content}, q|Total of fines is: | . $totalfine_formatted . q|.|, 'Account balance is printed correctly' ); |
394 |
|
369 |
# Test that _parseletter doesn't modify its parameters bug 15429 |
395 |
# Test that _parseletter doesn't modify its parameters bug 15429 |
370 |
{ |
396 |
{ |
371 |
my $values = { dateexpiry => '2015-12-13', }; |
397 |
my $values = { dateexpiry => '2015-12-13', }; |
372 |
- |
|
|