From a3e7bfe449dda6d15d2c15df22fe3d84dd0302e3 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 7 Nov 2023 10:25:18 +0000 Subject: [PATCH] Bug 35263: (QA follow-up) Update code Thank you Jonathan. I first tried with '||' but it would fallback to 1 for either undef or 0 (we want the first case, but not the second). But using '//' instead, it only falls back to 1 if undef, and not when 0. Today I learned between '||' and '//'! Thanks! From perldoc.perl.org (relating to '//'): 'In fact, it's exactly the same as ||, except that it tests the left hand side's definedness instead of its truth.' --- admin/categories.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/categories.pl b/admin/categories.pl index 1485e5b60f..8b436f7463 100755 --- a/admin/categories.pl +++ b/admin/categories.pl @@ -72,7 +72,7 @@ elsif ( $op eq 'add_validate' ) { my $category_type = $input->param('category_type'); my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); my $checkPrevCheckout = $input->param('checkprevcheckout'); - my $can_place_ill_in_opac = defined $input->param('can_place_ill_in_opac') ? $input->param('can_place_ill_in_opac') : 1; + my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1; my $default_privacy = $input->param('default_privacy'); my $reset_password = $input->param('reset_password'); my $change_password = $input->param('change_password'); -- 2.30.2