From 9b97ff0429e2aa86038ba0770d1bb4be15f22309 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 17 Oct 2022 10:14:43 -0300 Subject: [PATCH] Bug 31784: (QA follow-up) Cleanup This patch makes use of a ternary operator to simplify the code, and removes references to renamed things. Signed-off-by: Tomas Cohen Arazi --- Koha/Libraries.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Koha/Libraries.pm b/Koha/Libraries.pm index 933b477f847..7e22f84ec87 100644 --- a/Koha/Libraries.pm +++ b/Koha/Libraries.pm @@ -66,20 +66,17 @@ sub search_filtered { =head3 single_library_mode - Aka singleBranchMode. - my $boolean = Koha::Libraries->single_library_mode; - Returns 1 if there is only one library marked public. +Returns 1 if there is only one library marked public. =cut -sub single_library_mode { # formerly called singleBranchMode +sub single_library_mode { my $self = shift; - if( $self->search({ public => 1 })->count == 1 ) { # Historically we test number==1 instead of number<2 - return 1; - } - return 0; + + # Historically we test number==1 instead of number<2 + return $self->search({ public => 1 })->count == 1 ? 1 : 0; } =head3 type -- 2.34.1