MT 1094, Following : added a test to check if we really found the item
This commit is contained in:
parent
56750eebba
commit
d4f06e5023
2 changed files with 19 additions and 11 deletions
11
C4/Items.pm
11
C4/Items.pm
|
@ -2025,6 +2025,7 @@ MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio);
|
|||
|
||||
Moves an item from a biblio to another
|
||||
|
||||
Returns undef if the move failed or the biblionumber of the destination record otherwise
|
||||
=cut
|
||||
sub MoveItemFromBiblio {
|
||||
my ($itemnumber, $frombiblio, $tobiblio) = @_;
|
||||
|
@ -2055,6 +2056,10 @@ sub MoveItemFromBiblio {
|
|||
$record->delete_field($fielditem)
|
||||
}
|
||||
}
|
||||
|
||||
# If we found an item (should always true, except in case of database-marcxml inconsistency)
|
||||
if ($item) {
|
||||
|
||||
# Saving the modification
|
||||
ModBiblioMarc($record, $frombiblio, $frameworkcode);
|
||||
|
||||
|
@ -2066,8 +2071,12 @@ sub MoveItemFromBiblio {
|
|||
|
||||
# Saving the modification
|
||||
ModBiblioMarc($record, $tobiblio, $frameworkcode);
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
return undef;
|
||||
}
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ if ($barcode && $biblionumber) {
|
|||
my $frombiblionumber = $results->{'biblionumber'};
|
||||
|
||||
my $moveresult = MoveItemFromBiblio($itemnumber, $frombiblionumber, $biblionumber);
|
||||
|
||||
if ($moveresult) {
|
||||
$template->param(success => 1);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue