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

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

Return to bug 17975