From 46744e1e9b7b4af0e5e2d234ab9c446a01253e53 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 29 Jun 2022 17:42:28 +0200 Subject: [PATCH] Bug 32030: Make the ERMProviders syspref multivaluated Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/ERM/EHoldings/Packages.pm | 36 +- .../Packages/{Manual.pm => Local.pm} | 30 +- Koha/REST/V1/ERM/EHoldings/Resources.pm | 18 +- .../Resources/{Manual.pm => Local.pm} | 2 +- Koha/REST/V1/ERM/EHoldings/Titles.pm | 38 +- .../EHoldings/Titles/{Manual.pm => Local.pm} | 2 +- .../swagger/paths/erm_eholdings_packages.yaml | 14 +- .../erm_eholdings_packages_resources.yaml | 7 +- .../paths/erm_eholdings_resources.yaml | 14 +- .../swagger/paths/erm_eholdings_titles.yaml | 14 +- .../paths/erm_eholdings_titles_resources.yaml | 2 +- api/v1/swagger/swagger.yaml | 32 +- cypress/integration/Packages_spec.ts | 44 +- installer/data/mysql/atomicupdate/erm.pl | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/includes/erm-search.inc | 4 +- .../en/modules/admin/preferences/erm.pref | 8 +- .../intranet-tmpl/prog/en/modules/erm/erm.tt | 3 +- .../vue/components/ERM/EHoldingsEBSCOHome.vue | 30 ++ ...ue => EHoldingsEBSCOPackageAgreements.vue} | 2 +- ...ue => EHoldingsEBSCOPackageTitlesList.vue} | 76 ++-- .../ERM/EHoldingsEBSCOPackagesList.vue | 199 +++++++++ .../ERM/EHoldingsEBSCOPackagesShow.vue | 137 ++++++ ...ow.vue => EHoldingsEBSCOResourcesShow.vue} | 10 +- ...ue => EHoldingsEBSCOTitlePackagesList.vue} | 58 ++- .../ERM/EHoldingsEBSCOTitlesList.vue | 215 +++++++++ .../ERM/EHoldingsEBSCOTitlesShow.vue | 317 +++++++++++++ .../vue/components/ERM/EHoldingsLocalHome.vue | 30 ++ .../ERM/EHoldingsLocalPackageAgreements.vue | 84 ++++ .../ERM/EHoldingsLocalPackageTitlesList.vue | 120 +++++ ....vue => EHoldingsLocalPackagesFormAdd.vue} | 16 +- ...oldingsLocalPackagesFormConfirmDelete.vue} | 12 +- .../ERM/EHoldingsLocalPackagesList.vue | 208 +++++++++ ...how.vue => EHoldingsLocalPackagesShow.vue} | 20 +- ....vue => EHoldingsLocalPackagesToolbar.vue} | 4 +- .../ERM/EHoldingsLocalResourcesShow.vue | 150 +++++++ .../ERM/EHoldingsLocalTitlePackagesList.vue | 92 ++++ ...dd.vue => EHoldingsLocalTitlesFormAdd.vue} | 24 +- ... EHoldingsLocalTitlesFormAddResources.vue} | 6 +- ...EHoldingsLocalTitlesFormConfirmDelete.vue} | 12 +- .../ERM/EHoldingsLocalTitlesList.vue | 200 +++++++++ ...sShow.vue => EHoldingsLocalTitlesShow.vue} | 19 +- ...ar.vue => EHoldingsLocalTitlesToolbar.vue} | 4 +- .../js/vue/components/ERM/EHoldingsMain.vue | 39 +- .../components/ERM/EHoldingsPackagesList.vue | 293 ------------ .../components/ERM/EHoldingsTitlesList.vue | 291 ------------ .../prog/js/vue/components/ERM/ERMMain.vue | 90 ++-- koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js | 84 ++-- .../intranet-tmpl/prog/js/vue/main-erm.ts | 7 +- koha-tmpl/intranet-tmpl/prog/js/vue/routes.js | 417 ++++++++++++------ 50 files changed, 2519 insertions(+), 1019 deletions(-) rename Koha/REST/V1/ERM/EHoldings/Packages/{Manual.pm => Local.pm} (87%) rename Koha/REST/V1/ERM/EHoldings/Resources/{Manual.pm => Local.pm} (97%) rename Koha/REST/V1/ERM/EHoldings/Titles/{Manual.pm => Local.pm} (99%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOHome.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackageAgreements.vue => EHoldingsEBSCOPackageAgreements.vue} (98%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackageTitlesList.vue => EHoldingsEBSCOPackageTitlesList.vue} (69%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesList.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsResourcesShow.vue => EHoldingsEBSCOResourcesShow.vue} (95%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlePackagesList.vue => EHoldingsEBSCOTitlePackagesList.vue} (69%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesShow.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalHome.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageAgreements.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackageTitlesList.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackagesFormAdd.vue => EHoldingsLocalPackagesFormAdd.vue} (94%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackagesFormConfirmDelete.vue => EHoldingsLocalPackagesFormConfirmDelete.vue} (86%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalPackagesList.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackagesShow.vue => EHoldingsLocalPackagesShow.vue} (87%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsPackagesToolbar.vue => EHoldingsLocalPackagesToolbar.vue} (53%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalResourcesShow.vue create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlesFormAdd.vue => EHoldingsLocalTitlesFormAdd.vue} (97%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlesFormAddResources.vue => EHoldingsLocalTitlesFormAddResources.vue} (96%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlesFormConfirmDelete.vue => EHoldingsLocalTitlesFormConfirmDelete.vue} (87%) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlesShow.vue => EHoldingsLocalTitlesShow.vue} (95%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{EHoldingsTitlesToolbar.vue => EHoldingsLocalTitlesToolbar.vue} (54%) delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesList.vue delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsTitlesList.vue diff --git a/Koha/REST/V1/ERM/EHoldings/Packages.pm b/Koha/REST/V1/ERM/EHoldings/Packages.pm index 7e7b983848..1e7fdf8b6d 100644 --- a/Koha/REST/V1/ERM/EHoldings/Packages.pm +++ b/Koha/REST/V1/ERM/EHoldings/Packages.pm @@ -22,7 +22,7 @@ use Mojo::Base 'Mojolicious::Controller'; use Scalar::Util qw( blessed ); use Try::Tiny qw( catch try ); -use Koha::REST::V1::ERM::EHoldings::Packages::Manual; +use Koha::REST::V1::ERM::EHoldings::Packages::Local; use Koha::REST::V1::ERM::EHoldings::Packages::EBSCO; =head1 API @@ -34,11 +34,13 @@ use Koha::REST::V1::ERM::EHoldings::Packages::EBSCO; =cut sub list { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Packages::EBSCO::list(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::EBSCO::list($c); } else { - return Koha::REST::V1::ERM::EHoldings::Packages::Manual::list(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::Local::list($c); } } @@ -49,11 +51,13 @@ Controller function that handles retrieving a single Koha::ERM::EHoldings::Packa =cut sub get { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Packages::EBSCO::get(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::EBSCO::get($c); } else { - return Koha::REST::V1::ERM::EHoldings::Packages::Manual::get(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::Local::get($c); } } @@ -64,11 +68,13 @@ Controller function that handles adding a new Koha::ERM::EHoldings::Package obje =cut sub add { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Packages::Manual::add(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::Local::add($c); } } @@ -79,11 +85,13 @@ Controller function that handles updating a Koha::ERM::EHoldings::Package object =cut sub update { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Packages::Manual::update(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::Local::update($c); } }; @@ -92,11 +100,13 @@ sub update { =cut sub delete { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Packages::Manual::delete(@_); + return Koha::REST::V1::ERM::EHoldings::Packages::Local::delete($c); } } diff --git a/Koha/REST/V1/ERM/EHoldings/Packages/Manual.pm b/Koha/REST/V1/ERM/EHoldings/Packages/Local.pm similarity index 87% rename from Koha/REST/V1/ERM/EHoldings/Packages/Manual.pm rename to Koha/REST/V1/ERM/EHoldings/Packages/Local.pm index 27731ae81f..7bae58f605 100644 --- a/Koha/REST/V1/ERM/EHoldings/Packages/Manual.pm +++ b/Koha/REST/V1/ERM/EHoldings/Packages/Local.pm @@ -1,4 +1,19 @@ -package Koha::REST::V1::ERM::EHoldings::Packages::Manual; +package Koha::REST::V1::ERM::EHoldings::Packages::Local; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . use Modern::Perl; @@ -9,6 +24,14 @@ use Koha::ERM::EHoldings::Packages; use Scalar::Util qw( blessed ); use Try::Tiny qw( catch try ); +=head1 API + +=head2 Methods + +=head3 list + +=cut + sub list { my $c = shift->openapi->valid_input or return; return try { @@ -21,6 +44,10 @@ sub list { }; } +=head3 get + +=cut + sub get { my $c = shift->openapi->valid_input or return; @@ -137,6 +164,7 @@ sub update { my $body = $c->validation->param('body'); my $package_agreements = delete $body->{package_agreements} // []; + use Data::Printer colored => 1; warn p $package_agreements; $package->set_from_api($body)->store; $package->package_agreements($package_agreements); diff --git a/Koha/REST/V1/ERM/EHoldings/Resources.pm b/Koha/REST/V1/ERM/EHoldings/Resources.pm index e752a21681..707b10f7a9 100644 --- a/Koha/REST/V1/ERM/EHoldings/Resources.pm +++ b/Koha/REST/V1/ERM/EHoldings/Resources.pm @@ -19,7 +19,7 @@ use Modern::Perl; use Mojo::Base 'Mojolicious::Controller'; -use Koha::REST::V1::ERM::EHoldings::Resources::Manual; +use Koha::REST::V1::ERM::EHoldings::Resources::Local; use Koha::REST::V1::ERM::EHoldings::Resources::EBSCO; use Scalar::Util qw( blessed ); @@ -34,11 +34,13 @@ use Try::Tiny qw( catch try ); =cut sub list { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Resources::EBSCO::list(@_); + return Koha::REST::V1::ERM::EHoldings::Resources::EBSCO::list($c); } else { - return Koha::REST::V1::ERM::EHoldings::Resources::Manual::list(@_); + return Koha::REST::V1::ERM::EHoldings::Resources::Local::list($c); } } @@ -49,11 +51,13 @@ Controller function that handles retrieving a single Koha::ERM::EHoldings::Resou =cut sub get { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Resources::EBSCO::get(@_); + return Koha::REST::V1::ERM::EHoldings::Resources::EBSCO::get($c); } else { - return Koha::REST::V1::ERM::EHoldings::Resources::Manual::get(@_); + return Koha::REST::V1::ERM::EHoldings::Resources::Local::get($c); } } diff --git a/Koha/REST/V1/ERM/EHoldings/Resources/Manual.pm b/Koha/REST/V1/ERM/EHoldings/Resources/Local.pm similarity index 97% rename from Koha/REST/V1/ERM/EHoldings/Resources/Manual.pm rename to Koha/REST/V1/ERM/EHoldings/Resources/Local.pm index 537e34518b..81b4a383c6 100644 --- a/Koha/REST/V1/ERM/EHoldings/Resources/Manual.pm +++ b/Koha/REST/V1/ERM/EHoldings/Resources/Local.pm @@ -1,4 +1,4 @@ -package Koha::REST::V1::ERM::EHoldings::Resources::Manual; +package Koha::REST::V1::ERM::EHoldings::Resources::Local; # This file is part of Koha. # diff --git a/Koha/REST/V1/ERM/EHoldings/Titles.pm b/Koha/REST/V1/ERM/EHoldings/Titles.pm index 6b2975fdad..d48d6155e9 100644 --- a/Koha/REST/V1/ERM/EHoldings/Titles.pm +++ b/Koha/REST/V1/ERM/EHoldings/Titles.pm @@ -22,7 +22,7 @@ use Mojo::Base 'Mojolicious::Controller'; use Scalar::Util qw( blessed ); use Try::Tiny qw( catch try ); -use Koha::REST::V1::ERM::EHoldings::Titles::Manual; +use Koha::REST::V1::ERM::EHoldings::Titles::Local; use Koha::REST::V1::ERM::EHoldings::Titles::EBSCO; =head1 API @@ -34,11 +34,13 @@ use Koha::REST::V1::ERM::EHoldings::Titles::EBSCO; =cut sub list { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Titles::EBSCO::list(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::EBSCO::list($c); } else { - return Koha::REST::V1::ERM::EHoldings::Titles::Manual::list(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::Local::list($c); } } @@ -49,11 +51,13 @@ Controller function that handles retrieving a single Koha::ERM::EHoldings::Packa =cut sub get { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { - return Koha::REST::V1::ERM::EHoldings::Titles::EBSCO::get(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::EBSCO::get($c); } else { - return Koha::REST::V1::ERM::EHoldings::Titles::Manual::get(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::Local::get($c); } } @@ -64,11 +68,13 @@ Controller function that handles adding a new Koha::ERM::EHoldings::Title object =cut sub add{ - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Titles::Manual::add(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::Local::add($c); } } @@ -80,11 +86,13 @@ Controller function that handles updating a Koha::ERM::EHoldings::Title object =cut sub update { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Titles::Manual::update(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::Local::update($c); } } @@ -93,12 +101,14 @@ sub update { =cut sub delete { - my $provider = C4::Context->preference('ERMProvider'); + my $c = shift->openapi->valid_input or return; + + my $provider = $c->validation->param('provider'); if ( $provider eq 'ebsco' ) { die "invalid action"; } else { - return Koha::REST::V1::ERM::EHoldings::Titles::Manual::delete(@_); + return Koha::REST::V1::ERM::EHoldings::Titles::Local::delete($c); } -}; +} 1; diff --git a/Koha/REST/V1/ERM/EHoldings/Titles/Manual.pm b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm similarity index 99% rename from Koha/REST/V1/ERM/EHoldings/Titles/Manual.pm rename to Koha/REST/V1/ERM/EHoldings/Titles/Local.pm index 4564d2d976..51e6307d1a 100644 --- a/Koha/REST/V1/ERM/EHoldings/Titles/Manual.pm +++ b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm @@ -1,4 +1,4 @@ -package Koha::REST::V1::ERM::EHoldings::Titles::Manual; +package Koha::REST::V1::ERM::EHoldings::Titles::Local; # This file is part of Koha. # diff --git a/api/v1/swagger/paths/erm_eholdings_packages.yaml b/api/v1/swagger/paths/erm_eholdings_packages.yaml index 71078f4dac..2cefd89fa2 100644 --- a/api/v1/swagger/paths/erm_eholdings_packages.yaml +++ b/api/v1/swagger/paths/erm_eholdings_packages.yaml @@ -1,5 +1,5 @@ --- -/erm/eholdings/packages: +/erm/eholdings/{provider}/packages: get: x-mojo-to: ERM::EHoldings::Packages#list operationId: listErmEHoldingsPackages @@ -9,6 +9,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - description: Case insensitive search on package package_id in: query name: package_id @@ -138,7 +143,7 @@ x-koha-authorization: permissions: erm: 1 -"/erm/eholdings/packages/{package_id}": +"/erm/eholdings/{provider}/packages/{package_id}": get: x-mojo-to: ERM::EHoldings::Packages#get operationId: getErmEHoldingsPackages @@ -148,6 +153,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - $ref: "../swagger.yaml#/parameters/eholdings_package_id_pp" responses: 200: diff --git a/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml b/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml index f9483887ce..071b07eab0 100644 --- a/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_packages_resources.yaml @@ -1,5 +1,5 @@ --- -/erm/eholdings/packages/{package_id}/resources: +/erm/eholdings/{provider}/packages/{package_id}/resources: get: x-mojo-to: ERM::EHoldings::Resources#list operationId: listErmEHoldingsPackagesResources @@ -9,6 +9,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - description: Case insensitive search on resource_id in: query name: resource_id diff --git a/api/v1/swagger/paths/erm_eholdings_resources.yaml b/api/v1/swagger/paths/erm_eholdings_resources.yaml index 3d8ac9a91c..1d299f9f12 100644 --- a/api/v1/swagger/paths/erm_eholdings_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_resources.yaml @@ -1,5 +1,5 @@ --- -/erm/eholdings/resources: +/erm/eholdings/{provider}/resources: get: x-mojo-to: ERM::EHoldings::Resources#list operationId: listErmEHoldingsResources @@ -9,6 +9,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - description: Case insensitive search on resource_id in: query name: resource_id @@ -74,7 +79,7 @@ x-koha-authorization: permissions: erm: 1 -"/erm/eholdings/resources/{resource_id}": +"/erm/eholdings/{provider}/resources/{resource_id}": get: x-mojo-to: ERM::EHoldings::Resources#get operationId: getErmEHoldingsResources @@ -84,6 +89,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - $ref: "../swagger.yaml#/parameters/eholdings_resource_id_pp" responses: 200: diff --git a/api/v1/swagger/paths/erm_eholdings_titles.yaml b/api/v1/swagger/paths/erm_eholdings_titles.yaml index a5df76c3e7..56344f6831 100644 --- a/api/v1/swagger/paths/erm_eholdings_titles.yaml +++ b/api/v1/swagger/paths/erm_eholdings_titles.yaml @@ -1,5 +1,5 @@ --- -/erm/eholdings/titles: +/erm/eholdings/{provider}/titles: get: x-mojo-to: ERM::EHoldings::Titles#list operationId: listErmEHoldingsTitles @@ -9,6 +9,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - description: Case insensitive search on title title_id in: query name: title_id @@ -230,7 +235,7 @@ x-koha-authorization: permissions: erm: 1 -"/erm/eholdings/titles/{title_id}": +"/erm/eholdings/{provider}/titles/{title_id}": get: x-mojo-to: ERM::EHoldings::Titles#get operationId: getErmEHoldingsTitles @@ -240,6 +245,11 @@ produces: - application/json parameters: + - description: Provider name + in: path + name: provider + required: true + type: string - $ref: "../swagger.yaml#/parameters/eholdings_title_id_pp" responses: 200: diff --git a/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml b/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml index 645dd5275c..af8652a208 100644 --- a/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml +++ b/api/v1/swagger/paths/erm_eholdings_titles_resources.yaml @@ -1,5 +1,5 @@ --- -/erm/eholdings/titles/{title_id}/resources: +/erm/eholdings/{provider}/titles/{title_id}/resources: get: x-mojo-to: ERM::EHoldings::Resources#list operationId: listErmEHoldingsTitlesResources diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index 9aae93ab0d..34873839dd 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -171,22 +171,22 @@ paths: $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements "/erm/agreements/{agreement_id}": $ref: "./paths/erm_agreements.yaml#/~1erm~1agreements~1{agreement_id}" - /erm/eholdings/titles: - $ref: ./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1titles - "/erm/eholdings/titles/{title_id}": - $ref: "./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1titles~1{title_id}" - "/erm/eholdings/titles/{title_id}/resources": - $ref: "./paths/erm_eholdings_titles_resources.yaml#/~1erm~1eholdings~1titles~1{title_id}~1resources" - /erm/eholdings/packages: - $ref: ./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1packages - /erm/eholdings/resources: - $ref: ./paths/erm_eholdings_resources.yaml#/~1erm~1eholdings~1resources - "/erm/eholdings/resources/{resource_id}": - $ref: "./paths/erm_eholdings_resources.yaml#/~1erm~1eholdings~1resources~1{resource_id}" - "/erm/eholdings/packages/{package_id}": - $ref: "./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1packages~1{package_id}" - "/erm/eholdings/packages/{package_id}/resources": - $ref: "./paths/erm_eholdings_packages_resources.yaml#/~1erm~1eholdings~1packages~1{package_id}~1resources" + "/erm/eholdings/{provider}/titles": + $ref: ./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1{provider}~1titles + "/erm/eholdings/{provider}/titles/{title_id}": + $ref: "./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1{provider}~1titles~1{title_id}" + "/erm/eholdings/{provider}/titles/{title_id}/resources": + $ref: "./paths/erm_eholdings_titles_resources.yaml#/~1erm~1eholdings~1{provider}~1titles~1{title_id}~1resources" + "/erm/eholdings/{provider}/packages": + $ref: "./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1{provider}~1packages" + "/erm/eholdings/{provider}/resources": + $ref: "./paths/erm_eholdings_resources.yaml#/~1erm~1eholdings~1{provider}~1resources" + "/erm/eholdings/{provider}/resources/{resource_id}": + $ref: "./paths/erm_eholdings_resources.yaml#/~1erm~1eholdings~1{provider}~1resources~1{resource_id}" + "/erm/eholdings/{provider}/packages/{package_id}": + $ref: "./paths/erm_eholdings_packages.yaml#/~1erm~1eholdings~1{provider}~1packages~1{package_id}" + "/erm/eholdings/{provider}/packages/{package_id}/resources": + $ref: "./paths/erm_eholdings_packages_resources.yaml#/~1erm~1eholdings~1{provider}~1packages~1{package_id}~1resources" /erm/licenses: $ref: ./paths/erm_licenses.yaml#/~1erm~1licenses "/erm/licenses/{license_id}": diff --git a/cypress/integration/Packages_spec.ts b/cypress/integration/Packages_spec.ts index 4cb17d0569..9bce51f4a8 100644 --- a/cypress/integration/Packages_spec.ts +++ b/cypress/integration/Packages_spec.ts @@ -20,7 +20,7 @@ describe("Package CRUD operations", () => { it("List package", () => { // GET package returns 500 - cy.intercept("GET", "/api/v1/erm/eholdings/packages", { + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages", { statusCode: 500, error: "Something went wrong", }); @@ -31,15 +31,15 @@ describe("Package CRUD operations", () => { ); // GET packages returns empty list - cy.intercept("GET", "/api/v1/erm/eholdings/packages*", []); - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", []); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); cy.get("#packages_list").contains("There are no packages defined."); // GET packages returns something let erm_package = get_package(); let packages = [erm_package]; - cy.intercept("GET", "/api/v1/erm/eholdings/packages*", { + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { statusCode: 200, body: packages, headers: { @@ -47,14 +47,14 @@ describe("Package CRUD operations", () => { "X-Total-Count": "1", }, }); - cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package); - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages/*", erm_package); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); cy.get("#packages_list").contains("Showing 1 to 1 of 1 entries"); }); it("Add package", () => { // Click the button in the toolbar - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); cy.contains("New package").click(); cy.get("#packages_add h2").contains("New package"); @@ -71,7 +71,7 @@ describe("Package CRUD operations", () => { cy.get("#package_content_type").select(erm_package.content_type); // Submit the form, get 500 - cy.intercept("POST", "/api/v1/erm/eholdings/packages", { + cy.intercept("POST", "/api/v1/erm/eholdings/local/packages", { statusCode: 500, error: "Something went wrong", }); @@ -81,7 +81,7 @@ describe("Package CRUD operations", () => { ); // Submit the form, success! - cy.intercept("POST", "/api/v1/erm/eholdings/packages", { + cy.intercept("POST", "/api/v1/erm/eholdings/local/packages", { statusCode: 201, body: erm_package, }); @@ -95,7 +95,7 @@ describe("Package CRUD operations", () => { let erm_package = get_package(); let packages = [erm_package]; // Click the 'Edit' button from the list - cy.intercept("GET", "/api/v1/erm/eholdings/packages*", { + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { statusCode: 200, body: packages, headers: { @@ -103,10 +103,10 @@ describe("Package CRUD operations", () => { "X-Total-Count": "1", }, }); - cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package).as( + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages/*", erm_package).as( "get-package" ); - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); cy.get("#packages_list table tbody tr:first") .contains("Edit") .click(); @@ -120,7 +120,7 @@ describe("Package CRUD operations", () => { cy.get("#package_content_type").should("have.value", erm_package.content_type); // Submit the form, get 500 - cy.intercept("PUT", "/api/v1/erm/eholdings/packages/*", { + cy.intercept("PUT", "/api/v1/erm/eholdings/local/packages/*", { statusCode: 500, error: "Something went wrong", }); @@ -130,7 +130,7 @@ describe("Package CRUD operations", () => { ); // Submit the form, success! - cy.intercept("PUT", "/api/v1/erm/eholdings/packages/*", { + cy.intercept("PUT", "/api/v1/erm/eholdings/local/packages/*", { statusCode: 200, body: erm_package, }); @@ -144,7 +144,7 @@ describe("Package CRUD operations", () => { let erm_package = get_package(); let packages = [erm_package]; // Click the "name" link from the list - cy.intercept("GET", "/api/v1/erm/eholdings/packages*", { + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { statusCode: 200, body: packages, headers: { @@ -152,10 +152,10 @@ describe("Package CRUD operations", () => { "X-Total-Count": "1", }, }); - cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package).as( + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages/*", erm_package).as( "get-package" ); - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); let name_link = cy.get( "#packages_list table tbody tr:first td:first a" ); @@ -176,7 +176,7 @@ describe("Package CRUD operations", () => { let packages = [erm_package]; // Click the 'Delete' button from the list - cy.intercept("GET", "/api/v1/erm/eholdings/packages*", { + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { statusCode: 200, body: packages, headers: { @@ -184,8 +184,8 @@ describe("Package CRUD operations", () => { "X-Total-Count": "1", }, }); - cy.intercept("GET", "/api/v1/erm/eholdings/packages/*", erm_package); - cy.visit("/cgi-bin/koha/erm/eholdings/packages"); + cy.intercept("GET", "/api/v1/erm/eholdings/local/packages/*", erm_package); + cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); cy.get("#packages_list table tbody tr:first") .contains("Delete") @@ -194,7 +194,7 @@ describe("Package CRUD operations", () => { cy.contains("Package name: " + erm_package.name); // Submit the form, get 500 - cy.intercept("DELETE", "/api/v1/erm/eholdings/packages/*", { + cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", { statusCode: 500, error: "Something went wrong", }); @@ -204,7 +204,7 @@ describe("Package CRUD operations", () => { ); // Submit the form, success! - cy.intercept("DELETE", "/api/v1/erm/eholdings/packages/*", { + cy.intercept("DELETE", "/api/v1/erm/eholdings/local/packages/*", { statusCode: 204, body: null, }); diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl index 7363647269..e9bf90a1f2 100755 --- a/installer/data/mysql/atomicupdate/erm.pl +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -313,7 +313,7 @@ return { $dbh->do(q{ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) - VALUES ('ERMProvider', 'manual', 'manual|ebsco', 'Set the provider for the ERM module', 'Choice'); + VALUES ('ERMProviders', 'local', 'local|ebsco', 'Set the providers for the ERM module', 'multiple'); }); $dbh->do(q{ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index d908408e62..2f9c81567b 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -222,7 +222,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), ('ERMModule', '0', NULL, 'Enable the E-Resource management module', 'YesNo'), -('ERMProvider', 'manual', 'manual|ebsco', 'Set the provider for the ERM module', 'Choice'), +('ERMProviders', 'local', 'local|ebsco', 'Set the providers for the ERM module', 'Choice'), ('ERMProviderEbscoApiKey', '', '', 'API key for EBSCO', 'free'), ('ERMProviderEbscoCustomerID', '', '', 'Customer ID for EBSCO', 'free'), ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/erm-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/erm-search.inc index 35778ba6eb..31fe999a99 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/erm-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/erm-search.inc @@ -11,7 +11,7 @@