Bugzilla – Attachment 156850 Details for
Bug 16223
Automatically remove any borrower debarments after a payment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16223: Tidy
Bug-16223-Tidy.patch (text/plain), 4.83 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-10-11 15:11:20 UTC
(
hide
)
Description:
Bug 16223: Tidy
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-10-11 15:11:20 UTC
Size:
4.83 KB
patch
obsolete
>From b8e4a98210fcb87f38de4ef9183c1dfbe5bf1806 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16223
:
50078
|
50084
|
99697
|
99698
|
104399
|
104400
|
114272
|
114273
|
118526
|
118572
|
118574
|
118575
|
122768
|
122769
|
127252
|
128005
|
132284
|
132285
|
132286
|
132287
|
143388
|
143389
|
143390
|
143462
|
143670
|
143671
|
143672
|
143688
|
143689
|
143690
|
143765
|
143766
|
143767
|
143768
|
143769
|
143770
|
143936
|
146051
|
146052
|
146053
|
146054
|
146055
|
146056
|
146057
|
148307
|
148308
|
148309
|
148310
|
148311
|
148312
|
148313
|
150024
|
150025
|
150026
|
150027
|
150028
|
150029
|
153024
|
153025
|
153026
|
153027
|
153028
|
153029
|
155644
|
155645
|
155646
|
155647
|
155648
|
155649
|
155650
|
156841
|
156842
|
156843
|
156844
|
156845
|
156846
|
156847
|
156848
|
156849
| 156850