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 <carnold@dgiinc.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 1f0064bbdd)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 75d6195c0e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Mark Tompsett 2018-04-17 23:59:58 +00:00 committed by Fridolin Somers
parent 4adc6ca70e
commit 1671f009e6
1 changed files with 3 additions and 2 deletions

View File

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