From e9e8b635e14fe1229006b556e8aa0babf61455c7 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
---
t/db_dependent/Letters/TemplateToolkit.t | 26 ++++++++++++++++--------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t
index 6f55a8a93e..720b9d104d 100644
--- a/t/db_dependent/Letters/TemplateToolkit.t
+++ b/t/db_dependent/Letters/TemplateToolkit.t
@@ -522,17 +522,25 @@ You have [% count %] items due
my $code = 'HOLD_SLIP';
- C4::Reserves::AddReserve(
+ my $reserve_id1 = C4::Reserves::AddReserve(
{
branchcode => $library->{branchcode},
borrowernumber => $patron->{borrowernumber},
biblionumber => $biblio1->{biblionumber},
notes => "a note",
itemnumber => $item1->{itemnumber},
- found => 'W'
}
);
- C4::Reserves::AddReserve(
+ my $reserve_id2 = C4::Reserves::AddReserve(
+ {
+ branchcode => $library->{branchcode},
+ borrowernumber => $patron->{borrowernumber},
+ biblionumber => $biblio1->{biblionumber},
+ notes => "a note",
+ itemnumber => $item1->{itemnumber},
+ }
+ );
+ my $reserve_id3 = C4::Reserves::AddReserve(
{
branchcode => $library->{branchcode},
borrowernumber => $patron->{borrowernumber},
@@ -568,13 +576,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 %]
@@ -602,13 +610,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