Lines 48-54
use Koha::Checkouts;
Link Here
|
48 |
use Koha::Illrequests; |
48 |
use Koha::Illrequests; |
49 |
use Koha::Items; |
49 |
use Koha::Items; |
50 |
use Koha::Patrons; |
50 |
use Koha::Patrons; |
51 |
use Koha::Patron::Debarments qw( DelUniqueDebarment GetDebarments AddUniqueDebarment ); |
51 |
use Koha::Patron::Debarments qw( DelUniqueDebarment AddUniqueDebarment ); |
52 |
use Koha::Database; |
52 |
use Koha::Database; |
53 |
use Koha::Libraries; |
53 |
use Koha::Libraries; |
54 |
use Koha::Account::Lines; |
54 |
use Koha::Account::Lines; |
Lines 2534-2543
sub MarkIssueReturned {
Link Here
|
2534 |
} |
2534 |
} |
2535 |
|
2535 |
|
2536 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
2536 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
|
|
2537 |
my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); |
2537 |
if ( C4::Context->preference('AutoRemoveOverduesRestrictions') |
2538 |
if ( C4::Context->preference('AutoRemoveOverduesRestrictions') |
2538 |
&& $patron->debarred |
2539 |
&& $patron->debarred |
2539 |
&& !$patron->has_overdues |
2540 |
&& !$patron->has_overdues |
2540 |
&& @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } |
2541 |
&& $overdue_restrictions->count |
2541 |
) { |
2542 |
) { |
2542 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
2543 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
2543 |
} |
2544 |
} |
Lines 2626-2634
sub _calculate_new_debar_dt {
Link Here
|
2626 |
|
2627 |
|
2627 |
my ( $has_been_extended ); |
2628 |
my ( $has_been_extended ); |
2628 |
if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { |
2629 |
if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { |
2629 |
my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0]; |
2630 |
my $patron = Koha::Patrons->find($borrower->{borrowernumber}); |
|
|
2631 |
my $debarment = $patron->restrictions->search({type => 'SUSPENSION' },{rows => 1})->single; |
2630 |
if ( $debarment ) { |
2632 |
if ( $debarment ) { |
2631 |
$return_date = dt_from_string( $debarment->{expiration}, 'sql' ); |
2633 |
$return_date = dt_from_string( $debarment->expiration, 'sql' ); |
2632 |
$has_been_extended = 1; |
2634 |
$has_been_extended = 1; |
2633 |
} |
2635 |
} |
2634 |
} |
2636 |
} |
Lines 3165-3174
sub AddRenewal {
Link Here
|
3165 |
} |
3167 |
} |
3166 |
|
3168 |
|
3167 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
3169 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
|
|
3170 |
my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); |
3168 |
if ( $patron |
3171 |
if ( $patron |
3169 |
&& $patron->is_debarred |
3172 |
&& $patron->is_debarred |
3170 |
&& ! $patron->has_overdues |
3173 |
&& ! $patron->has_overdues |
3171 |
&& @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } |
3174 |
&& $overdue_restrictions->count |
3172 |
) { |
3175 |
) { |
3173 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
3176 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
3174 |
} |
3177 |
} |
3175 |
- |
|
|