|
Lines 27-32
use C4::Auth qw(checkpw);
Link Here
|
| 27 |
use Koha::Items; |
27 |
use Koha::Items; |
| 28 |
use Koha::Libraries; |
28 |
use Koha::Libraries; |
| 29 |
use Koha::Patrons; |
29 |
use Koha::Patrons; |
|
|
30 |
use Date::Calc qw/Today Date_to_Days/; |
| 31 |
use Koha::DateUtils; |
| 32 |
|
| 30 |
|
33 |
|
| 31 |
our $kp; # koha patron |
34 |
our $kp; # koha patron |
| 32 |
|
35 |
|
|
Lines 49-63
sub new {
Link Here
|
| 49 |
my $pw = $kp->{password}; |
52 |
my $pw = $kp->{password}; |
| 50 |
my $flags = C4::Members::patronflags( $kp ); |
53 |
my $flags = C4::Members::patronflags( $kp ); |
| 51 |
my $debarred = $patron->is_debarred; |
54 |
my $debarred = $patron->is_debarred; |
|
|
55 |
my $expired = 0; |
| 52 |
$debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here? |
56 |
$debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here? |
| 53 |
my ($day, $month, $year) = (localtime)[3,4,5]; |
57 |
if ( $kp->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) { |
| 54 |
my $today = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day; |
58 |
my ( $today_year, $today_month, $today_day) = Today(); |
| 55 |
my $expired = ($today gt $kp->{dateexpiry}) ? 1 : 0; |
59 |
my ($warning_year, $warning_month, $warning_day) = split /-/, $kp->{'dateexpiry'}; |
| 56 |
if ($expired) { |
60 |
my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day ); |
| 57 |
if ($kp->{opacnote} ) { |
61 |
my $dt = dt_from_string( $kp->{'dateexpiry'}, 'iso' ); |
| 58 |
$kp->{opacnote} .= q{ }; |
62 |
my $dateexpiry = output_pref({ dt => $dt, dateonly => 1}); |
|
|
63 |
if ( $days_to_expiry < 0 ) { |
| 64 |
#borrower card has expired, warn the borrower |
| 65 |
if ($kp->{opacnote} ) { |
| 66 |
$kp->{opacnote} .= q{ }; |
| 67 |
} |
| 68 |
$kp->{opacnote} .= "Your account has expired as of $dateexpiry"; |
| 69 |
$expired = 1; |
| 70 |
} elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) { |
| 71 |
# borrower card soon to expire, warn the borrower |
| 72 |
if ($kp->{opacnote} ) { |
| 73 |
$kp->{opacnote} .= q{ }; |
| 74 |
} |
| 75 |
$kp->{opacnote} .= "Your card will expire on $dateexpiry"; |
| 59 |
} |
76 |
} |
| 60 |
$kp->{opacnote} .= 'PATRON EXPIRED'; |
|
|
| 61 |
} |
77 |
} |
| 62 |
my %ilspatron; |
78 |
my %ilspatron; |
| 63 |
my $adr = _get_address($kp); |
79 |
my $adr = _get_address($kp); |
| 64 |
- |
|
|