View | Details | Raw Unified | Return to bug 14957
Collapse All | Expand All

(-)a/Koha/MarcOverlayRules.pm (-3 / +18 lines)
Lines 160-166 sub merge_records { Link Here
160
        my %keys_index = map { $_ => undef } (keys %{$a}, keys %{$b});
160
        my %keys_index = map { $_ => undef } (keys %{$a}, keys %{$b});
161
        foreach my $key (keys %keys_index) {
161
        foreach my $key (keys %keys_index) {
162
            if ($a->{$key} && $b->{$key}) {
162
            if ($a->{$key} && $b->{$key}) {
163
                push @intersecting, $a->{$key};
163
                push @intersecting, [$a->{$key}, $b->{$key}];
164
            }
164
            }
165
            elsif ($a->{$key}) {
165
            elsif ($a->{$key}) {
166
                push @removed, $a->{$key};
166
                push @removed, $a->{$key};
Lines 254-260 sub merge_records { Link Here
254
            # First add common fields (intersection)
254
            # First add common fields (intersection)
255
            # Unchanged
255
            # Unchanged
256
            if (@{$common_fields}) {
256
            if (@{$common_fields}) {
257
                push @merged_fields, @{$common_fields};
257
                if(
258
                    $rule->{delete}->{allow} &&
259
                    $rule->{add}->{allow} && (
260
                        @{$common_fields} == 1 || (
261
                            $rule->{append}->{allow} &&
262
                            $rule->{remove}->{allow}
263
                        )
264
                    )
265
                ) {
266
                    # If overwritable apply possible subfield order
267
                    # changes from incoming fields
268
                    push @merged_fields, map { $_->[1] } @{$common_fields};
269
                }
270
                else {
271
                    # else keep existing subfield order
272
                    push @merged_fields, map { $_->[0] } @{$common_fields};
273
                }
258
            }
274
            }
259
            # Removed
275
            # Removed
260
            if (@{$current_fields_only}) {
276
            if (@{$current_fields_only}) {
261
- 

Return to bug 14957