Bug 16499: Remove "Use of uninitialized value" warnings in circulation.pl
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 11 May 2016 14:05:59 +0000 (15:05 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 23 May 2016 17:31:58 +0000 (17:31 +0000)
If you search for a patron in the circulation module, you get:

Use of uninitialized value $barcode in string eq at
/home/koha/src/circ/circulation.pl line 84.
Use of uninitialized value $restoreduedatespec in string eq at
/home/koha/src/circ/circulation.pl line 170.

Test plan:
- Search for a patron and confirm the warnings are not displayed anymore
- Make sure this patch does not introduce regression on bug 14015

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
circ/circulation.pl

index 66b3dcf..136b7bf 100755 (executable)
@@ -81,7 +81,7 @@ if (!C4::Context->userenv){
 my $barcodes = [];
 my $barcode =  $query->param('barcode');
 # Barcode given by user could be '0'
-if ( $barcode || $barcode eq '0' ) {
+if ( $barcode or defined $barcode and $barcode eq '0' ) {
     $barcodes = [ $barcode ];
 } else {
     my $filefh = $query->upload('uploadfile');
@@ -167,7 +167,7 @@ my $duedatespec    = $query->param('duedatespec')   || $session->param('stickydu
 $duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso' }); }
     if ( $duedatespec );
 my $restoreduedatespec  = $query->param('restoreduedatespec') || $session->param('stickyduedate') || $duedatespec;
-if ($restoreduedatespec eq "highholds_empty") {
+if ($restoreduedatespec and $restoreduedatespec eq "highholds_empty") {
     undef $restoreduedatespec;
 }
 my $issueconfirmed = $query->param('issueconfirmed');