From 65da256011a3576fd5d5d3f0d13c9ef480b862e2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 10 Mar 2023 09:07:26 -0300 Subject: [PATCH] Bug 30920: (QA follow-up) Use get_dirty_columns to avoid DB query We can rely on DBIC's get_dirty_columns to check if the descriptions have changed, and set things for flushing without an extra DB query. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a44f03c7156cce4ff1ae55da3772f98e7b5e89b6) Signed-off-by: Matt Blenkinsop --- Koha/AuthorisedValue.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm index a1bdb31e2a..0fc5f4cd1b 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -49,9 +49,13 @@ sub store { $flush = 1; } else { - my $self_from_storage = $self->get_from_storage; - $flush = 1 if ( $self_from_storage->lib ne $self->lib ); - $flush = 1 if ( $self_from_storage->lib_opac ne $self->lib_opac ); + my %updated_columns = $self->_result->get_dirty_columns; + + if ( exists $updated_columns{lib} + or exists $updated_columns{lib_opac} ) + { + $flush = 1; + } } $self = $self->SUPER::store; -- 2.39.5