From cf5e38ac29eca84be740d94c9d0f22815475f119 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 18 Oct 2024 14:18:23 +0000 Subject: [PATCH] Bug 38208: Provide a link from vendors to ERM This patch provides a link in the left hand menu so that from a vendor record you can access ERM agreements and licenses relevant to that vendor Test plan: 1) Apply patch and reset_all 2) Navigate to ERM and create some agreements and licenses that link to a vendor and some that don't 3) Navigate to a vendor record 4) There should be links in the left hand menu for agreements and licenses 5) Click on these and you should be taken to ERM and see a filtered table based on that vendor Signed-off-by: Roman Dolny --- Koha/REST/V1/Acquisitions/Vendors.pm | 1 + .../swagger/definitions/vendors_config.yaml | 3 ++ .../js/vue/components/ERM/AgreementsList.vue | 7 ++++ .../js/vue/components/ERM/LicensesList.vue | 11 ++++++- .../js/vue/components/Islands/VendorMenu.vue | 32 ++++++++++++++++--- .../prog/js/vue/components/Vendors/Main.vue | 1 + 6 files changed, 50 insertions(+), 5 deletions(-) diff --git a/Koha/REST/V1/Acquisitions/Vendors.pm b/Koha/REST/V1/Acquisitions/Vendors.pm index d17f6e1952..2852bd250a 100644 --- a/Koha/REST/V1/Acquisitions/Vendors.pm +++ b/Koha/REST/V1/Acquisitions/Vendors.pm @@ -216,6 +216,7 @@ sub config { gst_values => \@gst_values, edifact => C4::Context->preference('EDIFACT'), marc_orders => C4::Context->preference('MarcOrderingAutomation'), + erm_module => C4::Context->preference('ERMModule'), }, ); } diff --git a/api/v1/swagger/definitions/vendors_config.yaml b/api/v1/swagger/definitions/vendors_config.yaml index 7e7819a95e..776b346a82 100644 --- a/api/v1/swagger/definitions/vendors_config.yaml +++ b/api/v1/swagger/definitions/vendors_config.yaml @@ -16,4 +16,7 @@ properties: marc_orders: type: boolean description: MarcOrderingAutomation system preference value + erm_module: + type: boolean + description: ERMModule system preference value additionalProperties: false diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue index 8e0989f35d..f57a1abf78 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue @@ -274,6 +274,13 @@ export default { if (this.filters.by_expired) url += "?max_expiration_date=" + this.filters.max_expiration_date; + + const vendorId = this.$route.query.vendor_id + if (vendorId) { + url = this.filters.by_expired + ? url + "&vendor_id=" + vendorId + : url + "?vendor_id=" + vendorId + } return url; }, filter_table: async function () { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue index 7e5409856d..e74d4f9885 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesList.vue @@ -70,7 +70,7 @@ export default { searchable_av_options: [], tableOptions: { columns: this.getTableColumns(), - url: "/api/v1/erm/licenses", + url: this.tableURL(), options: { embed: "vendor,extended_attributes,+strings" }, table_settings: this.license_table_settings, add_filters: true, @@ -114,6 +114,15 @@ export default { error => {} ); }, + tableURL() { + let url = "/api/v1/erm/licenses"; + + const vendorId = this.$route.query.vendor_id + if (vendorId) { + url += "?vendor_id=" + vendorId + } + return url + }, async getSearchableAdditionalFields() { const client = APIClient.additional_fields; await client.additional_fields.getAll("license").then( diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue index 7a253b5afb..aa6b60b53a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue @@ -75,6 +75,17 @@ >{{ $__("Uncertain prices") }} +
  • + {{ $__("ERM agreements") }} +
  • +
  • + {{ + $__("ERM licenses") + }} +
  • @@ -103,22 +114,35 @@ export default { issuemanage: { type: String, }, + ermmodule: { + type: String, + }, + erm: { + type: String, + }, }, setup() { - const permissionsStore = inject("permissionsStore"); - const { isUserPermitted } = permissionsStore; - const navigationStore = inject("navigationStore"); - const { params } = storeToRefs(navigationStore); + const permissionsStore = inject("permissionsStore") + const { isUserPermitted } = permissionsStore + const navigationStore = inject("navigationStore") + const { params } = storeToRefs(navigationStore) + const vendorStore = inject("vendorStore") + const { config } = storeToRefs(vendorStore) return { isUserPermitted, params, + config, }; }, data() { const vendorId = this.vendorid || this.params.id; + const ermModule = this.ermmodule + ? this.ermmodule + : this.config.settings.ermModule return { vendorId, + ermModule, }; }, mounted() { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue index b41b27f46f..e3b36a641a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/Main.vue @@ -66,6 +66,7 @@ export default { client.config.get("vendors").then(config => { this.userPermissions = config.permissions; this.config.settings.edifact = config.edifact; + this.config.settings.ermModule = config.erm_module; this.config.settings.marcOrderAutomation = config.marcOrderAutomation; this.vendorStore.currencies = config.currencies; -- 2.39.5