Bugzilla – Attachment 60968 Details for
Bug 18185
Clears loan history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18185: [SOLUTION 1]Remove primary key on old_issues.issue_id
Bug-18185-SOLUTION-1Remove-primary-key-on-oldissue.patch (text/plain), 2.37 KB, created by
Jonathan Druart
on 2017-03-09 19:01:04 UTC
(
hide
)
Description:
Bug 18185: [SOLUTION 1]Remove primary key on old_issues.issue_id
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-09 19:01:04 UTC
Size:
2.37 KB
patch
obsolete
>From abcfc0e073e6a7e49d09e0ca1b7c4d48358510d1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Mar 2017 15:54:02 -0300 >Subject: [PATCH] Bug 18185: [SOLUTION 1]Remove primary key on > old_issues.issue_id > >The table old_issues has a primary key defined on the issue_id column. >This issue_id comes from the issues table when an item is checked in. > >In some case the value of issue_id already exists in the table > >Basically this happens when an item is returned and mysqld is restarted: >The auto increment value for issues.issue_id will be reset to MAX(issue_id)+1 >(which is the value of the last entry of old_issues). See also the description >of bug 18003 for more informations. > >The easier solution seems to add a new column id as a primary key. The changes >to the codebase are very small. > >However this will raise few problems: >- We can no longer assume that accountlines.issue_id==old_issues.id (I >guess it is problematic). >- Code in Koha::REST::V1::_object_ownership_by_checkout_id is wrong >assuming that old_issues.issuing_id is unique >--- > C4/Circulation.pm | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index af5acce..22906c8 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2164,9 +2164,13 @@ sub MarkIssueReturned { > # FIXME transaction > my $sth_upd = $dbh->prepare($query); > $sth_upd->execute(@bind); >- my $sth_copy = $dbh->prepare('INSERT INTO old_issues SELECT * FROM issues >- WHERE borrowernumber = ? >- AND itemnumber = ?'); >+ my $sth_copy = $dbh->prepare(q| >+ INSERT INTO old_issues( issue_id, borrowernumber, itemnumber, date_due, branchcode, returndate, lastreneweddate, `return`, renewals, auto_renew, timestamp, issuedate, onsite_checkout ) >+ SELECT issue_id, borrowernumber, itemnumber, date_due, branchcode, returndate, lastreneweddate, `return`, renewals, auto_renew, timestamp, issuedate, onsite_checkout >+ FROM issues >+ WHERE borrowernumber = ? >+ AND itemnumber = ? >+ |); > $sth_copy->execute($borrowernumber, $itemnumber); > # anonymise patron checkout immediately if $privacy set to 2 and AnonymousPatron is set to a valid borrowernumber > if ( $privacy == 2) { >-- >2.9.3
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 18185
:
60749
|
60966
|
60967
|
60968