From 0e1bcbd3c7a5d068d57d69c6f283327ca731ca26 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 2 Apr 2025 12:56:24 +0000 Subject: [PATCH] Bug 37054: Add ability to adjust colors per branch --- Koha/Library.pm | 3 ++- Koha/Template/Plugin/Branches.pm | 5 +++++ admin/branches.pl | 1 + .../prog/en/includes/doc-head-open.inc | 8 ++++++++ .../prog/en/modules/admin/branches.tt | 19 +++++++++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Koha/Library.pm b/Koha/Library.pm index 90db8e978c0..6b3189fc5e7 100644 --- a/Koha/Library.pm +++ b/Koha/Library.pm @@ -369,7 +369,8 @@ sub to_api_mapping { branchnotes => 'notes', marcorgcode => 'marc_org_code', opacusercss => undef, - opacuserjs => undef + opacuserjs => undef, + library_color => undef }; } diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 164bc8162b2..3329a9c859b 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) = @_; diff --git a/admin/branches.pl b/admin/branches.pl index b6d55ea9ee1..0d084f26aec 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -98,6 +98,7 @@ if ( $op eq 'add_form' ) { public opacuserjs opacusercss + library_color ); my $is_a_modif = $input->param('is_a_modif'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc index 18b3fe39c1c..564ab68e111 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc @@ -33,3 +33,11 @@ [% IF ( bidi ) %][% ELSE %][% END %] +[% SET library_color = Branches.GetLoggedInBranch.library_color %] +[% IF library_color %] + +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index f1d875fa3eb..0ff4c8a4231 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -368,6 +368,12 @@ +
  • + + + + Clear +
  • [% IF additional_fields.size %] @@ -609,6 +615,10 @@ Library hours not set [% END %] +
  • + Library color + [% library.library_color | html %] +
  • @@ -880,6 +890,15 @@ } $( "#" + target ).hide(); }); + $("#colorpicker").on("change", function(){ + let library_color = this.value; + $("#library_color").val( library_color ); + }); + + $(".clear_color").on("click", function(e){ + e.preventDefault(); + $("#library_color, #colorpicker").val( "" ); + }); [% END %] -- 2.39.5