View | Details | Raw Unified | Return to bug 37930
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue (-64 / +17 lines)
Lines 42-47 export default { Link Here
42
        const vendorStore = inject("vendorStore")
42
        const vendorStore = inject("vendorStore")
43
43
44
        const AVStore = inject("AVStore")
44
        const AVStore = inject("AVStore")
45
        const { initialiseAVStore } = AVStore
45
46
46
        const mainStore = inject("mainStore")
47
        const mainStore = inject("mainStore")
47
48
Lines 59-64 export default { Link Here
59
            setError,
60
            setError,
60
            loading,
61
            loading,
61
            loaded,
62
            loaded,
63
            initialiseAVStore,
62
        }
64
        }
63
    },
65
    },
64
    data() {
66
    data() {
Lines 71-78 export default { Link Here
71
        this.loading()
73
        this.loading()
72
74
73
        const fetch_config = () => {
75
        const fetch_config = () => {
74
            let promises = []
75
76
            const acq_client = APIClient.acquisition
76
            const acq_client = APIClient.acquisition
77
            acq_client.vendors.getAll().then(
77
            acq_client.vendors.getAll().then(
78
                vendors => {
78
                vendors => {
Lines 80-151 export default { Link Here
80
                },
80
                },
81
                error => {}
81
                error => {}
82
            )
82
            )
83
83
            this.initialiseAVStore("erm").then(() => {
84
            const av_client = APIClient.authorised_values
84
                this.loaded()
85
            const authorised_values = {
85
                this.initialized = true
86
                av_agreement_statuses: "ERM_AGREEMENT_STATUS",
87
                av_agreement_closure_reasons: "ERM_AGREEMENT_CLOSURE_REASON",
88
                av_agreement_renewal_priorities:
89
                    "ERM_AGREEMENT_RENEWAL_PRIORITY",
90
                av_user_roles: "ERM_USER_ROLES",
91
                av_license_types: "ERM_LICENSE_TYPE",
92
                av_license_statuses: "ERM_LICENSE_STATUS",
93
                av_agreement_license_statuses: "ERM_AGREEMENT_LICENSE_STATUS",
94
                av_agreement_license_location: "ERM_AGREEMENT_LICENSE_LOCATION",
95
                av_package_types: "ERM_PACKAGE_TYPE",
96
                av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE",
97
                av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE",
98
                av_report_types: "ERM_REPORT_TYPES",
99
                av_platform_reports_metrics: "ERM_PLATFORM_REPORTS_METRICS",
100
                av_database_reports_metrics: "ERM_DATABASE_REPORTS_METRICS",
101
                av_title_reports_metrics: "ERM_TITLE_REPORTS_METRICS",
102
                av_item_reports_metrics: "ERM_ITEM_REPORTS_METRICS",
103
            }
104
105
            let av_cat_array = Object.keys(authorised_values).map(function (
106
                av_cat
107
            ) {
108
                return '"' + authorised_values[av_cat] + '"'
109
            })
86
            })
110
111
            promises.push(
112
                av_client.values
113
                    .getCategoriesWithValues(av_cat_array)
114
                    .then(av_categories => {
115
                        Object.entries(authorised_values).forEach(
116
                            ([av_var, av_cat]) => {
117
                                const av_match = av_categories.find(
118
                                    element => element.category_name == av_cat
119
                                )
120
                                this.AVStore[av_var] =
121
                                    av_match.authorised_values
122
                            }
123
                        )
124
                    })
125
            )
126
127
            return Promise.all(promises)
128
        }
87
        }
129
88
130
        const client = APIClient.erm
89
        const client = APIClient.erm
131
        client.config
90
        client.config.get().then(config => {
132
            .get()
91
            this.config = config
133
            .then(config => {
92
            if (this.config.settings.ERMModule != 1) {
134
                this.config = config
93
                return this.setError(
135
                if (this.config.settings.ERMModule != 1) {
94
                    this.$__(
136
                    return this.setError(
95
                        'The e-resource management module is disabled, turn on <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ERMModule">ERMModule</a> to use it'
137
                        this.$__(
96
                    ),
138
                            'The e-resource management module is disabled, turn on <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ERMModule">ERMModule</a> to use it'
97
                    false
139
                        ),
98
                )
140
                        false
99
            }
141
                    )
100
            return fetch_config()
142
                }
101
        })
143
                return fetch_config()
144
            })
145
            .then(() => {
146
                this.loaded()
147
                this.initialized = true
148
            })
149
    },
102
    },
150
    methods: {
103
    methods: {
151
        async filterProviders(navigationTree) {
104
        async filterProviders(navigationTree) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue (-32 / +17 lines)
Lines 37-42 import { storeToRefs } from "pinia" Link Here
37
export default {
37
export default {
38
    setup() {
38
    setup() {
39
        const AVStore = inject("AVStore")
39
        const AVStore = inject("AVStore")
40
        const { initialiseAVStore } = AVStore
40
41
41
        const mainStore = inject("mainStore")
42
        const mainStore = inject("mainStore")
42
43
Lines 52-57 export default { Link Here
52
            loaded,
53
            loaded,
53
            config,
54
            config,
54
            setError,
55
            setError,
56
            initialiseAVStore,
55
        }
57
        }
56
    },
58
    },
57
    data() {
59
    data() {
Lines 62-100 export default { Link Here
62
    beforeCreate() {
64
    beforeCreate() {
63
        this.loading()
65
        this.loading()
64
66
65
        const fetch_additional_config = () => {
66
            let promises = []
67
            const av_client = APIClient.authorised_values
68
            promises.push(
69
                av_client.values.get("NOT_LOAN").then(
70
                    values => {
71
                        this.AVStore.av_notforloan = values
72
                    },
73
                    error => {}
74
                )
75
            )
76
            return Promise.all(promises)
77
        }
78
79
        const client = APIClient.preservation
67
        const client = APIClient.preservation
80
        client.config
68
        client.config.get().then(config => {
81
            .get()
69
            this.config = config
82
            .then(config => {
70
            if (this.config.settings.enabled != 1) {
83
                this.config = config
71
                return this.setError(
84
                if (this.config.settings.enabled != 1) {
72
                    this.$__(
85
                    return this.setError(
73
                        'The preservation module is disabled, turn on <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=PreservationModule">PreservationModule</a> to use it'
86
                        this.$__(
74
                    ),
87
                            'The preservation module is disabled, turn on <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=PreservationModule">PreservationModule</a> to use it'
75
                    false
88
                        ),
76
                )
89
                        false
77
            }
90
                    )
78
        })
91
                }
79
        this.initialiseAVStore("preservation").then(() => {
92
                return fetch_additional_config()
80
            this.loaded()
93
            })
81
            this.initialized = true
94
            .then(() => {
82
        })
95
                this.loaded()
96
                this.initialized = true
97
            })
98
    },
83
    },
99
84
100
    components: {
85
    components: {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts (-1 / +1 lines)
Lines 21-27 import { routes as routesDef } from "../routes/erm"; Link Here
21
21
22
import { useMainStore } from "../stores/main";
22
import { useMainStore } from "../stores/main";
23
import { useVendorStore } from "../stores/vendors";
23
import { useVendorStore } from "../stores/vendors";
24
import { useAVStore } from "../stores/authorised-values";
24
import { useAVStore } from "../stores/authorisedValues/authorised-values";
25
import { useERMStore } from "../stores/erm";
25
import { useERMStore } from "../stores/erm";
26
import { useNavigationStore } from "../stores/navigation";
26
import { useNavigationStore } from "../stores/navigation";
27
import { useReportsStore } from "../stores/usage-reports";
27
import { useReportsStore } from "../stores/usage-reports";
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/preservation.ts (-2 / +1 lines)
Lines 32-38 import App from "../components/Preservation/Main.vue"; Link Here
32
import { routes as routesDef } from "../routes/preservation";
32
import { routes as routesDef } from "../routes/preservation";
33
33
34
import { useMainStore } from "../stores/main";
34
import { useMainStore } from "../stores/main";
35
import { useAVStore } from "../stores/authorised-values";
35
import { useAVStore } from "../stores/authorisedValues/authorised-values";
36
import { usePreservationStore } from "../stores/preservation";
36
import { usePreservationStore } from "../stores/preservation";
37
import { useNavigationStore } from "../stores/navigation";
37
import { useNavigationStore } from "../stores/navigation";
38
import i18n from "../i18n";
38
import i18n from "../i18n";
39
- 

Return to bug 37930