Bugzilla – Attachment 73676 Details for
Bug 20522
Fields with only one $9 subfield are removed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20522: Fields with only one $9 subfield are removed
Bug-20522-Fields-with-only-one-9-subfield-are-remo.patch (text/plain), 2.00 KB, created by
Frédéric Demians
on 2018-04-05 07:56:00 UTC
(
hide
)
Description:
Bug 20522: Fields with only one $9 subfield are removed
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2018-04-05 07:56:00 UTC
Size:
2.00 KB
patch
obsolete
>From e36aea2f038579e9963b7d2e474abcba68c40c23 Mon Sep 17 00:00:00 2001 >From: Tamil <Tamil e-Biblio Service contact@tamil.fr> >Date: Thu, 5 Apr 2018 07:26:21 +0000 >Subject: [PATCH] Bug 20522: Fields with only one $9 subfield are removed >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >There is a sort of cleaning functionnality in Koha when saving a biblio >record. If a field contains only a $9 subfield, the whole field is >removed. There is a logic there since $9 is generally used in Koha for >storing authority record ID. However there may exist fields perfectly >valid containing only a $9 subfield. This is a case in Unimarc 010 >field. > >To test in Unimarc: > >1. Add a $9 sufield to 010. You can name it "ISBN d'une livraison de > publication en série" > >2. Create a new biblio record. Fill 010 $a and $9 subfields. Save the > record. > > => Everything is fine: $a et $9 are properly stored. > >3. Modify the previous record, and remove $a subield. Save the > record. > > => 010 field is removed > >4. Apply the patch. Repeat 2-3 steps. Observe that a 010 field > containing only a $9 subfield can be saved properly. > >To test in MARC21: Replace 010 filed by any other field... >--- > C4/Biblio.pm | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 91707fd..44055b6 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -297,11 +297,10 @@ sub ModBiblio { > > # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to > # throw an exception which probably won't be handled. >+ # Remove fields with no subfields > foreach my $field ($record->fields()) { >- if (! $field->is_control_field()) { >- if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield('9'))) { >- $record->delete_field($field); >- } >+ if (! $field->is_control_field() && scalar($field->subfields()) == 0) { >+ $record->delete_field($field); > } > } > >-- >2.7.4
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 20522
: 73676