[Koha-bugs] [Bug 19873] Make it possible to search on value 0
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Apr 20 13:31:40 CEST 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19873
--- Comment #9 from Julian Maurice <julian.maurice at biblibre.com> ---
(In reply to Alex Arnaud from comment #4)
> (In reply to M. Tompsett from comment #3)
> > Comment on attachment 70122 [details] [review] [review]
> > Bug 19873 - Ability to search on 0 value
> >
> > Review of attachment 70122 [details] [review] [review]:
> > -----------------------------------------------------------------
> >
> > ::: C4/Search.pm
> > @@ +1532,4 @@
> > > for ( my $i = 0 ; $i <= @operands ; $i++ ) {
> > >
> > > # COMBINE OPERANDS, INDEXES AND OPERATORS
> > > + if ( $operands[$i] ne '' ) {
> >
> > perhaps a $operands[$i] // q{} ne q{} would be in order.
> > We don't want floody logs if $operands[$i] is undef.
> >
> > @@ +1677,4 @@
> > > query_desc => $query_desc,
> > > operator => ($operators[ $i - 1 ]) ? $operators[ $i - 1 ] : '',
> > > parsed_operand => $operand,
> > > + original_operand => ($operands[$i] ne '') ? $operands[$i] : '',
> >
> > perhaps a $operands[$i] // q{} is sufficient?
> > We don't want floody logs if $operands[$i] is undef.
>
> We want to search on 0 value. And $operands[$i] // q{} is false if
> $operands[$i] equals 0:
>
> (0 ne '') => 1
> (0 // '') => 0
> (0 // q{}) => 0
> (0 ne q{}) => 0
True but I think that what Mark suggested is to replace "if" condition by
($operands[$i] // '') ne '' # I don't like "q{}" string for empty strings
:)
which is true when $operands[$i] == 0, and doesn't generate a warning when
undef
and the other change by
$operands[$i] // ''
which has the same behaviour, with the additional benefit of preventing
warnings
I will provide a follow-up after testing
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list