From 6c180bdec8e73e44ce2a85e055dd46c79b9f811d Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Wed, 13 Mar 2013 16:12:03 +0100 Subject: [PATCH] Bug 7593: Move orders on the destination record when merging 2 records Note : this patch uses Acquisition::GetOrdersByBiblionumber created by bug 9780. So you need to apply bug 9780 before testing this one. At present, merging records breaks the link order/record. This patch moves existing orders from deleted record to destination record. To test : 1. create a basket with one order 2. put the record used by this order in a list 3. put an other record in the list 4. merge the 2 records 5. check if the order in the basket is updated --- cataloguing/merge.pl | 10 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cataloguing/merge.pl b/cataloguing/merge.pl index 6a46d2f..bfb3222 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'); @@ -109,6 +110,14 @@ if ($merge) { push @errors, $error if ($error); } + # Moving orders + my @allorders = GetOrdersByBiblionumber($frombiblio); + foreach my $myorder (@allorders) { + $myorder->{'biblionumber'} = $tobiblio; + $myorder->{'biblioitemnumber'} = $tobiblio; #maybe useless + ModOrder ($myorder); + # TODO : add error control (in ModOrder?) + } # Parameters $template->param( result => 1, -- 1.7.9.5