View | Details | Raw Unified | Return to bug 31095
Collapse All | Expand All

(-)a/C4/Circulation.pm (-6 / +8 lines)
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 2529-2538 sub MarkIssueReturned { Link Here
2529
        }
2529
        }
2530
2530
2531
        # Remove any OVERDUES related debarment if the borrower has no overdues
2531
        # Remove any OVERDUES related debarment if the borrower has no overdues
2532
        my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' });
2532
        if ( C4::Context->preference('AutoRemoveOverduesRestrictions')
2533
        if ( C4::Context->preference('AutoRemoveOverduesRestrictions')
2533
          && $patron->debarred
2534
          && $patron->debarred
2534
          && !$patron->has_overdues
2535
          && !$patron->has_overdues
2535
          && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
2536
          && $overdue_restrictions->count
2536
        ) {
2537
        ) {
2537
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2538
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2538
        }
2539
        }
Lines 2621-2629 sub _calculate_new_debar_dt { Link Here
2621
2622
2622
        my ( $has_been_extended );
2623
        my ( $has_been_extended );
2623
        if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) {
2624
        if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) {
2624
            my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0];
2625
            my $patron = Koha::Patrons->find($borrower->{borrowernumber});
2626
            my $debarment = $patron->restrictions->search({type => 'SUSPENSION' },{rows => 1})->single;
2625
            if ( $debarment ) {
2627
            if ( $debarment ) {
2626
                $return_date = dt_from_string( $debarment->{expiration}, 'sql' );
2628
                $return_date = dt_from_string( $debarment->expiration, 'sql' );
2627
                $has_been_extended = 1;
2629
                $has_been_extended = 1;
2628
            }
2630
            }
2629
        }
2631
        }
Lines 3210-3219 sub AddRenewal { Link Here
3210
        }
3212
        }
3211
3213
3212
        # Remove any OVERDUES related debarment if the borrower has no overdues
3214
        # Remove any OVERDUES related debarment if the borrower has no overdues
3215
        my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' });
3213
        if ( $patron
3216
        if ( $patron
3214
          && $patron->is_debarred
3217
          && $patron->is_debarred
3215
          && ! $patron->has_overdues
3218
          && ! $patron->has_overdues
3216
          && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
3219
          && $overdue_restrictions->count
3217
        ) {
3220
        ) {
3218
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3221
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3219
        }
3222
        }
3220
- 

Return to bug 31095