From 6f20f5e6580bd279b326665ef8834810f066fb29 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 14 Oct 2022 10:05:36 +0000 Subject: [PATCH] Bug 31784: (QA follow-up) Snake case for subroutine singleLibraryMode => single_library_mode Test plan: Run t/db_dependent/Koha/Libraries.t Run qa tools. Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- C4/Auth.pm | 2 +- C4/XSLT.pm | 2 +- Koha/Libraries.pm | 6 +++--- opac/opac-reserve.pl | 2 +- t/db_dependent/Koha/Libraries.t | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 2edb5b0ffd..5a619b9681 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -457,7 +457,7 @@ sub get_template_and_user { my $minPasswordLength = C4::Context->preference('minPasswordLength'); $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3; - my $singleLibraryMode = Koha::Libraries->singleLibraryMode; + my $singleLibraryMode = Koha::Libraries->single_library_mode; $template->param( EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'), GoogleJackets => C4::Context->preference("GoogleJackets"), diff --git a/C4/XSLT.pm b/C4/XSLT.pm index feec005349..35e2bba9da 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -107,7 +107,7 @@ sub get_xslt_sysprefs { # singleBranchMode was a system preference, but no longer is # we can retain it here for compatibility - my $singleBranchMode = Koha::Libraries->singleLibraryMode; + my $singleBranchMode = Koha::Libraries->single_library_mode; $sysxml .= "$singleBranchMode\n"; $sysxml .= "\n"; diff --git a/Koha/Libraries.pm b/Koha/Libraries.pm index b4fd772164..933b477f84 100644 --- a/Koha/Libraries.pm +++ b/Koha/Libraries.pm @@ -64,17 +64,17 @@ sub search_filtered { return $self->SUPER::search( $params, $attributes ); } -=head3 singleLibraryMode +=head3 single_library_mode Aka singleBranchMode. - my $boolean = Koha::Libraries->singleLibaryMode; + my $boolean = Koha::Libraries->single_library_mode; Returns 1 if there is only one library marked public. =cut -sub singleLibraryMode { # formerly called singleBranchMode +sub single_library_mode { # formerly called singleBranchMode my $self = shift; if( $self->search({ public => 1 })->count == 1 ) { # Historically we test number==1 instead of number<2 return 1; diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 8e271dd605..752480c838 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -226,7 +226,7 @@ if ( $query->param('place_reserve') ) { my $canreserve = 0; - my $singleBranchMode = Koha::Libraries->singleLibraryMode; + my $singleBranchMode = Koha::Libraries->single_library_mode; if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") ) { # single branch mode or disabled user choosing $branch = $patron->branchcode; diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t index a730de4900..edf40fa8c2 100755 --- a/t/db_dependent/Koha/Libraries.t +++ b/t/db_dependent/Koha/Libraries.t @@ -366,16 +366,16 @@ subtest 'outgoing_transfers' => sub { $schema->storage->txn_rollback; }; -subtest 'singleLibrarymode aka singleBranchMode' => sub { +subtest 'single_library_mode aka singleBranchMode' => sub { plan tests => 3; $schema->storage->txn_begin; Koha::Libraries->new->update({ public => 0 }); - is( Koha::Libraries->singleLibraryMode, 0, 'No public libraries' ); + is( Koha::Libraries->single_library_mode, 0, 'No public libraries' ); my $library1 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } }); - is( Koha::Libraries->singleLibraryMode, 1, 'One public library' ); + is( Koha::Libraries->single_library_mode, 1, 'One public library' ); my $library2 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } }); - is( Koha::Libraries->singleLibraryMode, 0, 'Two public libraries' ); + is( Koha::Libraries->single_library_mode, 0, 'Two public libraries' ); $schema->storage->txn_rollback; }; -- 2.30.2