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

--- Comment #7 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 187185
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187185&action=edit
Bug 32950: Fix subfield moving in repeatable MARC fields

This patch fixes the issue where moving subfields between repeatable
MARC fields could lose or duplicate values due to incorrect logic in
the _update_subfield function.

The problem was in the handling of multiple values when there were
more values than target fields. The original code would add all
remaining values to all target fields, causing duplication.

Changes made:
- Rewrote _update_subfield to handle one-to-one value mapping correctly
- Ensures proper ordering when moving between fields
- Creates new fields in correct position when needed
- Removes excess fields when there are fewer values than existing fields
- Maintains backwards compatibility for existing functionality

Test plan:
1. Create a MARC record with multiple 020 fields containing both $a and $z
subfields
2. Use MARC modification template to move 020$z to 024$a
3. Verify that values are transferred correctly without duplication
4. Verify that the order of values is preserved
5. Run existing SimpleMARC tests to ensure no regression

Signed-off-by: Bernard Scaife <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to