From 581bae58bed3978304f49fc2da09074ae08a05a9 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 --- acqui/newordersuggestion.pl | 23 +++++++++++++------ .../prog/en/modules/acqui/basket.tt | 4 ++++ .../en/modules/acqui/newordersuggestion.tt | 4 +++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index 9d35ec48def..fec5a2ef10f 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -103,14 +103,15 @@ my $input = CGI->new; # getting the CGI params my $basketno = $input->param('basketno'); -my $booksellerid = $input->param('booksellerid'); +my $booksellerid = $input->param('booksellerid'); my $author = $input->param('author'); my $title = $input->param('title'); my $publishercode = $input->param('publishercode'); my $op = $input->param('op'); my $suggestionid = $input->param('suggestionid'); my $duplicateNumber = $input->param('duplicateNumber'); -my $uncertainprice = $input->param('uncertainprice'); +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( { ( $author ? ( author => $author ) : () ), @@ -140,11 +148,12 @@ my $suggestions = [ Koha::Suggestions->search_limited( my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid ); $template->param( - suggestions => $suggestions, - basketno => $basketno, - booksellerid => $booksellerid, - name => $vendor->name, - "op_$op" => 1, + suggestions => $suggestions, + basketno => $basketno, + 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 651200ac258..c77df94f2fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -723,6 +723,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 0a0b968b57a..0b0f09c2772 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -100,7 +100,9 @@ [% suggestion.total | $Price %] - [% IF ( suggestion.biblionumber ) %] + [% IF link_order %] + [% tp('verb', 'Link suggestion') | html %] + [% ELSIF ( suggestion.biblionumber ) %] [% tp('verb', 'Order') | html %] [% ELSE %] [% tp('verb', 'Order') | html %] -- 2.39.2