Bug 24254: Compare itemlost with 0
authorTomas Cohen Arazi <tomascohen@theke.io>
Sat, 19 Dec 2020 13:05:16 +0000 (10:05 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 14 Jan 2021 13:03:49 +0000 (14:03 +0100)
commita592ebb3bb115f05812f140e8528dc1297a9dbfa
tree5a2906ae2c38612f19f473f7fa0d96351cfe58d2
parent2250cf0293c690c6d1e79090aa3cec7b43cb2797
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>
Koha/Items.pm
t/db_dependent/Koha/Items.t