From 282454f0f08f64ce991f86d54e7ebd1824dd5bc9 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 7 Nov 2024 13:24:00 +0000 Subject: [PATCH] Bug 38010: Rebase for bug 38390 --- api/v1/swagger/paths/acquisitions_vendors.yaml | 2 +- .../prog/js/vue/components/Vendors/VendorFormAdd.vue | 1 + .../prog/js/vue/components/Vendors/VendorList.vue | 10 +++++----- .../js/vue/components/Vendors/VendorSubscriptions.vue | 4 ++-- .../prog/js/vue/fetch/acquisition-api-client.js | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/api/v1/swagger/paths/acquisitions_vendors.yaml b/api/v1/swagger/paths/acquisitions_vendors.yaml index cebe964ac5f..87ec425767d 100644 --- a/api/v1/swagger/paths/acquisitions_vendors.yaml +++ b/api/v1/swagger/paths/acquisitions_vendors.yaml @@ -147,7 +147,7 @@ enum: - aliases - baskets - - subscriptions + - subscriptions+count - interfaces - contacts - contracts diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue index b4dc628553c..333b453206c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorFormAdd.vue @@ -112,6 +112,7 @@ export default { }) } delete vendor.physical + delete vendor.subscriptions_count vendor.contacts = vendor.contacts.map( ({ id, booksellerid, ...requiredProperties }) => diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue index e28ba15b53e..318fd1fd03e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue @@ -62,7 +62,7 @@ export default { searchTerm: null, tableOptions: { columns: this.getTableColumns(), - options: { embed: "aliases,baskets,subscriptions" }, + options: { embed: "aliases,baskets,subscriptions+count" }, url: () => this.tableURL(), add_filters: true, filters_options: { @@ -85,8 +85,8 @@ export default { should_display: row => (!row.baskets || row.baskets.length === 0) && - (!row.subscriptions || - row.subscriptions.length === 0), + (!row.subscriptions_count || + row.subscriptions_count === 0), }, }, ], @@ -234,13 +234,13 @@ export default { searchable: false, orderable: false, render(data, type, row, meta) { - return row.subscriptions.length + return row.subscriptions_count ? '' + escape_str( - `${row.subscriptions.length} subscription(s)` + `${row.subscriptions_count} subscription(s)` ) + "" : escape_str(__("No subscriptions")) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue index 419f5adeda3..50536d22a28 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue @@ -8,9 +8,9 @@ {{ vendor.subscriptions.length }}{{ vendor.subscriptions_count }} - {{ vendor.subscriptions.length }} + {{ vendor.subscriptions_count }}

diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js index 930ec22320f..7e3e59b4e58 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js @@ -14,7 +14,7 @@ export class AcquisitionAPIClient extends HttpClient { endpoint: "vendors/" + id, headers: { "x-koha-embed": - "aliases,subscriptions,interfaces,contacts,contracts", + "aliases,subscriptions+count,interfaces,contacts,contracts", }, }), getAll: (query, params) => -- 2.39.3 (Apple Git-146)