Bugzilla – Attachment 189826 Details for
Bug 30255
Allow skipping "list" step for record batch modification/deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30255: Improve handling of non-existant record ids in modification/deletion background jobs
Bug-30255-Improve-handling-of-non-existant-record-.patch (text/plain), 3.24 KB, created by
David Gustafsson
on 2025-11-21 07:42:47 UTC
(
hide
)
Description:
Bug 30255: Improve handling of non-existant record ids in modification/deletion background jobs
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2025-11-21 07:42:47 UTC
Size:
3.24 KB
patch
obsolete
>From 6d6fab4144a093d470d6d23f7cab82a4e5fe8111 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 21 Nov 2025 08:25:48 +0100 >Subject: [PATCH] Bug 30255: Improve handling of non-existant record ids in > modification/deletion background jobs > >--- > Koha/BackgroundJob/BatchDeleteBiblio.pm | 1 + > Koha/BackgroundJob/BatchUpdateAuthority.pm | 6 ++++-- > Koha/BackgroundJob/BatchUpdateBiblio.pm | 4 +++- > 3 files changed, 8 insertions(+), 3 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteBiblio.pm b/Koha/BackgroundJob/BatchDeleteBiblio.pm >index 3bc7f7336ee..4385025972b 100644 >--- a/Koha/BackgroundJob/BatchDeleteBiblio.pm >+++ b/Koha/BackgroundJob/BatchDeleteBiblio.pm >@@ -71,6 +71,7 @@ RECORD_IDS: for my $record_id ( sort { $a <=> $b } @record_ids ) { > # First, checking if issues exist. > # If yes, nothing to do > my $biblio = Koha::Biblios->find($biblionumber); >+ next unless $biblio; > > # TODO Replace with $biblio->get_issues->count > if ( C4::Biblio::CountItemsIssued($biblionumber) ) { >diff --git a/Koha/BackgroundJob/BatchUpdateAuthority.pm b/Koha/BackgroundJob/BatchUpdateAuthority.pm >index f19dddca600..b695aec5166 100644 >--- a/Koha/BackgroundJob/BatchUpdateAuthority.pm >+++ b/Koha/BackgroundJob/BatchUpdateAuthority.pm >@@ -76,11 +76,13 @@ RECORD_IDS: for my $record_id ( sort { $a <=> $b } @record_ids ) { > my $authid = $record_id; > my $error = eval { > my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid); >- my $record = $authority->record; >+ die("Invalid authid: $authid") unless $authority; >+ >+ my $record = $authority->record; > ModifyRecordWithTemplate( $mmtid, $record ); > ModAuthority( $authid, $record, $authority->authtypecode, { skip_record_index => 1 } ); > }; >- if ( $error and $error != $authid or $@ ) { >+ if ( $error && $error != $authid || $@ ) { > push @messages, { > type => 'error', > code => 'authority_not_modified', >diff --git a/Koha/BackgroundJob/BatchUpdateBiblio.pm b/Koha/BackgroundJob/BatchUpdateBiblio.pm >index bbd4a7a5453..fbe55619d56 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblio.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblio.pm >@@ -84,6 +84,8 @@ RECORD_IDS: for my $biblionumber ( sort { $a <=> $b } @record_ids ) { > # Modify the biblio > my $error = eval { > my $biblio = Koha::Biblios->find($biblionumber); >+ die("Invalid biblionumber: $biblionumber") unless $biblio; >+ > my $record = $biblio->metadata->record; > C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record ); > my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); >@@ -106,7 +108,7 @@ RECORD_IDS: for my $biblionumber ( sort { $a <=> $b } @record_ids ) { > } > ); > }; >- if ( $error and $error != 1 or $@ ) { # ModBiblio returns 1 if everything as gone well >+ if ( $error && $error != 1 || $@ ) { # ModBiblio returns 1 if everything as gone well > push @messages, { > type => 'error', > code => 'biblio_not_modified', >-- >2.51.2
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 30255
:
131527
|
151289
|
151382
|
162547
|
162603
|
178175
|
178176
|
179486
|
179487
|
179488
|
189803
|
189804
|
189805
|
189806
|
189824
|
189825
| 189826