Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
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 <http://www.gnu.org/licenses>. |
17 |
|
18 |
use Modern::Perl; |
19 |
|
20 |
use Koha::Items; |
21 |
|
22 |
{ |
23 |
my $items = Koha::Items->search({ -or => { homebranch => undef, holdingbranch => undef }}); |
24 |
if ( $items->count ) { new_section("Not defined items.homebranch and/or items.holdingbranch")} |
25 |
while ( my $item = $items->next ) { |
26 |
if ( not $item->homebranch and not $item->holdingbranch ) { |
27 |
new_item(sprintf "Item with itemnumber=%s does not have homebranch and holdingbranch defined", $item->itemnumber); |
28 |
} elsif ( $item->homebranch ) { |
29 |
new_item(sprintf "Item with itemnumber=%s does not have homebranch defined", $item->itemnumber); |
30 |
} else { |
31 |
new_item(sprintf "Item with itemnumber=%s does not have holdingbranch defined", $item->itemnumber); |
32 |
} |
33 |
} |
34 |
if ( $items->count ) { new_hint("Edit these items and set valid homebranch and/or holdingbranch")} |
35 |
} |
36 |
|
37 |
sub new_section { |
38 |
my ( $name ) = @_; |
39 |
say "\n== $name =="; |
40 |
} |
41 |
|
42 |
sub new_item { |
43 |
my ( $name ) = @_; |
44 |
say "\t* $name"; |
45 |
} |
46 |
sub new_hint { |
47 |
my ( $name ) = @_; |
48 |
say "=> $name"; |
49 |
} |
50 |
|
51 |
=head1 NAME |
52 |
|
53 |
search_for_data_inconsistencies.pl |
54 |
|
55 |
=head1 SYNOPSIS |
56 |
|
57 |
perl search_for_data_inconsistencies.pl |
58 |
|
59 |
=head1 DESCRIPTION |
60 |
|
61 |
Catch data inconsistencies in Koha database |
62 |
|
63 |
* Items with not defined homebranch and/or holdingbranch |
64 |
|
65 |
=back |
66 |
|
67 |
=cut |