Lines 286-292
$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 => 5; |
289 |
plan tests => 6; |
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' } ); |
Lines 316-321
subtest 'regression tests' => sub {
Link Here
|
316 |
itemcallnumber => 'itemcallnumber2', |
316 |
itemcallnumber => 'itemcallnumber2', |
317 |
} |
317 |
} |
318 |
)->store->unblessed; |
318 |
)->store->unblessed; |
|
|
319 |
my $biblio3 = Koha::Biblio->new({title => 'Test Biblio 3'})->store->unblessed; |
320 |
my $biblioitem3 = Koha::Biblioitem->new({biblionumber => $biblio3->{biblionumber}})->store()->unblessed; |
321 |
my $item3 = Koha::Item->new( |
322 |
{ |
323 |
biblionumber => $biblio3->{biblionumber}, |
324 |
biblioitemnumber => $biblioitem3->{biblioitemnumber}, |
325 |
barcode => 'another_t_barcode_3', |
326 |
homebranch => $library->{branchcode}, |
327 |
holdingbranch => $library->{branchcode}, |
328 |
itype => 'BK', |
329 |
itemcallnumber => 'itemcallnumber3', |
330 |
} |
331 |
)->store->unblessed; |
319 |
|
332 |
|
320 |
C4::Context->_new_userenv('xxx'); |
333 |
C4::Context->_new_userenv('xxx'); |
321 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Midway Public Library', '', '', ''); |
334 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Midway Public Library', '', '', ''); |
Lines 582-587
EOF
Link Here
|
582 |
is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, ); |
595 |
is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, ); |
583 |
is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, ); |
596 |
is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, ); |
584 |
}; |
597 |
}; |
|
|
598 |
|
599 |
subtest 'ISSUESLIP|checkedout|repeat' => sub { |
600 |
plan tests => 2; |
601 |
|
602 |
my $code = 'ISSUESLIP'; |
603 |
|
604 |
my $branchcode = $library->{branchcode}; |
605 |
|
606 |
Koha::News->delete; |
607 |
my $news_item = Koha::NewsItem->new({ branchcode => $branchcode, title => "A wonderful news", content => "This is the wonderful news." })->store; |
608 |
|
609 |
# historic syntax |
610 |
my $template = <<EOF; |
611 |
<h3><<branches.branchname>></h3> |
612 |
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> |
613 |
(<<borrowers.cardnumber>>) <br /> |
614 |
|
615 |
<<today>><br /> |
616 |
|
617 |
<h4>Checked Out</h4> |
618 |
<checkedout> |
619 |
<p> |
620 |
<<biblio.title>> <br /> |
621 |
Barcode: <<items.barcode>><br /> |
622 |
Date due: <<issues.date_due | dateonly>><br /> |
623 |
</p> |
624 |
</checkedout> |
625 |
|
626 |
<h4>Overdues</h4> |
627 |
<overdue> |
628 |
<p> |
629 |
<<biblio.title>> <br /> |
630 |
Barcode: <<items.barcode>><br /> |
631 |
Date due: <<issues.date_due | dateonly>><br /> |
632 |
</p> |
633 |
</overdue> |
634 |
|
635 |
<hr> |
636 |
|
637 |
<h4 style="text-align: center; font-style:italic;">News</h4> |
638 |
<news> |
639 |
<div class="newsitem"> |
640 |
<h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5> |
641 |
<p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.content>></p> |
642 |
<p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Posted on <<opac_news.timestamp>></p> |
643 |
<hr /> |
644 |
</div> |
645 |
</news> |
646 |
EOF |
647 |
|
648 |
reset_template( { template => $template, code => $code, module => 'circulation' } ); |
649 |
|
650 |
C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout |
651 |
my $first_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); |
652 |
|
653 |
C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout |
654 |
my $yesterday = dt_from_string->subtract( days => 1 ); |
655 |
C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue |
656 |
my $second_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); |
657 |
|
658 |
# Cleanup |
659 |
AddReturn( $item1->{barcode} ); |
660 |
AddReturn( $item2->{barcode} ); |
661 |
AddReturn( $item3->{barcode} ); |
662 |
|
663 |
# TT syntax |
664 |
my $tt_template = <<EOF; |
665 |
<h3>[% branch.branchname %]</h3> |
666 |
Checked out to [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %] <br /> |
667 |
([% borrower.cardnumber %]) <br /> |
668 |
|
669 |
[% today | \$KohaDates with_hours => 1 %]<br /> |
670 |
|
671 |
<h4>Checked Out</h4> |
672 |
[% FOREACH checkout IN checkouts %] |
673 |
[%~ SET item = checkout.item %] |
674 |
[%~ SET biblio = checkout.item.biblio %] |
675 |
<p> |
676 |
[% biblio.title %] <br /> |
677 |
Barcode: [% item.barcode %]<br /> |
678 |
Date due: [% checkout.date_due | \$KohaDates %]<br /> |
679 |
</p> |
680 |
[% END %] |
681 |
|
682 |
<h4>Overdues</h4> |
683 |
[% FOREACH overdue IN overdues %] |
684 |
[%~ SET item = overdue.item %] |
685 |
[%~ SET biblio = overdue.item.biblio %] |
686 |
<p> |
687 |
[% biblio.title %] <br /> |
688 |
Barcode: [% item.barcode %]<br /> |
689 |
Date due: [% overdue.date_due | \$KohaDates %]<br /> |
690 |
</p> |
691 |
[% END %] |
692 |
|
693 |
<hr> |
694 |
|
695 |
<h4 style="text-align: center; font-style:italic;">News</h4> |
696 |
[% FOREACH n IN news %] |
697 |
<div class="newsitem"> |
698 |
<h5 style="margin-bottom: 1px; margin-top: 1px"><b>[% n.title %]</b></h5> |
699 |
<p style="margin-bottom: 1px; margin-top: 1px">[% n.content %]</p> |
700 |
<p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Posted on [% n.timestamp | \$KohaDates %]</p> |
701 |
<hr /> |
702 |
</div> |
703 |
[% END %] |
704 |
EOF |
705 |
|
706 |
reset_template( { template => $tt_template, code => $code, module => 'circulation' } ); |
707 |
|
708 |
C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout |
709 |
my $first_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); |
710 |
|
711 |
C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout |
712 |
C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue |
713 |
my $second_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); |
714 |
|
715 |
# There is too many line breaks generated by the historic syntax |
716 |
$second_slip->{content} =~ s|</p>\n\n\n<p>|</p>\n\n<p>|s; |
717 |
|
718 |
is( $first_tt_slip->{content}, $first_slip->{content}, ); |
719 |
is( $second_tt_slip->{content}, $second_slip->{content}, ); |
720 |
}; |
585 |
}; |
721 |
}; |
586 |
|
722 |
|
587 |
subtest 'loops' => sub { |
723 |
subtest 'loops' => sub { |
588 |
- |
|
|