Bugzilla – Attachment 156971 Details for
Bug 35001
Simplify patron->is_active in light of TrackLastPatronActivityTriggers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35001: Take patron activity triggers into account in ->is_active
Bug-35001-Take-patron-activity-triggers-into-accou.patch (text/plain), 2.70 KB, created by
Marcel de Rooy
on 2023-10-12 14:11:56 UTC
(
hide
)
Description:
Bug 35001: Take patron activity triggers into account in ->is_active
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-10-12 14:11:56 UTC
Size:
2.70 KB
patch
obsolete
>From 215fe220cec3fa0ad4a20a5a0a91babb0d3e97ed Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 12 Oct 2023 14:10:51 +0000 >Subject: [PATCH] Bug 35001: Take patron activity triggers into account in > ->is_active >Content-Type: text/plain; charset=utf-8 > >Still in concept. > >Test plan: >TODO >--- > Koha/Patron.pm | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 5918e456af..f40febcefb 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -821,6 +821,9 @@ A recent enrollment as new patron counts too. > Recently is defined by $date or $value in days, weeks or months. You should > pass one of those; otherwise an exception is thrown. > >+The code takes the various triggers defined via pref TrackLastPatronActivityTriggers >+into account when deciding the need for querying holds, issues, etc. >+ > =cut > > sub is_active { >@@ -847,33 +850,37 @@ sub is_active { > return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1; > } > >- # Check holds, issues and article requests >- return 1 if $self->holds->filter_by_last_update( >+ # Check holds, issues and article requests (if not included in TrackLastPatronActivityTriggers) >+ # If included, the lastseen date has been updated, so no need to do the query >+ my $included = { map { ( $_, 1 ) } split /\s*,\s*/, lc C4::Context->preference('TrackLastPatronActivityTriggers') }; >+ return 1 if !$included->{hold} && $self->holds->filter_by_last_update( > { > timestamp_column_name => 'timestamp', from => $dt, > } > )->count; >- return 1 if $self->old_holds->filter_by_last_update( >+ return 1 if !$included->{hold} && $self->old_holds->filter_by_last_update( > { > timestamp_column_name => 'timestamp', from => $dt, > } > )->count; >- return 1 if $self->checkouts->filter_by_last_update( >+ return 1 if !$included->{check_out} && $self->checkouts->filter_by_last_update( > { > timestamp_column_name => 'timestamp', from => $dt, > } > )->count; >- return 1 if $self->old_checkouts->filter_by_last_update( >+ return 1 if !$included->{check_out} && $self->old_checkouts->filter_by_last_update( > { > timestamp_column_name => 'timestamp', from => $dt, > } > )->count; >- return 1 if $self->article_requests->filter_by_last_update( >+ return 1 if !$included->{article} && $self->article_requests->filter_by_last_update( > { > timestamp_column_name => 'updated_on', from => $dt, > } > )->count; > >+ #TODO Currently, we have no way to add recalls at staff side for a patron. If added, extend this. >+ > return 0; > } > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35001
:
156971
|
157016
|
157034
|
157035
|
157036
|
157037
|
157743
|
157744