|
Lines 20-25
export const useCircRulesStore = defineStore("circRules", () => {
Link Here
|
| 20 |
currentPatronCategoryId: null, |
20 |
currentPatronCategoryId: null, |
| 21 |
currentItemTypeId: null, |
21 |
currentItemTypeId: null, |
| 22 |
triggerCounts: { "*": 0 }, |
22 |
triggerCounts: { "*": 0 }, |
|
|
23 |
metaInitialized: false, |
| 23 |
// references |
24 |
// references |
| 24 |
itemTypes: [], |
25 |
itemTypes: [], |
| 25 |
libraries: [], |
26 |
libraries: [], |
|
Lines 44-53
export const useCircRulesStore = defineStore("circRules", () => {
Link Here
|
| 44 |
|
45 |
|
| 45 |
const actions = { |
46 |
const actions = { |
| 46 |
// controllers |
47 |
// controllers |
| 47 |
async init() { |
48 |
async init(defaultLibraryId = "*") { |
| 48 |
await this.getItemTypes(); |
49 |
await this.getItemTypes(); |
| 49 |
await this.getLibraries(); |
50 |
await this.getLibraries(); |
| 50 |
await this.getPatronCategories(); |
51 |
await this.getPatronCategories(); |
|
|
52 |
this.currentLibraryId = defaultLibraryId; |
| 53 |
this.metaInitialized = true; |
| 51 |
}, |
54 |
}, |
| 52 |
async loadUserPermissions() { |
55 |
async loadUserPermissions() { |
| 53 |
if (this.userPermissions !== null) { |
56 |
if (this.userPermissions !== null) { |
|
Lines 390-416
export const useCircRulesStore = defineStore("circRules", () => {
Link Here
|
| 390 |
}, |
393 |
}, |
| 391 |
// repositories |
394 |
// repositories |
| 392 |
async deleteRuleSet(ruleSet, triggerNumber) { |
395 |
async deleteRuleSet(ruleSet, triggerNumber) { |
|
|
396 |
if (!this.hasExplicitRulesForTrigger(ruleSet, triggerNumber)) { |
| 397 |
return; |
| 398 |
} |
| 399 |
|
| 393 |
const ruleSetInDb = await this.getSelectedRuleSet(ruleSet.context); |
400 |
const ruleSetInDb = await this.getSelectedRuleSet(ruleSet.context); |
| 394 |
|
401 |
|
| 395 |
if (this.hasConflict(ruleSet, ruleSetInDb, triggerNumber)) { |
402 |
if (this.hasConflict(ruleSet, ruleSetInDb, triggerNumber)) { |
| 396 |
throw "The rule set for the selected trigger context could not be reset as it was updated elsewhere. Please see the updated trigger above."; |
403 |
throw "The rule set for the selected trigger context could not be reset as it was updated elsewhere. Please see the updated trigger above."; |
| 397 |
} |
404 |
} |
| 398 |
|
405 |
|
| 399 |
const rulesForDeletion = { context: ruleSet.context }; |
406 |
const rulesForDeletion = { |
| 400 |
|
407 |
context: ruleSet.context, |
| 401 |
if (ruleSet[`overdue_${triggerNumber}_delay`] !== null) { |
408 |
[`overdue_${triggerNumber}_delay`]: null, |
| 402 |
rulesForDeletion[`overdue_${triggerNumber}_delay`] = null; |
409 |
[`overdue_${triggerNumber}_notice`]: null, |
| 403 |
} |
410 |
[`overdue_${triggerNumber}_restrict`]: null, |
| 404 |
if (ruleSet[`overdue_${triggerNumber}_notice`] !== null) { |
411 |
[`overdue_${triggerNumber}_mtt`]: null, |
| 405 |
rulesForDeletion[`overdue_${triggerNumber}_notice`] = null; |
412 |
}; |
| 406 |
} |
413 |
await this.updateCircRuleSets(rulesForDeletion, triggerNumber); |
| 407 |
if (ruleSet[`overdue_${triggerNumber}_restrict`] !== null) { |
|
|
| 408 |
rulesForDeletion[`overdue_${triggerNumber}_restrict`] = null; |
| 409 |
} |
| 410 |
if (ruleSet[`overdue_${triggerNumber}_mtt`] !== null) { |
| 411 |
rulesForDeletion[`overdue_${triggerNumber}_mtt`] = null; |
| 412 |
} |
| 413 |
this.updateCircRuleSets(rulesForDeletion, triggerNumber); |
| 414 |
}, |
414 |
}, |
| 415 |
async getLibrariesWithRules() { |
415 |
async getLibrariesWithRules() { |
| 416 |
const client = APIClient.circRule; |
416 |
const client = APIClient.circRule; |
| 417 |
- |
|
|