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

(-)a/Koha/Preservation/Train/Item/Attribute.pm (-1 / +27 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use JSON qw( to_json );
20
use JSON qw( to_json );
21
use Try::Tiny;
21
use Try::Tiny;
22
22
23
use Koha::Database;
23
use Koha::AuthorisedValues;
24
24
25
use base qw(Koha::Object);
25
use base qw(Koha::Object);
26
26
Lines 50-55 sub processing_attribute { Link Here
50
    return Koha::Preservation::Processing::Attribute->_new_from_dbic($processing_attribute_rs)
50
    return Koha::Preservation::Processing::Attribute->_new_from_dbic($processing_attribute_rs)
51
}
51
}
52
52
53
=head3 strings_map
54
55
Returns a map of column name to string representations including the string.
56
57
=cut
58
59
sub strings_map {
60
    my ($self) = @_;
61
    my $str = $self->value;
62
    if ( $self->processing_attribute->type eq 'authorised_value' ) {
63
        my $av = Koha::AuthorisedValues->search(
64
            {
65
                category         => $self->processing_attribute->option_source,
66
                authorised_value => $self->value,
67
            }
68
        );
69
        if ( $av->count ) {
70
            $str = $av->next->lib || $self->value;
71
        }
72
    }
73
74
    return {
75
        value => { str => $str, type => 'authorised_value' },
76
    };
77
}
78
53
=head2 Internal methods
79
=head2 Internal methods
54
80
55
=head3 _type
81
=head3 _type
(-)a/api/v1/swagger/paths/preservation_trains.yaml (+1 lines)
Lines 165-170 Link Here
165
          enum:
165
          enum:
166
            - items
166
            - items
167
            - items.attributes
167
            - items.attributes
168
            - items.attributes+strings
168
            - items.attributes.processing_attribute
169
            - items.attributes.processing_attribute
169
            - default_processing
170
            - default_processing
170
            - default_processing.attributes
171
            - default_processing.attributes
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue (-6 / +6 lines)
Lines 173-181 Link Here
173
                                ) in item.attributes"
173
                                ) in item.attributes"
174
                                v-bind:key="counter_attribute"
174
                                v-bind:key="counter_attribute"
175
                            >
175
                            >
176
                                <!-- FIXME We need to display the description of the AV here -->
177
                                {{ attribute.processing_attribute.name }}={{
176
                                {{ attribute.processing_attribute.name }}={{
178
                                    attribute.value
177
                                    attribute._strings.value.str
179
                                }}
178
                                }}
180
                            </span>
179
                            </span>
181
                        </div>
180
                        </div>
Lines 238-243 export default { Link Here
238
            train_list: [],
237
            train_list: [],
239
            train_id_selected_for_copy: null,
238
            train_id_selected_for_copy: null,
240
            train_item_id_to_copy: null,
239
            train_item_id_to_copy: null,
240
            av_options: {},
241
        }
241
        }
242
    },
242
    },
243
    beforeRouteEnter(to, from, next) {
243
    beforeRouteEnter(to, from, next) {
Lines 252-263 export default { Link Here
252
            await client.trains.get(train_id).then(
252
            await client.trains.get(train_id).then(
253
                train => {
253
                train => {
254
                    this.train = train
254
                    this.train = train
255
                    let display = this.train.items.every(
255
                    let display_table = this.train.items.every(
256
                        item =>
256
                        item =>
257
                            item.processing_id ==
257
                            item.processing_id ==
258
                            this.train.default_processing_id
258
                            this.train.default_processing_id
259
                    )
259
                    )
260
                    if (display) {
260
                    if (display_table) {
261
                        this.item_table.data = []
261
                        this.item_table.data = []
262
                        this.train.items.forEach(item => {
262
                        this.train.items.forEach(item => {
263
                            let item_row = {}
263
                            let item_row = {}
Lines 271-277 export default { Link Here
271
                                                a.processing_attribute_id ==
271
                                                a.processing_attribute_id ==
272
                                                attribute.processing_attribute_id
272
                                                attribute.processing_attribute_id
273
                                        )
273
                                        )
274
                                        .map(a => a.value)
274
                                        .map(a => a._strings.value.str)
275
                                }
275
                                }
276
                            )
276
                            )
277
                            item_row.item = item
277
                            item_row.item = item
Lines 305-311 export default { Link Here
305
                        })
305
                        })
306
                    }
306
                    }
307
                    this.initialized = true
307
                    this.initialized = true
308
                    this.item_table.display = display
308
                    this.item_table.display = display_table
309
                },
309
                },
310
                error => {}
310
                error => {}
311
            )
311
            )
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/preservation-api-client.js (-15 / +16 lines)
Lines 9-35 export class PreservationAPIClient extends HttpClient { Link Here
9
9
10
    get trains() {
10
    get trains() {
11
        return {
11
        return {
12
            get: (id) =>
12
            get: id =>
13
                this.get({
13
                this.get({
14
                    endpoint: "trains/" + id,
14
                    endpoint: "trains/" + id,
15
                    headers: {
15
                    headers: {
16
                        "x-koha-embed":
16
                        "x-koha-embed":
17
                            "default_processing,default_processing.attributes,items,items.attributes,items.attributes.processing_attribute",
17
                            "default_processing,default_processing.attributes,items,items.attributes,items.attributes+strings,items.attributes.processing_attribute",
18
                    },
18
                    },
19
                }),
19
                }),
20
            getAll: (query = {}) =>
20
            getAll: (query = {}) =>
21
                this.get({
21
                this.get({
22
                    endpoint: "trains?" +
22
                    endpoint:
23
                        "trains?" +
23
                        new URLSearchParams({
24
                        new URLSearchParams({
24
                            _per_page: -1,
25
                            _per_page: -1,
25
                            ...(query && { q: JSON.stringify(query) }),
26
                            ...(query && { q: JSON.stringify(query) }),
26
                        }),
27
                        }),
27
                }),
28
                }),
28
            delete: (id) =>
29
            delete: id =>
29
                this.delete({
30
                this.delete({
30
                    endpoint: "trains/" + id,
31
                    endpoint: "trains/" + id,
31
                }),
32
                }),
32
            create: (train) =>
33
            create: train =>
33
                this.post({
34
                this.post({
34
                    endpoint: "trains",
35
                    endpoint: "trains",
35
                    body: train,
36
                    body: train,
Lines 54-80 export class PreservationAPIClient extends HttpClient { Link Here
54
55
55
    get processings() {
56
    get processings() {
56
        return {
57
        return {
57
            get: (id) =>
58
            get: id =>
58
                this.get({
59
                this.get({
59
                    endpoint: "processings/" + id,
60
                    endpoint: "processings/" + id,
60
                    headers: {
61
                    headers: {
61
                        "x-koha-embed": "attributes",
62
                        "x-koha-embed": "attributes",
62
                    },
63
                    },
63
                }),
64
                }),
64
            getAll: (query) =>
65
            getAll: query =>
65
                this.get({
66
                this.get({
66
                    endpoint: "processings?" +
67
                    endpoint:
68
                        "processings?" +
67
                        new URLSearchParams({
69
                        new URLSearchParams({
68
                            _per_page: -1,
70
                            _per_page: -1,
69
                            ...(query && { q: JSON.stringify(query) }),
71
                            ...(query && { q: JSON.stringify(query) }),
70
                        }),
72
                        }),
71
                }),
73
                }),
72
74
73
            delete: (id) =>
75
            delete: id =>
74
                this.delete({
76
                this.delete({
75
                    endpoint: "processings/" + id,
77
                    endpoint: "processings/" + id,
76
                }),
78
                }),
77
            create: (processing) =>
79
            create: processing =>
78
                this.post({
80
                this.post({
79
                    endpoint: "processings",
81
                    endpoint: "processings",
80
                    body: processing,
82
                    body: processing,
Lines 148-154 export class PreservationAPIClient extends HttpClient { Link Here
148
150
149
    get waiting_list_items() {
151
    get waiting_list_items() {
150
        return {
152
        return {
151
            get_from_barcode: (barcode) => {
153
            get_from_barcode: barcode => {
152
                const q = {
154
                const q = {
153
                    "me.barcode": barcode,
155
                    "me.barcode": barcode,
154
                };
156
                };
Lines 164-178 export class PreservationAPIClient extends HttpClient { Link Here
164
                    headers: {
166
                    headers: {
165
                        "x-koha-embed": "biblio",
167
                        "x-koha-embed": "biblio",
166
                    },
168
                    },
167
                }).then((response) => {
169
                }).then(response => {
168
                    return response.length ? response[0] : undefined;
170
                    return response.length ? response[0] : undefined;
169
                });
171
                });
170
            },
172
            },
171
            delete: (id) =>
173
            delete: id =>
172
                this.delete({
174
                this.delete({
173
                    endpoint: "waiting-list/items/" + id,
175
                    endpoint: "waiting-list/items/" + id,
174
                }),
176
                }),
175
            createAll: (items) =>
177
            createAll: items =>
176
                this.post({
178
                this.post({
177
                    endpoint: "waiting-list/items",
179
                    endpoint: "waiting-list/items",
178
                    body: items,
180
                    body: items,
179
- 

Return to bug 30708