From 08c0b8b8960257a5b419c83fb702a1414a946311 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 --- acqui/newordersuggestion.pl | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index 3c467892f7..4ae693c54b 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; @@ -131,8 +131,23 @@ 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; + + 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.34.1