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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementRelationships.vue (-9 / +9 lines)
Lines 99-113 export default { Link Here
99
    },
99
    },
100
    beforeCreate() {
100
    beforeCreate() {
101
        const client = APIClient.erm
101
        const client = APIClient.erm
102
        client.agreements.getAll().then(
102
        client.agreements
103
            agreements => {
103
            .getAll({ "me.agreement_id": { "!=": this.agreement_id } })
104
                this.agreements = agreements.filter(
104
            .then(
105
                    agreement => agreement.agreement_id !== this.agreement_id
105
                agreements => {
106
                )
106
                    this.agreements = agreements
107
                this.initialized = true
107
                    this.initialized = true
108
            },
108
                },
109
            error => {}
109
                error => {}
110
        )
110
            )
111
    },
111
    },
112
    methods: {
112
    methods: {
113
        addRelationship() {
113
        addRelationship() {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js (-54 / +9 lines)
Lines 18-30 export class ERMAPIClient extends HttpClient { Link Here
18
                    },
18
                    },
19
                }),
19
                }),
20
            getAll: query =>
20
            getAll: query =>
21
                this.get({
21
                this.getAll({
22
                    endpoint:
22
                    endpoint: "agreements",
23
                        "agreements?" +
23
                    query: query,
24
                        new URLSearchParams({
25
                            _per_page: -1,
26
                            ...(query && { q: JSON.stringify(query) }),
27
                        }),
28
                }),
24
                }),
29
            delete: id =>
25
            delete: id =>
30
                this.delete({
26
                this.delete({
Lines 64-76 export class ERMAPIClient extends HttpClient { Link Here
64
                    },
60
                    },
65
                }),
61
                }),
66
            getAll: query =>
62
            getAll: query =>
67
                this.get({
63
                this.getAll({
68
                    endpoint:
64
                    endpoint: "licenses",
69
                        "licenses?" +
65
                    query: query,
70
                        new URLSearchParams({
71
                            _per_page: -1,
72
                            ...(query && { q: JSON.stringify(query) }),
73
                        }),
74
                    headers: {
66
                    headers: {
75
                        "x-koha-embed": "vendor",
67
                        "x-koha-embed": "vendor",
76
                    },
68
                    },
Lines 113-125 export class ERMAPIClient extends HttpClient { Link Here
113
                    },
105
                    },
114
                }),
106
                }),
115
            getAll: query =>
107
            getAll: query =>
116
                this.get({
108
                this.getAll({
117
                    endpoint:
109
                    endpoint: "eholdings/local/packages",
118
                        "eholdings/local/packages?" +
110
                    query: query,
119
                        new URLSearchParams({
120
                            _per_page: -1,
121
                            ...(query && { q: JSON.stringify(query) }),
122
                        }),
123
                    headers: {
111
                    headers: {
124
                        "x-koha-embed": "resources+count,vendor.name",
112
                        "x-koha-embed": "resources+count,vendor.name",
125
                    },
113
                    },
Lines 160-174 export class ERMAPIClient extends HttpClient { Link Here
160
                        "x-koha-embed": "resources,resources.package",
148
                        "x-koha-embed": "resources,resources.package",
161
                    },
149
                    },
162
                }),
150
                }),
163
            getAll: query =>
164
                this.get({
165
                    endpoint:
166
                        "eholdings/local/titles?" +
167
                        new URLSearchParams({
168
                            _per_page: -1,
169
                            ...(query && { q: JSON.stringify(query) }),
170
                        }),
171
                }),
172
            delete: id =>
151
            delete: id =>
173
                this.delete({
152
                this.delete({
174
                    endpoint: "eholdings/local/titles/" + id,
153
                    endpoint: "eholdings/local/titles/" + id,
Lines 223-242 export class ERMAPIClient extends HttpClient { Link Here
223
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
202
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
224
                    },
203
                    },
225
                }),
204
                }),
226
            getAll: query =>
227
                this.get({
228
                    endpoint:
229
                        "eholdings/ebsco/packages/" +
230
                        id +
231
                        "?" +
232
                        new URLSearchParams({
233
                            _per_page: -1,
234
                            ...(query && { q: JSON.stringify(query) }),
235
                        }),
236
                    headers: {
237
                        "x-koha-embed": "resources+count,vendor.name",
238
                    },
239
                }),
240
            patch: (id, body) =>
205
            patch: (id, body) =>
241
                this.patch({
206
                this.patch({
242
                    endpoint: "eholdings/ebsco/packages/" + id,
207
                    endpoint: "eholdings/ebsco/packages/" + id,
Lines 254-269 export class ERMAPIClient extends HttpClient { Link Here
254
                        "x-koha-embed": "resources,resources.package",
219
                        "x-koha-embed": "resources,resources.package",
255
                    },
220
                    },
256
                }),
221
                }),
257
            getAll: query =>
258
                this.get({
259
                    endpoint:
260
                        "eholdings/local/ebsco/titles" +
261
                        "?" +
262
                        new URLSearchParams({
263
                            _per_page: -1,
264
                            ...(query && { q: JSON.stringify(query) }),
265
                        }),
266
                }),
267
        };
222
        };
268
    }
223
    }
269
224
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js (-1 / +13 lines)
Lines 50-55 class HttpClient { Link Here
50
        });
50
        });
51
    }
51
    }
52
52
53
    getAll(params = {}) {
54
        let url =
55
            params.endpoint + "?" +
56
            new URLSearchParams({
57
                _per_page: -1,
58
                ...(params.query && { q: JSON.stringify(params.query) }),
59
            })
60
        return this._fetchJSON(url, params.headers, {
61
            ...params.options,
62
            method: "GET",
63
        });
64
    }
65
53
    post(params = {}) {
66
    post(params = {}) {
54
        const body = params.body
67
        const body = params.body
55
            ? typeof params.body === "string"
68
            ? typeof params.body === "string"
56
- 

Return to bug 33623