From be0738fa366fc38a6a5df741d26a9c045e33b62b Mon Sep 17 00:00:00 2001 From: Lisette Scheer Date: Fri, 20 Jun 2025 20:19:51 +0000 Subject: [PATCH] Bug 20644: (QA follow-up) Remove duplicate variable I removed a duplicate variable and tidied. --- Koha/Patron.pm | 2 +- admin/itemtypes.pl | 1 - .../prog/en/modules/admin/itemtypes.tt | 18 ++--- t/db_dependent/Patron/Borrower_PrevCheckout.t | 71 ++++++++++--------- 4 files changed, 48 insertions(+), 44 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 7fd2b7ab1ca..27b01a3a482 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -828,7 +828,7 @@ Return 1 if Koha needs to perform PrevIssue checking, else 0. =cut sub wants_check_for_previous_checkout { - my ($self, $item) = @_; + my ( $self, $item ) = @_; my $syspref = C4::Context->preference("checkPrevCheckout"); # Simple cases diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 172fe249b19..1acc49bdd5b 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -99,7 +99,6 @@ if ( $op eq 'add_form' ) { my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0; my $automatic_checkin = $input->param('automatic_checkin') // 0; my $bookable = $input->param('bookable') // 0; - my $automatic_checkin = $input->param('automatic_checkin') // 0; my $checkprevcheckout = $input->param('checkprevcheckout'); if ( $itemtype and $is_a_modif ) { # it's a modification diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 585ad224ed2..f442006b24a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -362,17 +362,17 @@ diff --git a/t/db_dependent/Patron/Borrower_PrevCheckout.t b/t/db_dependent/Patron/Borrower_PrevCheckout.t index c8d3ab0fc55..ac9b0548766 100755 --- a/t/db_dependent/Patron/Borrower_PrevCheckout.t +++ b/t/db_dependent/Patron/Borrower_PrevCheckout.t @@ -49,26 +49,32 @@ my $inheritCatCode = $builder->build( } ); -my $yesItypeCode = $builder->build_object({ - class => 'Koha::ItemTypes', - value => { - checkprevcheckout => 'yes', +my $yesItypeCode = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { + checkprevcheckout => 'yes', + } } -}); +); -my $noItypeCode = $builder->build_object({ - class => 'Koha::ItemTypes', - value => { - checkprevcheckout => 'no', +my $noItypeCode = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { + checkprevcheckout => 'no', + } } -}); +); -my $inheritItypeCode = $builder->build_object({ - class => 'Koha::ItemTypes', - value => { - checkprevcheckout => 'inherit', +my $inheritItypeCode = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { + checkprevcheckout => 'inherit', + } } -}); +); # Create context for some tests late on in the file. my $library = $builder->build( { source => 'Branch' } ); @@ -235,7 +241,6 @@ map { } @{ $_->{categories} }; } @{$mappings}; - # wants_check_for_previous_checkout # We want to test the subroutine by passing the $item parameter @@ -288,29 +293,29 @@ map { # | Expected Result | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | my $itypeCode = { - 'yes' => $yesItypeCode->itemtype, - 'no' => $noItypeCode->itemtype, + 'yes' => $yesItypeCode->itemtype, + 'no' => $noItypeCode->itemtype, 'inherit' => $inheritItypeCode->itemtype, }; -foreach my $syspref ('hardyes','softyes','softno','hardno'){ +foreach my $syspref ( 'hardyes', 'softyes', 'softno', 'hardno' ) { t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref ); - foreach my $itemtype_setting ('yes','no','inherit'){ #itemtype Setting - my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } ); - foreach my $categorie_settings('yes','no','inherit'){ + foreach my $itemtype_setting ( 'yes', 'no', 'inherit' ) { #itemtype Setting + my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } ); + foreach my $categorie_settings ( 'yes', 'no', 'inherit' ) { my $catCode = $categorie_settings . 'Cat'; - foreach my $patron_setting('yes','no','inherit'){ + foreach my $patron_setting ( 'yes', 'no', 'inherit' ) { my $result = undef; - $result = 1 if($syspref eq 'hardyes'); - $result = 0 if($syspref eq 'hardno'); - $result = 1 if(!defined $result && $itemtype_setting eq 'yes'); - $result = 0 if(!defined $result && $itemtype_setting eq 'no'); - $result = 1 if(!defined $result && $patron_setting eq 'yes'); - $result = 0 if(!defined $result && $patron_setting eq 'no'); - $result = 1 if(!defined $result && $categorie_settings eq 'yes'); - $result = 0 if(!defined $result && $categorie_settings eq 'no'); - $result = 1 if(!defined $result && $syspref eq 'softyes'); - $result = 0 if(!defined $result && $syspref eq 'softno'); + $result = 1 if ( $syspref eq 'hardyes' ); + $result = 0 if ( $syspref eq 'hardno' ); + $result = 1 if ( !defined $result && $itemtype_setting eq 'yes' ); + $result = 0 if ( !defined $result && $itemtype_setting eq 'no' ); + $result = 1 if ( !defined $result && $patron_setting eq 'yes' ); + $result = 0 if ( !defined $result && $patron_setting eq 'no' ); + $result = 1 if ( !defined $result && $categorie_settings eq 'yes' ); + $result = 0 if ( !defined $result && $categorie_settings eq 'no' ); + $result = 1 if ( !defined $result && $syspref eq 'softyes' ); + $result = 0 if ( !defined $result && $syspref eq 'softno' ); my $kpatron = $builder->build( { source => 'Borrower', -- 2.39.5