Bug 24254: Compare itemlost with 0
authorTomas Cohen Arazi <tomascohen@theke.io>
Sat, 19 Dec 2020 13:05:16 +0000 (10:05 -0300)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Mon, 1 Feb 2021 20:15:36 +0000 (21:15 +0100)
commitdad15b74f63efb15e337a5a2db14a4d647cc6389
tree3455ac599dc7607934430e48e7213256305680b0
parent66da038348e9c474fd04adcd6a34da884832ce5f
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: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 4ffe7ddac04b0240b8007df6521fe6e65e403241)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Koha/Items.pm
t/db_dependent/Koha/Items.t