Bug 26516: Don't accept incorrect values for copyrightdate/publicationyear
authorNick Clemens <nick@bywatersolutions.com>
Wed, 23 Sep 2020 14:42:40 +0000 (14:42 +0000)
committerAndrew Fuerste-Henry <andrew@bywatersolutions.com>
Wed, 9 Dec 2020 20:09:16 +0000 (20:09 +0000)
commitc56972ddd3b9fc703a9123fc02140079957b1671
tree984a7a9f50e4d9128708da7de741ff93a445f147
parent1e7d04a6089bc3f57f3ff52363cda26cda28d126
Bug 26516: 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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1400890ec8040ced8e3550eddbfd0d4e8af2347)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
C4/Biblio.pm
t/db_dependent/Biblio/TransformMarcToKoha.t