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

(-)a/C4/Letters.pm (-1 / +1 lines)
Lines 1603-1609 sub _get_tt_params { Link Here
1603
        }
1603
        }
1604
    }
1604
    }
1605
1605
1606
    $params->{today} = dt_from_string();
1606
    $params->{today} = output_pref({ dt => dt_from_string, dateformat => 'iso' });
1607
1607
1608
    return $params;
1608
    return $params;
1609
}
1609
}
(-)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 500-505 You have [% count %] items due Link Here
500
        is( $tt_letter->{content}, $letter->{content}, );
502
        is( $tt_letter->{content}, $letter->{content}, );
501
    };
503
    };
502
504
505
    subtest 'HOLD_SLIP|dates|today' => sub {
506
        plan tests => 2;
507
508
        my $code = 'HOLD_SLIP';
509
510
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber}, 'W' );
511
        C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} );
512
513
        my $template = <<EOF;
514
<h5>Date: <<today>></h5>
515
516
<h3> Transfer to/Hold in <<branches.branchname>></h3>
517
518
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
519
520
<ul>
521
    <li><<borrowers.cardnumber>></li>
522
    <li><<borrowers.phone>></li>
523
    <li> <<borrowers.address>><br />
524
         <<borrowers.address2>><br />
525
         <<borrowers.city>>  <<borrowers.zipcode>>
526
    </li>
527
    <li><<borrowers.email>></li>
528
</ul>
529
<br />
530
<h3>ITEM ON HOLD</h3>
531
<h4><<biblio.title>></h4>
532
<h5><<biblio.author>></h5>
533
<ul>
534
   <li><<items.barcode>></li>
535
   <li><<items.itemcallnumber>></li>
536
   <li><<reserves.waitingdate>></li>
537
</ul>
538
<p>Notes:
539
<pre><<reserves.reservenotes>></pre>
540
</p>
541
EOF
542
543
        reset_template( { template => $template, code => $code, module => 'circulation' } );
544
        my $letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
545
        my $letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
546
547
        my $tt_template = <<EOF;
548
<h5>Date: [% today | \$KohaDates with_hours => 1 %]</h5>
549
550
<h3> Transfer to/Hold in [% branch.branchname %]</h3>
551
552
<h3>[% borrower.surname %], [% borrower.firstname %]</h3>
553
554
<ul>
555
    <li>[% borrower.cardnumber %]</li>
556
    <li>[% borrower.phone %]</li>
557
    <li> [% borrower.address %]<br />
558
         [% borrower.address2 %]<br />
559
         [% borrower.city %]  [% borrower.zipcode %]
560
    </li>
561
    <li>[% borrower.email %]</li>
562
</ul>
563
<br />
564
<h3>ITEM ON HOLD</h3>
565
<h4>[% biblio.title %]</h4>
566
<h5>[% biblio.author %]</h5>
567
<ul>
568
   <li>[% item.barcode %]</li>
569
   <li>[% item.itemcallnumber %]</li>
570
   <li>[% hold.waitingdate | \$KohaDates %]</li>
571
</ul>
572
<p>Notes:
573
<pre>[% hold.reservenotes %]</pre>
574
</p>
575
EOF
576
577
        reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
578
        my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} );
579
        my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} );
580
581
        is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, );
582
        is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, );
583
    };
503
};
584
};
504
585
505
sub reset_template {
586
sub reset_template {
506
- 

Return to bug 17975