|
Lines 1-5
Link Here
|
| 1 |
<template> |
1 |
<template> |
| 2 |
<div v-if="ERMModule"> |
2 |
<div v-if="initialized"> |
| 3 |
<div id="sub-header"> |
3 |
<div id="sub-header"> |
| 4 |
<Breadcrumb /> |
4 |
<Breadcrumb /> |
| 5 |
<Help /> |
5 |
<Help /> |
|
Lines 140-147
export default {
Link Here
|
| 140 |
vendorStore, |
140 |
vendorStore, |
| 141 |
AVStore, |
141 |
AVStore, |
| 142 |
setError, |
142 |
setError, |
| 143 |
erm_providers, |
|
|
| 144 |
ERMModule, |
| 145 |
loading, |
143 |
loading, |
| 146 |
loaded, |
144 |
loaded, |
| 147 |
} |
145 |
} |
|
Lines 149-210
export default {
Link Here
|
| 149 |
data() { |
147 |
data() { |
| 150 |
return { |
148 |
return { |
| 151 |
component: "agreement", |
149 |
component: "agreement", |
|
|
150 |
initialized: false, |
| 151 |
ERMModule: null, |
| 152 |
erm_providers: [], |
| 152 |
} |
153 |
} |
| 153 |
}, |
154 |
}, |
| 154 |
beforeCreate() { |
155 |
beforeCreate() { |
| 155 |
if (!this.ERMModule) { |
|
|
| 156 |
return this.setError( |
| 157 |
this.$__( |
| 158 |
'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' |
| 159 |
), |
| 160 |
false |
| 161 |
) |
| 162 |
} |
| 163 |
this.loading() |
156 |
this.loading() |
| 164 |
|
157 |
|
| 165 |
const acq_client = APIClient.acquisition |
158 |
const fetch_config = () => { |
| 166 |
acq_client.vendors.getAll().then( |
159 |
let promises = [] |
| 167 |
vendors => { |
|
|
| 168 |
this.vendorStore.vendors = vendors |
| 169 |
this.initialized = true |
| 170 |
}, |
| 171 |
error => {} |
| 172 |
) |
| 173 |
|
| 174 |
const av_client = APIClient.authorised_values |
| 175 |
const authorised_values = { |
| 176 |
av_agreement_statuses: "ERM_AGREEMENT_STATUS", |
| 177 |
av_agreement_closure_reasons: "ERM_AGREEMENT_CLOSURE_REASON", |
| 178 |
av_agreement_renewal_priorities: "ERM_AGREEMENT_RENEWAL_PRIORITY", |
| 179 |
av_user_roles: "ERM_USER_ROLES", |
| 180 |
av_license_types: "ERM_LICENSE_TYPE", |
| 181 |
av_license_statuses: "ERM_LICENSE_STATUS", |
| 182 |
av_agreement_license_statuses: "ERM_AGREEMENT_LICENSE_STATUS", |
| 183 |
av_agreement_license_location: "ERM_AGREEMENT_LICENSE_LOCATION", |
| 184 |
av_package_types: "ERM_PACKAGE_TYPE", |
| 185 |
av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE", |
| 186 |
av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE", |
| 187 |
} |
| 188 |
|
160 |
|
| 189 |
let av_cat_array = Object.keys(authorised_values).map(function ( |
161 |
const acq_client = APIClient.acquisition |
| 190 |
av_cat |
162 |
promises.push( |
| 191 |
) { |
163 |
acq_client.vendors.getAll().then( |
| 192 |
return '"' + authorised_values[av_cat] + '"' |
164 |
vendors => { |
| 193 |
}) |
165 |
this.vendorStore.vendors = vendors |
| 194 |
|
166 |
}, |
| 195 |
av_client.values |
167 |
error => {} |
| 196 |
.getCategoriesWithValues(av_cat_array) |
168 |
) |
| 197 |
.then(av_categories => { |
169 |
) |
| 198 |
Object.entries(authorised_values).forEach( |
170 |
|
| 199 |
([av_var, av_cat]) => { |
171 |
const av_client = APIClient.authorised_values |
| 200 |
const av_match = av_categories.find( |
172 |
const authorised_values = { |
| 201 |
element => element.category_name == av_cat |
173 |
av_agreement_statuses: "ERM_AGREEMENT_STATUS", |
|
|
174 |
av_agreement_closure_reasons: "ERM_AGREEMENT_CLOSURE_REASON", |
| 175 |
av_agreement_renewal_priorities: |
| 176 |
"ERM_AGREEMENT_RENEWAL_PRIORITY", |
| 177 |
av_user_roles: "ERM_USER_ROLES", |
| 178 |
av_license_types: "ERM_LICENSE_TYPE", |
| 179 |
av_license_statuses: "ERM_LICENSE_STATUS", |
| 180 |
av_agreement_license_statuses: "ERM_AGREEMENT_LICENSE_STATUS", |
| 181 |
av_agreement_license_location: "ERM_AGREEMENT_LICENSE_LOCATION", |
| 182 |
av_package_types: "ERM_PACKAGE_TYPE", |
| 183 |
av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE", |
| 184 |
av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE", |
| 185 |
} |
| 186 |
|
| 187 |
let av_cat_array = Object.keys(authorised_values).map(function ( |
| 188 |
av_cat |
| 189 |
) { |
| 190 |
return '"' + authorised_values[av_cat] + '"' |
| 191 |
}) |
| 192 |
|
| 193 |
promises.push( |
| 194 |
av_client.values |
| 195 |
.getCategoriesWithValues(av_cat_array) |
| 196 |
.then(av_categories => { |
| 197 |
Object.entries(authorised_values).forEach( |
| 198 |
([av_var, av_cat]) => { |
| 199 |
const av_match = av_categories.find( |
| 200 |
element => element.category_name == av_cat |
| 201 |
) |
| 202 |
this.AVStore[av_var] = |
| 203 |
av_match.authorised_values |
| 204 |
} |
| 202 |
) |
205 |
) |
| 203 |
this.AVStore[av_var] = av_match.authorised_values |
206 |
}) |
| 204 |
} |
207 |
) |
|
|
208 |
|
| 209 |
promises.push( |
| 210 |
sysprefs_client.sysprefs.get("ERMProviders").then( |
| 211 |
providers => { |
| 212 |
this.erm_providers = providers.value.split(",") |
| 213 |
}, |
| 214 |
error => {} |
| 205 |
) |
215 |
) |
|
|
216 |
) |
| 217 |
return Promise.all(promises) |
| 218 |
} |
| 219 |
|
| 220 |
const sysprefs_client = APIClient.sysprefs |
| 221 |
sysprefs_client.sysprefs |
| 222 |
.get("ERMModule") |
| 223 |
.then(value => { |
| 224 |
this.ERMModule = value |
| 225 |
if (!this.ERMModule) { |
| 226 |
this.loaded() |
| 227 |
return this.setError( |
| 228 |
this.$__( |
| 229 |
'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' |
| 230 |
), |
| 231 |
false |
| 232 |
) |
| 233 |
} |
| 234 |
return fetch_config() |
| 235 |
}) |
| 236 |
.then(() => { |
| 237 |
this.loaded() |
| 238 |
this.initialized = true |
| 206 |
}) |
239 |
}) |
| 207 |
.then(() => this.loaded()) |
|
|
| 208 |
}, |
240 |
}, |
| 209 |
components: { |
241 |
components: { |
| 210 |
Breadcrumb, |
242 |
Breadcrumb, |