Bug 15504: (QA follow-up) Final changes
[1] Comment in Patron->is_active sharpened.
[2] Patron->update_lastseen
return if $cached && $cached eq $now->ymd;
Should be
return $self if $cached && $cached eq $now->ymd;
Consistent return value.
[3] Typo if there are not TrackLastPatronActivityTriggers enabled
[4] Typo TrackLastPatronActivityTriggers must be contain
[5] Typo patron is does .. option => performs an action
[6] Tidy on dbrev to fix
The file is less tidy than before (bad/messy lines before: 0, now: 4)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
7a91be1814
commit
a939f8da15
|
|
@ -842,7 +842,7 @@ sub is_active {
|
|||
# Enrollment within this period?
|
||||
return 1 if DateTime->compare( dt_from_string( $self->dateenrolled ), $dt ) > -1;
|
||||
|
||||
# Last seen? Updated each login when you track patron activity
|
||||
# Last seen? Updated for tracked patron activities
|
||||
if ( C4::Context->preference('TrackLastPatronActivityTriggers') ) {
|
||||
return 1 if DateTime->compare( dt_from_string( $self->lastseen ), $dt ) > -1;
|
||||
}
|
||||
|
|
@ -1189,7 +1189,7 @@ sub update_lastseen {
|
|||
my $cache_key = "track_activity_" . $self->borrowernumber;
|
||||
my $cached = $cache->get_from_cache($cache_key);
|
||||
my $now = dt_from_string();
|
||||
return if $cached && $cached eq $now->ymd;
|
||||
return $self if $cached && $cached eq $now->ymd;
|
||||
|
||||
$self->lastseen($now)->store;
|
||||
$cache->set_in_cache( $cache_key, $now->ymd );
|
||||
|
|
|
|||
|
|
@ -8,21 +8,25 @@ return {
|
|||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
# Get existing value from the TrackLastPatronActivity system preference
|
||||
my ($tracklastactivity) = $dbh->selectrow_array( q|
|
||||
my ($tracklastactivity) = $dbh->selectrow_array(
|
||||
q|
|
||||
SELECT value FROM systempreferences WHERE variable='TrackLastPatronActivity';
|
||||
|);
|
||||
|
|
||||
);
|
||||
|
||||
my $triggers = $tracklastactivity ? 'check_out,connection,login' : '';
|
||||
$dbh->do(
|
||||
qq{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('TrackLastPatronActivityTriggers',?,NULL,'If set, the field borrowers.lastseen will be updated every time a patron is does a selected option','multiple') },
|
||||
qq{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('TrackLastPatronActivityTriggers',?,NULL,'If set, the field borrowers.lastseen will be updated every time a patron performs a selected action','multiple') },
|
||||
undef, $triggers,
|
||||
);
|
||||
|
||||
say $out "Added system preference 'TrackLastPatronActivityTriggers'";
|
||||
|
||||
$dbh->do(q{
|
||||
$dbh->do(
|
||||
q{
|
||||
DELETE FROM systempreferences WHERE variable='TrackLastPatronActivity'
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
say $out "Removed system preference 'TrackLastPatronActivity'";
|
||||
},
|
||||
|
|
|
|||
|
|
@ -753,7 +753,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
|
|||
('TraceCompleteSubfields','0','0','Force subject tracings to only match complete subfields.','YesNo'),
|
||||
('TraceSubjectSubdivisions','0','1','Create searches on all subdivisions for subject tracings.','YesNo'),
|
||||
('TrackClicks','0',NULL,'Track links clicked','Integer'),
|
||||
('TrackLastPatronActivityTriggers','',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is does a selected option','multiple'),
|
||||
('TrackLastPatronActivityTriggers','',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron performs a selected action','multiple'),
|
||||
('TransfersBlockCirc','1',NULL,'Should the transfer modal block circulation staff from continuing scanning items','YesNo'),
|
||||
('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
|
||||
('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'),
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ $expired_before = dt_from_string( $expired_before, 'iso' )
|
|||
if $expired_before;
|
||||
|
||||
if ( $last_seen and not C4::Context->preference('TrackLastPatronActivityTriggers') ) {
|
||||
pod2usage(q{The --last_seen will be ineffective if there are not TrackLastPatronActivityTriggers enabled});
|
||||
pod2usage(q{The option --last_seen will be ineffective if preference TrackLastPatronActivityTriggers is empty});
|
||||
}
|
||||
|
||||
unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code or $branchcode or $file ) {
|
||||
|
|
@ -185,7 +185,7 @@ Delete patrons with an account expired before this date.
|
|||
|
||||
Delete patrons who have not been active since this date.
|
||||
|
||||
The system preference TrackLastPatronActivityTriggers must be contain least trigger to use this option.
|
||||
The system preference TrackLastPatronActivityTriggers must contain at least one trigger to use this option.
|
||||
|
||||
=item B<--category_code>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue