View | Details | Raw Unified | Return to bug 31858
Collapse All | Expand All

(-)a/t/db_dependent/Letters.t (-2 / +52 lines)
Lines 18-24 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 => 85;
21
use Test::More tests => 86;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
use Test::Exception;
24
use Test::Exception;
Lines 343-348 is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $ye Link Here
343
$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>');});
343
$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>');});
344
$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> Basket name: [% basket.basketname %]');});
344
$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> Basket name: [% basket.basketname %]');});
345
345
346
my $testacqorder2_content = <<EOF;
347
[%- USE Price -%]
348
[% bookseller.name %]
349
[% FOREACH order IN orders %]
350
Ordernumber [% order.ordernumber %] [% order.quantity %] [% order.listprice | \$Price %]
351
[% END %]
352
EOF
353
354
$dbh->do("INSERT INTO letter (module, code, name, title, content) VALUES ('orderacquisition','TESTACQORDER2','Acquisition Order','Order','$testacqorder2_content');");
355
356
my $popito = $builder->build({
357
    source => 'Aqbookseller',
358
    value  => { name => 'Popito' }
359
});
360
361
my $order_1 = $builder->build({
362
    source => 'Aqorder',
363
    value  => {
364
       quantity => 2,
365
       listprice => '12.00'
366
    }
367
});
368
369
my $order_2 = $builder->build({
370
    source => 'Aqorder',
371
    value  => {
372
       quantity => 1,
373
       listprice => '23.50'
374
    }
375
});
376
377
$prepared_letter = GetPreparedLetter((
378
    module                 => 'orderacquisition',
379
    branchcode             => '',
380
    letter_code            => 'TESTACQORDER2',
381
    tables                 => { 'aqbooksellers' => $popito->{id} },
382
    loops                  => {
383
        aqorders => [ $order_1->{ordernumber}, $order_2->{ordernumber} ]
384
    }
385
));
386
387
my $testacqorder2_expected = qq|Popito
388
389
Ordernumber | . $order_1->{ordernumber} . qq| 2 12.00
390
391
Ordernumber | . $order_2->{ordernumber} . qq| 1 23.50
392
393
|;
394
395
is($prepared_letter->{content}, $testacqorder2_expected);
396
346
# Test that _parseletter doesn't modify its parameters bug 15429
397
# Test that _parseletter doesn't modify its parameters bug 15429
347
{
398
{
348
    my $values = { dateexpiry => '2015-12-13', };
399
    my $values = { dateexpiry => '2015-12-13', };
349
- 

Return to bug 31858