From 26c31e374fb3b42f3cca379aaad4e53802e498d0 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 22 Apr 2019 13:36:21 +0000 Subject: [PATCH] Bug 21591: Additionally check for blank strings in itypes --- C4/Reserves.pm | 2 +- misc/maintenance/search_for_data_inconsistencies.pl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 41ac2c4dc5..56ce22f307 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -330,7 +330,7 @@ sub CanItemBeReserved { # Check for item on shelves and OnShelfHoldsAllowed return { status => 'onShelfHoldsNotAllowed' } - unless ( IsAvailableForItemLevelRequest($item,$borrower) ); + unless ( IsAvailableForItemLevelRequest($item->unblessed,$borrower) ); # Check for the age restriction my ( $ageRestriction, $daysToAgeRestriction ) = diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl index 37b697b977..c19173d1c6 100755 --- a/misc/maintenance/search_for_data_inconsistencies.pl +++ b/misc/maintenance/search_for_data_inconsistencies.pl @@ -51,11 +51,11 @@ use Koha::Authorities; { if ( C4::Context->preference('item-level_itypes') ) { - my $items_without_itype = Koha::Items->search( { itype => undef } ); + my $items_without_itype = Koha::Items->search( { -or => [itype => undef,itype => ''] } ); if ( $items_without_itype->count ) { new_section("Items do not have itype defined"); while ( my $item = $items_without_itype->next ) { - if (defined $item->biblioitem->itemtype) { + if (defined $item->biblioitem->itemtype && $item->biblioitem->itemtype ne '' ) { new_item( sprintf "Item with itemnumber=%s does not have a itype value, biblio's item type will be used (%s)", $item->itemnumber, $item->biblioitem->itemtype @@ -86,7 +86,7 @@ use Koha::Authorities; my @itemtypes = Koha::ItemTypes->search->get_column('itemtype'); if ( C4::Context->preference('item-level_itypes') ) { - my $items_with_invalid_itype = Koha::Items->search( { itype => { not_in => \@itemtypes } } ); + my $items_with_invalid_itype = Koha::Items->search( { -and => [itype => { not_in => \@itemtypes }, itype => { '!=' => '' }] } ); if ( $items_with_invalid_itype->count ) { new_section("Items have invalid itype defined"); while ( my $item = $items_with_invalid_itype->next ) { -- 2.11.0