Bug 32547

Summary: Koha::Item->as_marc_field ignores more_subfields_xml
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: tomascohen
Version: 21.11   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Tomás Cohen Arazi (tcohen) 2022-12-29 12:31:19 UTC
The method, as introduced on bug 23807, handled the extra subfields correctly.

Probably due to the changes introduced by bug 28445, it now doesn't. This is really bad.
Comment 1 Tomás Cohen Arazi (tcohen) 2022-12-29 12:45:20 UTC
I think the bug references are wrong, as I cannot reproduce in master. But this bug is present in 21.11 and wasn't on 20.05
Comment 2 Tomás Cohen Arazi (tcohen) 2022-12-29 13:01:24 UTC
I confirm this problem is only present in 21.11.

Steps to reproduce:

0. Launch a 21.11 KTD:
   # stop any running KTD
   $ ktd down
   $ git checkout origin/21.11.x -b bug_32547
   $ KOHA_IMAGE=21.11 ktd up -d

1. Edit the default framework field 952, add a 'R' subfield for items. Make sure you set:

tab: 10
visibility: opac, staff, editor

2. Pick a biblio and make sure it uses the default framework. I searched for 'att' and picked  "Introduction to Attic Greek / Donald J. Mastronarde." from the sample dataset.
3. Add an item, set the 'R' subfield to some value.
4. Run:
   $ kshell
  k$ perl -MKoha::Items -MData::Printer -e 'my $item = Koha::Items->find(973); p($item->as_marc_field->as_formatted);'
=> FAIL: the output doesn't show subfield R.
Comment 3 Tomás Cohen Arazi (tcohen) 2022-12-29 13:20:57 UTC
I'm going to close this. It seems that the problem is the frameworks contained '' for kohafield instead of NULL, and the code checks 

    if ( defined $kohafield )

Will double check on the different branches how this looks. But closing for now.