From 66b6c3e936769c7b57f1eb86032d80c3fa7b6584 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. Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../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 537d824e91..b8daba1c6a 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.39.5