|
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 35-47
sub can_be_discharged {
Link Here
|
| 35 |
my ($params) = @_; |
34 |
my ($params) = @_; |
| 36 |
return unless $params->{borrowernumber}; |
35 |
return unless $params->{borrowernumber}; |
| 37 |
|
36 |
|
| 38 |
my $issues = GetPendingIssues( $params->{borrowernumber} ); |
37 |
my $patron = Koha::Patrons->find( $params->{borrowernumber} ); |
| 39 |
if( @$issues ) { |
38 |
return unless $patron; |
| 40 |
return 0; |
39 |
|
| 41 |
} |
40 |
my $has_pending_checkouts = $patron->pending_checkouts->count; |
| 42 |
else { |
41 |
return $has_pending_checkouts ? 0 : 1; |
| 43 |
return 1; |
|
|
| 44 |
} |
| 45 |
} |
42 |
} |
| 46 |
|
43 |
|
| 47 |
sub is_discharged { |
44 |
sub is_discharged { |
| 48 |
- |
|
|