From fe73e89fbf6ff7c043794ff362e0b82744c0ac39 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 23 Jul 2024 02:50:29 +0000 Subject: [PATCH] Bug 31632: Link a suggestion to an existing order This enhancement allows library staff to link an order (in an unclosed basket, or a standing order) to an accepted suggestion. To test: 1) In the staff interface, go to Suggestions and create at least two suggestions. 2) Mark at least two suggestions as Accepted. 3) Go to Acquisitions, create a vendor if you don't have one already. 4) Have or create two baskets - one should be standing, and one not standing (normal). 5) In the normal basket (not standing), add an order from any source but NOT from a suggestion. 6) When you save the order, there should be a new link in the Modify column of the Orders table - "Search for suggestion to link". Click this. 7) Choose one of your suggestions to link to the order. 8) You should be redirected back to the basket. Confirm your order has been correctly linked to the suggestion. Confirm there is no link to "Search for suggestion to link" for this order now that a suggestion has already been linked. 9) Add another order to this basket from any source but NOT from a suggestion. 10) Close the basket. Confirm there is no link to "Search for suggestion to link" because the basket is closed, but you could reopen the basket to link the order if you wanted to. 11) Go to Baskets in the left navigation so you can find your standing basket. 12) Add an order to your standing basket from any source but NOT from a suggestion. 13) Go to the vendor and Receive shipments. Receive your standing order and finish receiving. 14) Go to the standing basket. There should be a new unreceived standing order for the record you just received, with a link to "Search for suggestion to link". Click this. 15) Choose a suggestion to link to the order. 16) You should be redirected back to the basket. Confirm your orders for this record have been correctly linked to the suggestion. Sponsored-by: Pymble Ladies' College Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste Henry Signed-off-by: Emily Lamancusa --- acqui/newordersuggestion.pl | 9 +++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 4 ++++ .../prog/en/modules/acqui/newordersuggestion.tt | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index e41381f4f4..33fb3fc8d9 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -111,6 +111,7 @@ my $op = $input->param('op'); my $suggestionid = $input->param('suggestionid'); my $duplicateNumber = $input->param('duplicateNumber'); my $uncertainprice = $input->param('uncertainprice'); +my $link_order = $input->param('link_order'); $op = 'else' unless $op; @@ -128,6 +129,13 @@ if ( $op eq 'connectDuplicate' ) { ConnectSuggestionAndBiblio( $suggestionid, $duplicateNumber ); } +if ( $op eq '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; + print $input->redirect( "/cgi-bin/koha/acqui/basket.pl?basketno=" . $basketno ); +} + my $suggestions = [ Koha::Suggestions->search_limited( { @@ -147,6 +155,7 @@ $template->param( booksellerid => $booksellerid, name => $vendor->name, "op_$op" => 1, + link_order => $link_order, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 49c9d98fd3..70dc2f9063 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -812,6 +812,10 @@ Modify
Transfer +
+ [% END %] + [% UNLESS ( books_loo.suggestionid ) %] + Search for suggestion to link [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt index 613b56588b..6d2da78124 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -89,7 +89,9 @@ [% suggestion.total | $Price %] - [% IF ( suggestion.biblionumber ) %] + [% IF link_order %] + [% tp('verb', 'Link suggestion') | html %] + [% ELSIF ( suggestion.biblionumber ) %]