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 2528-2537
sub MarkIssueReturned {
Link Here
|
2528 |
} |
2528 |
} |
2529 |
|
2529 |
|
2530 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
2530 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
|
|
2531 |
my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); |
2531 |
if ( C4::Context->preference('AutoRemoveOverduesRestrictions') |
2532 |
if ( C4::Context->preference('AutoRemoveOverduesRestrictions') |
2532 |
&& $patron->debarred |
2533 |
&& $patron->debarred |
2533 |
&& !$patron->has_overdues |
2534 |
&& !$patron->has_overdues |
2534 |
&& @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } |
2535 |
&& $overdue_restrictions->count |
2535 |
) { |
2536 |
) { |
2536 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
2537 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
2537 |
} |
2538 |
} |
Lines 2620-2628
sub _calculate_new_debar_dt {
Link Here
|
2620 |
|
2621 |
|
2621 |
my ( $has_been_extended ); |
2622 |
my ( $has_been_extended ); |
2622 |
if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { |
2623 |
if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) { |
2623 |
my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0]; |
2624 |
my $patron = Koha::Patrons->find($borrower->{borrowernumber}); |
|
|
2625 |
my $debarment = $patron->restrictions->search({type => 'SUSPENSION' },{rows => 1})->single; |
2624 |
if ( $debarment ) { |
2626 |
if ( $debarment ) { |
2625 |
$return_date = dt_from_string( $debarment->{expiration}, 'sql' ); |
2627 |
$return_date = dt_from_string( $debarment->expiration, 'sql' ); |
2626 |
$has_been_extended = 1; |
2628 |
$has_been_extended = 1; |
2627 |
} |
2629 |
} |
2628 |
} |
2630 |
} |
Lines 3159-3168
sub AddRenewal {
Link Here
|
3159 |
} |
3161 |
} |
3160 |
|
3162 |
|
3161 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
3163 |
# Remove any OVERDUES related debarment if the borrower has no overdues |
|
|
3164 |
my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' }); |
3162 |
if ( $patron |
3165 |
if ( $patron |
3163 |
&& $patron->is_debarred |
3166 |
&& $patron->is_debarred |
3164 |
&& ! $patron->has_overdues |
3167 |
&& ! $patron->has_overdues |
3165 |
&& @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) } |
3168 |
&& $overdue_restrictions->count |
3166 |
) { |
3169 |
) { |
3167 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
3170 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
3168 |
} |
3171 |
} |
3169 |
- |
|
|