Bug 15504: (follow-up) Respect existing TrackLastPatronActivity

This patch updates the database update to set
'check_out,connection,login' as the activity triggers should we find at
upgrade time that TrackLastPatronActivity is set to true.

This retains the existing functionality.

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:
Martin Renvoize 2023-10-11 17:47:06 +01:00 committed by Tomas Cohen Arazi
parent 305a221112
commit 66b6c3e936
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -7,8 +7,14 @@ return {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Get existing value from the TrackLastPatronActivity system preference
my ($tracklastactivity) = $dbh->selectrow_array( q|
SELECT value FROM systempreferences WHERE variable='TrackLastPatronActivity';
|);
my $triggers = $tracklastactivity ? 'check_out,connection,login' : '';
$dbh->do(
q{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',$triggers,NULL,'If set, the field borrowers.lastseen will be updated every time a patron is does a selected option','multiple') }
);
say $out "Added system preference 'TrackLastPatronActivityTriggers'";