[Bug 5860] New: Adding duplicate stocknumber will fail silently
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Bug #: 5860 Summary: Adding duplicate stocknumber will fail silently Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Platform: All OS/Version: All Status: NEW Severity: critical Priority: P5 Component: Cataloging AssignedTo: gmcharlt@gmail.com ReportedBy: katrin.fischer@bsz-bw.de QAContact: koha-bugs@lists.koha-community.org CC: ian.walls@bywatersolutions.com To test: Add new field 952 $i to framework and map to items.stocknumber. Add a new item, make stocknumber 1. Add another item, make stocknumber 1. The second stocknumber will not be saved, because the items.stocknumber is unique. The logs show an error message: [Sun Mar 13 22:12:37 2011] [error] [client ::1] [Sun Mar 13 22:12:37 2011] additem.pl: DBD::mysql::st execute failed: Duplicate entry '1' for key 'itemstocknumberidx' at /home/katrin/kohaclone/C4/Items.pm line 1896., referer: http://localhost:8080/cgi-bin/koha/cataloguing/additem.pl We need an error message for the user like we have barcode, which is also unique. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |5861 -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.poulain@biblibre.com --- Comment #1 from Paul Poulain <paul.poulain@biblibre.com> 2011-03-13 21:47:47 UTC --- I'm not sure that stocknumber must be unique. I think it would be better to have it not unique accepted (functionnaly, at least in France, it's common to have libraries having multiple stocknumber, even if it's intellectually strange, I agree. For example, when a library buys 4 of the same book at the same time, the 4 have the same stocknumber) -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-03-13 22:18:04 UTC --- I think we agree that it is a bug at the moment that can be solved in 2 different ways: 1) items.stocknumber stays unique and we give a proper error message. 2) items.stucknumber is changed to not be unique, no error message required. I think the situation in Germany might be similar to France here. It can happen that a stocknumber is assigned for more than 1 item. I think I saw it happen for serials items. And if you have old data it can happen that a stocknumber was duplicated by accident. See also discussion about stocknumber's uniqueness on bug 5839 -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Bug 5860 depends on bug 5861, which changed state. Bug 5861 Summary: items.stocknumber not saved correctly http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5861 What |Old Value |New Value ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |5839 -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-03-25 11:39:50 UTC --- Is someone strictly opposed to changing items.stocknumber to be not unique? I would like to work on that this weekend. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-03-29 20:54:26 UTC --- Created attachment 3506 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=3506 Patch -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 |PATCH-Sent Patch Status|--- |Needs Signoff AssignedTo|gmcharlt@gmail.com |katrin.fischer@bsz-bw.de -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #3506|0 |1 is obsolete| | --- Comment #5 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-04-04 11:21:33 UTC --- Created attachment 3615 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=3615 Signed patch Includes typo fix. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |m.de.rooy@rijksmuseum.nl Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz Patch Status|Signed Off |Patch Pushed --- Comment #6 from Chris Cormack <chris@bigballofwax.co.nz> 2011-04-04 21:33:10 UTC --- Patch pushed, please test -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |julian.maurice@biblibre.com Resolution| |FIXED -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-04-18 10:03:10 UTC --- This patch needs a follow-up for 3.2.x and master. Problem: The applied patch and update will work only for databases created after the stocknumber field was added to the items table. For databases created before stocknumber was introduced to the database the update will fail with an error message and the unique attribute will not be removed. The problem is, that the indexname in kohastructure.pl is different to the name in updatadatabase.pl: kohastructur.sql: 1033 KEY `itemstocknumberidx` (`stocknumber`), updatadatabase.pl: 3251 ALTER TABLE items ADD UNIQUE INDEX itemsstocknumberidx (stocknumber); I am not sure how to solve this so that no error message will be shown while updating the database. And not sure I can work on this in time for the 3.4 release. If someone else has time and is able to fix this - please do. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Patch Pushed |--- -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|PATCH-Sent |P5 Patch Status|--- |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |--- -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 |PATCH-Sent Patch Status|--- |Needs Signoff --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> 2011-05-13 02:03:27 UTC --- Follow up patch sent -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #9 from Chris Cormack <chris@bigballofwax.co.nz> 2011-05-13 02:03:54 UTC --- Created attachment 4092 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4092 Follow up patch -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #10 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-13 12:41:18 UTC --- (In reply to comment #9)
Created attachment 4092 [details] Follow up patch
Patch uses select on information_schema. If a server runs multiple Koha instances [and versions], this could not be reliable. Statement show indexes from items where key_name=... runs on current db. Sending signed patch including this change. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4092|0 |1 is obsolete| | --- Comment #11 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-13 12:51:35 UTC --- Created attachment 4103 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4103 Signed followup patch -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-05-13 12:52:11 UTC --- Hi Marcel, thx for your work on that! I talked to Chris about it in the morning and we debated if checking for the uniqueness of the index might be away to make it easier not relying on version numbers. We also need a patch for 3.2.x and 3.4, because the bug is currently in all maintained versions. People are at different stages when updating, some might be in between and have run into a mysql error message and are already past the update with index still being unique. I think what we need to do is add another database update at the end. Making sure that in every case the index will be fixed. As I said a check for uniqueness using the information_schema tablae and the NOT_UNIQUE field might be easier here. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #13 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-13 12:56:13 UTC --- (In reply to comment #12)
I talked to Chris about it in the morning and we debated if checking for the uniqueness of the index might be away to make it easier not relying on version numbers. We also need a patch for 3.2.x and 3.4, because the bug is currently in all maintained versions. People are at different stages when updating, some might be in between and have run into a mysql error message and are already past the update with index still being unique. I think what we need to do is add another database update at the end. Making sure that in every case the index will be fixed. As I said a check for uniqueness using the information_schema tablae and the NOT_UNIQUE field might be easier here. I would not use information_schema if you do not include name of database (Table schema). Do you send another revision?
-- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #14 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-05-13 13:18:23 UTC --- Hi Marcel, I will try to work on it at the weekend, but will be happy if someone else steps in. I tried "show indexes from items" and see the field non_unique - so I think we can combine both ideas to improve this. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #15 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-16 07:52:46 UTC --- Sending two additinal patches for 32x and 34x. Idea is: just delete both indexes if needed and recreate the non-unique one. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #3615|0 |1 is obsolete| | -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4103|0 |1 is obsolete| | -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Signed Off |Needs Signoff --- Comment #16 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-16 09:51:30 UTC --- After some discussion on IRC with Chris and Katrin, now submitting three new revised patches: one for master, one for 32x and one for 34x. Incorporating all changes in one. The patch tests if it is needed to replace the index. Setting status back to needs signoff. Katrin or Chris: could you sign it please? -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #17 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-16 09:53:00 UTC --- Created attachment 4121 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4121 Followup patch for 3.2.x -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #18 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-16 09:53:45 UTC --- Created attachment 4122 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4122 Followup patch for 3.4.x -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 --- Comment #19 from M. de Rooy <m.de.rooy@rijksmuseum.nl> 2011-05-16 09:54:29 UTC --- Created attachment 4123 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4123 Followup patch for master -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4123|0 |1 is obsolete| | --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-05-17 11:07:45 UTC --- Created attachment 4141 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4141 Patch for MASTER, tested and signed off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4122|0 |1 is obsolete| | --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-05-17 11:57:03 UTC --- Created attachment 4143 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4143 Patch for 3.4.x, tested and signed off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4121|0 |1 is obsolete| | --- Comment #22 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-05-17 12:42:07 UTC --- Created attachment 4144 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4144 Patch for 3.2.x, tested and signed off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Signed Off |Patch Pushed --- Comment #23 from Chris Cormack <chris@bigballofwax.co.nz> 2011-06-12 23:49:35 UTC --- Patch for master pushed, please test -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5860 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #24 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-07-17 13:46:39 UTC --- Patches have been pushed to master, 3.4.x. and 3.2.x. Closing this resolved. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org