From 148f7471845a0109cbd9e33a0427809f161359c0 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 --- acqui/vendors.pl | 3 ++- .../prog/en/modules/acqui/vendors.tt | 1 + .../js/vue/components/ERM/AgreementsList.vue | 7 ++++++ .../js/vue/components/ERM/LicensesFormAdd.vue | 4 ++-- .../js/vue/components/ERM/LicensesList.vue | 11 ++++++++- .../js/vue/components/Islands/VendorMenu.vue | 24 +++++++++++++++++++ .../prog/js/vue/components/Vendors/Main.vue | 1 + 7 files changed, 47 insertions(+), 4 deletions(-) diff --git a/acqui/vendors.pl b/acqui/vendors.pl index a160284308c..b9d2628e805 100755 --- a/acqui/vendors.pl +++ b/acqui/vendors.pl @@ -48,7 +48,8 @@ $template->param( user_permissions => $user_permissions, currencies => Koha::Acquisition::Currencies->search->unblessed, gst_values => \@gst_values, - edifact => C4::Context->preference('EDIFACT') + edifact => C4::Context->preference('EDIFACT'), + erm_module => C4::Context->preference('ERMModule') ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/vendors.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/vendors.tt index f71b42881f5..17d350e1a97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/vendors.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/vendors.tt @@ -33,6 +33,7 @@ const currencies = [% To.json(currencies) | $raw %]; const gstValues = [% To.json(gst_values) | $raw %]; const edifact = [% To.json(edifact) | $raw %]; + const ermModule = [% To.json(erm_module) | $raw %]; 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 5484c76d24b..656057276aa 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 @@ -234,6 +234,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/LicensesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue index e0e8348142f..c60a15ebc34 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/LicensesFormAdd.vue @@ -152,12 +152,12 @@ import { storeToRefs } from "pinia" export default { setup() { const AVStore = inject("AVStore") - const { av_license_types, av_license_statuses, av_user_roles } = + const { av_license_statuses, av_license_types, av_user_roles } = storeToRefs(AVStore) return { - av_license_types, av_license_statuses, + av_license_types, av_user_roles, max_allowed_packet, } 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 42fbd52d8ad..47fe36b95a4 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 @@ -69,7 +69,7 @@ export default { searchable_av_options: [], tableOptions: { columns: this.getTableColumns(), - url: this.getResourceTableUrl(), + url: this.tableURL(), options: { embed: "vendor,extended_attributes,+strings" }, table_settings: this.license_table_settings, add_filters: true, @@ -113,6 +113,15 @@ export default { error => {} ) }, + tableURL() { + let url = this.getResourceTableUrl() + + 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 442723ee39c..254ce58c966 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 @@ -68,6 +68,17 @@ >{{ $__("Uncertain prices") }} +
  • + {{ $__("ERM agreements") }} +
  • +
  • + {{ + $__("ERM licenses") + }} +
  • @@ -96,22 +107,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 vendorStore = inject("vendorStore") + const { config } = storeToRefs(vendorStore) return { isUserPermitted, params, + config, } }, data() { const vendorId = this.vendorid ? this.vendorid : this.params.id + const ermModule = this.ermmodule + ? this.ermmodule + : this.config.settings.ermModule return { vendorId, + ermModule, } }, } 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 e78555857c3..323e0d8d4c8 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 @@ -99,6 +99,7 @@ export default { this.loaded() this.userPermissions = userPermissions this.config.settings.edifact = edifact + this.config.settings.ermModule = ermModule this.vendorStore.currencies = currencies this.vendorStore.gstValues = gstValues.map(gv => { return { -- 2.39.5 (Apple Git-154)