Bug 17741: Use Koha::Patron->holds when deleting a patron

There is a TODO in Koha::Patron->delete, this method should call the
Koha::Patron->holds to retrieve the holds made by the patron we are
removing instead of calling Koha::Holds->search

Test plan:
  prove t/db_dependent/Koha/Patrons.t
Should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-12-07 03:21:43 +00:00 committed by Kyle M Hall
parent 81585647ef
commit 767a33a91e

View file

@ -66,8 +66,7 @@ sub delete {
$self->_result->result_source->schema->txn_do(
sub {
# Delete Patron's holds
# FIXME Should be $patron->get_holds
$_->delete for Koha::Holds->search( { borrowernumber => $self->borrowernumber } );
$self->holds->delete;
# Delete all lists and all shares of this borrower
# Consistent with the approach Koha uses on deleting individual lists