Lines 6-16
use File::Temp qw( :POSIX );
Link Here
|
6 |
use Carp; |
6 |
use Carp; |
7 |
|
7 |
|
8 |
use C4::Templates qw ( gettemplate ); |
8 |
use C4::Templates qw ( gettemplate ); |
9 |
use C4::Members qw( GetPendingIssues ); |
|
|
10 |
|
9 |
|
11 |
use Koha::Database; |
10 |
use Koha::Database; |
12 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
11 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
13 |
use Koha::Patrons; |
12 |
use Koha::Checkouts; |
14 |
|
13 |
|
15 |
sub count { |
14 |
sub count { |
16 |
my ($params) = @_; |
15 |
my ($params) = @_; |
Lines 34-46
sub can_be_discharged {
Link Here
|
34 |
my ($params) = @_; |
33 |
my ($params) = @_; |
35 |
return unless $params->{borrowernumber}; |
34 |
return unless $params->{borrowernumber}; |
36 |
|
35 |
|
37 |
my $issues = GetPendingIssues( $params->{borrowernumber} ); |
36 |
my $patron = Koha::Patrons->find( $params->{borrowernumber} ); |
38 |
if( @$issues ) { |
37 |
return unless $patron; |
39 |
return 0; |
38 |
|
40 |
} |
39 |
my $has_pending_checkouts = $patron->pending_checkouts->count; |
41 |
else { |
40 |
return $has_pending_checkouts ? 0 : 1; |
42 |
return 1; |
|
|
43 |
} |
44 |
} |
41 |
} |
45 |
|
42 |
|
46 |
sub is_discharged { |
43 |
sub is_discharged { |
47 |
- |
|
|