Bug 22439

Summary: Duplicated code in PrepHostMarcField and prepare_host_field
Product: Koha Reporter: paxed <pasi.kallinen>
Component: CatalogingAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: emmi.takkinen, flyingendpaper, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37305    
Bug Blocks:    

Description paxed 2019-03-01 09:06:13 UTC
The C4/Biblio.pm subroutines PrepHostMarcField and prepare_host_field both do the same thing, so should be merged.
Comment 1 paxed 2019-03-04 08:17:28 UTC
In addition:

1) prepare_host_field: if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) - the '11' should be '111'

2) prepare_host_field has a 240 -> 773b, which should be 250a -> 773b, as it is in PrepHostMarcField

3) There's a difference in how the 773a is set: prepare_host_field uses 100ab | 110ab | 11ab, but PrepHostMarcField uses 100a | 110a | 111a
Comment 2 Martin Renvoize (ashimema) 2024-07-17 10:13:10 UTC
*** Bug 30793 has been marked as a duplicate of this bug. ***
Comment 3 Martin Renvoize (ashimema) 2024-07-17 10:30:10 UTC
I remove C4::Biblio::prepare_host_field in bug 37305, opting to use the tested method I add to Koha::Biblio as `generate_marc_host_field` in bug 29560.

1) The 111 vs 11 mistake in prepare_marc_host is fixed in generate_marc_host_field already.
2) We set 773b t 250ab and 773s to 240a in generate_marc_host_field
3) We stick to 1XXab for 773a in generate_marc_host_field

The outstanding differences between PrepHostMarcField, for EasyAnalytics, and generate_marc_host_field are:

1) Subfield 0 is set to the host biblionumber
2) Subfield 9 is set to the host itemnumber
3) Subfield o is set to the host item barcode