From b432f38c10d6a697668cd12d25658b75f93f71d2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Nov 2023 14:56:06 +0100 Subject: [PATCH] Bug 35717: Adjust other calls Signed-off-by: Nick Clemens --- Koha/EDI.pm | 13 +++++-------- acqui/addorder.pl | 13 +------------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Koha/EDI.pm b/Koha/EDI.pm index ad7ea7a075b..c59073e2867 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -45,6 +45,7 @@ use Koha::Plugins; # Adds plugin dirs to @INC use Koha::Plugins::Handler; use Koha::Acquisition::Baskets; use Koha::Acquisition::Booksellers; +use Koha::Acquisition::Orders; our $VERSION = 1.1; @@ -330,16 +331,12 @@ sub process_invoice { # ModReceiveOrder does not validate that $ordernumber exists validate here if ($order) { - # check suggestions - my $s = $schema->resultset('Suggestion')->search( - { - biblionumber => $order->biblionumber->biblionumber, - } - )->single; - if ($s) { + my $order_koha_object = Koha::Acquisition::Orders->find($ordernumber); + my $suggestions = $order_koha_object->suggestions; + while ( my $suggestion = $suggestions->next ) { ModSuggestion( { - suggestionid => $s->suggestionid, + suggestionid => $suggestion->id, STATUS => 'AVAILABLE', } ); diff --git a/acqui/addorder.pl b/acqui/addorder.pl index ae95c14f229..37da22dc3ee 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -340,6 +340,7 @@ if ( $op eq 'cud-order' ) { { suggestionid => $suggestionid, biblionumber => $orderinfo->{biblionumber}, + ordernumber => $order->ordernumber, STATUS => 'ORDERED', } ); @@ -369,18 +370,6 @@ 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', - } - ); - } - # Log the order creation if ( C4::Context->preference("AcquisitionLog") ) { my $infos = {}; -- 2.39.2