Lines 821-826
A recent enrollment as new patron counts too.
Link Here
|
821 |
Recently is defined by $date or $value in days, weeks or months. You should |
821 |
Recently is defined by $date or $value in days, weeks or months. You should |
822 |
pass one of those; otherwise an exception is thrown. |
822 |
pass one of those; otherwise an exception is thrown. |
823 |
|
823 |
|
|
|
824 |
The code takes the various triggers defined via pref TrackLastPatronActivityTriggers |
825 |
into account when deciding the need for querying holds, issues, etc. |
826 |
|
824 |
=cut |
827 |
=cut |
825 |
|
828 |
|
826 |
sub is_active { |
829 |
sub is_active { |
Lines 847-879
sub is_active {
Link Here
|
847 |
return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1; |
850 |
return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1; |
848 |
} |
851 |
} |
849 |
|
852 |
|
850 |
# Check holds, issues and article requests |
853 |
# Check holds, issues and article requests (if not included in TrackLastPatronActivityTriggers) |
851 |
return 1 if $self->holds->filter_by_last_update( |
854 |
# If included, the lastseen date has been updated, so no need to do the query |
|
|
855 |
my $included = { map { ( $_, 1 ) } split /\s*,\s*/, lc C4::Context->preference('TrackLastPatronActivityTriggers') }; |
856 |
return 1 if !$included->{hold} && $self->holds->filter_by_last_update( |
852 |
{ |
857 |
{ |
853 |
timestamp_column_name => 'timestamp', from => $dt, |
858 |
timestamp_column_name => 'timestamp', from => $dt, |
854 |
} |
859 |
} |
855 |
)->count; |
860 |
)->count; |
856 |
return 1 if $self->old_holds->filter_by_last_update( |
861 |
return 1 if !$included->{hold} && $self->old_holds->filter_by_last_update( |
857 |
{ |
862 |
{ |
858 |
timestamp_column_name => 'timestamp', from => $dt, |
863 |
timestamp_column_name => 'timestamp', from => $dt, |
859 |
} |
864 |
} |
860 |
)->count; |
865 |
)->count; |
861 |
return 1 if $self->checkouts->filter_by_last_update( |
866 |
return 1 if !$included->{check_out} && $self->checkouts->filter_by_last_update( |
862 |
{ |
867 |
{ |
863 |
timestamp_column_name => 'timestamp', from => $dt, |
868 |
timestamp_column_name => 'timestamp', from => $dt, |
864 |
} |
869 |
} |
865 |
)->count; |
870 |
)->count; |
866 |
return 1 if $self->old_checkouts->filter_by_last_update( |
871 |
return 1 if !$included->{check_out} && $self->old_checkouts->filter_by_last_update( |
867 |
{ |
872 |
{ |
868 |
timestamp_column_name => 'timestamp', from => $dt, |
873 |
timestamp_column_name => 'timestamp', from => $dt, |
869 |
} |
874 |
} |
870 |
)->count; |
875 |
)->count; |
871 |
return 1 if $self->article_requests->filter_by_last_update( |
876 |
return 1 if !$included->{article} && $self->article_requests->filter_by_last_update( |
872 |
{ |
877 |
{ |
873 |
timestamp_column_name => 'updated_on', from => $dt, |
878 |
timestamp_column_name => 'updated_on', from => $dt, |
874 |
} |
879 |
} |
875 |
)->count; |
880 |
)->count; |
876 |
|
881 |
|
|
|
882 |
#TODO Currently, we have no way to add recalls at staff side for a patron. If added, extend this. |
883 |
|
877 |
return 0; |
884 |
return 0; |
878 |
} |
885 |
} |
879 |
|
886 |
|
880 |
- |
|
|