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

(-)a/misc/maintenance/search_for_data_inconsistencies.pl (-5 / +15 lines)
Lines 38-43 our %options = ( Link Here
38
    'check-title'     => 0,
38
    'check-title'     => 0,
39
    'check-age'       => 0,
39
    'check-age'       => 0,
40
    'check-loop'      => 0,
40
    'check-loop'      => 0,
41
    'check-all'       => 0,
41
    'skip-branch'     => 0,
42
    'skip-branch'     => 0,
42
    'skip-auth'       => 0,
43
    'skip-auth'       => 0,
43
    'skip-status'     => 0,
44
    'skip-status'     => 0,
Lines 57-62 GetOptions( Link Here
57
    'check-title'     => sub { $options{'check-title'}     = 1 },
58
    'check-title'     => sub { $options{'check-title'}     = 1 },
58
    'check-age'       => sub { $options{'check-age'}       = 1 },
59
    'check-age'       => sub { $options{'check-age'}       = 1 },
59
    'check-loop'      => sub { $options{'check-loop'}      = 1 },
60
    'check-loop'      => sub { $options{'check-loop'}      = 1 },
61
    'check-all'       => sub { $options{'check-all'}       = 1 },
60
    'skip-branch'     => sub { $options{'skip-branch'}     = 1 },
62
    'skip-branch'     => sub { $options{'skip-branch'}     = 1 },
61
    'skip-auth'       => sub { $options{'skip-auth'}       = 1 },
63
    'skip-auth'       => sub { $options{'skip-auth'}       = 1 },
62
    'skip-status'     => sub { $options{'skip-status'}     = 1 },
64
    'skip-status'     => sub { $options{'skip-status'}     = 1 },
Lines 125-133 sub set_skip_options { Link Here
125
127
126
# Set all check options to 1 if none are provided, considering skip options
128
# Set all check options to 1 if none are provided, considering skip options
127
sub set_all_check_options_if_none_provided {
129
sub set_all_check_options_if_none_provided {
128
    my $any_check_option_provided = grep { $options{$_} } grep { /^check-/ } keys %options;
130
    my $check_all_option_provided = grep { $options{$_} && $_ eq "check-all" } grep { /^check-/ } keys %options;
131
    if ( $check_all_option_provided ) {
132
        foreach my $key ( keys %options ) {
133
            if ( $key =~ /^check-/ ) {
134
                my $skip_key = $key;
135
                $skip_key =~ s/^check-/skip-/;
129
136
130
    if ( !$any_check_option_provided ) {
137
                # Set check option to 1 unless the corresponding skip option indicated
138
                $options{$key} = 1 unless $options{$skip_key};
139
            }
140
        }
141
    }
142
    elsif ( 0 == grep { $options{$_} && $_ ne "check-all" } grep { /^check-/ } keys %options) {
131
        handle_invalid_options("No options selected");
143
        handle_invalid_options("No options selected");
132
        die;
144
        die;
133
    }
145
    }
Lines 742-747 Catch data inconsistencies in Koha database: Link Here
742
  --check-title      Check for bibliographic records without a title
754
  --check-title      Check for bibliographic records without a title
743
  --check-age        Check for patrons with invalid age for category
755
  --check-age        Check for patrons with invalid age for category
744
  --check-loop       Check for relationships that form guarantor loops
756
  --check-loop       Check for relationships that form guarantor loops
757
  --check-all        Run all checks without specifying any other option
745
  --skip-branch      Skip checking for items without home or holding library
758
  --skip-branch      Skip checking for items without home or holding library
746
  --skip-auth        Skip checking for authority records with invalid authority type
759
  --skip-auth        Skip checking for authority records with invalid authority type
747
  --skip-status      Skip checking for bibliographic records and items without an item type or with an invalid item type
760
  --skip-status      Skip checking for bibliographic records and items without an item type or with an invalid item type
Lines 751-756 Catch data inconsistencies in Koha database: Link Here
751
  --skip-loop        Skip checking for relationships that form guarantor loops
764
  --skip-loop        Skip checking for relationships that form guarantor loops
752
  --help             Print usage information
765
  --help             Print usage information
753
766
754
Note: If no options are provided, all tests will be run.
755
756
=cut
767
=cut
757
- 

Return to bug 36027