From 40bb3700e4cffedf2a0701f39df35901a3a8e776 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 5 Jan 2011 15:35:51 +0100 Subject: [PATCH] Bug 6097: Overdue_notices : when no letter debarred action not done When No letter in overduerules, if action is debarr... Then the member would not be debarred This patch fixes that --- misc/cronjobs/overdue_notices.pl | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index ba7cba8..76607e1 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -412,11 +412,6 @@ END_SQL : ($MAX) ); # issues being more than maxdays late are managed somewhere else. (borrower probably suspended) - if ( !$overdue_rules->{"letter$i"} ) { - $verbose and warn "No letter$i code for branch '$branchcode'"; - next PERIOD; - } - # $letter->{'content'} is the text of the mail that is sent. # this text contains fields that are replaced by their value. Those fields must be written between brackets # The following fields are available : @@ -457,6 +452,17 @@ END_SQL $address1, $address2, $city, $postcode, $country, $email, $longest_issue ) = $sth->fetchrow ) { + if ( $overdue_rules->{"debarred$i"} ) { + + #action taken is debarring + C4::Members::DebarMember( $borrowernumber, '9999-12-31' ); + $verbose and warn "debarring $borrowernumber $firstname $lastname\n"; + } + if ( !$overdue_rules->{"letter$i"} ) { + $verbose and warn "No letter$i code for branch '$branchcode'"; + next PERIOD; + } + $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i."; my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} ); @@ -469,12 +475,6 @@ END_SQL next PERIOD; } - if ( $overdue_rules->{"debarred$i"} ) { - - #action taken is debarring - C4::Members::DebarMember($borrowernumber); - $verbose and warn "debarring $borrowernumber $firstname $lastname\n"; - } my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays )); $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber, mindays = $mindays, maxdays = $maxdays"; $sth2->execute(@params); -- 1.7.4.1