From 29e53d6f734dcf0e5b072980d2f53b65d1c75e05 Mon Sep 17 00:00:00 2001
From: Jonathan Druart
Date: Mon, 13 Apr 2020 13:10:55 +0200
Subject: [PATCH] Bug 24612: Add tests
ReserveSlip call need to be adjusted in test.
We also add a new reserve (same biblio, same patron) to highlight the problem.
Signed-off-by: Victor Grousset/tuxayo
Signed-off-by: Katrin Fischer
Signed-off-by: Martin Renvoize
(cherry picked from commit e9e8b635e14fe1229006b556e8aa0babf61455c7)
Signed-off-by: Aleisha Amohia
---
t/db_dependent/Letters/TemplateToolkit.t | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t
index af8778f8c6..223e0439b1 100644
--- a/t/db_dependent/Letters/TemplateToolkit.t
+++ b/t/db_dependent/Letters/TemplateToolkit.t
@@ -524,8 +524,9 @@ You have [% count %] items due
my $code = 'HOLD_SLIP';
- C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber}, 'W' );
- C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} );
+ my $reserve_id1 = C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber} );
+ my $reserve_id2 = C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber} );
+ my $reserve_id3 = C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} );
my $template = <Date: <>
@@ -553,13 +554,13 @@ You have [% count %] items due
<>
Notes:
-
<>
+<>=<>
EOF
reset_template( { template => $template, code => $code, module => 'circulation' } );
- my $letter_for_item1 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, borrowernumber => $patron->{borrowernumber}, biblionumber => $biblio1->{biblionumber} } );
- my $letter_for_item2 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, borrowernumber => $patron->{borrowernumber}, biblionumber => $biblio2->{biblionumber} } );
+ my $letter_for_item1 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, reserve_id => $reserve_id1 } );
+ my $letter_for_item2 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, reserve_id => $reserve_id3 } );
my $tt_template = <Date: [% today | \$KohaDates with_hours => 1 %]
@@ -587,13 +588,13 @@ EOF
[% hold.waitingdate | \$KohaDates %]
Notes:
-
[% hold.reservenotes %]
+[% hold.reserve_id %]=[% hold.reservenotes %]
EOF
reset_template( { template => $tt_template, code => $code, module => 'circulation' } );
- my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, borrowernumber => $patron->{borrowernumber}, biblionumber => $biblio1->{biblionumber} } );
- my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, borrowernumber => $patron->{borrowernumber}, biblionumber => $biblio2->{biblionumber} } );
+ my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, reserve_id => $reserve_id1 } );
+ my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( { branchcode => $library->{branchcode}, reserve_id => $reserve_id3 } );
is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, );
is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, );
--
2.39.5