From d47b54ce343f8089cf0deed53e14c615caf5c307 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 17 Oct 2024 11:32:26 -0300 Subject: [PATCH] Bug 35717: Fix rebase issue after bug 34478 Some code was introduced and the block setting the `ordernumber` for the suggestion when creating an order from a suggestion got located before the actual order is created, and as such the suggestion got is ordernumber set as NULL. --- acqui/addorder.pl | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 04091131cc3..31d732624bb 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -334,24 +334,6 @@ if ( $op eq 'cud-order' ) { $orderinfo->{biblionumber} = $biblionumber; } - # change suggestion status if applicable - if ( my $suggestionid = $input->param('suggestionid') ) { - ModSuggestion( - { - suggestionid => $suggestionid, - biblionumber => $orderinfo->{biblionumber}, - ordernumber => $orderinfo->{ordernumber}, - STATUS => 'ORDERED', - } - ); - if ( C4::Context->preference('PlaceHoldsOnOrdersFromSuggestions') ) { - my $suggestion = Koha::Suggestions->find($suggestionid); - if ($suggestion) { - $suggestion->place_hold(); - } - } - } - $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq ''; @@ -370,6 +352,24 @@ if ( $op eq 'cud-order' ) { $order->populate_with_prices_for_ordering(); $order->store; + # change suggestion status if applicable + if ( my $suggestionid = $input->param('suggestionid') ) { + ModSuggestion( + { + suggestionid => $suggestionid, + biblionumber => $orderinfo->{biblionumber}, + ordernumber => $order->ordernumber, + STATUS => 'ORDERED', + } + ); + if ( C4::Context->preference('PlaceHoldsOnOrdersFromSuggestions') ) { + my $suggestion = Koha::Suggestions->find($suggestionid); + if ($suggestion) { + $suggestion->place_hold(); + } + } + } + # Log the order creation if ( C4::Context->preference("AcquisitionLog") ) { my $infos = {}; -- 2.47.0