Comment 8 for bug 712490

Revision history for this message
Bill Erickson (berick) wrote :

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp712490-vandelay-replace-field-retain-order

This branch replaces vandelay.replace_field() function with a PGPERL handler, very similar to vandelay.strip_field() and vandelay.add_field(). In short, when replacing subfield-level values, it performs a merge instead of a delete+add.

The code iterates each affected field, leaving uncontrolled subfields alone, replacing values for matching controlled subfields, splicing in new controlled subfields (i.e. those that only existing on the source record), and deleting controlled subfields that only exist on the target field.

The final result is consistent with the existing vandelay.add_field() with respect to which fields are present. The only difference is the field order.

I have confirmed Dan's example from comment #2 now retains the field order (assuming 600$c is uncontrolled).

Includes PGTAP test.

To test:

[1] Link a an authority record to a bib field by adding a $0 as the final subfield.
[2] Modify the authority record
[3] Confirm the modifications propagated to the affected bib field leaving the $0 as the last field.