Lines 27-49
use Koha::Items;
Link Here
|
27 |
use Koha::ItemTypes; |
27 |
use Koha::ItemTypes; |
28 |
use Koha::Patrons; |
28 |
use Koha::Patrons; |
29 |
use C4::Biblio qw( GetMarcFromKohaField ); |
29 |
use C4::Biblio qw( GetMarcFromKohaField ); |
|
|
30 |
use Koha::Database::DataInconsistency; |
30 |
|
31 |
|
31 |
{ |
32 |
{ |
32 |
my $items = Koha::Items->search( { -or => { homebranch => undef, holdingbranch => undef } } ); |
33 |
my $items = Koha::Items->search; |
33 |
if ( $items->count ) { new_section("Not defined items.homebranch and/or items.holdingbranch") } |
34 |
my @errors = Koha::Database::DataInconsistency->item_library($items); |
34 |
while ( my $item = $items->next ) { |
35 |
if (@errors) { |
35 |
if ( not $item->homebranch and not $item->holdingbranch ) { |
36 |
new_section("Not defined items.homebranch and/or items.holdingbranch"); |
36 |
new_item( |
37 |
for my $error (@errors) { |
37 |
sprintf "Item with itemnumber=%s does not have homebranch and holdingbranch defined", |
38 |
new_item($error); |
38 |
$item->itemnumber |
|
|
39 |
); |
40 |
} elsif ( not $item->homebranch ) { |
41 |
new_item( sprintf "Item with itemnumber=%s does not have homebranch defined", $item->itemnumber ); |
42 |
} else { |
43 |
new_item( sprintf "Item with itemnumber=%s does not have holdingbranch defined", $item->itemnumber ); |
44 |
} |
39 |
} |
45 |
} |
40 |
} |
46 |
if ( $items->count ) { new_hint("Edit these items and set valid homebranch and/or holdingbranch") } |
41 |
if (@errors) { new_hint("Edit these items and set valid homebranch and/or holdingbranch") } |
47 |
} |
42 |
} |
48 |
|
43 |
|
49 |
{ |
44 |
{ |
50 |
- |
|
|