From 3ab45e00f010d1c2210a55f9ff34ae1adb1e6b40 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 5 May 2023 14:55:16 +0100 Subject: [PATCH] Bug 32721: (QA follow-up) Rename fields to opac* This patch updates the field names to reflect that they're OPAC related. Signed-off-by: Martin Renvoize --- Koha/Library.pm | 4 +-- Koha/Template/Plugin/Branches.pm | 16 +++++----- admin/branches.pl | 4 +-- .../bug_32721-add_branch_level_js.pl | 14 ++++---- installer/data/mysql/kohastructure.sql | 4 +-- .../prog/en/modules/admin/branches.tt | 12 +++---- t/db_dependent/Template/Plugin/Branches.t | 32 +++++++++---------- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Koha/Library.pm b/Koha/Library.pm index 078760c167..9987bbc53e 100644 --- a/Koha/Library.pm +++ b/Koha/Library.pm @@ -353,8 +353,8 @@ sub to_api_mapping { branchip => 'ip', branchnotes => 'notes', marcorgcode => 'marc_org_code', - usercss => undef, - userjs => undef + opacusercss => undef, + opacuserjs => undef }; } diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 693c088fe2..7090530f38 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -154,25 +154,25 @@ sub pickup_locations { } sub GetBranchSpecificJS { - my ($self, $branchcode) = @_; + my ( $self, $branchcode ) = @_; return q{} unless defined $branchcode; - my $library = Koha::Libraries->find($branchcode); - my $userjs = $library ? $library->userjs : q{}; + my $library = Koha::Libraries->find($branchcode); + my $opacuserjs = $library ? $library->opacuserjs : q{}; - return $userjs + return $opacuserjs; } sub GetBranchSpecificCSS { - my ($self, $branchcode) = @_; + my ( $self, $branchcode ) = @_; return q{} unless defined $branchcode; - my $library = Koha::Libraries->find($branchcode); - my $usercss = $library ? $library->usercss : q{}; + my $library = Koha::Libraries->find($branchcode); + my $opacusercss = $library ? $library->opacusercss : q{}; - return $usercss + return $opacusercss; } 1; diff --git a/admin/branches.pl b/admin/branches.pl index 2ee0a71760..50e909dfa0 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -81,8 +81,8 @@ if ( $op eq 'add_form' ) { marcorgcode pickup_location public - userjs - usercss + opacuserjs + opacusercss ); my $is_a_modif = $input->param('is_a_modif'); diff --git a/installer/data/mysql/atomicupdate/bug_32721-add_branch_level_js.pl b/installer/data/mysql/atomicupdate/bug_32721-add_branch_level_js.pl index 4471d96eef..d2dddd44c2 100755 --- a/installer/data/mysql/atomicupdate/bug_32721-add_branch_level_js.pl +++ b/installer/data/mysql/atomicupdate/bug_32721-add_branch_level_js.pl @@ -7,19 +7,19 @@ return { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - if( !column_exists( 'branches', 'userjs' ) ) { + if( !column_exists( 'branches', 'opacuserjs' ) ) { $dbh->do(q{ - ALTER TABLE branches ADD COLUMN `userjs` longtext DEFAULT NULL AFTER `public` + ALTER TABLE branches ADD COLUMN `opacuserjs` longtext DEFAULT NULL AFTER `public` }); - say $out "Added column 'branches.userjs'"; + say $out "Added column 'branches.opacuserjs'"; } - if( !column_exists( 'branches', 'usercss' ) ) { + if( !column_exists( 'branches', 'opacusercss' ) ) { $dbh->do(q{ - ALTER TABLE branches ADD COLUMN `usercss` longtext DEFAULT NULL AFTER `userjs` + ALTER TABLE branches ADD COLUMN `opacusercss` longtext DEFAULT NULL AFTER `opacuserjs` }); - say $out "Added column 'branches.usercss'"; + say $out "Added column 'branches.opacusercss'"; } }, -}; \ No newline at end of file +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ef056a326c..6bec95071e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1581,8 +1581,8 @@ CREATE TABLE `branches` ( `marcorgcode` varchar(16) DEFAULT NULL COMMENT 'MARC Organization Code, see http://www.loc.gov/marc/organizations/orgshome.html, when empty defaults to syspref MARCOrgCode', `pickup_location` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'the ability to act as a pickup location', `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac', - `userjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC', - `usercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC', + `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC', + `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC', 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/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 2505ecce79..8b1e38d5c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -280,17 +280,17 @@ Libraries › Administration › Koha
  • - Click to edit - - + Click to edit + +
  • - Click to edit - - + Click to edit + +
  • diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t index 0c37ae0416..163696d190 100755 --- a/t/db_dependent/Template/Plugin/Branches.t +++ b/t/db_dependent/Template/Plugin/Branches.t @@ -227,35 +227,35 @@ subtest 'branch specific js and css' => sub { my $newbranch_with = $builder->build({ source => 'Branch', value => { - userjs => 'console.log(\'Hello World\');', - usercss => 'body { background-color: blue; }' + opacuserjs => 'console.log(\'Hello World\');', + opacusercss => 'body { background-color: blue; }' } }); my $newbranch_none = $builder->build({ source => 'Branch', value => { - userjs => '', - usercss => '' + opacuserjs => '', + opacusercss => '' } }); my $plugin = Koha::Template::Plugin::Branches->new(); - my $userjs = $plugin->GetBranchSpecificJS($newbranch_with->{branchcode}); - is($userjs, $newbranch_with->{userjs},'received correct JS string from function'); + my $opacuserjs = $plugin->GetBranchSpecificJS($newbranch_with->{branchcode}); + is($opacuserjs, $newbranch_with->{opacuserjs},'received correct JS string from function'); - my $usercss = $plugin->GetBranchSpecificCSS($newbranch_with->{branchcode}); - is($usercss, $newbranch_with->{usercss},'received correct CSS string from function'); + my $opacusercss = $plugin->GetBranchSpecificCSS($newbranch_with->{branchcode}); + is($opacusercss, $newbranch_with->{opacusercss},'received correct CSS string from function'); - $userjs = $plugin->GetBranchSpecificJS($newbranch_none->{branchcode}); - $usercss = $plugin->GetBranchSpecificCSS($newbranch_none->{branchcode}); - is($userjs, q{},'received correct blank string from function when branch has none'); - is($usercss, q{},'received correct blank string from function when branch has none'); + $opacuserjs = $plugin->GetBranchSpecificJS($newbranch_none->{branchcode}); + $opacusercss = $plugin->GetBranchSpecificCSS($newbranch_none->{branchcode}); + is($opacuserjs, q{},'received correct blank string from function when branch has none'); + is($opacusercss, q{},'received correct blank string from function when branch has none'); - $userjs = $plugin->GetBranchSpecificJS(); - $usercss = $plugin->GetBranchSpecificCSS(); - is($userjs, q{},'received correct blank string from function when no branch set'); - is($usercss, q{},'received correct blank string from function when no branch set'); + $opacuserjs = $plugin->GetBranchSpecificJS(); + $opacusercss = $plugin->GetBranchSpecificCSS(); + is($opacuserjs, q{},'received correct blank string from function when no branch set'); + is($opacusercss, q{},'received correct blank string from function when no branch set'); $schema->storage->txn_rollback; }; -- 2.40.1