From 75d6195c0ef36c4da244c4e2e2341696c94642c1 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 17 Apr 2018 23:59:58 +0000 Subject: [PATCH] Bug 20592: Return early in ModItem if nothing to update Two lines of code and move them earlier. Add a check to make sure there are changes. Followed the test plan, both the _BEFORE_ and after do as described. Signed-off-by: Cori Lynn Arnold Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens (cherry picked from commit 1f0064bbddb9d00529d5eac1c096e669732eb551) Signed-off-by: Martin Renvoize --- C4/Items.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index cbb0c18af7..3c5d9c3012 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -547,6 +547,9 @@ sub ModItem { my $log_action = $additional_params->{log_action} // 1; my $unlinked_item_subfields = $additional_params->{unlinked_item_subfields}; + return unless %$item; + $item->{'itemnumber'} = $itemnumber or return; + # if $biblionumber is undefined, get it from the current item unless (defined $biblionumber) { $biblionumber = _get_single_item_column('biblionumber', $itemnumber); @@ -556,8 +559,6 @@ sub ModItem { $item->{'more_subfields_xml'} = _get_unlinked_subfields_xml($unlinked_item_subfields); }; - $item->{'itemnumber'} = $itemnumber or return; - my @fields = qw( itemlost withdrawn damaged ); # Only call GetItem if we need to set an "on" date field -- 2.39.5