Bugzilla – Attachment 50084 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: Enable regex match for rules of debarment removals
Bug-16223-Enable-regex-match-for-rules-of-debarmen.patch (text/plain), 4.18 KB, created by
Lari Taskula
on 2016-04-08 13:49:40 UTC
(
hide
)
Description:
Bug 16223: Enable regex match for rules of debarment removals
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2016-04-08 13:49:40 UTC
Size:
4.18 KB
patch
obsolete
>From 2e0e9e45f776724da05faf3928ab5d4c11e8dd38 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Fri, 8 Apr 2016 13:26:26 +0000 >Subject: [PATCH] Bug 16223: Enable regex match for rules of debarment removals > >--- > Koha/Patron/Debarments.pm | 36 +++++++++++++--------- > .../prog/en/modules/admin/preferences/patrons.pref | 9 +++--- > 2 files changed, 26 insertions(+), 19 deletions(-) > >diff --git a/Koha/Patron/Debarments.pm b/Koha/Patron/Debarments.pm >index 3394bcd..7413df5 100644 >--- a/Koha/Patron/Debarments.pm >+++ b/Koha/Patron/Debarments.pm >@@ -311,22 +311,28 @@ sub DelDebarmentsAfterPayment { > my ( $total_due, $accts, $numaccts ) = C4::Members::GetMemberAccountRecords($borrowernumber); > > foreach my $debarment (@{ $debarments }){ >- if (exists $liftDebarmentRules->{$debarment->{'comment'}}) { >- # Delete debarment IF: >- # 1. there is no maximum outstanding fines defined for the liftDebarmentRule >- # and there is no outstanding fines. >- # 2. there is a maximum outstanding fines amount defined >- # and total_due is smaller or equal than the defined maximum outstanding amount >- # Otherwise, do not lift the debarment. >- if (not defined $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}){ >- if ($total_due <= 0) { >- DelDebarment($debarment->{'borrower_debarment_id'}); >- } >+ my $rule; >+ >+ foreach my $liftRule (keys $liftDebarmentRules){ >+ my $comment = $debarment->{'comment'}; >+ $rule = $liftRule if $comment =~ $liftRule; >+ } >+ next unless $rule; >+ >+ # Delete debarment IF: >+ # 1. there is no maximum outstanding fines defined for the liftDebarmentRule >+ # and there is no outstanding fines. >+ # 2. there is a maximum outstanding fines amount defined >+ # and total_due is smaller or equal than the defined maximum outstanding amount >+ # Otherwise, do not lift the debarment. >+ if (not defined $liftDebarmentRules->{$rule}->{'outstanding'}){ >+ if ($total_due <= 0) { >+ DelDebarment($debarment->{'borrower_debarment_id'}); > } >- else { >- if ($total_due <= $liftDebarmentRules->{$debarment->{'comment'}}->{'outstanding'}) { >- DelDebarment($debarment->{'borrower_debarment_id'}); >- } >+ } >+ else { >+ if ($total_due <= $liftDebarmentRules->{$rule}->{'outstanding'}) { >+ DelDebarment($debarment->{'borrower_debarment_id'}); > } > } > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index b1aac70..9c1937b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -53,13 +53,14 @@ Patrons: > - pref: DebarmentsToLiftAfterPayment > type: textarea > class: code >- - Lift these debarments after Borrower has paid his/her fees >- - "<p>Example, debarment is lifted after all fees are paid:</p>" >+ - Lift these debarments after Borrower has paid his/her fees. Matches dynamic content in debarment comment. >+ - "<p>Example, debarments with comment (either exact match or dynamic content, e.g. 'Debarment message for Patron 123') that match 'Debarment message' are lifted after all fees are paid:</p>" > - "<pre>Debarment message:</pre> > <pre> outstanding: 0</pre>" >- - "<p>Example, debarment is lifted after payment with outstanding fees less or equal than 5:</p>" >- - "<pre>Another debarment:</pre> >+ - "<p>Example, debarment with message of exactly 'Debarment message' is lifted after payment with outstanding fees less or equal than 5:</p>" >+ - "<pre>^Debarment message$:</pre> > <pre> outstanding: 5.00</pre>" >+ - You can use regex in the definitions to match your needs. > - > - pref: EnhancedMessagingPreferences > choices: >-- >1.9.1
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