Bug 16223: Tidy

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2023-10-11 12:01:14 -03:00
parent 693b52f5aa
commit d4da5419dc
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
4 changed files with 20 additions and 19 deletions

View File

@ -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;
}

View File

@ -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 ) {

View File

@ -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' };
}

View File

@ -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" );