diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue index a11b9940ef..6ded9bdcf7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue @@ -89,6 +89,50 @@ }}

+
+

+ {{ + $__( + "No default overdue triggers are defined. Default triggers apply to all libraries unless overridden." + ) + }} +

+ +

+ {{ + $__( + "No library-specific triggers are defined either. Select add new trigger above to get started." + ) + }} +

+
Filter by @@ -294,6 +338,7 @@ export default { setAllEffectiveRuleSets, setAllExhaustiveEffectiveRuleSets, isLastTrigger, + getLibrariesWithRules, } = circRulesStore; const { currentLibraryId, @@ -305,6 +350,7 @@ export default { triggerCounts, allExhaustiveEffectiveRuleSets, allEffectiveRuleSets, + librariesWithRules, storeInitialized, } = storeToRefs(circRulesStore); @@ -322,7 +368,9 @@ export default { setAllEffectiveRuleSets, setAllExhaustiveEffectiveRuleSets, allEffectiveRuleSets, + librariesWithRules, isLastTrigger, + getLibrariesWithRules, storeInitialized, from_branch, }; @@ -343,6 +391,12 @@ export default { this.updateTriggerCount(); this.setAllEffectiveRuleSets(); this.setAllExhaustiveEffectiveRuleSets(); + if ( + this.currentLibraryId === "*" && + this.triggerCounts["*"] === 0 + ) { + await this.getLibrariesWithRules(); + } this.storeInitialized = true; }, formatSelectedParams() { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js index 27ad9875cd..77af0caa18 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js @@ -38,6 +38,7 @@ export const useCircRulesStore = defineStore("circRules", () => { allEffectiveRuleSets: [], // main data set for display explicitly set rules for current library allExhaustiveEffectiveRuleSets: [], // main data set for display all applied rules for current library currentAndDefaultRawRuleSets: [], // data set to identify effective rules from (combines allDefaultLibraryRawRuleSets and allCurrentLibraryRawRuleSets) + librariesWithRules: [], storeInitialized: false, }); @@ -411,6 +412,21 @@ export const useCircRulesStore = defineStore("circRules", () => { } this.updateCircRuleSets(rulesForDeletion, triggerNumber); }, + async getLibrariesWithRules() { + const client = APIClient.circRule; + const allRules = await client.circ_rules.getAll( + {}, + { effective: false } + ); + const libraryIds = new Set( + allRules + .map(r => r.context?.library_id) + .filter(id => id && id !== "*") + ); + this.librariesWithRules = this.libraries.filter( + lib => lib.library_id !== "*" && libraryIds.has(lib.library_id) + ); + }, async getAllRawRuleSets() { const client = APIClient.circRule; this.allDefaultLibraryRawRuleSets = await client.circ_rules.getAll(