Bugzilla – Attachment 133511 Details for
Bug 30326
Cronjob that checks biblios for MARC errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30326: (follow-up) Add output parameter and handle bad biblionumbers
Bug-30326-follow-up-Add-output-parameter-and-handl.patch (text/plain), 3.78 KB, created by
Aleisha Amohia
on 2022-04-21 02:43:23 UTC
(
hide
)
Description:
Bug 30326: (follow-up) Add output parameter and handle bad biblionumbers
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-04-21 02:43:23 UTC
Size:
3.78 KB
patch
obsolete
>From 60cf5d44167851a3a7b6ac1493f8d473471bc41d Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 21 Apr 2022 02:39:22 +0000 >Subject: [PATCH] Bug 30326: (follow-up) Add output parameter and handle bad > biblionumbers > >When the script is run without the --html parameter, the output will be >simply text. When the script is run with the --html parameter, the >output will display in an HTML table. > >Additional test plan: > >5. Test running script with and without --html parameter and confirm >output is correct. > >6. Test running script with a --bibnum that does not exist and confirm >the output acknowledges this. >--- > misc/cronjobs/check_marc_errors.pl | 40 ++++++++++++++++++++++++-------------- > 1 file changed, 25 insertions(+), 15 deletions(-) > >diff --git a/misc/cronjobs/check_marc_errors.pl b/misc/cronjobs/check_marc_errors.pl >index 24b8b350ac..ccd0080795 100755 >--- a/misc/cronjobs/check_marc_errors.pl >+++ b/misc/cronjobs/check_marc_errors.pl >@@ -45,6 +45,10 @@ Check a specified biblio for MARC errors. Can be repeated to use with multiple b > > 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. > >+=item B<--html> >+ >+Flag to output results in HTML format >+ > =back > > =cut >@@ -58,22 +62,24 @@ use Koha::Biblios; > > my @bibnum; > my $intranet; >+my $html; > > GetOptions( > '+bibnum=i' => \@bibnum, > 'intranet=s' => \$intranet, >+ 'html' => \$html, > ); > > my $count = 0; > >-print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>"; >+print "<html>\n<body>\n<div id=\"marc_errors\">\n<table>" if $html; > > # checking MARC errors for specific records only > if ( @bibnum ) { > foreach my $id ( @bibnum ) { > my $record = GetMarcBiblio({ biblionumber => $id }); > >- my $warning = lint_record( $record ); >+ my $warning = $record ? lint_record( $record ) : "Record does not exist."; > my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; > report( $id, $warning, $detail_uri ); > } >@@ -86,13 +92,13 @@ if ( @bibnum ) { > while ( my ( $biblionumber ) = $sth->fetchrow ) { > my $record = GetMarcBiblio({ biblionumber => $biblionumber }); > >- my $warning = lint_record( $record ); >+ my $warning = $record ? lint_record( $record ) : "Record does not exist."; > my $detail_uri = "cgi-bin/koha/catalogue/detail.pl?biblionumber="; > report( $biblionumber, $warning, $detail_uri ); > } > } > >-print "</table>\n</div>\n</body>\n</html>"; >+print "</table>\n</div>\n</body>\n</html>" if $html; > > sub lint_record { > my $record = shift; >@@ -105,19 +111,23 @@ sub lint_record { > sub report { > my ( $id, $warning, $detail_uri ) = @_; > if ( $warning ) { >- my $string = "<tr>\n"; > $count++; >- $string .= "<td>" . $count . "</td>\n"; >- if ( $intranet ) { >- $string .= "<td><a href=\"" >- . $intranet >- . $detail_uri >- . $id >- . "\">$id</a></td>\n"; >+ if ( $html ) { >+ my $string = "<tr>\n"; >+ $string .= "<td>" . $count . ".</td>\n"; >+ if ( $intranet ) { >+ $string .= "<td><a href=\"" >+ . $intranet >+ . $detail_uri >+ . $id >+ . "\">$id</a></td>\n"; >+ } else { >+ $string .= "<td>" . $id . "</td>\n"; >+ } >+ $string .= "<td>" . $warning . "</td>\n</tr>\n"; >+ print $string; > } else { >- $string .= "<td>" . $id . "</td>\n"; >+ print "$count.\t$id\t$warning\n"; > } >- $string .= "<td>" . $warning . "</td>\n</tr>\n"; >- print $string; > } > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30326
:
131994
|
132038
|
132053
|
133511
|
133674
|
134345
|
134447