From bf522cf4cd191805ce454187323475f4d74849c2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Oct 2025 12:46:21 +0200 Subject: [PATCH] Bug 28308: DBrev To remove the unnecessary entries from the DB --- .../data/mysql/atomicupdate/bug_28308.pl | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_28308.pl diff --git a/installer/data/mysql/atomicupdate/bug_28308.pl b/installer/data/mysql/atomicupdate/bug_28308.pl new file mode 100755 index 00000000000..37b1f83e1df --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_28308.pl @@ -0,0 +1,23 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "28308", + description => "Remove unnecessary message preference entries", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Remove message transport types entries for Advance notice (id=2) if "Days in advance" is 0 or NULL + $dbh->do( + q{ + DELETE bmtp + FROM borrower_message_transport_preferences bmtp + JOIN borrower_message_preferences bmp + ON bmtp.borrower_message_preference_id = bmp.borrower_message_preference_id + WHERE bmp.message_attribute_id = 2 + AND (bmp.days_in_advance = 0 OR bmp.days_in_advance IS NULL); + } + ); + }, +}; -- 2.34.1