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 2540-2549 sub MarkIssueReturned { Link Here
2540
        }
2540
        }
2541
2541
2542
        # Remove any OVERDUES related debarment if the borrower has no overdues
2542
        # Remove any OVERDUES related debarment if the borrower has no overdues
2543
        my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' });
2543
        if ( C4::Context->preference('AutoRemoveOverduesRestrictions')
2544
        if ( C4::Context->preference('AutoRemoveOverduesRestrictions')
2544
          && $patron->debarred
2545
          && $patron->debarred
2545
          && !$patron->has_overdues
2546
          && !$patron->has_overdues
2546
          && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
2547
          && $overdue_restrictions->count
2547
        ) {
2548
        ) {
2548
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2549
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
2549
        }
2550
        }
Lines 2632-2640 sub _calculate_new_debar_dt { Link Here
2632
2633
2633
        my ( $has_been_extended );
2634
        my ( $has_been_extended );
2634
        if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) {
2635
        if ( C4::Context->preference('CumulativeRestrictionPeriods') and $borrower->{debarred} ) {
2635
            my $debarment = @{ GetDebarments( { borrowernumber => $borrower->{borrowernumber}, type => 'SUSPENSION' } ) }[0];
2636
            my $patron = Koha::Patrons->find($borrower->{borrowernumber});
2637
            my $debarment = $patron->restrictions->search({type => 'SUSPENSION' },{rows => 1})->single;
2636
            if ( $debarment ) {
2638
            if ( $debarment ) {
2637
                $return_date = dt_from_string( $debarment->{expiration}, 'sql' );
2639
                $return_date = dt_from_string( $debarment->expiration, 'sql' );
2638
                $has_been_extended = 1;
2640
                $has_been_extended = 1;
2639
            }
2641
            }
2640
        }
2642
        }
Lines 3171-3180 sub AddRenewal { Link Here
3171
        }
3173
        }
3172
3174
3173
        # Remove any OVERDUES related debarment if the borrower has no overdues
3175
        # Remove any OVERDUES related debarment if the borrower has no overdues
3176
        my $overdue_restrictions = $patron->restrictions->search({ type => 'OVERDUES' });
3174
        if ( $patron
3177
        if ( $patron
3175
          && $patron->is_debarred
3178
          && $patron->is_debarred
3176
          && ! $patron->has_overdues
3179
          && ! $patron->has_overdues
3177
          && @{ GetDebarments({ borrowernumber => $borrowernumber, type => 'OVERDUES' }) }
3180
          && $overdue_restrictions->count
3178
        ) {
3181
        ) {
3179
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3182
            DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
3180
        }
3183
        }
3181
- 

Return to bug 31095