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

(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/biblio-api-client.js (-2 / +8 lines)
Lines 12-22 export class BiblioAPIClient { Link Here
12
                    endpoint: "biblios",
12
                    endpoint: "biblios",
13
                    query,
13
                    query,
14
                    params,
14
                    params,
15
                    headers,
15
                    headers: {
16
                        Accept: "application/json",
17
                        ...headers,
18
                    },
16
                }),
19
                }),
17
            get: id =>
20
            get: id =>
18
                this.httpClient.get({
21
                this.httpClient.get({
19
                    endpoint: "items/" + id,
22
                    endpoint: "biblios/" + id,
23
                    headers: {
24
                        Accept: "application/json",
25
                    },
20
                }),
26
                }),
21
        };
27
        };
22
    }
28
    }
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Display/DisplaysResource.vue (-17 / +36 lines)
Lines 251-258 export default { Link Here
251
                        hidden: display => !!display.display_items?.length,
251
                        hidden: display => !!display.display_items?.length,
252
                        columns: [
252
                        columns: [
253
                            {
253
                            {
254
                                name: $__("Record number"),
254
                                name: $__("Record title"),
255
                                value: "biblionumber",
255
                                value: "title",
256
                                link: {
256
                                link: {
257
                                    href: "/cgi-bin/koha/catalogue/detail.pl",
257
                                    href: "/cgi-bin/koha/catalogue/detail.pl",
258
                                    params: {
258
                                    params: {
Lines 260-275 export default { Link Here
260
                                    },
260
                                    },
261
                                },
261
                                },
262
                            },
262
                            },
263
                            {
264
                                name: $__("Internal item number"),
265
                                value: "itemnumber",
266
                                link: {
267
                                    href: "/cgi-bin/koha/catalogue/moredetail.pl",
268
                                    params: {
269
                                        itemnumber: "itemnumber",
270
                                    },
271
                                },
272
                            },
273
                            {
263
                            {
274
                                name: $__("Item barcode"),
264
                                name: $__("Item barcode"),
275
                                value: "barcode",
265
                                value: "barcode",
Lines 360-365 export default { Link Here
360
            },
350
            },
361
        };
351
        };
362
352
353
        const getBiblioFromId = async id => {
354
            const bibliosApiClient = APIClient.biblio.biblios;
355
            let item = undefined;
356
357
            await bibliosApiClient
358
                .get(id)
359
                .then(data => {
360
                    item = data;
361
                })
362
                .catch(error => {
363
                    console.error(error);
364
                });
365
366
            return item;
367
        };
368
363
        const getItemFromId = async id => {
369
        const getItemFromId = async id => {
364
            const itemsApiClient = APIClient.item.items;
370
            const itemsApiClient = APIClient.item.items;
365
            let item = undefined;
371
            let item = undefined;
Lines 506-517 export default { Link Here
506
        const afterResourceFetch = (componentData, resource, caller) => {
512
        const afterResourceFetch = (componentData, resource, caller) => {
507
            if (caller === "show" || caller === "form") {
513
            if (caller === "show" || caller === "form") {
508
                resource.display_items.forEach((display_item, idx) => {
514
                resource.display_items.forEach((display_item, idx) => {
515
                    componentData.resource.value.display_items[idx].title =
516
                        _("Loading");
517
                    componentData.resource.value.display_items[idx].barcode =
518
                        _("Loading");
519
520
                    getBiblioFromId(display_item.biblionumber)
521
                        .then(biblio => {
522
                            componentData.resource.value.display_items[
523
                                idx
524
                            ].title = biblio.title;
525
                        })
526
                        .catch(error => {
527
                            console.error(error);
528
                        });
529
509
                    getItemFromId(display_item.itemnumber)
530
                    getItemFromId(display_item.itemnumber)
510
                        .then(item => {
531
                        .then(item => {
511
                            componentData.resource.value.display_items[idx] = {
532
                            componentData.resource.value.display_items[
512
                                barcode: item.external_id,
533
                                idx
513
                                ...display_item,
534
                            ].barcode = item.external_id;
514
                            };
515
                        })
535
                        })
516
                        .catch(error => {
536
                        .catch(error => {
517
                            console.error(error);
537
                            console.error(error);
518
- 

Return to bug 14962