Bug 24254: Compare itemlost with 0
authorTomas Cohen Arazi <tomascohen@theke.io>
Sat, 19 Dec 2020 13:05:16 +0000 (10:05 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 19 Jan 2021 07:44:34 +0000 (08:44 +0100)
commitaacc3b7c3666e20c7d25fad88854375df706638e
tree91445e2e418120bc541865ccc9068c24ce26bd04
parent2fbd16dbed45d630ec7ac5ac6c64f243aaa07c95
Bug 24254: Compare itemlost with 0

On C4::Search and C4::Circulation the uses of the items.itemlost field
highlight the fact that the comparisson itemlost <= 0 was wrong, as it
is evaluated as a Perl boolean.

The column can only be an int and NOT NULL, so we need to check if it is
0 to ponder if not hidden.

This patch changes the tests to reflect this, and adjust the
Koha::Items->filter_by_visible_in_opac implementation to adapt to this.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a592ebb3bb115f05812f140e8528dc1297a9dbfa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Items.pm
t/db_dependent/Koha/Items.t