Lines 45-50
Check a specified biblio for MARC errors. Can be repeated to use with multiple b
Link Here
|
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. Required for the results to print a handy link to the record with the warning. Must include a trailing slash and a complete URL. |
47 |
|
47 |
|
|
|
48 |
=item B<--html> |
49 |
|
50 |
Flag to output results in HTML format |
51 |
|
48 |
=back |
52 |
=back |
49 |
|
53 |
|
50 |
=cut |
54 |
=cut |
Lines 58-79
use Koha::Biblios;
Link Here
|
58 |
|
62 |
|
59 |
my @bibnum; |
63 |
my @bibnum; |
60 |
my $intranet; |
64 |
my $intranet; |
|
|
65 |
my $html; |
61 |
|
66 |
|
62 |
GetOptions( |
67 |
GetOptions( |
63 |
'+bibnum=i' => \@bibnum, |
68 |
'+bibnum=i' => \@bibnum, |
64 |
'intranet=s' => \$intranet, |
69 |
'intranet=s' => \$intranet, |
|
|
70 |
'html' => \$html, |
65 |
); |
71 |
); |
66 |
|
72 |
|
67 |
my $count = 0; |
73 |
my $count = 0; |
68 |
|
74 |
|
69 |
print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>"; |
75 |
print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>" if $html; |
70 |
|
76 |
|
71 |
# checking MARC errors for specific records only |
77 |
# checking MARC errors for specific records only |
72 |
if ( @bibnum ) { |
78 |
if ( @bibnum ) { |
73 |
foreach my $id ( @bibnum ) { |
79 |
foreach my $id ( @bibnum ) { |
74 |
my $record = GetMarcBiblio({ biblionumber => $id }); |
80 |
my $record = GetMarcBiblio({ biblionumber => $id }); |
75 |
|
81 |
|
76 |
my $warning = lint_record( $record ); |
82 |
my $warning = $record ? lint_record( $record ) : "Record does not exist."; |
77 |
my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
83 |
my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
78 |
report( $id, $warning, $detail_uri ); |
84 |
report( $id, $warning, $detail_uri ); |
79 |
} |
85 |
} |
Lines 86-98
if ( @bibnum ) {
Link Here
|
86 |
while ( my ( $biblionumber ) = $sth->fetchrow ) { |
92 |
while ( my ( $biblionumber ) = $sth->fetchrow ) { |
87 |
my $record = GetMarcBiblio({ biblionumber => $biblionumber }); |
93 |
my $record = GetMarcBiblio({ biblionumber => $biblionumber }); |
88 |
|
94 |
|
89 |
my $warning = lint_record( $record ); |
95 |
my $warning = $record ? lint_record( $record ) : "Record does not exist."; |
90 |
my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
96 |
my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
91 |
report( $biblionumber, $warning, $detail_uri ); |
97 |
report( $biblionumber, $warning, $detail_uri ); |
92 |
} |
98 |
} |
93 |
} |
99 |
} |
94 |
|
100 |
|
95 |
print "</table>\n</div>\n</body>\n</html>"; |
101 |
print "</table>\n</div>\n</body>\n</html>" if $html; |
96 |
|
102 |
|
97 |
sub lint_record { |
103 |
sub lint_record { |
98 |
my $record = shift; |
104 |
my $record = shift; |
Lines 105-123
sub lint_record {
Link Here
|
105 |
sub report { |
111 |
sub report { |
106 |
my ( $id, $warning, $detail_uri ) = @_; |
112 |
my ( $id, $warning, $detail_uri ) = @_; |
107 |
if ( $warning ) { |
113 |
if ( $warning ) { |
108 |
my $string = "<tr>\n"; |
|
|
109 |
$count++; |
114 |
$count++; |
110 |
$string .= "<td>" . $count . "</td>\n"; |
115 |
if ( $html ) { |
111 |
if ( $intranet ) { |
116 |
my $string = "<tr>\n"; |
112 |
$string .= "<td><a href=\"" |
117 |
$string .= "<td>" . $count . ".</td>\n"; |
113 |
. $intranet |
118 |
if ( $intranet ) { |
114 |
. $detail_uri |
119 |
$string .= "<td><a href=\"" |
115 |
. $id |
120 |
. $intranet |
116 |
. "\">$id</a></td>\n"; |
121 |
. $detail_uri |
|
|
122 |
. $id |
123 |
. "\">$id</a></td>\n"; |
124 |
} else { |
125 |
$string .= "<td>" . $id . "</td>\n"; |
126 |
} |
127 |
$string .= "<td>" . $warning . "</td>\n</tr>\n"; |
128 |
print $string; |
117 |
} else { |
129 |
} else { |
118 |
$string .= "<td>" . $id . "</td>\n"; |
130 |
print "$count.\t$id\t$warning\n"; |
119 |
} |
131 |
} |
120 |
$string .= "<td>" . $warning . "</td>\n</tr>\n"; |
|
|
121 |
print $string; |
122 |
} |
132 |
} |
123 |
} |
133 |
} |
124 |
- |
|
|