Summary: | Importing records with unexpected format of copyrightdate fails | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | Tools | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | andrew, david, flyingendpaper, lisette, martin.renvoize, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: |
20.11.00, 20.05.07, 19.11.13
|
Circulation function: | |
Bug Depends on: | 11046 | ||
Bug Blocks: | |||
Attachments: |
Bug 26516: Check if int before save
Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear Bug 26516: [alternate] Don't accept incorrect values for copyrightdate/publicationyear |
Description
Nick Clemens (kidclamp)
2020-09-23 14:40:18 UTC
Created attachment 110602 [details] [review] 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! Created attachment 110605 [details] [review] 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! 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 Created attachment 112905 [details] [review] 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> (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. Created attachment 113655 [details] [review] 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> 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 Pushed to master for 20.11, thanks to everybody involved! Pushed to 20.05.x for 20.05.07 Backported to 19.11.x branch for 19.11.13 |