From 6642284c564ca28989ca546a8590249bd3f11711 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 10 Oct 2024 11:21:41 +0100
Subject: [PATCH] Bug 10190: Take DefaultToLoggedInLibraryOverdueTriggers into
 account

This updates the logic for the default page load to take account of
DefaultToLoggedInLibraryOverdueTriggers.

Sponsored-by: Glasgow Colleges Library Group <https://library.cityofglasgowcollege.ac.uk>
Signed-off-by: George Harkins <George.Harkins@cityofglasgowcollege.ac.uk>
---
 .../prog/en/modules/admin/circulation_triggers.tt          | 2 ++
 .../Admin/CirculationTriggers/CirculationTriggersList.vue  | 7 ++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/circulation_triggers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/circulation_triggers.tt
index 57ba3129856..9162f0c769d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/circulation_triggers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/circulation_triggers.tt
@@ -1,6 +1,7 @@
 [% USE raw %]
 [% USE To %]
 [% USE Asset %]
+[% USE Branches %]
 [% USE KohaDates %]
 [% USE TablesSettings %]
 [% USE AuthorisedValues %]
@@ -32,6 +33,7 @@
     <script>
 
         const letters = [% To.json(letters) | $raw %];
+        const default_view = "[%- IF Koha.Preference('DefaultToLoggedInLibraryOverdueTriggers') -%][% Branches.GetLoggedInBranchcode %][%- ELSE -%]*[%- END -%]";
 
     </script>
 
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 bc276972680..6e91e7a514b 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
@@ -138,7 +138,7 @@ export default {
         return {
             initialized: false,
             libraries: null,
-            selectedLibrary: "*",
+            selectedLibrary: default_view,
             circRules: null,
             numberOfTabs: [1],
             tabSelected: "Notice 1",
@@ -201,11 +201,8 @@ export default {
                 error => {}
             )
         },
-        async getCircRules(params = {}, pageLoad) {
+        async getCircRules(params = {}) {
             params.effective = false
-            if (pageLoad) {
-                params.library_id = "*"
-            }
             const client = APIClient.circRule
             await client.circRules.getAll({}, params).then(
                 rules => {
-- 
2.47.0