View | Details | Raw Unified | Return to bug 21591
Collapse All | Expand All

(-)a/misc/maintenance/search_for_data_inconsistencies.pl (-7 / +13 lines)
Lines 55-68 use C4::Biblio; Link Here
55
55
56
{
56
{
57
    if ( C4::Context->preference('item-level_itypes') ) {
57
    if ( C4::Context->preference('item-level_itypes') ) {
58
        my $items_without_itype = Koha::Items->search( { itype => undef } );
58
        my $items_without_itype = Koha::Items->search( { -or => [itype => undef,itype => ''] } );
59
        if ( $items_without_itype->count ) {
59
        if ( $items_without_itype->count ) {
60
            new_section("Items do not have itype defined");
60
            new_section("Items do not have itype defined");
61
            while ( my $item = $items_without_itype->next ) {
61
            while ( my $item = $items_without_itype->next ) {
62
                new_item(
62
                if (defined $item->biblioitem->itemtype && $item->biblioitem->itemtype ne '' ) {
63
                    sprintf "Item with itemnumber=%s does not have a itype value, biblio's item type will be used (%s)",
63
                    new_item(
64
                    $item->itemnumber, $item->biblioitem->itemtype
64
                        sprintf "Item with itemnumber=%s does not have a itype value, biblio's item type will be used (%s)",
65
                );
65
                        $item->itemnumber, $item->biblioitem->itemtype
66
                    );
67
                } else {
68
                    new_item(
69
                        sprintf "Item with itemnumber=%s does not have a itype value, additionally no item type defined for biblionumber=%s",
70
                        $item->itemnumber, $item->biblioitem->biblionumber
71
                    );
72
               }
66
            }
73
            }
67
            new_hint("The system preference item-level_itypes expects item types to be defined at item level");
74
            new_hint("The system preference item-level_itypes expects item types to be defined at item level");
68
        }
75
        }
Lines 83-89 use C4::Biblio; Link Here
83
90
84
    my @itemtypes = Koha::ItemTypes->search->get_column('itemtype');
91
    my @itemtypes = Koha::ItemTypes->search->get_column('itemtype');
85
    if ( C4::Context->preference('item-level_itypes') ) {
92
    if ( C4::Context->preference('item-level_itypes') ) {
86
        my $items_with_invalid_itype = Koha::Items->search( { itype => { not_in => \@itemtypes } } );
93
        my $items_with_invalid_itype = Koha::Items->search( { -and => [itype => { not_in => \@itemtypes }, itype => { '!=' => '' }] } );
87
        if ( $items_with_invalid_itype->count ) {
94
        if ( $items_with_invalid_itype->count ) {
88
            new_section("Items have invalid itype defined");
95
            new_section("Items have invalid itype defined");
89
            while ( my $item = $items_with_invalid_itype->next ) {
96
            while ( my $item = $items_with_invalid_itype->next ) {
90
- 

Return to bug 21591