Bugzilla – Attachment 154852 Details for
Bug 31035
Script to update OPACSuppression field depending on hidden items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31035: (follow-up) handle broken MARCXML
Bug-31035-follow-up-handle-broken-MARCXML.patch (text/plain), 3.24 KB, created by
Fridolin Somers
on 2023-08-25 22:04:46 UTC
(
hide
)
Description:
Bug 31035: (follow-up) handle broken MARCXML
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2023-08-25 22:04:46 UTC
Size:
3.24 KB
patch
obsolete
>From 5f5128889644befc3a57e776491e71bf58c6bba1 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 25 Aug 2023 10:45:24 -1000 >Subject: [PATCH] Bug 31035: (follow-up) handle broken MARCXML > >Plus show progress each 1000 records >--- > misc/maintenance/update_opac_suppression.pl | 36 +++++++++++++-------- > 1 file changed, 22 insertions(+), 14 deletions(-) > >diff --git a/misc/maintenance/update_opac_suppression.pl b/misc/maintenance/update_opac_suppression.pl >index cdb1f70ada..197bc79b83 100755 >--- a/misc/maintenance/update_opac_suppression.pl >+++ b/misc/maintenance/update_opac_suppression.pl >@@ -47,6 +47,8 @@ GetOptions( > pod2usage(1) if $want_help; > pod2usage("Parameter marc is mandatory") unless $os_marc_input; > >+$| = 1; # flushes output >+ > sub _read_marc_code { > my $input = shift; > my ( $field, $subfield ); >@@ -129,17 +131,17 @@ my $count_modified = 0; > > while ( my ($biblionumber) = $query->fetchrow ) { > $count_total++; >- my $biblio = Koha::Biblios->find($biblionumber); >- unless ($biblio) { >- warn "Error in biblio $biblionumber : not found"; >- next; >- } >- my $marc_record = $biblio->metadata->record; >- unless ($marc_record) { >- warn "Error in biblio $biblionumber : can't parse record"; >- next; >- } > eval { >+ my $biblio = Koha::Biblios->find($biblionumber); >+ unless ($biblio) { >+ say "Error with record biblionumber=$biblionumber : not found"; >+ next; >+ } >+ my $marc_record = $biblio->metadata->record; >+ unless ($marc_record) { >+ say "Error with record biblionumber=$biblionumber : can not parse record"; >+ next; >+ } > my $os_new_value = _get_new_value( $biblio, $rules ); > my $os_old_value = _get_old_value( $marc_record, $os_field_input, $os_subfield_input ); > if ( $os_new_value != $os_old_value ) { >@@ -148,19 +150,25 @@ while ( my ($biblionumber) = $query->fetchrow ) { > C4::Biblio::ModBiblio( $marc_record, $biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } ); > $count_modified++; > if ($verbose) { >- say "Bibliographic record $biblionumber changed to " . ( $os_new_value ? "hidden" : "visible" ) . " in OPAC"; >+ say "Record biblionumber=$biblionumber changed to " . ( $os_new_value ? "hidden" : "visible" ) . " in OPAC"; > } > } elsif ($verbose) { >- say "Bibliographic record $biblionumber would have been changed to " . ( $os_new_value ? "hidden" : "visible" ) . " in OPAC"; >+ say "Record biblionumber=$biblionumber would have been changed to " . ( $os_new_value ? "hidden" : "visible" ) . " in OPAC"; > } > } > }; > if ($@) { >- warn "Problem with biblio $biblionumber : $@"; >+ say "Error with record biblionumber=$biblionumber : not processed"; >+ } >+ if ($verbose) { >+ say "$count_total records processed" unless $count_total % 1000; > } > } > >-say "$count_total records processed, $count_modified modified" if $verbose; >+if ($verbose) { >+ say "Total $count_total records processed"; >+ say "Total $count_modified modified" if $confirm; >+} > > =head1 NAME > >-- >2.41.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 31035
:
136466
|
136472
|
144793
| 154852