From 0c37140861f711e04fcc4edbc9f9d3111ac65782 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 17 Apr 2024 11:17:22 +0000 Subject: [PATCH] Bug 36620: Broken order management for suggestions with quantity Test plan ========= Scenario A (the bug) -------------------- 1. In OPAC, create a purchase suggestion with defined quantity ("Copies" in staff interface). 2. Accept the suggestion. 2. Have a budget, fund, vendor etc. to use the Acquisitions module. Ensure that AcqCreateItem syspref is set to 'placing an order'. 3. Create a new basket and add to basket an order line from accepted suggestion. Note the initial Quantity set to the quantity entered in suggestion. Note increasing this number while you add items to the order with the 'Add item' button. Save the order, close the basket. 4. Start receiving shipments for this order (create invoice etc.). Receive items you created by 'Add item' until there is nothing more to receive. Note the number of unreecived items in the order (eqal to the initial quantity from the suggestion) that cannot be regulary received (with the items table on the left). This is the *bug*. [This is due to the ambiguity of $data->{quantity} in the neworderempty.pl -- it normally comes from the order: GetOrder, but in the case of a yet empty order created from a suggestion, it comes from the suggestions table: GetSuggestion]. 5. Apply the patch, restart plack etc. 6. Repeat step 2 and 3. While adding items in order note that you start from quantity 0, and that the suggested quantity is shown in brackets. 7. Continue with p. 4. You should be able to receive the order in the regular way (with the items created). Scenario B (bonus) ------------------ Repeat the above with AcqCreateItem syspref is set to 'receiving the order', or 'cataloging the record'. These cases do not create a bug as it does the case with 'placing an order'. Note however, after applying the patch, the initial quantity in the order is set to 0 and there is the bonus infomation about the suggested number of items (from the suggestion). Sponsored-by: Ignatianum University in Cracow --- acqui/neworderempty.pl | 3 +++ .../intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 1ec08269f6..c3d40e4ac3 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -207,6 +207,8 @@ if ( not $ordernumber ) { # create order # otherwise, retrieve suggestion information. elsif ($suggestionid) { $data = GetSuggestion($suggestionid); + $data->{quantitysugg} = $data->{quantity}; + undef $data->{quantity}; $budget_id ||= $data->{'budgetid'} // 0; } @@ -488,6 +490,7 @@ $template->param( itemtypeloop => \@itemtypes, quantity => $quantity, quantityrec => $quantity, + quantitysugg => $data->{quantitysugg}, rrp => $data->{'rrp'}, replacementprice => $data->{'replacementprice'}, gst_values => \@gst_values, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index e9b62396f1..56434434ad 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -562,12 +562,18 @@ [% ELSE %] + [% IF quantitysugg %] + (suggested: [% quantitysugg %]) + [% END %] [% END %] [% ELSE %] [% IF basket.is_standing %] [% ELSE %] + [% IF quantitysugg %] + (suggested: [% quantitysugg %]) + [% END %] [% END %] [% END %] Required -- 2.39.2