Bug 36620: Broken order management for suggestions with quantity
authorJanusz Kaczmarek <januszop@gmail.com>
Wed, 17 Apr 2024 11:17:22 +0000 (11:17 +0000)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 17 May 2024 08:36:30 +0000 (10:36 +0200)
commit3cfe1af7dba820410c5537172a875e82d472c8e2
tree9d7a3cf0a217cfe9f31aa1ebd473840f61ca815f
parent98faf85163d75ae37a12a0e283d97206d37acead
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 <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
acqui/neworderempty.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt