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

(-)a/misc/cronjobs/check_marc_errors.pl (-6 / +7 lines)
Lines 43-49 Check a specified biblio for MARC errors. Can be repeated to use with multiple b Link Here
43
43
44
=item B<--intranet https://koha-intranet-url.com/>
44
=item B<--intranet https://koha-intranet-url.com/>
45
45
46
URL for Koha staff client. Required for the results to print a handy link to the record with the warning. Must include a trailing slash and a complete URL.
46
URL for Koha staff client. Must include a trailing slash and a complete URL. If not provided, the staffClientBaseURL system preference will be used.
47
47
48
=item B<--html>
48
=item B<--html>
49
49
Lines 61-67 use MARC::Lint; Link Here
61
use Koha::Biblios;
61
use Koha::Biblios;
62
62
63
my @bibnum;
63
my @bibnum;
64
my $intranet;
64
my $intranet = C4::Context->preference('staffClientBaseURL') . "/";
65
my $html;
65
my $html;
66
66
67
GetOptions(
67
GetOptions(
Lines 72-78 GetOptions( Link Here
72
72
73
my $count = 0;
73
my $count = 0;
74
74
75
print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>" if $html;
75
print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>\n<thead>\n<tr>\n<td>No.</td>\n<td>Link to record</td>\n<td>Warning</td>\n</tr>\n</thead>\n<tbody>" if $html;
76
76
77
# checking MARC errors for specific records only
77
# checking MARC errors for specific records only
78
if ( @bibnum ) {
78
if ( @bibnum ) {
Lines 80-85 if ( @bibnum ) { Link Here
80
        my $record = GetMarcBiblio({ biblionumber => $id });
80
        my $record = GetMarcBiblio({ biblionumber => $id });
81
81
82
        my $warning = $record ? lint_record( $record ) : "Record does not exist.";
82
        my $warning = $record ? lint_record( $record ) : "Record does not exist.";
83
        $warning =~ s/\n/<br>/g if $html;
83
        my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber=";
84
        my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber=";
84
        report( $id, $warning, $detail_uri );
85
        report( $id, $warning, $detail_uri );
85
    }
86
    }
Lines 93-104 if ( @bibnum ) { Link Here
93
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
94
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
94
95
95
        my $warning = $record ? lint_record( $record ) : "Record does not exist.";
96
        my $warning = $record ? lint_record( $record ) : "Record does not exist.";
97
        $warning =~ s/\n/<br>/g if $html;
96
        my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber=";
98
        my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber=";
97
        report( $biblionumber, $warning, $detail_uri );
99
        report( $biblionumber, $warning, $detail_uri );
98
    }
100
    }
99
}
101
}
100
102
101
print "</table>\n</div>\n</body>\n</html>" if $html;
103
print "</tbody>\n</table>\n</div>\n</body>\n</html>" if $html;
102
104
103
sub lint_record {
105
sub lint_record {
104
    my $record = shift;
106
    my $record = shift;
Lines 127-133 sub report { Link Here
127
            $string .= "<td>" . $warning . "</td>\n</tr>\n";
129
            $string .= "<td>" . $warning . "</td>\n</tr>\n";
128
            print $string;
130
            print $string;
129
        } else {
131
        } else {
130
            print "$count.\t$id\t$warning\n";
132
            print "$count.\tRecord ID: $id\n$warning\n\n";
131
        }
133
        }
132
    }
134
    }
133
}
135
}
134
- 

Return to bug 30326