From 03d23be15db8955df0518567493eb4762e7c8ee4 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 28 Oct 2022 22:14:16 +0000 Subject: [PATCH] Bug 32030: Add users to licenses - Preparation Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/ERM/Agreement.pm | 8 ++++---- Koha/ERM/{Agreement => }/UserRole.pm | 6 +++--- Koha/ERM/{Agreement => }/UserRoles.pm | 10 +++++----- .../prog/en/modules/admin/authorised_values.tt | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt | 2 +- .../js/vue/components/ERM/AgreementsFormAdd.vue | 13 +++++++------ .../prog/js/vue/components/ERM/AgreementsShow.vue | 2 +- .../prog/js/vue/components/ERM/ERMMain.vue | 2 +- .../ERM/{AgreementUserRoles.vue => UserRoles.vue} | 11 ++++++----- koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js | 2 +- .../prog/js/vue/stores/authorised_values.js | 2 +- t/db_dependent/Koha/ERM/Agreements.t | 5 +++-- 12 files changed, 34 insertions(+), 31 deletions(-) rename Koha/ERM/{Agreement => }/UserRole.pm (87%) rename Koha/ERM/{Agreement => }/UserRoles.pm (78%) rename koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/{AgreementUserRoles.vue => UserRoles.vue} (94%) diff --git a/Koha/ERM/Agreement.pm b/Koha/ERM/Agreement.pm index b2ab338d87..dac3e56c9e 100644 --- a/Koha/ERM/Agreement.pm +++ b/Koha/ERM/Agreement.pm @@ -28,9 +28,9 @@ use Koha::Acquisition::Bookseller; use base qw(Koha::Object); use Koha::ERM::Agreement::Periods; -use Koha::ERM::Agreement::UserRoles; use Koha::ERM::Agreement::Licenses; use Koha::ERM::Agreement::Relationships; +use Koha::ERM::UserRoles; use Koha::ERM::Documents; use Koha::ERM::EHoldings::Package::Agreements; @@ -86,13 +86,13 @@ sub user_roles { $self->user_roles->delete; for my $user_role (@$user_roles) { - $self->_result->add_to_erm_agreement_user_roles($user_role); + $self->_result->add_to_erm_user_roles($user_role); } } ); } - my $user_roles_rs = $self->_result->erm_agreement_user_roles; - return Koha::ERM::Agreement::UserRoles->_new_from_dbic($user_roles_rs); + my $user_roles_rs = $self->_result->erm_user_roles; + return Koha::ERM::UserRoles->_new_from_dbic($user_roles_rs); } =head3 agreement_licenses diff --git a/Koha/ERM/Agreement/UserRole.pm b/Koha/ERM/UserRole.pm similarity index 87% rename from Koha/ERM/Agreement/UserRole.pm rename to Koha/ERM/UserRole.pm index 9e749ac123..d0e6a72cec 100644 --- a/Koha/ERM/Agreement/UserRole.pm +++ b/Koha/ERM/UserRole.pm @@ -1,4 +1,4 @@ -package Koha::ERM::Agreement::UserRole; +package Koha::ERM::UserRole; # This file is part of Koha. # @@ -25,7 +25,7 @@ use base qw(Koha::Object); =head1 NAME -Koha::ERM::Agreement::UserRole - Koha Agreement UserRole Object class +Koha::ERM::UserRole - Koha ERM UserRole Object class =head1 API @@ -52,7 +52,7 @@ sub patron { =cut sub _type { - return 'ErmAgreementUserRole'; + return 'ErmUserRole'; } 1; diff --git a/Koha/ERM/Agreement/UserRoles.pm b/Koha/ERM/UserRoles.pm similarity index 78% rename from Koha/ERM/Agreement/UserRoles.pm rename to Koha/ERM/UserRoles.pm index f200f25834..d4153dbec4 100644 --- a/Koha/ERM/Agreement/UserRoles.pm +++ b/Koha/ERM/UserRoles.pm @@ -1,4 +1,4 @@ -package Koha::ERM::Agreement::UserRoles; +package Koha::ERM::UserRoles; # This file is part of Koha. # @@ -20,13 +20,13 @@ use Modern::Perl; use Koha::Database; -use Koha::ERM::Agreement::UserRole; +use Koha::ERM::UserRole; use base qw(Koha::Objects); =head1 NAME -Koha::ERM::Agreement::UserRoles- Koha Agreement UserRole Object set class +Koha::ERM::UserRoles- Koha ERM UserRole Object set class =head1 API @@ -39,7 +39,7 @@ Koha::ERM::Agreement::UserRoles- Koha Agreement UserRole Object set class =cut sub _type { - return 'ErmAgreementUserRole'; + return 'ErmUserRole'; } =head3 object_class @@ -47,7 +47,7 @@ sub _type { =cut sub object_class { - return 'Koha::ERM::Agreement::UserRole'; + return 'Koha::ERM::UserRole'; } 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 03d87a403b..689730d7d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -511,7 +511,7 @@

Renewal priorities of agreements (E-Resource management module)

[% CASE 'ERM_AGREEMENT_STATUS' %]

Statuses of agreements (E-Resource management module)

- [% CASE 'ERM_AGREEMENT_USER_ROLES' %] + [% CASE 'ERM_USER_ROLES' %]

Roles for users (E-Resource management module)

[% CASE 'ERM_LICENSE_STATUS' %]

Statuses of the licenses (E-Resource management module)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt index 70defb8bfe..80ea9ab507 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/erm/erm.tt @@ -33,7 +33,7 @@ const agreement_closure_reasons = [% To.json(AuthorisedValues.Get('ERM_AGREEMENT_CLOSURE_REASON')) | $raw %]; const agreement_renewal_priorities = [% To.json(AuthorisedValues.Get('ERM_AGREEMENT_RENEWAL_PRIORITY')) | $raw %]; - const agreement_user_roles = [% To.json(AuthorisedValues.Get('ERM_AGREEMENT_USER_ROLES')) | $raw %]; + const user_roles = [% To.json(AuthorisedValues.Get('ERM_USER_ROLES')) | $raw %]; const license_types = [% To.json(AuthorisedValues.Get('ERM_LICENSE_TYPE')) | $raw %]; const license_statuses = [% To.json(AuthorisedValues.Get('ERM_LICENSE_STATUS')) | $raw %]; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue index 91d467a380..1d50636002 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue @@ -148,9 +148,10 @@ - import { inject } from "vue" import AgreementPeriods from "./AgreementPeriods.vue" -import AgreementUserRoles from "./AgreementUserRoles.vue" +import UserRoles from "./UserRoles.vue" import AgreementLicenses from "./AgreementLicenses.vue" import AgreementRelationships from "./AgreementRelationships.vue" import Documents from "./Documents.vue" @@ -202,7 +203,7 @@ export default { av_agreement_statuses, av_agreement_closure_reasons, av_agreement_renewal_priorities, - av_agreement_user_roles, + av_user_roles, av_agreement_license_statuses, av_agreement_license_location, av_agreement_relationships, @@ -213,7 +214,7 @@ export default { av_agreement_statuses, av_agreement_closure_reasons, av_agreement_renewal_priorities, - av_agreement_user_roles, + av_user_roles, av_agreement_license_statuses, av_agreement_license_location, av_agreement_relationships, @@ -406,7 +407,7 @@ export default { }, components: { AgreementPeriods, - AgreementUserRoles, + UserRoles, AgreementLicenses, AgreementRelationships, Documents, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue index ee8d4337ae..df8afa093f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue @@ -130,7 +130,7 @@ {{ get_lib_from_av( - "av_agreement_user_roles", + "av_user_roles", role.role ) }} diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/ERMMain.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/ERMMain.vue index 65b7c9f5c6..ea0bf54daf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/ERMMain.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/ERMMain.vue @@ -131,7 +131,7 @@ export default { AVStore.av_agreement_statuses = agreement_statuses AVStore.av_agreement_closure_reasons = agreement_closure_reasons AVStore.av_agreement_renewal_priorities = agreement_renewal_priorities - AVStore.av_agreement_user_roles = agreement_user_roles + AVStore.av_user_roles = user_roles AVStore.av_license_types = license_types AVStore.av_license_statuses = license_statuses AVStore.av_agreement_license_statuses = agreement_license_statuses diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementUserRoles.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue similarity index 94% rename from koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementUserRoles.vue rename to koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue index 0cc8412be0..c5c8e430af 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementUserRoles.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UserRoles.vue @@ -1,5 +1,5 @@