Bug 32529: Make Koha::Item->safe_to_delete consider 'P' holds as found

Currently, the Koha::Item->safe_to_delete method checks (among other things) if there are existing waiting or in-transit holds.

It seems that 'In processing' should block item deletion as well.

This patch implements that.

To test:
1. Apply up to the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item.t
=> FAIL: Boo! Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0e8f28b942)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2022-12-26 15:27:02 -03:00 committed by Jacob O'Mara
parent ce9a837468
commit c09db11320
1 changed files with 1 additions and 1 deletions

View File

@ -301,7 +301,7 @@ sub safe_to_delete {
# check it doesn't have a waiting reserve
$error = "book_reserved"
if $self->holds->search( { found => [ 'W', 'T' ] } )->count;
if $self->holds->filter_by_found->count;
$error = "linked_analytics"
if C4::Items::GetAnalyticsCount( $self->itemnumber ) > 0;