From 0993587827e32d83e6be128bad6b2fb9a254c5d8 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 30 Dec 2024 18:03:32 +0000 Subject: [PATCH] Bug 37054: (follow-up) Rename branchcolor to library_color and use snake casing --- Koha/Library.pm | 2 +- Koha/Template/Plugin/Branches.pm | 6 +++--- admin/branches.pl | 2 +- .../atomicupdate/bug_37054_add_branchcolor.pl | 8 ++++---- installer/data/mysql/kohastructure.sql | 2 +- .../prog/en/includes/doc-head-close.inc | 12 ++++++------ .../prog/en/modules/admin/branches.tt | 14 +++++++------- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Koha/Library.pm b/Koha/Library.pm index 4dc5377f858..361ece2a035 100644 --- a/Koha/Library.pm +++ b/Koha/Library.pm @@ -371,7 +371,7 @@ sub to_api_mapping { marcorgcode => 'marc_org_code', opacusercss => undef, opacuserjs => undef, - branchcolor => undef + library_color => undef }; } diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 53ab7d3053d..566faedfc2c 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -191,15 +191,15 @@ sub GetBranchSpecificCSS { return $opacusercss; } -sub GetBranchColor { +sub get_library_color { my ( $self, $branchcode ) = @_; return q{} unless defined $branchcode; my $library = Koha::Libraries->find($branchcode); - my $branchcolor = $library ? $library->branchcolor : q{}; + my $library_color = $library ? $library->library_color : q{}; - return $branchcolor; + return $library_color; } 1; diff --git a/admin/branches.pl b/admin/branches.pl index 32f58d55365..497efa5c31c 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -84,7 +84,7 @@ if ( $op eq 'add_form' ) { public opacuserjs opacusercss - branchcolor + library_color ); my $is_a_modif = $input->param('is_a_modif'); diff --git a/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl b/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl index 8bb54539bc5..df3e090cd17 100755 --- a/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl +++ b/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl @@ -3,21 +3,21 @@ use Koha::Installer::Output qw(say_warning say_failure say_success say_info); return { bug_number => "37054", - description => "Add branches.branchcolor", + description => "Add branches.library_color", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; - if ( !column_exists( 'branches', 'branchcolor' ) ) { + if ( !column_exists( 'branches', 'library_color' ) ) { $dbh->do( q{ ALTER TABLE branches - ADD COLUMN `branchcolor` varchar(16) DEFAULT 0 COMMENT 'defines the branch color' + ADD COLUMN `library_color` varchar(16) DEFAULT 0 COMMENT 'defines the library color' AFTER `opacusercss` } ); } - say $out "Added column 'branch.branchcolor'"; + say $out "Added column 'branch.library_color'"; }, }; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 738ed8968ea..ab89b48086e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1677,7 +1677,7 @@ CREATE TABLE `branches` ( `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac', `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC', `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC', - `branchcolor` varchar(16) DEFAULT NULL COMMENT 'branch specific color', + `library_color` varchar(16) DEFAULT NULL COMMENT 'library specific color', PRIMARY KEY (`branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; 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 e229e7ab9e6..5d213da393e 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,23 +51,23 @@ var Koha = {}; [% IF ( login ) %] [% Asset.css("css/login.css") | $raw %] [% END %] -[% SET branchcolor = Branches.GetBranchColor( Branches.GetLoggedInBranchcode() ) %] -[% IF branchcolor %] +[% SET library_color = Branches.get_library_color( Branches.GetLoggedInBranchcode() ) %] +[% IF library_color %] 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 28cabc4b2ab..4e95e811486 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -368,8 +368,8 @@
  • - - + + Clear
  • @@ -605,8 +605,8 @@ [% END %]
  • - Branch color - [% library.branchcolor | html %] + Library color + [% library.library_color | html %]
  • @@ -879,13 +879,13 @@ }); $("#colorpicker").on("change", function(){ - let branchcolor = this.value; - $("#branchcolor").val( branchcolor ); + let library_color = this.value; + $("#library_color").val( library_color ); }); $(".clear_color").on("click", function(e){ e.preventDefault(); - $("#branchcolor, #colorpicker").val( "" ); + $("#library_color, #colorpicker").val( "" ); }); [% END %] -- 2.39.2