Bug 29062: Use primary key issued_id to fetch old_issues for letters
authorNick Clemens <nick@bywatersolutions.com>
Wed, 22 Sep 2021 11:49:14 +0000 (11:49 +0000)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 8 Oct 2021 15:15:51 +0000 (11:15 -0400)
commit22cc378e4cd5c1e3a782669c9e13bff3de42993d
tree7912b1882f32f1ee4271d3968390bf8037da0970
parent18e4eed3e1a84256170b61d23dc290c0463c79ce
Bug 29062: Use primary key issued_id to fetch old_issues for letters

The code currently uses itemnumber to fetch old_issues for notices.
This doesn't seem to be used in any current notices except the CHECKINSLIP:
SELECTY letter.code,content FROM letter WHERE content LIKE 'old\\_%'\G

For issues we use itemnumber, however, issues has a constraint to limit issues for an itemnumber to 1
Old issues has no such constraint, we try to rectify this in the old code by adding 'ORDER BY returndate DESC LIMIT 1"

As the code is not used by default and buggy I think we can make a change to using 'issue_id' as the key and
announcing the change - it prevents leaky data

To test:
1. Check something out to patron A. Check it in.
2. Check something out to patron B. Check it in.
3. Check something out to patron C. Check it in and print the check-in slip. (Leave the checkin paghe open)
4. You will see the checkin repeat itself 3 times, one for each line in old_issues.
5. Apply patch and restart_all
6. Click the 'Print checkin slip' button again
7. You see a single checkin
8. Checkout a different item to patron A. Check it in and print the check-in slip
9. See the correct checkins

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Letters.pm
members/printslip.pl