[Bug 26516] New: Importing records with unexpected format of copyrightdate fails
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Bug ID: 26516 Summary: Importing records with unexpected format of copyrightdate fails Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Bug 11046 attempted to improve the parsing of publicationyear/copyrightdate from marc records. Unfortunately copyrightdate is strictly an integer field, so now adds/imports fail if invalid data is passed To recreate: 1 - Add a new record to Koha making sure data is valid except 260$c: 198- 2 - Save the record 3 - It fails DBD::mysql::st execute failed: Data truncated for column 'copyrightdate' at row 1 [for Statement "INSERT INTO biblio SET frameworkcode = ?, author = ?, title = ?, subtitle = ?, medium = ?, part_number = ?, part_name = ?, unititle =?, notes = ?, serial = ?, seriestitle = ?, copyrightdate = ?, datecreated=NOW(), abstract = ? " with ParamValues: 0='', 1=undef, 2="This record", 3=undef, 4=undef, 5=undef, 6=undef, 7=undef, 8=undef, 9=0, 10=undef, 11="198-", 12=undef] at /kohadevbox/koha/C4/Biblio.pm line 2745. ERROR in _koha_add_biblio INSERT INTO biblio -- 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=26516 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- 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=26516 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 110602 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110602&action=edit Bug 26516: Check if int before save This is how we handle it when modifying a biblio To test: To recreate: 1 - Add a new record to Koha making sure data is valid except 260$c: 198- 2 - Save the record 3 - It fails 4 - Apply patch 5 - restart all the things 6 - Repeat 7 - Success! -- 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=26516 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110602|0 |1 is obsolete| | --- Comment #2 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 110605 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=110605&action=edit Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear The previous patch rejects incorrect values when saving to the db specifically for copyrightdate An error is thrown for the int conversion when it fails Rather than catching things when saving we can fix the value when generated, simply returning null when parsing the record To test: 1 - Add a new record to Koha making sure data is valid except 260$c: 198- 2 - Save the record 3 - It fails 4 - Apply this patch 5 - Restart all the thigns 6 - Repeat 7 - Success! -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | Depends on| |11046 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11046 [Bug 11046] Better handling of uncertain years for publicationyear/copyrightdate -- 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=26516 Lisette Scheer <lisetteslatah@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisetteslatah@gmail.com --- Comment #3 from Lisette Scheer <lisetteslatah@gmail.com> --- Before applying the patch, when adding a record with 198- in the 260$c: field, we got the following error on the sandbox: Broken FK constraint at /usr/share/perl5/Exception/Class/Base.pm line 88 in Exception::Class::Base::throw at /usr/share/perl5/Exception/Class/Base.pm line 88 We were not able to import a record with 198- in the 260$c: field before applying the patch. After the patch was applied we still got the same error when trying to add a new record with 198- in the 260$c: field. We were able to export the record, edit it to have 198- and import the record successfully. Owen wasn't able to recreate the error below on his test server. Broken FK constraint at /usr/share/perl5/Exception/Class/Base.pm line 88 in Exception::Class::Base::throw at /usr/share/perl5/Exception/Class/Base.pm line 88 Lisette -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Heather <heather_hernandez@nps.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |heather_hernandez@nps.gov -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #110605|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 112905 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=112905&action=edit Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear The previous patch rejects incorrect values when saving to the db specifically for copyrightdate An error is thrown for the int conversion when it fails Rather than catching things when saving we can fix the value when generated, simply returning null when parsing the record To test: 1 - Add a new record to Koha making sure data is valid except 260$c: 198- 2 - Save the record 3 - It fails 4 - Apply this patch 5 - Restart all the thigns 6 - Repeat 7 - Success! Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- (In reply to Lisette Scheer from comment #3)
Before applying the patch, when adding a record with 198- in the 260$c: field, we got the following error on the sandbox:
Broken FK constraint at /usr/share/perl5/Exception/Class/Base.pm line 88 in Exception::Class::Base::throw at /usr/share/perl5/Exception/Class/Base.pm line 88
I got this error as well locally using koha-testing-docker. For me the error mentioned in the description appeared in /var/log/koha/kohadev/plack-intranet-error.log (not sure whether this will be the same when using kohadevbox). I imported a record using Z39.50 from the Library of Congress (title = IBM Style Guide), and changed the 260$c to 198- After applying the patch I went flush_memcached and restart_all, redid the import and everything worked as per the test plan - successfully able to add a record with 198- for $260$c. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #112905|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 113655 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=113655&action=edit Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear The previous patch rejects incorrect values when saving to the db specifically for copyrightdate An error is thrown for the int conversion when it fails Rather than catching things when saving we can fix the value when generated, simply returning null when parsing the record To test: 1 - Add a new record to Koha making sure data is valid except 260$c: 198- 2 - Save the record 3 - It fails 4 - Apply this patch 5 - Restart all the thigns 6 - Repeat 7 - Success! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Signed Off |Passed QA --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- A simple elegant fix.. I did wonder if we aught to use the same form as we do for the ISBD rules and simply replace the '-' with '0'.. but I'm now really sure that would benefit us in any meaningful way here. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com Status|Pushed to master |Pushed to stable Version(s)|20.11.00 |20.11.00, 20.05.07 released in| | --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Pushed to 20.05.x for 20.05.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26516 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net Version(s)|20.11.00, 20.05.07 |20.11.00, 20.05.07, released in| |19.11.13 Status|Pushed to oldstable |Pushed to oldoldstable --- Comment #10 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported to 19.11.x branch for 19.11.13 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org