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

(-)a/Koha/Preservation/Processing.pm (-2 / +23 lines)
Lines 46-55 sub attributes { Link Here
46
        my $schema = $self->_result->result_source->schema;
46
        my $schema = $self->_result->result_source->schema;
47
        $schema->txn_do(
47
        $schema->txn_do(
48
            sub {
48
            sub {
49
                $self->attributes->delete;
49
                my @existing_ids = map { $_->{processing_attribute_id} || () } @$attributes;
50
                if (@existing_ids || !@$attributes) {
51
                    $self->attributes->search(
52
                        {
53
                            (
54
                                # If no attributes passed we delete all the existing ones
55
                                @$attributes
56
                                ? (
57
                                    processing_attribute_id => {
58
                                        -not_in => \@existing_ids
59
                                    }
60
                                  )
61
                                : ()
62
                            )
63
                        }
64
                    )->delete;
65
                }
50
66
51
                for my $attribute (@$attributes) {
67
                for my $attribute (@$attributes) {
52
                    $self->_result->add_to_preservation_processing_attributes($attribute);
68
                    my $existing_attribute = $self->attributes->find( $attribute->{processing_attribute_id} );
69
                    if ($existing_attribute) {
70
                        $existing_attribute->set($attribute)->store;
71
                    } else {
72
                        $self->_result ->add_to_preservation_processing_attributes( $attribute );
73
                    }
53
                }
74
                }
54
            }
75
            }
55
        );
76
        );
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue (-3 / +18 lines)
Lines 25-30 Link Here
25
                </fieldset>
25
                </fieldset>
26
                <fieldset class="rows">
26
                <fieldset class="rows">
27
                    <legend>{{ $__("Attributes") }}</legend>
27
                    <legend>{{ $__("Attributes") }}</legend>
28
                    <div
29
                        v-if="processing.processing_id"
30
                        id="alert-removal"
31
                        class="dialog message"
32
                    >
33
                        {{
34
                            $__(
35
                                "Be careful removing attribute to this processing, the items using it will be impacted as well!"
36
                            )
37
                        }}
38
                    </div>
28
                    <fieldset
39
                    <fieldset
29
                        :id="`attribute_${counter}`"
40
                        :id="`attribute_${counter}`"
30
                        class="rows"
41
                        class="rows"
Lines 246-253 export default { Link Here
246
            }
257
            }
247
258
248
            processing.attributes = processing.attributes.map(
259
            processing.attributes = processing.attributes.map(
249
                ({ processing_id, processing_attribute_id, ...keepAttrs }) =>
260
                ({ processing_id, ...keepAttrs }) => keepAttrs
250
                    keepAttrs
251
            )
261
            )
252
262
253
            const client = APIClient.preservation
263
            const client = APIClient.preservation
Lines 284-286 export default { Link Here
284
    name: "SettingsProcessingsFormAdd",
294
    name: "SettingsProcessingsFormAdd",
285
}
295
}
286
</script>
296
</script>
287
- 
297
298
<style>
299
#alert-removal {
300
    margin: 0;
301
}
302
</style>

Return to bug 30708