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

(-)a/Koha/Database/DataInconsistency.pm (-1 / +69 lines)
Lines 1-5 Link Here
1
package Koha::Database::DataInconsistency;
1
package Koha::Database::DataInconsistency;
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
3
use Modern::Perl;
18
use Modern::Perl;
4
use C4::Context;
19
use C4::Context;
5
use C4::Biblio;
20
use C4::Biblio;
Lines 10-15 use Koha::Items; Link Here
10
use Koha::ItemTypes;
25
use Koha::ItemTypes;
11
use Koha::I18N qw( __x );
26
use Koha::I18N qw( __x );
12
27
28
=head1 NAME
29
30
Koha::Database::DataInconsistency - Search for data inconsistency in the database
31
32
=head1 API
33
34
=head2 invalid_item_library
35
36
    Search for items with non-existent holding or home library.
37
38
=cut
39
13
sub invalid_item_library {
40
sub invalid_item_library {
14
    my ( $self, $items ) = @_;
41
    my ( $self, $items ) = @_;
15
42
Lines 39-44 sub invalid_item_library { Link Here
39
    return @errors;
66
    return @errors;
40
}
67
}
41
68
69
=head2 ids
70
71
    Build a hashref of IDs from a Koha::Object Koha::Objects-based object.
72
73
=cut
74
42
sub ids {
75
sub ids {
43
    my ( $self, $object ) = @_;
76
    my ( $self, $object ) = @_;
44
    if ( $object->can('_resultset') ) {
77
    if ( $object->can('_resultset') ) {
Lines 52-57 sub ids { Link Here
52
    }
85
    }
53
}
86
}
54
87
88
=head2 no_item_type
89
90
    Search for items of biblioitems with non-existent item type.
91
92
=cut
93
55
sub no_item_type {
94
sub no_item_type {
56
    my ( $self, $biblios ) = @_;
95
    my ( $self, $biblios ) = @_;
57
    my $ids = $self->ids($biblios);
96
    my $ids = $self->ids($biblios);
Lines 99-104 sub no_item_type { Link Here
99
    return @errors;
138
    return @errors;
100
}
139
}
101
140
141
=head2 invalid_item_type
142
143
    Search for items or biblioitems with invalid item type.
144
145
=cut
146
102
sub invalid_item_type {
147
sub invalid_item_type {
103
    my ( $self, $biblios ) = @_;
148
    my ( $self, $biblios ) = @_;
104
    my $ids = $self->ids($biblios);
149
    my $ids = $self->ids($biblios);
Lines 141-146 sub invalid_item_type { Link Here
141
    return @errors;
186
    return @errors;
142
}
187
}
143
188
189
=head2 errors_in_marc
190
191
    Search for bibliographic records with errors in the MARC record.
192
193
=cut
194
144
sub errors_in_marc {
195
sub errors_in_marc {
145
    my ( $self, $biblios ) = @_;
196
    my ( $self, $biblios ) = @_;
146
    my $ids = $self->ids($biblios);
197
    my $ids = $self->ids($biblios);
Lines 218-223 sub errors_in_marc { Link Here
218
    return $errors;
269
    return $errors;
219
}
270
}
220
271
272
=head2 nonexistent_AV
273
274
    Search for bibliographic frameworks with non-existent authorised values.
275
276
=cut
277
221
sub nonexistent_AV {
278
sub nonexistent_AV {
222
    my ( $self, $biblios ) = @_;
279
    my ( $self, $biblios ) = @_;
223
    my $ids = $self->ids($biblios);
280
    my $ids = $self->ids($biblios);
Lines 302-307 sub nonexistent_AV { Link Here
302
    return @errors;
359
    return @errors;
303
}
360
}
304
361
362
=head2 empty_title
363
364
    Search for bibliographic records without title defined.
365
366
=cut
367
305
sub empty_title {
368
sub empty_title {
306
    my ( $self, $biblios ) = @_;
369
    my ( $self, $biblios ) = @_;
307
    my $ids = $self->ids($biblios);
370
    my $ids = $self->ids($biblios);
Lines 327-332 sub empty_title { Link Here
327
    return @errors;
390
    return @errors;
328
}
391
}
329
392
393
=head2 for_biblio
394
395
    Search for possible problems in a given bibliographic record.
396
397
=cut
398
330
sub for_biblio {
399
sub for_biblio {
331
    my ( $self, $biblio ) = @_;
400
    my ( $self, $biblio ) = @_;
332
    my @invalid_item_library = $self->invalid_item_library( $biblio->items );
401
    my @invalid_item_library = $self->invalid_item_library( $biblio->items );
333
- 

Return to bug 40777