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 / +83 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 533-538 You have [% count %] items due Link Here
533
        is( $tt_letter->{content}, $letter->{content}, );
535
        is( $tt_letter->{content}, $letter->{content}, );
534
    };
536
    };
535
537
538
    subtest 'HOLD_SLIP|dates|today' => sub {
539
        plan tests => 2;
540
541
        my $code = 'HOLD_SLIP';
542
543
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber}, 'W' );
544
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} );
545
546
        my $template = <<EOF;
547
<h5>Date: <<today>></h5>
548
549
<h3> Transfer to/Hold in <<branches.branchname>></h3>
550
551
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
552
553
<ul>
554
    <li><<borrowers.cardnumber>></li>
555
    <li><<borrowers.phone>></li>
556
    <li> <<borrowers.address>><br />
557
         <<borrowers.address2>><br />
558
         <<borrowers.city>>  <<borrowers.zipcode>>
559
    </li>
560
    <li><<borrowers.email>></li>
561
</ul>
562
<br />
563
<h3>ITEM ON HOLD</h3>
564
<h4><<biblio.title>></h4>
565
<h5><<biblio.author>></h5>
566
<ul>
567
   <li><<items.barcode>></li>
568
   <li><<items.itemcallnumber>></li>
569
   <li><<reserves.waitingdate>></li>
570
</ul>
571
<p>Notes:
572
<pre><<reserves.reservenotes>></pre>
573
</p>
574
EOF
575
576
        reset_template( { template => $template, code => $code, module => 'circulation' } );
577
        my $letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
578
        my $letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
579
580
        my $tt_template = <<EOF;
581
<h5>Date: [% today | \$KohaDates with_hours => 1 %]</h5>
582
583
<h3> Transfer to/Hold in [% branch.branchname %]</h3>
584
585
<h3>[% borrower.surname %], [% borrower.firstname %]</h3>
586
587
<ul>
588
    <li>[% borrower.cardnumber %]</li>
589
    <li>[% borrower.phone %]</li>
590
    <li> [% borrower.address %]<br />
591
         [% borrower.address2 %]<br />
592
         [% borrower.city %]  [% borrower.zipcode %]
593
    </li>
594
    <li>[% borrower.email %]</li>
595
</ul>
596
<br />
597
<h3>ITEM ON HOLD</h3>
598
<h4>[% biblio.title %]</h4>
599
<h5>[% biblio.author %]</h5>
600
<ul>
601
   <li>[% item.barcode %]</li>
602
   <li>[% item.itemcallnumber %]</li>
603
   <li>[% hold.waitingdate | \$KohaDates %]</li>
604
</ul>
605
<p>Notes:
606
<pre>[% hold.reservenotes %]</pre>
607
</p>
608
EOF
609
610
        reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
611
        my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
612
        my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
613
614
        is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, );
615
        is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, );
616
    };
536
};
617
};
537
618
538
sub reset_template {
619
sub reset_template {
539
- 

Return to bug 17975