X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=cataloguing%2Fmerge.pl;h=019b4688368ab4809af8641dc308bece5de17a28;hb=f01606d89b487d585bf06eae1dd6de6ff138eab9;hp=6a46d2f601076aaab90add7cac1e05d59c302da9;hpb=16a0975f313748aea48abf067a297638d0ccabe0;p=koha.git diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl index 6a46d2f601..019b468836 100755 --- a/cataloguing/merge.pl +++ b/cataloguing/merge.pl @@ -29,6 +29,7 @@ use C4::Biblio; use C4::Serials; use C4::Koha; use C4::Reserves qw/MergeHolds/; +use C4::Acquisition qw/ModOrder GetOrdersByBiblionumber/; my $input = new CGI; my @biblionumber = $input->param('biblionumber'); @@ -69,6 +70,7 @@ if ($merge) { ModBiblio($record, $tobiblio, $frameworkcode); # Moving items from the other record to the reference record + # Also moving orders from the other record to the reference record, only if the order is linked to an item of the other record my $itemnumbers = get_itemnumbers_of($frombiblio); foreach my $itloop ($itemnumbers->{$frombiblio}) { foreach my $itemnumber (@$itloop) { @@ -101,6 +103,16 @@ if ($merge) { # TODO : Moving reserves + # Moving orders (orders linked to items of frombiblio have already been moved by MoveItemFromBiblio) + my @allorders = GetOrdersByBiblionumber($frombiblio); + my @tobiblioitem = GetBiblioItemByBiblioNumber ($tobiblio); + my $tobiblioitem_biblioitemnumber = $tobiblioitem [0]-> {biblioitemnumber }; + foreach my $myorder (@allorders) { + $myorder->{'biblionumber'} = $tobiblio; + ModOrder ($myorder); + # TODO : add error control (in ModOrder?) + } + # Deleting the other record if (scalar(@errors) == 0) { # Move holds