Bug 28567: Fix 0 vs "" vs undef on the admin library form
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 25 Jun 2021 10:44:19 +0000 (12:44 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 30 Jul 2021 13:54:12 +0000 (15:54 +0200)
commit6b7e17f9fdb6906460b11b8eef298917e523ecd9
treed54bdc1b1e90fb212a41ef008026e5e78e7a5150
parent1634dd122b131d74d32817ba9c33c98c2372a48f
Bug 28567: Fix 0 vs "" vs undef on the admin library form

There are two things here:
* Branches.pickup_location has a default = 1 in DB, we should not set to undef if 0
or it will be set to 1 when stored.
* The other fields are all text (varchar, mediumtext or longtext) and
can be NULL. They are correct set to NULL when a new library is created
but set to an empty string when the library is modified. That's not
consistent

Test plan:
0. Don't apply the patch
1. Create a new library, set pickup location to "No"
2. Save
=> Pickup location is set to YES
=> In DB notice that the different values you didn't fill in are set to
NULL
3. Edit the library
4. Save
=> In DB notice that the different values you didn't fill in are now set
to an empty string
5. Apply the patch, restart_all
6. Run the updatedatabase script
=> In DB all the empty string values are set to NULL
7. Repeat 1 to 4 and confirm that everything is now working as expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
admin/branches.pl
installer/data/mysql/atomicupdate/bug_28567.perl [new file with mode: 0644]