From b8e4a98210fcb87f38de4ef9183c1dfbe5bf1806 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 11 Oct 2023 12:01:14 -0300 Subject: [PATCH] Bug 16223: Tidy --- Koha/Account/Line.pm | 2 +- Koha/Patron/Debarments.pm | 9 ++++----- admin/restrictions.pl | 20 +++++++++++--------- t/db_dependent/Patron/Borrower_Debarments.t | 8 ++++---- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 0c35d497cb2..4cd914d9b76 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -700,7 +700,7 @@ sub apply { } }); - Koha::Patron::Debarments::del_restrictions_after_payment({ borrowernumber => $self->borrowernumber }); + Koha::Patron::Debarments::del_restrictions_after_payment( { borrowernumber => $self->borrowernumber } ); return $self; } diff --git a/Koha/Patron/Debarments.pm b/Koha/Patron/Debarments.pm index f8c5ca0cf76..e866dc2ea74 100644 --- a/Koha/Patron/Debarments.pm +++ b/Koha/Patron/Debarments.pm @@ -274,9 +274,9 @@ sub UpdateBorrowerDebarmentFlags { =head2 del_restrictions_after_payment -my $success = del_restrictions_after_payment({ - borrowernumber => $borrowernumber, -}); + my $success = del_restrictions_after_payment({ + borrowernumber => $borrowernumber, + }); Deletes any restrictions from patron by following the rules defined in "Patron restrictions". @@ -295,8 +295,7 @@ sub del_restrictions_after_payment { my $restrictions = $patron->restrictions; return unless ( $restrictions->count ); - my $lines = - Koha::Account::Lines->search( { borrowernumber => $borrowernumber } ); + my $lines = Koha::Account::Lines->search( { borrowernumber => $borrowernumber } ); my $total_due = $lines->total_outstanding; while ( my $restriction = $restrictions->next ) { diff --git a/admin/restrictions.pl b/admin/restrictions.pl index 48313316990..8b3a1640361 100755 --- a/admin/restrictions.pl +++ b/admin/restrictions.pl @@ -53,10 +53,10 @@ if ( $op eq 'add_form') { } } elsif ( $op eq 'add_validate' ) { - my $display_text = $input->param('display_text'); + my $display_text = $input->param('display_text'); my $lift_after_payment = $input->param('lift_after_payment'); - my $fee_limit = $input->param('fee_limit'); - my $is_a_modif = $input->param("is_a_modif"); + my $fee_limit = $input->param('fee_limit'); + my $is_a_modif = $input->param("is_a_modif"); if ($is_a_modif) { # Check whether another restriction already has this display text @@ -86,12 +86,14 @@ if ( $op eq 'add_form') { type => 'error', code => 'duplicate_code' }; } else { - my $restriction = Koha::Patron::Restriction::Type->new({ - code => $code, - display_text => $display_text, - lift_after_payment => $lift_after_payment, - fee_limit => $fee_limit - }); + my $restriction = Koha::Patron::Restriction::Type->new( + { + code => $code, + display_text => $display_text, + lift_after_payment => $lift_after_payment, + fee_limit => $fee_limit + } + ); $restriction->store; push @messages, { type => 'message', code => 'add_success' }; } diff --git a/t/db_dependent/Patron/Borrower_Debarments.t b/t/db_dependent/Patron/Borrower_Debarments.t index e97ef48a5ed..7887332f092 100755 --- a/t/db_dependent/Patron/Borrower_Debarments.t +++ b/t/db_dependent/Patron/Borrower_Debarments.t @@ -262,7 +262,7 @@ my $patron4 = Koha::Patron->new( )->store; my $account = $patron4->account; -my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 10, interface => 'commandline' }); +my $line1 = $account->add_debit( { type => 'ACCOUNT', amount => 10, interface => 'commandline' } ); Koha::Patron::Debarments::AddDebarment( { @@ -286,11 +286,11 @@ $restrictions = $patron4->restrictions; is( $restrictions->count, 2, "->restrictions returns 2 restrictions before payment" ); -$account->pay({amount => 5}); +$account->pay( { amount => 5 } ); $restrictions = $patron4->restrictions; -is( $restrictions->count, 1, "->restrictions returns 1 restriction after paying half of the fee" ); +is( $restrictions->count, 1, "->restrictions returns 1 restriction after paying half of the fee" ); is( $restrictions->next->type->code, "TEST2", "Restriction left has type value 'TEST2'" ); -$account->pay({amount => 5}); +$account->pay( { amount => 5 } ); $restrictions = $patron4->restrictions; is( $restrictions->count, 0, "->restrictions returns 0 restrictions after paying all fees" ); -- 2.42.0