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)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Thu, 10 Dec 2020 13:09:58 +0000 (14:09 +0100)
commit0fdac36bbea4ae81ec838e91115ec3959a1dd4c7
tree8da88752d3244f3acdcdd4912845f1d65936e9a2
parentf29a494d75f5f79298ef11d7d35af50aefa71c3f
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>
(cherry picked from commit c56972ddd3b9fc703a9123fc02140079957b1671)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
C4/Biblio.pm
t/db_dependent/Biblio/TransformMarcToKoha.t