Bugzilla – Attachment 195017 Details for
Bug 42039
Properly set LDR/5 for deleted bibliographic records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 42039: Properly set LDR/5 for deleted bibliographic records
Bug-42039-Properly-set-LDR5-for-deleted-bibliograp.patch (text/plain), 2.05 KB, created by
Janusz Kaczmarek
on 2026-03-09 17:20:54 UTC
(
hide
)
Description:
Bug 42039: Properly set LDR/5 for deleted bibliographic records
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2026-03-09 17:20:54 UTC
Size:
2.05 KB
patch
obsolete
>From fd311a2b5a6a08357704c5a54a102f9369c22869 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Mon, 9 Mar 2026 15:27:27 +0000 >Subject: [PATCH] Bug 42039: Properly set LDR/5 for deleted bibliographic > records >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >For deleted authority records we automatically set LDR/5 to 'd' >(cf. https://www.loc.gov/marc/authority/adleader.html). > >Test plan: >========== >1. Find any bibliographic record. Check the value of the 5th byte of > the leader. It should not be equal to 'd'. >2. Delete the bibliographic record (you may have to delete the items > first). >3. In ktd --dbshell check the 5th byte of the leader, e.g.: > select biblionumber, ExtractValue(metadata, '//leader') from deletedbiblio_metadata order by timestamp desc limit 1; > It should be equlal to the initial value. >4. Apply the patch ; restart_all. >5. Repeat p. 1-3. The 5th byte of the leader should now be properly > set to 'd'. > >Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) >--- > C4/Biblio.pm | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 863f4d34b4..532e8c23a2 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2863,6 +2863,17 @@ sub _koha_delete_biblio_metadata { > my $schema = Koha::Database->new->schema; > $schema->txn_do( > sub { >+ my $metadata = Koha::Biblio::Metadatas->find( { biblionumber => $biblionumber } ); >+ if ($metadata) { >+ my $marc = $metadata->record; >+ if ($marc) { >+ my $leader = $marc->leader; >+ substr( $leader, 5, 1, 'd' ); >+ $marc->leader($leader); >+ my $encoding = C4::Context->preference("marcflavour"); >+ $metadata->update( { metadata => $marc->as_xml_record($encoding) } ); >+ } >+ } > $dbh->do( > q| > INSERT INTO deletedbiblio_metadata (biblionumber, format, `schema`, metadata) >-- >2.39.5
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 42039
:
195017
|
195018
|
195022
|
195023