From 1671f009e61d6e0fffaa5a627e5e85fcadf8f7fc 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 (cherry picked from commit 75d6195c0ef36c4da244c4e2e2341696c94642c1) Signed-off-by: Fridolin Somers --- C4/Items.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 845d63595c..85bb9c5d34 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -546,6 +546,9 @@ sub ModItem { my $biblionumber = shift; my $itemnumber = shift; + 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); @@ -560,8 +563,6 @@ sub ModItem { $item->{'more_subfields_xml'} = _get_unlinked_subfields_xml($unlinked_item_subfields); }; - $item->{'itemnumber'} = $itemnumber or return; - my @fields = qw( itemlost withdrawn ); # Only call GetItem if we need to set an "on" date field -- 2.39.5