From d47a5ea9055f9244c2e88e6bf597c0bcd0c5dd96 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 18 Feb 2021 10:54:34 +0000 Subject: [PATCH] Bug 24446: (QA follow-up) Remove superflous store calls The original code here called store after setting each field. Instead, we set all the fields and call store at the end and save ourselves a few database hits. --- Koha/StockRotationItem.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Koha/StockRotationItem.pm b/Koha/StockRotationItem.pm index a3e49a00c7..6c6d99cd43 100644 --- a/Koha/StockRotationItem.pm +++ b/Koha/StockRotationItem.pm @@ -202,14 +202,14 @@ sub advance { my $stage = $self->stage; my $new_stage; if ( $self->indemand && !$self->fresh ) { - $self->indemand(0)->store; # De-activate indemand + $self->indemand(0); # De-activate indemand $new_stage = $stage; } else { # New to rota? if ( $self->fresh ) { $new_stage = $self->stage->first_sibling || $self->stage; - $self->fresh(0)->store; # Reset fresh + $self->fresh(0); # Reset fresh } # Last stage? elsif ( !$stage->last_sibling ) { @@ -229,7 +229,8 @@ sub advance { } # Update stage and record transfer - $self->stage_id( $new_stage->stage_id )->store; # Set new stage + $self->stage_id( $new_stage->stage_id ); # Set new stage + $self->store(); $item->homebranch( $new_stage->branchcode_id )->store; # Update homebranch $transfer = try { $item->request_transfer( -- 2.20.1