From 24fe57f07e28a20c665174ba917e7674f3bf9686 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia <aleishaamohia@hotmail.com> Date: Fri, 29 Apr 2022 03:00:52 +0000 Subject: [PATCH] Bug 30326: (follow-up) Tidy up output and use staffClientBaseURL --- misc/cronjobs/check_marc_errors.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/misc/cronjobs/check_marc_errors.pl b/misc/cronjobs/check_marc_errors.pl index ccd00807953..029a6a36f96 100755 --- a/misc/cronjobs/check_marc_errors.pl +++ b/misc/cronjobs/check_marc_errors.pl @@ -43,7 +43,7 @@ Check a specified biblio for MARC errors. Can be repeated to use with multiple b =item B<--intranet https://koha-intranet-url.com/> -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. +URL for Koha staff client. Must include a trailing slash and a complete URL. If not provided, the staffClientBaseURL system preference will be used. =item B<--html> @@ -61,7 +61,7 @@ use MARC::Lint; use Koha::Biblios; my @bibnum; -my $intranet; +my $intranet = C4::Context->preference('staffClientBaseURL') . "/"; my $html; GetOptions( @@ -72,7 +72,7 @@ GetOptions( my $count = 0; -print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>" if $html; +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; # checking MARC errors for specific records only if ( @bibnum ) { @@ -80,6 +80,7 @@ if ( @bibnum ) { my $record = GetMarcBiblio({ biblionumber => $id }); my $warning = $record ? lint_record( $record ) : "Record does not exist."; + $warning =~ s/\n/<br>/g if $html; my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; report( $id, $warning, $detail_uri ); } @@ -93,12 +94,13 @@ if ( @bibnum ) { my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $warning = $record ? lint_record( $record ) : "Record does not exist."; + $warning =~ s/\n/<br>/g if $html; my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; report( $biblionumber, $warning, $detail_uri ); } } -print "</table>\n</div>\n</body>\n</html>" if $html; +print "</tbody>\n</table>\n</div>\n</body>\n</html>" if $html; sub lint_record { my $record = shift; @@ -127,7 +129,7 @@ sub report { $string .= "<td>" . $warning . "</td>\n</tr>\n"; print $string; } else { - print "$count.\t$id\t$warning\n"; + print "$count.\tRecord ID: $id\n$warning\n\n"; } } } -- 2.11.0