Description
Marcel de Rooy
2022-10-14 07:21:59 UTC
Offending line in admin/branches: : ( $_ => scalar $input->param($_) || undef ) The 0 of public becomes undef ;) Created attachment 141863 [details] [review] Bug 31785: Fix for adding non-public library The code in admin/branches.pl changed a 0 to undef which is not desirable for booleans. A similar fix was already present for pickup_location. This may need a bit more thought (somewhere else!). Test plan: Add a new branch with pickup location No, public No. Check. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Trivial: self SO Created attachment 141864 [details] [review] Bug 31785: Fix for adding non-public library The code in admin/branches.pl changed a 0 to undef which is not desirable for booleans. A similar fix was already present for pickup_location. This may need a bit more thought (somewhere else!). Test plan: Add a new branch with pickup location No, public No. Check. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Added a ^ and $ to be more safe :) Created attachment 141868 [details] [review] Bug 31785: (follow-up) Fix modify operation too Test plan: Enable SQL strict mode (koha-conf). Modify branch, set Public to No. Check. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Strict SQL mode triggers the error on update. [WARN] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'public' cannot be null at /usr/share/koha/Koha/Object.pm line 170 (In reply to Marcel de Rooy from comment #7) > Strict SQL mode triggers the error on update. > > [WARN] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: > DBD::mysql::st execute failed: Column 'public' cannot be null at > /usr/share/koha/Koha/Object.pm line 170 Fixed in the follow-up Can confirm that this now works as expected - can now edit a library and change public to 'No', and change back to 'Yes'. *** Bug 31688 has been marked as a duplicate of this bug. *** Trivial, fixes the problem, QA script is happy. Going to Pass QA. Created attachment 141897 [details] [review] Bug 31785: Fix for adding non-public library The code in admin/branches.pl changed a 0 to undef which is not desirable for booleans. A similar fix was already present for pickup_location. This may need a bit more thought (somewhere else!). Test plan: Add a new branch with pickup location No, public No. Check. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Created attachment 141898 [details] [review] Bug 31785: (follow-up) Fix modify operation too Test plan: Enable SQL strict mode (koha-conf). Modify branch, set Public to No. Check. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Pushed to master for 22.11. Nice work everyone, thanks! Backported to 22.05.x for upcoming 22.05.08 applied to 21.11 for 21.11.15 Not backported to 21.05.x |