]> git.koha-community.org Git - koha.git/commit
Bug 15473: Make Koha::Objects->find accepts 0 and '' as a key
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 5 Jan 2016 15:08:23 +0000 (15:08 +0000)
committerJulian Maurice <julian.maurice@biblibre.com>
Fri, 15 Jan 2016 08:02:36 +0000 (09:02 +0100)
commite4175ee89d98c441952cd4728dbf62412a320b4f
tree7464607abd9cc2c6f788f2f40d1ab201c7497e55
parent2fbd04103a1807efd7378a3ee9c60e7974ccb606
Bug 15473: Make Koha::Objects->find accepts 0 and '' as a key

This bug has been found after bug 15381 was pushed:
If you go on authorities/authorities.pl, you expect a form to create a
 authorities with a "Default" authority type.
Now, it explodes:
    Can't call method "authtypetext" on an undefined value at
    /home/koha/src/authorities/authorities.pl line 665.

Koha::Objects->find does not want to search if the key does not exist
(undef, '', 0). But actually it should only be a coward if it is not defined.

Moreover this is the default behavior of the DBIx::Class find method.

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green
and
  GET /cgi-bin/koha/authorities/authorities.pl
should not make everything explode.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Find this after signing 15470 :)
Test pass, new auth (Default) created, no errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit 6cf157f9930fc1deb47da2d5c3b7f3abc3e7e3c4)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Koha/Objects.pm
t/db_dependent/Koha/Objects.t [new file with mode: 0644]