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

(-)a/C4/Letters.pm (-1 / +1 lines)
Lines 1627-1633 sub _get_tt_params { Link Here
1627
        }
1627
        }
1628
    }
1628
    }
1629
1629
1630
    $params->{today} = dt_from_string();
1630
    $params->{today} = output_pref({ dt => dt_from_string, dateformat => 'iso' });
1631
1631
1632
    return $params;
1632
    return $params;
1633
}
1633
}
(-)a/t/db_dependent/Letters/TemplateToolkit.t (-3 / +84 lines)
Lines 286-296 $prepared_letter = GetPreparedLetter( Link Here
286
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' );
286
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' );
287
287
288
subtest 'regression tests' => sub {
288
subtest 'regression tests' => sub {
289
    plan tests => 4;
289
    plan tests => 5;
290
290
291
    my $library = $builder->build( { source => 'Branch' } );
291
    my $library = $builder->build( { source => 'Branch' } );
292
    my $patron  = $builder->build( { source => 'Borrower' } );
292
    my $patron  = $builder->build( { source => 'Borrower' } );
293
    my $biblio1 = Koha::Biblio->new({title => 'Test Biblio 1'})->store->unblessed;
293
    my $biblio1 = Koha::Biblio->new({title => 'Test Biblio 1', author => 'An author', })->store->unblessed;
294
    my $biblioitem1 = Koha::Biblioitem->new({biblionumber => $biblio1->{biblionumber}})->store()->unblessed;
294
    my $biblioitem1 = Koha::Biblioitem->new({biblionumber => $biblio1->{biblionumber}})->store()->unblessed;
295
    my $item1 = Koha::Item->new(
295
    my $item1 = Koha::Item->new(
296
        {
296
        {
Lines 300-305 subtest 'regression tests' => sub { Link Here
300
            homebranch       => $library->{branchcode},
300
            homebranch       => $library->{branchcode},
301
            holdingbranch    => $library->{branchcode},
301
            holdingbranch    => $library->{branchcode},
302
            itype            => 'BK',
302
            itype            => 'BK',
303
            itemcallnumber   => 'itemcallnumber1',
303
        }
304
        }
304
    )->store->unblessed;
305
    )->store->unblessed;
305
    my $biblio2 = Koha::Biblio->new({title => 'Test Biblio 2'})->store->unblessed;
306
    my $biblio2 = Koha::Biblio->new({title => 'Test Biblio 2'})->store->unblessed;
Lines 312-317 subtest 'regression tests' => sub { Link Here
312
            homebranch       => $library->{branchcode},
313
            homebranch       => $library->{branchcode},
313
            holdingbranch    => $library->{branchcode},
314
            holdingbranch    => $library->{branchcode},
314
            itype            => 'BK',
315
            itype            => 'BK',
316
            itemcallnumber   => 'itemcallnumber2',
315
        }
317
        }
316
    )->store->unblessed;
318
    )->store->unblessed;
317
319
Lines 500-505 You have [% count %] items due Link Here
500
        my $tt_letter = process_letter( { template => $tt_template, %$params });
502
        my $tt_letter = process_letter( { template => $tt_template, %$params });
501
        is( $tt_letter->{content}, $letter->{content}, );
503
        is( $tt_letter->{content}, $letter->{content}, );
502
    };
504
    };
505
506
    subtest 'HOLD_SLIP|dates|today' => sub {
507
        plan tests => 2;
508
509
        my $code = 'HOLD_SLIP';
510
511
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber}, 'W' );
512
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} );
513
514
        my $template = <<EOF;
515
<h5>Date: <<today>></h5>
516
517
<h3> Transfer to/Hold in <<branches.branchname>></h3>
518
519
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
520
521
<ul>
522
    <li><<borrowers.cardnumber>></li>
523
    <li><<borrowers.phone>></li>
524
    <li> <<borrowers.address>><br />
525
         <<borrowers.address2>><br />
526
         <<borrowers.city>>  <<borrowers.zipcode>>
527
    </li>
528
    <li><<borrowers.email>></li>
529
</ul>
530
<br />
531
<h3>ITEM ON HOLD</h3>
532
<h4><<biblio.title>></h4>
533
<h5><<biblio.author>></h5>
534
<ul>
535
   <li><<items.barcode>></li>
536
   <li><<items.itemcallnumber>></li>
537
   <li><<reserves.waitingdate>></li>
538
</ul>
539
<p>Notes:
540
<pre><<reserves.reservenotes>></pre>
541
</p>
542
EOF
543
544
        reset_template( { template => $template, code => $code, module => 'circulation' } );
545
        my $letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
546
        my $letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
547
548
        my $tt_template = <<EOF;
549
<h5>Date: [% today | \$KohaDates with_hours => 1 %]</h5>
550
551
<h3> Transfer to/Hold in [% branch.branchname %]</h3>
552
553
<h3>[% borrower.surname %], [% borrower.firstname %]</h3>
554
555
<ul>
556
    <li>[% borrower.cardnumber %]</li>
557
    <li>[% borrower.phone %]</li>
558
    <li> [% borrower.address %]<br />
559
         [% borrower.address2 %]<br />
560
         [% borrower.city %]  [% borrower.zipcode %]
561
    </li>
562
    <li>[% borrower.email %]</li>
563
</ul>
564
<br />
565
<h3>ITEM ON HOLD</h3>
566
<h4>[% biblio.title %]</h4>
567
<h5>[% biblio.author %]</h5>
568
<ul>
569
   <li>[% item.barcode %]</li>
570
   <li>[% item.itemcallnumber %]</li>
571
   <li>[% hold.waitingdate | \$KohaDates %]</li>
572
</ul>
573
<p>Notes:
574
<pre>[% hold.reservenotes %]</pre>
575
</p>
576
EOF
577
578
        reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
579
        my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
580
        my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
581
582
        is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, );
583
        is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, );
584
    };
503
};
585
};
504
586
505
subtest 'loops' => sub {
587
subtest 'loops' => sub {
506
- 

Return to bug 17975