Bugzilla – Attachment 125129 Details for
Bug 29062
Patron check-in slip repeats data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29062: Use primary key issued_id to fetch old_issues for letters
Bug-29062-Use-primary-key-issuedid-to-fetch-oldiss.patch (text/plain), 3.61 KB, created by
Nick Clemens (kidclamp)
on 2021-09-22 11:55:46 UTC
(
hide
)
Description:
Bug 29062: Use primary key issued_id to fetch old_issues for letters
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-09-22 11:55:46 UTC
Size:
3.61 KB
patch
obsolete
>From 1f2fa93ec427d17c3a8980e7631b34f7c2caac74 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 22 Sep 2021 11:49:14 +0000 >Subject: [PATCH] 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 >--- > C4/Letters.pm | 4 ++-- > members/printslip.pl | 6 +++--- > 2 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 87b82624c6..ac980c80bb 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -785,7 +785,7 @@ sub _parseletter_sth { > ($table eq 'debits' ) ? "SELECT * FROM accountlines WHERE accountlines_id = ?" : > ($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : > ($table eq 'issues' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : >- ($table eq 'old_issues' ) ? "SELECT * FROM $table WHERE itemnumber = ? ORDER BY timestamp DESC LIMIT 1" : >+ ($table eq 'old_issues' ) ? "SELECT * FROM $table WHERE issue_id = ?" : > ($table eq 'reserves' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" : > ($table eq 'borrowers' ) ? "SELECT * FROM $table WHERE borrowernumber = ?" : > ($table eq 'branches' ) ? "SELECT * FROM $table WHERE branchcode = ?" : >@@ -1734,7 +1734,7 @@ sub _get_tt_params { > module => 'Koha::Old::Checkouts', > singular => 'old_checkout', > plural => 'old_checkouts', >- fk => 'itemnumber', >+ pk => 'issue_id', > }, > overdues => { > module => 'Koha::Checkouts', >diff --git a/members/printslip.pl b/members/printslip.pl >index 1bb11f68be..368d84cc7f 100755 >--- a/members/printslip.pl >+++ b/members/printslip.pl >@@ -71,11 +71,11 @@ if ( $print eq 'checkinslip' ) { > my $checkinslip_branch = $session->param('branch') ? $session->param('branch') : $branch; > > # get today's checkins >- my @itemnumbers = $patron->old_checkouts->search( { branchcode => $checkinslip_branch } ) >- ->filter_by_todays_checkins->get_column('itemnumber'); >+ my @issue_ids = $patron->old_checkouts->search( { branchcode => $checkinslip_branch } ) >+ ->filter_by_todays_checkins->get_column('issue_id'); > > my %loops = ( >- old_issues => \@itemnumbers, >+ old_issues => \@issue_ids, > ); > > my $letter = C4::Letters::GetPreparedLetter( >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29062
:
125129
|
125154
|
125712
|
125749
|
125806
|
125807
|
125809
|
125879