Bug 34022 - Adding items on receive is broken
Summary: Adding items on receive is broken
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P1 - high blocker
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Katrin Fischer
URL:
Keywords: rel_23_05_candidate
: 34046 34057 (view as bug list)
Depends on: 8179
Blocks: 34109
  Show dependency treegraph
 
Reported: 2023-06-15 11:27 UTC by Ranjan
Modified: 2024-07-04 20:37 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.01
Circulation function:


Attachments
steps followed for receiving an order (257.47 KB, application/pdf)
2023-06-15 11:27 UTC, Ranjan
Details
All steps (341.32 KB, application/pdf)
2023-06-15 13:40 UTC, Ranjan
Details
Bug 34022: Adjust items data structure (3.86 KB, patch)
2023-06-22 19:11 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 34022: Adjust items data structure (3.92 KB, patch)
2023-06-23 06:40 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 34022: Adjust items data structure (3.97 KB, patch)
2023-06-23 07:39 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ranjan 2023-06-15 11:27:59 UTC
Created attachment 152377 [details]
steps followed for receiving an order

The acquisition module, the system failed to save the barcode at the time of receiving items in an order. Clicking on confirmation and finishing the receipt while cataloguing showing Holding 0 though in the acquisition details button it is showing received 1 copy.
Comment 1 Katrin Fischer 2023-06-15 11:49:30 UTC
In your PDF, the actual receive form is missing, also the basket summary page. 

On the receive form, do you have the item form on the left?

Koha can create items in acq on ordering, on receiving or not at all. It depends on your setting for each basket. 

So copies don't need to be linked to items.
Comment 2 Ranjan 2023-06-15 12:12:33 UTC
Yes... at the time of receiving all data are showing perfectly including currency and the right side barcode, but after confirmation, in the summery showing the item under Already received (as shown in the attached file) but without the barcodes which I had assigned at the time of receiving the copies.
Comment 3 Katrin Fischer 2023-06-15 12:21:04 UTC
Do you see the item form or where do you enter the barcode?
Comment 4 Ranjan 2023-06-15 13:40:42 UTC
Created attachment 152383 [details]
All steps
Comment 5 Ranjan 2023-06-15 13:41:58 UTC
Submitted new attachments showing the setup at AcqCreateItem - receiving an order in Global preference and order receiving worksheet
Comment 6 Katrin Fischer 2023-06-19 08:36:38 UTC
Hi Ranjan, thanks a lot for providing the updated document. I can confirm that adding items on receive in master and 23.05 is broken. I am updating this bug to high severity.

Testing notes:
* Create a basket with 'create items on receive'
* Create an order line
* Close basket
* Receive shipment
* Enter invoice number
* Click on Receive link in the table
* Fill out item form, make sure all mandatory fields are set
* Save 
* Verify that the order line is marked as 'received'
* Verify that there has been no item created on the record
Comment 7 Ranjan 2023-06-19 11:15:28 UTC
Thanks Katrin Fischer 

I am perfect with all this steps. Only problem is on clicking on the Confirmation button, the barcode is not saving and showing holding as zero.
Comment 8 Katrin Fischer 2023-06-19 11:42:38 UTC
*** Bug 34057 has been marked as a duplicate of this bug. ***
Comment 9 Katrin Fischer 2023-06-20 14:26:01 UTC
blocker is worse than critical ;)
Comment 10 Ranjan 2023-06-21 02:53:17 UTC
Hope the community is working on this for solving the problem quickly.
Comment 11 Katrin Fischer 2023-06-21 05:47:22 UTC
*** Bug 34046 has been marked as a duplicate of this bug. ***
Comment 12 Ranjan 2023-06-21 11:26:21 UTC
Today I have observed that, on receiving, the system is not showing any result at the bottom immediately. Just after refresh, the result is coming. I have tested with one record, tried to give the barcode by edit item option from catalogue module, KOHA failed to carry the Item wise Price, and vendor information from acqusition.
Comment 13 Katrin Fischer 2023-06-21 13:38:41 UTC
(In reply to Ranjan from comment #12)
> Today I have observed that, on receiving, the system is not showing any
> result at the bottom immediately. Just after refresh, the result is coming.
> I have tested with one record, tried to give the barcode by edit item option
> from catalogue module, KOHA failed to carry the Item wise Price, and vendor
> information from acqusition.

There is a separate bug for this already:
Comment 14 Katrin Fischer 2023-06-21 13:39:17 UTC
(In reply to Katrin Fischer from comment #13)
> (In reply to Ranjan from comment #12)
> > Today I have observed that, on receiving, the system is not showing any
> > result at the bottom immediately. Just after refresh, the result is coming.
> > I have tested with one record, tried to give the barcode by edit item option
> > from catalogue module, KOHA failed to carry the Item wise Price, and vendor
> > information from acqusition.
> 
> There is a separate bug for this already:
Bug 34036 - Single receive doesn't reload data and order lines appears as pending
Comment 15 Tomás Cohen Arazi (tcohen) 2023-06-22 19:11:11 UTC
Created attachment 152581 [details] [review]
Bug 34022: Adjust items data structure

When creating items at receiving, the generated data structure didn't
match what the code expected, so this patch adapts the code to match the
new data structure introduced by bug 8179.

Once I fixed that, I noticed that the $.ajax request payload, when it
contains an array parameter, it renames it like `param[]`. So the
finishreceive.pl controller is adjusted to this behaviour for the 'on
receiving' use case.

To test:
1. Apply this patch
2. Create a basket with 'create items on receive'
3. Create an order line
4. Close basket
5. Receive shipment
6. Enter invoice number
7. Click on Receive link in the table
8. Fill out item form, make sure all mandatory fields are set
9. Save
10. Verify that the order line is marked as 'received'
11. Verify that there item is created on the record
=> SUCCESS: Works as expected
12. Sign off :-D
Comment 16 PTFS Europe Sandboxes 2023-06-23 06:40:44 UTC
Created attachment 152612 [details] [review]
Bug 34022: Adjust items data structure

When creating items at receiving, the generated data structure didn't
match what the code expected, so this patch adapts the code to match the
new data structure introduced by bug 8179.

Once I fixed that, I noticed that the $.ajax request payload, when it
contains an array parameter, it renames it like `param[]`. So the
finishreceive.pl controller is adjusted to this behaviour for the 'on
receiving' use case.

To test:
1. Apply this patch
2. Create a basket with 'create items on receive'
3. Create an order line
4. Close basket
5. Receive shipment
6. Enter invoice number
7. Click on Receive link in the table
8. Fill out item form, make sure all mandatory fields are set
9. Save
10. Verify that the order line is marked as 'received'
11. Verify that there item is created on the record
=> SUCCESS: Works as expected
12. Sign off :-D

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 17 Katrin Fischer 2023-06-23 07:15:33 UTC
Thanks Michaela! Starting QA, but if someone else wants to have a look, the more eyes the better.
Comment 18 Katrin Fischer 2023-06-23 07:39:14 UTC
Created attachment 152619 [details] [review]
Bug 34022: Adjust items data structure

When creating items at receiving, the generated data structure didn't
match what the code expected, so this patch adapts the code to match the
new data structure introduced by bug 8179.

Once I fixed that, I noticed that the $.ajax request payload, when it
contains an array parameter, it renames it like `param[]`. So the
finishreceive.pl controller is adjusted to this behaviour for the 'on
receiving' use case.

To test:
1. Apply this patch
2. Create a basket with 'create items on receive'
3. Create an order line
4. Close basket
5. Receive shipment
6. Enter invoice number
7. Click on Receive link in the table
8. Fill out item form, make sure all mandatory fields are set
9. Save
10. Verify that the order line is marked as 'received'
11. Verify that there item is created on the record
=> SUCCESS: Works as expected
12. Sign off :-D

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 19 Katrin Fischer 2023-06-23 07:53:01 UTC
I've tested the various workflows (in cataloging, on order, on receive) with single and multiple items. Found 2 more bugs in the process:

Bug 34109 - When adding items on receive, mandatory fields are not checked (major)
Bug 34108 - When items are added on receive, item selection gets lost on editing items  (normal)

Also noticed this one again, it also needs an urgent fix:

Bug 34036 - Single receive doesn't reload data and order lines appears as pending
Comment 20 Tomás Cohen Arazi (tcohen) 2023-06-23 12:46:27 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 21 Fridolin Somers 2023-06-26 12:51:05 UTC
Pushed to 23.05.x for 23.05.01
Comment 22 Matt Blenkinsop 2023-07-12 08:40:41 UTC
Not backporting to 22.11.x, missing dependency 8719
Comment 23 Aude Charillon 2023-09-29 09:35:24 UTC
No updates to the Koha Manual needed. Moving this to Resolved.