]> git.koha-community.org Git - koha.git/commit
Bug 18651: [QA Follow-up] Fix the MAX(issue_id) calculation
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 20 Jun 2017 13:03:35 +0000 (15:03 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 22 Jun 2017 07:43:17 +0000 (09:43 +0200)
commit845a41b2bab1b9d85221143cf59c9b58ff5a810b
tree1542da32da83ab2088f0636225e15808d19d1fea
parent7540d6b28224914e9be84e2ead3045a2d00a0a0c
Bug 18651: [QA Follow-up] Fix the MAX(issue_id) calculation

Found this by inserting the same issue_id in old_issues before checkin:
The call to ->search( )->get_column is in scalar context and will
return the number of results, i.e. always 1.
If you have an issue_id 2 in old_issues, it will crash:
    DBIx::Class::Storage::DBI::_dbh_execute(): Duplicate entry '2' for key 'PRIMARY'

The fix is fairly simple: Put get_column in list context and pick the first
array entry.
NOTE: Using DBIx's get_column()->max here might look simpler here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit ee7969d3461e6ce08b4fbfd982c90f263f19f693)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Circulation.pm