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

(-)a/C4/SIP/ILS/Patron.pm (-2 / +20 lines)
Lines 26-35 use C4::Auth qw(checkpw); Link Here
26
use Koha::Items;
26
use Koha::Items;
27
use Koha::Libraries;
27
use Koha::Libraries;
28
use Koha::Patrons;
28
use Koha::Patrons;
29
use Koha::Checkouts;
29
30
30
our $kp;    # koha patron
31
our $kp;    # koha patron
31
32
32
=head1 Methods
33
=head1 METHODS
33
34
34
=cut
35
=cut
35
36
Lines 209-215 my %fields = ( Link Here
209
    too_many_overdue        => 0,   # for patron_status[6]
210
    too_many_overdue        => 0,   # for patron_status[6]
210
    too_many_renewal        => 0,   # for patron_status[7]
211
    too_many_renewal        => 0,   # for patron_status[7]
211
    too_many_claim_return   => 0,   # for patron_status[8]
212
    too_many_claim_return   => 0,   # for patron_status[8]
212
    too_many_lost           => 0,   # for patron_status[9]
213
#   excessive_fines         => 0,   # for patron_status[10]
213
#   excessive_fines         => 0,   # for patron_status[10]
214
#   excessive_fees          => 0,   # for patron_status[11]
214
#   excessive_fees          => 0,   # for patron_status[11]
215
    recall_overdue          => 0,   # for patron_status[12]
215
    recall_overdue          => 0,   # for patron_status[12]
Lines 287-292 sub check_password { Link Here
287
}
287
}
288
288
289
# A few special cases, not in AUTOLOADed %fields
289
# A few special cases, not in AUTOLOADed %fields
290
291
=head2 too_many_lost
292
293
This method checks if number of checkouts of lost items exceeds a threshold (defined in server account).
294
295
=cut
296
297
sub too_many_lost {
298
    my ( $self, $server ) = @_;
299
    my $too_many_lost = 0;
300
    if( $server && $server->{account} && ( my $lost_block_checkout = $server->{account}->{lost_block_checkout} )) {
301
        my $lost_block_checkout_value = $server->{account}->{lost_block_checkout_value} // 1;
302
        my $lost_checkouts = Koha::Checkouts->search({ borrowernumber => $self->borrowernumber, 'itemlost' => { '>=', $lost_block_checkout_value } }, { join => 'item'} )->count;
303
        $too_many_lost = $lost_checkouts >= $lost_block_checkout;
304
    }
305
    return $too_many_lost;
306
}
307
290
sub fee_amount {
308
sub fee_amount {
291
    my $self = shift;
309
    my $self = shift;
292
    if ( $self->{fines} ) {
310
    if ( $self->{fines} ) {
(-)a/C4/SIP/ILS/Patron.pod (-2 / +2 lines)
Lines 41-47 and to display information about the patron's borrowing activity. Link Here
41
	$bool = $patron->too_many_overdue;
41
	$bool = $patron->too_many_overdue;
42
	$bool = $patron->too_many_renewal;
42
	$bool = $patron->too_many_renewal;
43
	$bool = $patron->too_many_claim_return;
43
	$bool = $patron->too_many_claim_return;
44
	$bool = $patron->too_many_lost;
44
	$bool = $patron->too_many_lost( $server );
45
	$bool = $patron->excessive_fines;
45
	$bool = $patron->excessive_fines;
46
	$bool = $patron->excessive_fees;
46
	$bool = $patron->excessive_fees;
47
	$bool = $patron->too_many_billed;
47
	$bool = $patron->too_many_billed;
Lines 149-155 checking if they're authorized to perform various actions: Link Here
149
	$bool = $patron-E<gt>too_many_overdue;
149
	$bool = $patron-E<gt>too_many_overdue;
150
	$bool = $patron-E<gt>too_many_renewal;
150
	$bool = $patron-E<gt>too_many_renewal;
151
	$bool = $patron-E<gt>too_many_claim_return;
151
	$bool = $patron-E<gt>too_many_claim_return;
152
	$bool = $patron-E<gt>too_many_lost;
152
	$bool = $patron-E<gt>too_many_lost( $server );
153
	$bool = $patron-E<gt>excessive_fines;
153
	$bool = $patron-E<gt>excessive_fines;
154
	$bool = $patron-E<gt>excessive_fees;
154
	$bool = $patron-E<gt>excessive_fees;
155
	$bool = $patron-E<gt>too_many_billed;
155
	$bool = $patron-E<gt>too_many_billed;
(-)a/C4/SIP/Sip/MsgType.pm (-9 / +1 lines)
Lines 1717-1729 sub patron_status_string { Link Here
1717
1717
1718
    my $patron_status;
1718
    my $patron_status;
1719
1719
1720
    my $too_many_lost = 0;
1721
    if ( my $lost_block_checkout = $server->{account}->{lost_block_checkout} ) {
1722
        my $lost_block_checkout_value = $server->{account}->{lost_block_checkout_value} // 1;
1723
        my $lost_checkouts = Koha::Checkouts->search({ borrowernumber => $patron->borrowernumber, 'itemlost' => { '>=', $lost_block_checkout_value } }, { join => 'item'} )->count;
1724
        $too_many_lost = $lost_checkouts >= $lost_block_checkout;
1725
    }
1726
1727
    siplog( "LOG_DEBUG", "patron_status_string: %s charge_ok: %s", $patron->id, $patron->charge_ok );
1720
    siplog( "LOG_DEBUG", "patron_status_string: %s charge_ok: %s", $patron->id, $patron->charge_ok );
1728
    $patron_status = sprintf(
1721
    $patron_status = sprintf(
1729
        '%s%s%s%s%s%s%s%s%s%s%s%s%s%s',
1722
        '%s%s%s%s%s%s%s%s%s%s%s%s%s%s',
Lines 1736-1742 sub patron_status_string { Link Here
1736
        $server->{account}->{overdues_block_checkout} ? boolspace( $patron->too_many_overdue ) : q{ },
1729
        $server->{account}->{overdues_block_checkout} ? boolspace( $patron->too_many_overdue ) : q{ },
1737
        boolspace( $patron->too_many_renewal ),
1730
        boolspace( $patron->too_many_renewal ),
1738
        boolspace( $patron->too_many_claim_return ),
1731
        boolspace( $patron->too_many_claim_return ),
1739
        boolspace( $too_many_lost ),
1732
        boolspace( $patron->too_many_lost( $server ) ),
1740
        boolspace( $patron->excessive_fines ),
1733
        boolspace( $patron->excessive_fines ),
1741
        boolspace( $patron->excessive_fees ),
1734
        boolspace( $patron->excessive_fees ),
1742
        boolspace( $patron->recall_overdue ),
1735
        boolspace( $patron->recall_overdue ),
1743
- 

Return to bug 32684