[Koha-bugs] [Bug 11844] Additional fields for order lines

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon May 15 22:53:34 CEST 2023


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

--- Comment #110 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
I can fix the test. I think what happens is:

If the field is a repeatable one, we are only looking at the first occurence.
The test was using 999, but this field is already present in the created
biblio, before another 999 is added with $Z.

So when trying to set the field, no $Z was found and the additional_field was
not set.

This can be fixed by: 

1) Using another field than 999 that doesn't already exist in the record.
2) appending Z to the already existing 999
3) Making sure that set_additional_fields loops through repeatable subfields,
using the first subfield found.

1) is done easily, 3) is harder. I tried to determine how it worked before this
patch set, as the 'set' functionality was already there:

https://git.koha-community.org/Koha-community/Koha/src/commit/f891156f424a466aadb5ab85c445fcdbae4f3536/serials/subscription-add.pl#L370

        my $value = $query->param('additional_field_' . $field->id);
        if ($field->marcfield) {
            my ($field, $subfield) = split /\$/, $field->marcfield;
            if ( $record and $field and $subfield ) {
                $value = $record->subfield( $field, $subfield );
            }
        }

It appears it never dealt 'cleverly' with repeated subfields. So we might move
this to a separate bug and go with 1) for now.

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


More information about the Koha-bugs mailing list