Lines 32-37
use Koha::Account;
Link Here
|
32 |
use Koha::ArticleRequests; |
32 |
use Koha::ArticleRequests; |
33 |
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); |
33 |
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); |
34 |
use Koha::AuthUtils; |
34 |
use Koha::AuthUtils; |
|
|
35 |
use Koha::Caches; |
35 |
use Koha::Checkouts; |
36 |
use Koha::Checkouts; |
36 |
use Koha::CirculationRules; |
37 |
use Koha::CirculationRules; |
37 |
use Koha::Club::Enrollments; |
38 |
use Koha::Club::Enrollments; |
Lines 998-1020
sub has_overdues {
Link Here
|
998 |
return $self->_result->issues->search({ date_due => { '<' => $dtf->format_datetime( dt_from_string() ) } })->count; |
999 |
return $self->_result->issues->search({ date_due => { '<' => $dtf->format_datetime( dt_from_string() ) } })->count; |
999 |
} |
1000 |
} |
1000 |
|
1001 |
|
1001 |
=head3 track_login |
1002 |
=head3 update_lastseen |
1002 |
|
1003 |
|
1003 |
$patron->track_login; |
1004 |
$patron->update_lastseen('activity'); |
1004 |
$patron->track_login({ force => 1 }); |
|
|
1005 |
|
1005 |
|
1006 |
Tracks a (successful) login attempt. |
1006 |
Tracks a (successful) login attempt when the TrackLastPatronActivity preference is enabled |
1007 |
The preference TrackLastPatronActivity must be enabled. Or you |
1007 |
and the activity passed is in the TrackLastPatronActivityTriggers list. |
1008 |
should pass the force parameter. |
|
|
1009 |
|
1008 |
|
1010 |
=cut |
1009 |
=cut |
1011 |
|
1010 |
|
1012 |
sub track_login { |
1011 |
sub update_lastseen { |
1013 |
my ( $self, $params ) = @_; |
1012 |
my ( $self, $activity ) = @_; |
1014 |
return if |
1013 |
return $self if !C4::Context->preference('TrackLastPatronActivity'); |
1015 |
!$params->{force} && |
1014 |
|
1016 |
!C4::Context->preference('TrackLastPatronActivity'); |
1015 |
my $tracked_activities = { |
1017 |
$self->lastseen( dt_from_string() )->store; |
1016 |
map { ( lc $_, 1 ); } split /\s*\,\s*/, |
|
|
1017 |
C4::Context->preference('TrackLastPatronActivityTriggers') |
1018 |
}; |
1019 |
return $self unless $tracked_activities->{$activity}; |
1020 |
|
1021 |
my $cache = Koha::Caches->get_instance(); |
1022 |
my $cache_key = "track_login_" . $self->userid; |
1023 |
my $cached = $cache->get_from_cache($cache_key); |
1024 |
my $now = dt_from_string(); |
1025 |
return if $cached && $cached eq $now->ymd; |
1026 |
|
1027 |
$self->lastseen($now)->store; |
1028 |
$cache->set_in_cache( $cache_key, $now->ymd ); |
1029 |
return $self; |
1018 |
} |
1030 |
} |
1019 |
|
1031 |
|
1020 |
=head3 move_to_deleted |
1032 |
=head3 move_to_deleted |
1021 |
- |
|
|