From 71d7abf10c2bf89e179fd64efcc6b8a936e0f219 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Mar 2023 14:55:53 +0100 Subject: [PATCH] Bug 33106: Add vendor link to ERM licenses This patch adds a "Licenses" link in the acquisition module to link to the licenses defined in the ERM module. Test plan: - Create a vendor - Create some licenses in the ERM module, add some to the vendor previously created - Go to the detail page of the vendor in the acquisition module => Notice the new "Licenses" tab on the side bar => Notice that this tab does not appear if you do not have the permission to see licenses - Click on the new tab => Notice that you are redirected to the license list view, in the ERM module, with an automatic filter on the vendor Signed-off-by: Jonathan Field --- .../prog/en/includes/vendor-menu.inc | 5 +++++ .../prog/js/vue/components/ERM/LicensesList.vue | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc index 3fc669e840b..394bf6c6dea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc @@ -1,3 +1,4 @@ +[% USE Koha %] [% IF ( booksellerid ) %] [% END %] 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 3cb678f9a92..fe757b88388 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 @@ -45,6 +45,9 @@ export default { return { license_count: 0, initialized: false, + column_filters: { + vendor_id: this.$route.query.vendor_id || null, + }, } }, beforeRouteEnter(to, from, next) { @@ -122,7 +125,7 @@ export default { window[av_cat] = map_av_dt_filter(av_cat) }) - $("#" + table_id).kohaTable( + let table = $("#" + table_id).kohaTable( { ajax: { url: "/api/v1/erm/licenses", @@ -140,6 +143,7 @@ export default { }, }, ], + iDeferLoading: true, columns: [ { title: __("Name"), @@ -324,6 +328,15 @@ export default { license_table_settings, 1 ) + + let table_dt = table.DataTable() + if (this.column_filters.vendor_id) { + table + .find('thead tr:eq(1) th[data-filter="vendors"] select') + .val(this.column_filters.vendor_id) + table_dt.column(1).search(this.column_filters.vendor_id) + } + table_dt.draw() }, }, props: { -- 2.25.1