From 6d54d2419f98d7d473c0a0ef888aea00be5f9eb7 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 25 Aug 2023 16:26:10 +0000 Subject: [PATCH] Bug 34622: Fix store default query MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Exclude self smtp server from all the servers being updated to not default if self is_default Signed-off-by: Émily-Rose Francoeur Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/SMTP/Server.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/SMTP/Server.pm b/Koha/SMTP/Server.pm index 44d3158aa8..f85b34e3d7 100644 --- a/Koha/SMTP/Server.pm +++ b/Koha/SMTP/Server.pm @@ -44,9 +44,9 @@ sub store { $self->_result->result_source->schema->txn_do( sub { - Koha::SMTP::Servers->search->update( { is_default => 0 }, - { no_triggers => 1 } ) - if $self->is_default; + Koha::SMTP::Servers->search( { id => { '!=' => $self->id } } ) + ->update( { is_default => 0 }, { no_triggers => 1 } ) + if $self->is_default; $self = $self->SUPER::store; } -- 2.39.5