From 1ad9959fa588cc15de5dbdba9d0a5533c53a6a0d Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 3 Aug 2023 16:45:41 +0000 Subject: [PATCH] Bug 34587: Make column options dependent on data_type In the reports builder you can select which columns you would like to display in a report. Not all columns are applicable to all data types so it needs limiting to only be selectable if that column is available for that data type Signed-off-by: Jessica Zairo Signed-off-by: Michaela Sieber Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../ERM/UsageStatisticsReportBuilder.vue | 23 ++++++++++-- .../prog/js/vue/stores/usage-reports.js | 35 ++++++++++++++----- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue index f8fbfd66b0..af9366946f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue @@ -204,17 +204,20 @@ class="checkbox_options" > - @@ -788,6 +791,20 @@ export default { return single_report_types.includes(report_type) }) + // Unselect any additional columns that aren't applicable to this data_type + const title_properties = Object.keys( + this.title_property_column_options + ) + title_properties.shift() // Remove the first column as this is a default + title_properties.forEach(prop => { + if ( + !this.title_property_column_options[ + prop + ].used_by.includes(this.data_type) + ) { + this.title_property_column_options[prop].active = false + } + }) } else { this.metric_types_options = [] this.query.metric_types = null diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/usage-reports.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/usage-reports.js index 4942ccb10a..d0fde5a64b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/usage-reports.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/usage-reports.js @@ -22,6 +22,7 @@ export const useReportsStore = defineStore('reports', { id: 1, name: "Provider name", active: true, + used_by: ["title", "item", "database", 'platform'], column: { title: __("Data provider"), data: "provider_name", @@ -33,6 +34,7 @@ export const useReportsStore = defineStore('reports', { id: 2, name: "Publisher", active: false, + used_by: ["title", "item", "database"], column: { title: __("Publisher"), data: "publisher", @@ -42,8 +44,21 @@ export const useReportsStore = defineStore('reports', { }, 3: { id: 3, + name: "Platform", + active: false, + used_by: ["item", "database", "platforms"], + column: { + title: __("Platform"), + data: "platform", + searchable: true, + orderable: true, + }, + }, + 4: { + id: 4, name: "Publisher ID", active: false, + used_by: ["title", "database"], column: { title: __("Publisher ID"), data: "publisher_id", @@ -51,10 +66,11 @@ export const useReportsStore = defineStore('reports', { orderable: true, }, }, - 4: { - id: 4, + 5: { + id: 5, name: "Online ISSN", active: false, + used_by: ["title"], column: { title: __("Online ISSN"), data: "online_issn", @@ -62,10 +78,11 @@ export const useReportsStore = defineStore('reports', { orderable: true, }, }, - 5: { - id: 5, + 6: { + id: 6, name: "Print ISSN", active: false, + used_by: ["title"], column: { title: __("Print ISSN"), data: "print_issn", @@ -73,10 +90,11 @@ export const useReportsStore = defineStore('reports', { orderable: true, }, }, - 6: { - id: 6, + 7: { + id: 7, name: "DOI", active: false, + used_by: ["title"], column: { title: __("DOI"), data: "title_doi", @@ -84,10 +102,11 @@ export const useReportsStore = defineStore('reports', { orderable: true, }, }, - 7: { - id: 7, + 8: { + id: 8, name: "URI", active: false, + used_by: ["title"], column: { title: __("URI"), data: "title_uri", -- 2.39.5