From e925a570b41591bc8e6c12e6ece939e23018534e Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 11 Sep 2024 13:33:10 +0000 Subject: [PATCH] Bug 38010: Add the component to display a vendor --- Koha/Acquisition/Bookseller.pm | 21 +++ api/v1/swagger/definitions/vendor.yaml | 9 ++ .../swagger/paths/acquisitions_vendors.yaml | 15 +++ .../vue/components/Vendors/VendorContacts.vue | 97 ++++++++++++++ .../components/Vendors/VendorContracts.vue | 64 +++++++++ .../vue/components/Vendors/VendorDetails.vue | 78 +++++++++++ .../components/Vendors/VendorInterfaces.vue | 54 ++++++++ .../Vendors/VendorOrderingInformation.vue | 75 +++++++++++ .../js/vue/components/Vendors/VendorShow.vue | 123 ++++++++++++++++++ .../Vendors/VendorSubscriptions.vue | 27 ++++ .../js/vue/fetch/acquisition-api-client.js | 6 +- 11 files changed, 565 insertions(+), 4 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue diff --git a/Koha/Acquisition/Bookseller.pm b/Koha/Acquisition/Bookseller.pm index 098a0be19bd..3a77d324d10 100644 --- a/Koha/Acquisition/Bookseller.pm +++ b/Koha/Acquisition/Bookseller.pm @@ -23,6 +23,8 @@ use Koha::Acquisition::Bookseller::Interfaces; use Koha::Acquisition::Bookseller::Issues; use Koha::Subscriptions; +use C4::Contract qw( GetContracts ); + use base qw( Koha::Object ); =head1 NAME @@ -63,6 +65,25 @@ sub contacts { return Koha::Acquisition::Bookseller::Contacts->_new_from_dbic( $contacts_rs ); } +=head3 contracts + + my $vendor = Koha::Acquisition::Booksellers->find( $id ); + my @contracts = $vendor->contracts(); + +Returns the list of contracts for the vendor + +=cut + +sub contracts { + my ($self) = @_; + return GetContracts( + { + booksellerid => $self->id, + } + ); +} + + =head3 subscriptions my $vendor = Koha::Acquisition::Booksellers->find( $id ); diff --git a/api/v1/swagger/definitions/vendor.yaml b/api/v1/swagger/definitions/vendor.yaml index 87a5c4440dc..5698ba970d1 100644 --- a/api/v1/swagger/definitions/vendor.yaml +++ b/api/v1/swagger/definitions/vendor.yaml @@ -125,6 +125,15 @@ properties: subscriptions: type: array description: List of subscriptions + interfaces: + type: array + description: List of interfaces + contacts: + type: array + description: List of contacts + contracts: + type: array + description: List of contracts additionalProperties: false required: - name diff --git a/api/v1/swagger/paths/acquisitions_vendors.yaml b/api/v1/swagger/paths/acquisitions_vendors.yaml index e671dea9742..6a091cb318f 100644 --- a/api/v1/swagger/paths/acquisitions_vendors.yaml +++ b/api/v1/swagger/paths/acquisitions_vendors.yaml @@ -137,6 +137,21 @@ summary: Get vendor parameters: - $ref: "../swagger.yaml#/parameters/vendor_id_pp" + - name: x-koha-embed + in: header + required: false + description: Embed list sent as a request header + type: array + items: + type: string + enum: + - aliases + - baskets + - subscriptions + - interfaces + - contacts + - contracts + collectionFormat: csv produces: - application/json responses: diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue new file mode 100644 index 00000000000..61a56e3e7d3 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContacts.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue new file mode 100644 index 00000000000..068d7a549c8 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorContracts.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue new file mode 100644 index 00000000000..dfafd08075d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorDetails.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue new file mode 100644 index 00000000000..2df655378b5 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorInterfaces.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue new file mode 100644 index 00000000000..60a3e621570 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue new file mode 100644 index 00000000000..bb4b06a05b2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorShow.vue @@ -0,0 +1,123 @@ + + + + + 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 new file mode 100644 index 00000000000..a0b7650ea33 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorSubscriptions.vue @@ -0,0 +1,27 @@ + + + + + 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 2f1417fe4c2..37c265f545e 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 @@ -13,7 +13,8 @@ export class AcquisitionAPIClient extends HttpClient { this.get({ endpoint: "vendors/" + id, headers: { - "x-koha-embed": "aliases", + "x-koha-embed": + "baskets,aliases,subscriptions,interfaces,contacts,contracts", }, }), getAll: (query, params) => @@ -21,9 +22,6 @@ export class AcquisitionAPIClient extends HttpClient { endpoint: "vendors", query, params, - headers: { - "x-koha-embed": "aliases,baskets", - }, }), delete: id => this.delete({ -- 2.39.3 (Apple Git-146)