[Bug 42303] New: Duplicate itemnumber in items and deleteditems table when order cancel fails
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42303 Bug ID: 42303 Summary: Duplicate itemnumber in items and deleteditems table when order cancel fails Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: emmi.takkinen@koha-suomi.fi QA Contact: testopia@bugs.koha-community.org Noticed this while working on bug 41169. It's possible to end up with duplicate itemnumber in items and deleteditems table when cancelling an order. I attempted to cancel an order and one of the items is present in items_last_borrower table. This caused Koha to die on error 500 and exception [Foreign key constraint broken on deleting resource] was raised. After some debugging I tried canceling again and got:
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '227661' for key 'PRIMARY' since item is now in both items and deleteditems table after failed cancel.
-- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42303 --- Comment #1 from Emmi Takkinen <emmi.takkinen@koha-suomi.fi> --- I'm wondering, could we check in sub safe_to_delete if deleting the item doesn't fail on constraint error? Now it checks if item is on loan or reserved etc. and if not, item is moved to deleteditems table. But when actual delete method fails, the item is still kept in deleteditems table even though it wasn't deleted from items table. Or maybe we could revert the move to the deleteditems table? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org