Tthe slip RESERVESLIP is not replacing fields correctly. C4::Reserves::ReserveSlip calls C4::Letters::GetPreparedLetter, and passes the $reserve hashref to it for each table except branches ( which is passed the branchcode ). The problem is, if you pass a hashref for a table, it uses that hashref for the replacing, rather than looking up the data from the database.
Created attachment 11877 [details] [review] Bug 8700 - RESERVESLIP fields not being replaced correctly The slip RESERVESLIP is not replacing fields correctly. C4::Reserves::ReserveSlip calls C4::Letters::GetPreparedLetter, and passes the $reserve hashref to it for each table except branches ( which is passed the branchcode ). The problem is, if you pass a hashref for a table, it uses that hashref for the replacing, rather than looking up the data from the database. Fixed by passing the correct keys for each of the tables requested.
Can you please add a test plan for this?
Test plan: 1) Edit the slip RESERVESLIP, set it to the following: borrowers.title: <<borrowers.title>> <br/> biblio.copyrightdate: <<biblio.copyrightdate>> <br/> items.replacementprice: <<items.replacementprice>> 2) Place a reserve for a borrower. Make sure that borrower has a borrowers.title value in the database ( I prefer "King of the World" ), as well as biblio.copyrightdate, and items.replacementprice 3) Return the item, confirm hold and print slip. The slip will probably show the *item's* title in borrowers.title. It did for me. The other two will probably by blank. 4) Apply the patch, repeat step 2 and 3, the values should now be correct and accurate.
Created attachment 12406 [details] [review] [SIGNED-OFF] Bug 8700 - RESERVESLIP fields not being replaced correctly The slip RESERVESLIP is not replacing fields correctly. C4::Reserves::ReserveSlip calls C4::Letters::GetPreparedLetter, and passes the $reserve hashref to it for each table except branches ( which is passed the branchcode ). The problem is, if you pass a hashref for a table, it uses that hashref for the replacing, rather than looking up the data from the database. Fixed by passing the correct keys for each of the tables requested. Signed-off-by: Marc Veron <veron@veron.ch> Tested following the test plan. Could reproduce the bug. After applying the patch slip printed as expected.
I just want to add kudos for Kyle and Marc. I just had the same issue come up, so it's nice to see that someone has already taken care of it :)
QA comment * tiny & trivial (from a QA POV) patch passed QA
Patch pushed to master
Pushed to 3.8.x, will be in 3.8.6