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 <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a44f03c715)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2023-03-10 09:07:26 -03:00 committed by Matt Blenkinsop
parent 721fa4a634
commit 65da256011
1 changed files with 7 additions and 3 deletions

View File

@ -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;