From 35ba0baa9c98b89bcdfa68f7d2732d67fc38051a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 30 May 2022 15:07:54 +0200 Subject: [PATCH] Bug 32030: Add links to vendors Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/ERM/EHoldings/Package.pm | 14 +++++++++++++ .../definitions/erm_eholdings_package.yaml | 4 ++++ .../components/ERM/EHoldingsPackagesShow.vue | 21 +++++++------------ koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js | 2 +- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Koha/ERM/EHoldings/Package.pm b/Koha/ERM/EHoldings/Package.pm index 2e2edd6802..6ee7975277 100644 --- a/Koha/ERM/EHoldings/Package.pm +++ b/Koha/ERM/EHoldings/Package.pm @@ -21,6 +21,7 @@ use Koha::Database; use base qw(Koha::Object); +use Koha::Acquisition::Booksellers; use Koha::ERM::EHoldings::Package::Agreements; use Koha::ERM::EHoldings::Resources; @@ -70,6 +71,19 @@ sub resources { return Koha::ERM::EHoldings::Resources->_new_from_dbic($rs); } +=head3 vendor + +Returns the vendor + +=cut + +sub vendor { + my ( $self ) = @_; + my $rs = $self->_result->vendor; + return unless $rs; + return Koha::Acquisition::Bookseller->_new_from_dbic($rs); +} + =head2 Internal methods =head3 _type diff --git a/api/v1/swagger/definitions/erm_eholdings_package.yaml b/api/v1/swagger/definitions/erm_eholdings_package.yaml index dac059192e..356de545cb 100644 --- a/api/v1/swagger/definitions/erm_eholdings_package.yaml +++ b/api/v1/swagger/definitions/erm_eholdings_package.yaml @@ -43,6 +43,10 @@ properties: description: resources items: $ref: erm_eholdings_resource.yaml + vendor: + type: + - object + - "null" additionalProperties: false required: diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesShow.vue index 4253be0499..ac0c3c7e4c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesShow.vue @@ -28,18 +28,19 @@
  • - - {{ - vendors.find( - (e) => e.id == erm_package.vendor_id - ).name - }} + {{ erm_package.vendor.name }}
  • - {{ erm_package.external_id }} + + + {{ erm_package.external_id }} +
  • @@ -107,25 +108,19 @@