[Koha-bugs] [Bug 31441] Koha::Item::as_marc_field ignores subfields where kohafield is an empty string

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Sep 23 01:25:04 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31441

David Nind <david at davidnind.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #139676|0                           |1
        is obsolete|                            |

--- Comment #2 from David Nind <david at davidnind.com> ---
Created attachment 140877
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140877&action=edit
Bug 31441: Fix Koha::Item::as_marc_field when kohafield = ''

marc_subfield_structure.kohafield can be NULL, but it can also be an
empty string. But in that case, Koha::Item::as_marc_field ignores them,
which means the resulting MARC::Field object has missing data.
This can produce a bug in OPAC ISBD view (and probably other places
where this method is used)

Test plan:
1. Edit the default biblio MARC framework for the item field: find or
   create a subfield that is not linked to a DB column.
   Save even if you made no changes to make sure that
   marc_subfield_structure.kohafield is set to an empty string.
   I'll use 995$Z as an example for the following steps.
2. Add the following to syspref OPACISBD:
    #995|<br>Item:|{995Z}|
3. Create a biblio with an item and put a value into 995$Z
4. Go to the ISBD detail page for this record at OPAC. Confirm that the
   value you entered in 995$Z is not visible
5. Apply patch and restart koha
6. Refresh the ISBD detail page. Confirm that the 995$Z is now visible.
7. Run `prove t/db_dependent/Koha/Item.t`

Signed-off-by: David Nind <david at davidnind.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list