Bugzilla – Attachment 102078 Details for
Bug 25006
Koha::Item->as_marc_field generates undef subfields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields
Bug-25006-Make-KohaItem-asmarcfield-skip-undefined.patch (text/plain), 1.51 KB, created by
Jonathan Druart
on 2020-03-30 10:41:23 UTC
(
hide
)
Description:
Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-30 10:41:23 UTC
Size:
1.51 KB
patch
obsolete
>From 2036c3fd2d0833849acaeb410805a1c357dda483 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 27 Mar 2020 16:38:15 -0300 >Subject: [PATCH] Bug 25006: Make Koha::Item->as_marc_field skip undefined > subfields > >This patch makes as_marc_field skip subfields that don't have a value or >contains an empty string (replicating C4::Items:1021 logic). > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Item.t >=> FAIL: Tests fail because the generated MARC::Field contains undef >subfields. >3. Apply this patch >4. Repeat 2. >=> SUCCESS: Tests pass! Undefined and empty subfields are skipped! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Item.pm | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 48dc73bf5c..70819cc96b 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -683,7 +683,8 @@ sub as_marc_field { > next if !$tagfield; # TODO: Should we raise an exception instead? > # Feels like safe fallback is better > >- push @subfields, $tagsubfield => $self->$item_field; >+ push @subfields, $tagsubfield => $self->$item_field >+ if defined $self->$item_field and $item_field ne ''; > } > > my $unlinked_item_subfields = C4::Items::_parse_unlinked_item_subfields_from_xml($self->more_subfields_xml); >-- >2.20.1
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 25006
:
102016
|
102017
|
102051
|
102052
|
102077
| 102078