Bug 14046: Make the CheckIfIssuedToPatron using the biblionumber
C4::Circ::CheckIfIssuedToPatron called $items = GetItemsByBiblioitemnumber($biblionumber); But if biblionumber != biblioitemnumber, the items retrieved were not the good ones! Test plan: Make your Auto increment values for biblio and biblioitems differs Launch the tests: prove t/db_dependent/Circulation/CheckIfIssuedToPatron.t Before this patch, they did not pass. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
5ee69d78dc
commit
40e4722a95
1 changed files with 9 additions and 6 deletions
|
@ -3808,12 +3808,15 @@ sub TransferSlip {
|
||||||
sub CheckIfIssuedToPatron {
|
sub CheckIfIssuedToPatron {
|
||||||
my ($borrowernumber, $biblionumber) = @_;
|
my ($borrowernumber, $biblionumber) = @_;
|
||||||
|
|
||||||
my $items = GetItemsByBiblioitemnumber($biblionumber);
|
my $dbh = C4::Context->dbh;
|
||||||
|
my $query = q|
|
||||||
foreach my $item (@{$items}) {
|
SELECT COUNT(*) FROM issues
|
||||||
return 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber);
|
LEFT JOIN items ON items.itemnumber = issues.itemnumber
|
||||||
}
|
WHERE items.biblionumber = ?
|
||||||
|
AND issues.borrowernumber = ?
|
||||||
|
|;
|
||||||
|
my $is_issued = $dbh->selectrow_array($query, {}, $biblionumber, $borrowernumber );
|
||||||
|
return 1 if $is_issued;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue