From 2497c5760f670ad71933884d4e0abe353d138dd1 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Wed, 4 Dec 2024 10:49:32 -0500 Subject: [PATCH] Bug 31632: (QA follow-up) Align behavior with order from suggestion If an order is added from a suggestion in the first place, the suggestion automatically changes status to ORDERED, and a notice is sent out to the patron. If a suggestion is linked to the order after the fact, it should move to ORDERED and notify the patron as well. Signed-off-by: Emily Lamancusa Signed-off-by: Aleisha Amohia --- acqui/newordersuggestion.pl | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index 429b6702f7d..344cf79148c 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -93,7 +93,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); -use C4::Suggestions qw( ConnectSuggestionAndBiblio ); +use C4::Suggestions qw( ConnectSuggestionAndBiblio ModSuggestion ); use C4::Budgets; use Koha::Acquisition::Booksellers; @@ -130,9 +130,24 @@ if ( $op eq 'connectDuplicate' ) { } if ( $op eq 'cud-link_order' and $link_order ) { - my $order = Koha::Acquisition::Orders->find($link_order); - my $suggestion = Koha::Suggestions->find($suggestionid); - $suggestion->update( { biblionumber => $order->biblionumber } ) if $order->biblionumber; + my $order = Koha::Acquisition::Orders->find($link_order); + + if ( $order->biblionumber ) { + ModSuggestion( + { + suggestionid => $suggestionid, + biblionumber => $order->biblionumber, + STATUS => 'ORDERED', + } + ); + if ( C4::Context->preference('PlaceHoldsOnOrdersFromSuggestions') ) { + my $suggestion = Koha::Suggestions->find($suggestionid); + if ($suggestion) { + $suggestion->place_hold(); + } + } + } + print $input->redirect( "/cgi-bin/koha/acqui/basket.pl?basketno=" . $basketno ); } -- 2.39.5