[Koha-bugs] [Bug 14015] Checkout: Fix software error if barcode '0' is given

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Dec 21 14:24:36 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14015

--- Comment #8 from Marc Véron <veron at veron.ch> ---
(In reply to Jonathan Druart from comment #7)
> Comment on attachment 45873 [details] [review]
> Bug 14015 - Checkout: Fix software error if barcode '0' is given
> 
> Review of attachment 45873 [details] [review]:
> -----------------------------------------------------------------
> 
> ::: circ/circulation.pl
> @@ +217,5 @@
> >  }
> >  
> >  # check and see if we should print
> > +# but do not set to 'yes' if barcode given by user is '0'
> > +if ( ( @$barcodes == 0 )  && ( ! @$barcodes eq '0')  && ( $print eq 'maybe' )  ) {
> 
> What is supposed to test !@$barcodes eq '0' ??

Hi Jonathan,

The first (already existing) part @$barcodes == 0 tests @$barcodes for
numerical equality (no barcodes given). While testing I found out that it
evaluates to true for a barcode that is '0'. Because it evaluated to true with
a barcode '0', $print was set to 'yes' (but we do not want to print, since we
have a barcode). With $print set to 'yes' the borrowernumber is set to '' in
line 235, and that leads to the software error in line 473.
By adding a test for the barcode not to be equal to '0' by the string equality
oparator eq ( ! @$barcodes eq '0'), the value of $print is not set to 'yes' and
the barcode '0' is treated as such. Koha will then display the message 'The
barcode was not found 0' (as expected)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list