From d015eaf1de6d6f5f0e9fb85a26544ee4d4386e28 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 11 Oct 2023 17:47:06 +0100 Subject: [PATCH] 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. --- .../bug_15504-add-tracklastpatronactivityoptions.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/atomicupdate/bug_15504-add-tracklastpatronactivityoptions.pl b/installer/data/mysql/atomicupdate/bug_15504-add-tracklastpatronactivityoptions.pl index 537d824e91e..b8daba1c6aa 100755 --- a/installer/data/mysql/atomicupdate/bug_15504-add-tracklastpatronactivityoptions.pl +++ b/installer/data/mysql/atomicupdate/bug_15504-add-tracklastpatronactivityoptions.pl @@ -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'"; -- 2.41.0