Bug 18242: [SOLUTION 2]Handle correctly move to old_issues
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 9 Mar 2017 19:58:17 +0000 (16:58 -0300)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Wed, 22 Mar 2017 17:38:14 +0000 (17:38 +0000)
commit7aa0808ff227850fc448b74dabed9b15ac0eb927
tree995dba1e50d22b49e499716eee79bfe417cfd307
parent48b1328ebeb7ed2337ba75a582705389767b691a
Bug 18242: [SOLUTION 2]Handle correctly move to old_issues

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.

In this solution the change is done at code level instead of DB
structure: If old_issues.issue_id already exists before moving from
the issues table, the issue_id is updated (not on cascade for
accountlines.issue_id, should it?) before the move.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
C4/Circulation.pm