From f3e58dd18a35695e17e0d992c879bfaf045ce3ce 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 63c8d22f671..fab0764dcb1 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.vendor_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 960ca63ee23..620d679bade 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 @@ -97,6 +97,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.3 (Apple Git-146)