This patch fixes a bug whereby GetMember(searchfield => undef)
(i.e., searching for patron records where 'searchfield' is NULL)
would crash.
This fixes a regression introduced by bug 15344 that in turn
exposed a long-standing bug in GetMember().
To test:
[1] Import some offline circulation transactions that include at
least one return.
[2] Attempt to view the list of pending transactions; a crash
will occur.
[3] Apply the patch and view the list of pending transactions again;
this time, it should work.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
}
$debug && warn $select, " ",values %information;
my $sth = $dbh->prepare("$select");
}
$debug && warn $select, " ",values %information;
my $sth = $dbh->prepare("$select");
- $sth->execute(map{$information{$_}} keys %information);
+ $sth->execute(@values);
my $data = $sth->fetchall_arrayref({});
#FIXME interface to this routine now allows generation of a result set
#so whole array should be returned but bowhere in the current code expects this
my $data = $sth->fetchall_arrayref({});
#FIXME interface to this routine now allows generation of a result set
#so whole array should be returned but bowhere in the current code expects this
-use Test::More tests => 56;
+use Test::More tests => 58;
use Test::MockModule;
use Data::Dumper;
use C4::Context;
use Test::MockModule;
use Data::Dumper;
use C4::Context;
$member->{dateofbirth} = $original_dateofbirth; #It is polite to revert made changes in the unit tests.
} #sub testAgeAccessors
$member->{dateofbirth} = $original_dateofbirth; #It is polite to revert made changes in the unit tests.
} #sub testAgeAccessors
+# regression test for bug 16009
+my $patron;
+eval {
+ my $patron = GetMember(cardnumber => undef);
+};
+is($@, '', 'Bug 16009: GetMember(cardnumber => undef) works');
+is($patron, undef, 'Bug 16009: GetMember(cardnumber => undef) returns undef');
+