Lines 33-38
use C4::Log qw( logaction );
Link Here
|
33 |
use Koha::Account; |
33 |
use Koha::Account; |
34 |
use Koha::ArticleRequests; |
34 |
use Koha::ArticleRequests; |
35 |
use Koha::AuthUtils; |
35 |
use Koha::AuthUtils; |
|
|
36 |
use Koha::Caches; |
36 |
use Koha::Checkouts; |
37 |
use Koha::Checkouts; |
37 |
use Koha::CirculationRules; |
38 |
use Koha::CirculationRules; |
38 |
use Koha::Club::Enrollments; |
39 |
use Koha::Club::Enrollments; |
Lines 1165-1188
sub _get_overdue_debarred_delay {
Link Here
|
1165 |
} |
1166 |
} |
1166 |
} |
1167 |
} |
1167 |
|
1168 |
|
|
|
1169 |
=head3 update_lastseen |
1168 |
|
1170 |
|
1169 |
=head3 track_login |
1171 |
$patron->update_lastseen('activity'); |
1170 |
|
1172 |
|
1171 |
$patron->track_login; |
1173 |
Tracks a (successful) login attempt when the TrackLastPatronActivity preference is enabled |
1172 |
$patron->track_login({ force => 1 }); |
1174 |
and the activity passed is in the TrackLastPatronActivityTriggers list. |
1173 |
|
|
|
1174 |
Tracks a (successful) login attempt. |
1175 |
The preference TrackLastPatronActivity must be enabled. Or you |
1176 |
should pass the force parameter. |
1177 |
|
1175 |
|
1178 |
=cut |
1176 |
=cut |
1179 |
|
1177 |
|
1180 |
sub track_login { |
1178 |
sub update_lastseen { |
1181 |
my ( $self, $params ) = @_; |
1179 |
my ( $self, $activity ) = @_; |
1182 |
return if |
1180 |
return $self if !C4::Context->preference('TrackLastPatronActivity'); |
1183 |
!$params->{force} && |
1181 |
|
1184 |
!C4::Context->preference('TrackLastPatronActivity'); |
1182 |
my $tracked_activities = { |
1185 |
$self->lastseen( dt_from_string() )->store; |
1183 |
map { ( lc $_, 1 ); } split /\s*\,\s*/, |
|
|
1184 |
C4::Context->preference('TrackLastPatronActivityTriggers') |
1185 |
}; |
1186 |
return $self unless $tracked_activities->{$activity}; |
1187 |
|
1188 |
my $cache = Koha::Caches->get_instance(); |
1189 |
my $cache_key = "track_login_" . $self->userid; |
1190 |
my $cached = $cache->get_from_cache($cache_key); |
1191 |
my $now = dt_from_string(); |
1192 |
return if $cached && $cached eq $now->ymd; |
1193 |
|
1194 |
$self->lastseen($now)->store; |
1195 |
$cache->set_in_cache( $cache_key, $now->ymd ); |
1196 |
return $self; |
1186 |
} |
1197 |
} |
1187 |
|
1198 |
|
1188 |
=head3 move_to_deleted |
1199 |
=head3 move_to_deleted |
1189 |
- |
|
|