Bug 37930: Extend new AV logic to the rest of ERM

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2025-04-07 16:25:56 +01:00 committed by Katrin Fischer
parent 60005f6568
commit 2e4be8465c
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
22 changed files with 85 additions and 111 deletions

View File

@ -354,8 +354,8 @@ export default {
const { setConfirmationDialog, setMessage } = inject("mainStore");
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
return {
format_date,

View File

@ -26,7 +26,7 @@
>
<option value="">{{ $__("All") }}</option>
<option
v-for="type in av_title_publication_types"
v-for="type in authorisedValues.av_title_publication_types"
:key="type.value"
:value="type.value"
>
@ -66,9 +66,9 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_title_publication_types } = storeToRefs(AVStore);
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const table = ref();
const filters = reactive({
@ -78,11 +78,11 @@ export default {
});
return {
av_title_publication_types,
get_lib_from_av,
escape_str,
map_av_dt_filter,
table,
authorisedValues,
};
},
data() {

View File

@ -11,11 +11,7 @@
{{ $__("Content type") }}:
<select id="content_type_filter" v-model="filters.content_type">
<option value="">{{ $__("All") }}</option>
<option
v-for="type in av_package_content_types"
:key="type.authorised_values"
:value="type.value"
>
<option :key="type.authorised_values" :value="type.value">
{{ type.description }}
</option>
</select>
@ -73,13 +69,9 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_package_types, av_package_content_types } =
storeToRefs(AVStore);
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { config } = ERMStore;
const { config, get_lib_from_av, map_av_dt_filter } = ERMStore;
const { authorisedValues } = storeToRefs(ERMStore);
const table = ref();
const filters = reactive({
@ -89,13 +81,12 @@ export default {
});
return {
av_package_types,
av_package_content_types,
get_lib_from_av,
escape_str,
map_av_dt_filter,
config,
table,
authorisedValues,
};
},
data: function () {
@ -241,12 +232,7 @@ export default {
searchable: false,
orderable: false,
render: function (data, type, row, meta) {
return escape_str(
get_lib_from_av(
"av_package_content_types",
row.content_type
)
);
return escape_str(get_lib_from_av(row.content_type));
},
},
];

View File

@ -122,8 +122,8 @@ export default {
setup() {
const format_date = $date;
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
return {
format_date,

View File

@ -15,7 +15,7 @@
>
<option value="">{{ $__("All") }}</option>
<option
v-for="type in av_title_publication_types"
v-for="type in authorisedValues.av_title_publication_types"
:key="type.value"
:value="type.value"
>
@ -77,12 +77,9 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_title_publication_types } = storeToRefs(AVStore);
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { config } = ERMStore;
const { authorisedValues } = storeToRefs(ERMStore);
const { get_lib_from_av, config } = ERMStore;
const table = ref();
const filters = reactive({
@ -92,7 +89,7 @@ export default {
});
return {
av_title_publication_types,
authorisedValues,
get_lib_from_av,
escape_str,
config,
@ -123,7 +120,9 @@ export default {
},
filters_options: {
1: () =>
this.map_av_dt_filter("av_title_publication_types"),
this.map_av_dt_filter(
"authorisedValues.av_title_publication_types"
),
},
actions: { 0: ["show"] },
default_filters: {
@ -253,7 +252,7 @@ export default {
render: function (data, type, row, meta) {
return escape_str(
get_lib_from_av(
"av_title_publication_types",
"authorisedValues.av_title_publication_types",
row.publication_type
)
);

View File

@ -249,8 +249,8 @@ import { APIClient } from "../../fetch/api-client.js";
export default {
setup() {
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
return {
get_lib_from_av,

View File

@ -10,8 +10,8 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const table = ref();
return {

View File

@ -37,7 +37,7 @@
v-model="erm_package.package_type"
label="description"
:reduce="av => av.value"
:options="av_package_types"
:options="authorisedValues.av_package_types"
/>
</li>
<li>
@ -49,7 +49,9 @@
v-model="erm_package.content_type"
label="description"
:reduce="av => av.value"
:options="av_package_content_types"
:options="
authorisedValues.av_package_content_types
"
/>
</li>
<li>
@ -100,13 +102,11 @@ import { storeToRefs } from "pinia";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_package_types, av_package_content_types } =
storeToRefs(AVStore);
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
return {
av_package_types,
av_package_content_types,
authorisedValues,
};
},
data() {

View File

@ -44,8 +44,8 @@ export default {
const vendorStore = inject("vendorStore");
const { vendors } = storeToRefs(vendorStore);
const AVStore = inject("AVStore");
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");

View File

@ -133,8 +133,8 @@ export default {
const { setConfirmationDialog, setMessage } = inject("mainStore");
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
return {
format_date,

View File

@ -234,7 +234,9 @@
v-model="title.publication_type"
label="description"
:reduce="av => av.value"
:options="av_title_publication_types"
:options="
authorisedValues.av_title_publication_types
"
/>
</li>
@ -420,12 +422,12 @@ import { storeToRefs } from "pinia";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_title_publication_types } = storeToRefs(AVStore);
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
const { get_lib_from_av } = ERMStore;
return {
av_title_publication_types,
authorisedValues,
get_lib_from_av,
};
},

View File

@ -49,9 +49,8 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_title_publication_types } = storeToRefs(AVStore);
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");
@ -62,7 +61,6 @@ export default {
});
return {
av_title_publication_types,
get_lib_from_av,
map_av_dt_filter,
escape_str,

View File

@ -271,8 +271,8 @@ import ToolbarButton from "../ToolbarButton.vue";
export default {
setup() {
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");
return {

View File

@ -53,7 +53,7 @@
v-model="license.type"
label="description"
:reduce="av => av.value"
:options="av_license_types"
:options="authorisedValues.av_license_types"
>
<template #search="{ attributes, events }">
<input
@ -74,7 +74,7 @@
id="license_status"
v-model="license.status"
:reduce="av => av.value"
:options="av_license_statuses"
:options="authorisedValues.av_license_statuses"
label="description"
>
<template #search="{ attributes, events }">
@ -117,7 +117,7 @@
<UserRoles
:user_type="$__('License user %s')"
:user_roles="license.user_roles"
:av_user_roles="av_user_roles"
:av_user_roles="authorisedValues.av_user_roles"
/>
<Documents :documents="license.documents" />
<fieldset class="action">
@ -151,14 +151,11 @@ import { storeToRefs } from "pinia";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_license_types, av_license_statuses, av_user_roles } =
storeToRefs(AVStore);
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
return {
av_license_types,
av_license_statuses,
av_user_roles,
authorisedValues,
max_allowed_packet,
};
},

View File

@ -38,8 +38,8 @@ export default {
const vendorStore = inject("vendorStore");
const { vendors } = storeToRefs(vendorStore);
const AVStore = inject("AVStore");
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");

View File

@ -168,8 +168,8 @@ export default {
const { setConfirmationDialog, setMessage } = inject("mainStore");
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
return {
format_date,

View File

@ -41,9 +41,6 @@ import { APIClient } from "../../fetch/api-client.js";
export default {
setup() {
const AVStore = inject("AVStore"); // Left in for future permissions fixes
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const { setMessage } = inject("mainStore");
return {

View File

@ -392,11 +392,11 @@ import { storeToRefs } from "pinia";
export default {
setup() {
const AVStore = inject("AVStore");
const { av_report_types } = storeToRefs(AVStore);
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
return {
av_report_types,
authorisedValues,
};
},
data() {
@ -425,7 +425,7 @@ export default {
{ description: this.$__("Inactive"), value: 0 },
],
registry_data: [],
valid_report_types: [...this.av_report_types],
valid_report_types: [...this.authorisedValues.av_report_types],
selected_provider: null,
manual_form: false,
required_fields: [],

View File

@ -42,8 +42,8 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore"); // Left in for future permissions fixes
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore"); // Left in for future permissions fixes
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const { setConfirmationDialog, setMessage, setWarning } =
inject("mainStore");

View File

@ -128,8 +128,8 @@ import UsageStatisticsProviderDataList from "./UsageStatisticsProviderDataList.v
export default {
setup() {
const AVStore = inject("AVStore");
const { get_lib_from_av } = AVStore;
const ERMStore = inject("ERMStore");
const { get_lib_from_av } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");

View File

@ -31,8 +31,8 @@ import KohaTable from "../KohaTable.vue";
export default {
setup() {
const AVStore = inject("AVStore"); // Left in for future permissions fixes
const { get_lib_from_av, map_av_dt_filter } = AVStore;
const ERMStore = inject("ERMStore"); // Left in for future permissions fixes
const { get_lib_from_av, map_av_dt_filter } = ERMStore;
const { setConfirmationDialog, setMessage } = inject("mainStore");

View File

@ -364,14 +364,8 @@ import { APIClient } from "../../fetch/api-client.js";
export default {
setup() {
const AVStore = inject("AVStore");
const {
av_report_types,
av_platform_reports_metrics,
av_database_reports_metrics,
av_title_reports_metrics,
av_item_reports_metrics,
} = storeToRefs(AVStore);
const ERMStore = inject("ERMStore");
const { authorisedValues } = storeToRefs(ERMStore);
const { setConfirmationDialog, setMessage, setError } =
inject("mainStore");
@ -382,11 +376,7 @@ export default {
const title_property_column_options = getColumnOptions();
return {
av_report_types,
av_platform_reports_metrics,
av_database_reports_metrics,
av_title_reports_metrics,
av_item_reports_metrics,
authorisedValues,
setConfirmationDialog,
setMessage,
setError,
@ -472,7 +462,7 @@ export default {
},
metric_types_options: [],
access_types_options: [],
report_types_options: [...this.av_report_types],
report_types_options: [...this.authorisedValues.av_report_types],
filter_data: [],
usage_data_provider_list: [...this.usage_data_providers],
time_period_columns_builder: null,
@ -788,19 +778,22 @@ export default {
if (report_type) {
switch (report_type.substring(0, 1)) {
case "P":
av_type = this.av_platform_reports_metrics;
av_type =
this.authorisedValues.av_platform_reports_metrics;
this.data_type = "platform";
break;
case "T":
av_type = this.av_title_reports_metrics;
av_type =
this.authorisedValues.av_title_reports_metrics;
this.data_type = "title";
break;
case "I":
av_type = this.av_item_reports_metrics;
av_type = this.authorisedValues.av_item_reports_metrics;
this.data_type = "item";
break;
case "D":
av_type = this.av_database_reports_metrics;
av_type =
this.authorisedValues.av_database_reports_metrics;
this.data_type = "database";
break;
}
@ -859,7 +852,8 @@ export default {
setReportTypesAndResetFilterData(providers) {
const permittedReportTypes = [];
if (providers.length === 0) {
this.report_types_options = this.av_report_types;
this.report_types_options =
this.authorisedValues.av_report_types;
this.query.keywords = null;
this.filter_data.length = 0;
return;
@ -874,9 +868,10 @@ export default {
single_report_types.pop(); // remove trailing "" from array
single_report_types.forEach(type => {
const report_type = this.av_report_types.find(
rt => rt.value === type
);
const report_type =
this.authorisedValues.av_report_types.find(
rt => rt.value === type
);
permittedReportTypes.push(report_type);
});
// If we change/remove a data provider then we don't want data being displayed from that provider in the dropdown