From 93db893bc4eb1324ee96b48ed305a1da688621b4 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 Signed-off-by: Laura_Escamilla --- Koha/REST/V1/Acquisitions/Vendors.pm | 1 + .../swagger/definitions/vendors_config.yaml | 3 +++ .../vue/components/ERM/AgreementResource.vue | 6 +++++ .../js/vue/components/ERM/LicenseResource.vue | 11 ++++++++- .../js/vue/components/Islands/VendorMenu.vue | 24 ++++++++++++++++++- .../prog/js/vue/components/Vendors/Main.vue | 1 + 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Koha/REST/V1/Acquisitions/Vendors.pm b/Koha/REST/V1/Acquisitions/Vendors.pm index e0ec5c8fe90..8196bafc30a 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 7e7819a95e1..776b346a82d 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/AgreementResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue index e3b26a33094..a1075e8a866 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementResource.vue @@ -831,6 +831,12 @@ export default { let url = baseResource.getResourceTableUrl(); if (filters?.by_expired) url += "?max_expiration_date=" + filters.max_expiration_date; + const vendorId = baseResource.route.query.vendor_id; + if (vendorId) { + url = filters?.by_expired + ? url + "&vendor_id=" + vendorId + : url + "?vendor_id=" + vendorId; + } return url; }; const filterTable = async (filters, table, embedded = false) => { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue index f21b4523aec..34396cd13f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicenseResource.vue @@ -288,9 +288,18 @@ export default { }, ], }); + const tableURL = () => { + let url = baseResource.getResourceTableUrl(); + + const vendorId = baseResource.route.query.vendor_id; + if (vendorId) { + url += "?vendor_id=" + vendorId; + } + return url; + }; const tableOptions = { - url: baseResource.getResourceTableUrl(), + url: tableURL(), options: { embed: "vendor,extended_attributes,+strings" }, table_settings: license_table_settings, add_filters: true, 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 73b6bb4d76e..b2db2a84fea 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,14 +114,23 @@ export default { issuemanage: { type: String, }, + ermmodule: { + type: String, + }, + erm: { + type: String, + }, }, setup(props) { const vendorStore = inject("vendorStore"); - const { isUserPermitted } = vendorStore; + const { isUserPermitted, config } = vendorStore; const navigationStore = inject("navigationStore"); const { params } = storeToRefs(navigationStore); const vendorId = ref(props.vendorid || params.value.id); + const ermModule = props.ermmodule + ? props.ermmodule + : config.settings.ermModule; const templateRefs = ref([]); onMounted(() => { @@ -123,6 +143,8 @@ export default { return { isUserPermitted, params, + config, + ermModule, vendorId, templateRefs, }; 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 647cf6bce25..796b521d555 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 @@ -55,6 +55,7 @@ export default { client.config.get("vendors").then(result => { userPermissions.value = result.permissions; config.value.settings.edifact = result.edifact; + config.value.settings.ermModule = result.erm_module; config.value.settings.marcOrderAutomation = result.marcOrderAutomation; vendorStore.currencies = result.currencies; -- 2.50.1