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

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

Return to bug 21591