From 0d1828e554cdaa2ec8c968804d632a3f65da6b65 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Jan 2025 11:12:00 +0100 Subject: [PATCH] Bug 37054: Replace the TT plugin method with a more generic one Let's return the whole Koha::Library object so that it can be reusable for another attribute. Keeping the CamelCase to be consistent with the rest of the other methods in this file. --- Koha/Template/Plugin/Branches.pm | 16 +++++----------- .../prog/en/includes/doc-head-close.inc | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 566faedfc2c..32429bbb00a 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -45,6 +45,11 @@ sub GetName { return $branchname; } +sub GetLoggedInBranch { + my ($self) = @_; + return Koha::Libraries->find( $self->GetLoggedInBranchcode ); +} + sub GetLoggedInBranchcode { my ($self) = @_; @@ -191,15 +196,4 @@ sub GetBranchSpecificCSS { return $opacusercss; } -sub get_library_color { - my ( $self, $branchcode ) = @_; - - return q{} unless defined $branchcode; - - my $library = Koha::Libraries->find($branchcode); - my $library_color = $library ? $library->library_color : q{}; - - return $library_color; -} - 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index 5d213da393e..03cc44c4811 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -51,7 +51,7 @@ var Koha = {}; [% IF ( login ) %] [% Asset.css("css/login.css") | $raw %] [% END %] -[% SET library_color = Branches.get_library_color( Branches.GetLoggedInBranchcode() ) %] +[% SET library_color = Branches.GetLoggedInBranch.library_color %] [% IF library_color %]