From 31b7ec2b29c6a7ad60a6edb07ea1e440c460b272 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 Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 3cfe1af7dba820410c5537172a875e82d472c8e2) Signed-off-by: Fridolin Somers --- 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 5249e1ff1a..4297de58db 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -205,6 +205,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; } @@ -486,6 +488,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 592c5411a8..ec57233d5b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -567,12 +567,18 @@ [% ELSE %] + [% IF quantitysugg %] + (suggested: [% quantitysugg %]) + [% END %] [% END %] [% ELSE %] [% IF basket.is_standing %] [% ELSE %] + [% IF quantitysugg %] + (suggested: [% quantitysugg %]) + [% END %] [% END %] [% END %] Required -- 2.39.5