When using the Koha acquisition module to receive items (basket receiving an order), Koha does not consideration of UniqueItemFields setting. The problem is that you can accidentally attach 3 items to an order with the same values.
Created attachment 168559 [details] [review] Add UniqueItemFields in orderreceive Test plan: 1) Set preferences UniqueItemFields: Public note (itemnotes) 2) Go to acquisition module 3) Create a basket with option Create items when: receiving an order 4) Add order to basket example from From a new (empty) record with Quantity: 3 or more 5) Close Basket 6) Receiving an order 7) Add Public note: TEST and receive first item (Add item) 8) You will see that next item have the same Public note 9) Apply this patch and repeat step 7 Sponsored-by: kohawbibliotece.pl
Thanks for the patch Michal! I had a go at testing (using the koha-testing-docker development environment). I could replicate the problem that you identified (and by manually making the change in the patch, I can confirm that it fixes the problem you identified). Issue applying the patch ~~~~~~~~~~~~~~~~~~~~~~~~ However, I had an issue applying the patch. I don't know what this means or how to fix it: git bz apply 37265 Bug 37265 - Consideration of UniqueItemFields setting when receiving items in an order. 168559 - Add UniqueItemFields in orderreceive Apply? [(y)es, (n)o, (i)nteractive] y Traceback (most recent call last): File "/usr/bin/git-bz", line 2834, in <module> applied = do_apply(bug_ref) ^^^^^^^^^^^^^^^^^ File "/usr/bin/git-bz", line 1918, in do_apply users = bug.server.get_xmlrpc_proxy().User.get({'names': [patch.attacher]})['users'] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/xmlrpc/client.py", line 1122, in __call__ return self.__send(self.__name, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/xmlrpc/client.py", line 1464, in __request response = self.__transport.request( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/xmlrpc/client.py", line 1166, in request return self.single_request(host, handler, request_body, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/xmlrpc/client.py", line 1178, in single_request http_conn = self.send_request(host, handler, request_body, verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/git-bz", line 1239, in send_request connection.putheader("Cookie", cookie) ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'putheader' I'm assuming that this means the patch is not in the required format that then development environment expects. Feel free to post on this bug, or ask for help in the Development channel at https://chat.koha-community.org/ Koha development environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most regular Koha developers use the koha-testing-docker development environment (https://gitlab.com/koha-community/koha-testing-docker) - if you need help setting that up, please ask in the Koha Community Chat > Development channel. Commit message guidelines ~~~~~~~~~~~~~~~~~~~~~~~~~ Also, the commit message needs to follow the guidelines at https://wiki.koha-community.org/wiki/Commit_messages If I was authoring the patch, I would format it similar to this: Bug 37265: Use UniqueItemFields settings for fields when receiving orders When using the acquisition module and receiving orders (where items are created when receiving an order), Koha does not consider the UniqueItemFields system preference settings for for fields when adding items. The problem is that the unique field values are copied to the next items received in the order, when they shouldn't be. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for "Create items when:" set to "receiving an order". 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl It can sometimes be a challenge getting a development environment setup, and I'd be happy to try and help you to get this to work (or alternatively, I can attach the patch to the bug in the format required). Changes to the bug information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I've added you as the assignee for this bug, and set the version to main (the release maintainer for 24.05 will review this bug once it is pushed to main by the release manager (after the quality assurance step is completed), and decide whether it should be added to 24.05).
The file attached is just a diff file not a patch - missing the header lines with the commit message and the bug number - I think this explains the error from git bz. Please let us know if we can help!
Created attachment 168594 [details] [review] Add UniqueItemFields in orderreceive When using the Koha acquisition module to receive items (basket receiving an order), Koha does not consideration of UniqueItemFields setting. The problem is that you can accidentally attach 3 items to an order with the same values. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for 'Create items when:' set to receiving an order. 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl
This looks much better. Small but important: Subject: [PATCH] Bug 37265 - Consideration of UniqueItemFields setting when receiving items in an order Should be: Bug 37265: ... Another small thing: I think you created the patch manually and uploaded it here. Are you using koha-testing-docker? Have a look at git bz, it makes creating and handling the patch files with bugzilla much easier: https://wiki.koha-community.org/wiki/Git_bz_configuration
Created attachment 168607 [details] [review] Bug 37265: Consideration of UniqueItemFields setting when receiving items in an order Bug 37265: Use UniqueItemFields settings for fields when receiving orders When using the acquisition module and receiving orders (where items are created when receiving an order), Koha does not consider the UniqueItemFields system preference settings for for fields when adding items. The problem is that the unique field values are copied to the next items received in the order, when they shouldn't be. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for "Create items when:" set to "receiving an order". 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl
Created attachment 168608 [details] [review] Bug 37265: Consideration of UniqueItemFields setting when receiving items in an order When using the acquisition module and receiving orders (where items are created when receiving an order), Koha does not consider the UniqueItemFields system preference settings for for fields when adding items. The problem is that the unique field values are copied to the next items received in the order, when they shouldn't be. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for "Create items when:" set to "receiving an order". 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl
David, thank you for the information. They helped me a lot. I think I've already uploaded the patch according to community guidelines.
Katrin, thank you for your tips. I currently work locally. Next time I will use git-bz.
Created attachment 168638 [details] [review] Bug 37265: Consideration of UniqueItemFields setting when receiving items in an order When using the Koha acquisition module to receive items (basket receiving an order), Koha does not consideration of UniqueItemFields setting. The problem is that you can accidentally attach 3 items to an order with the same values. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for 'Create items when:' set to receiving an order. 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl Signed-off-by: David Nind <david@davidnind.com>
Thanks Michal! Good luck with h equality assurance (QA) stage. There is a bit of a backlog at the moment for the QA Team (180), so it may take a while to get through. David
Created attachment 171949 [details] [review] Bug 37265: Consideration of UniqueItemFields setting when receiving items in an order When using the Koha acquisition module to receive items (basket receiving an order), Koha does not consideration of UniqueItemFields setting. The problem is that you can accidentally attach 3 items to an order with the same values. Test plan: 1. Set preference UniqueItemFields: Public note (itemnotes) 2. Go to the acquisition module. 3. Create a basket with the option for 'Create items when:' set to receiving an order. 4. Add an order to the basket, for example: From a new (empty) record with the Quantity set to 3 or more. 5. Close the basket. 6. Receive the order. 7. Add a public note: TEST, and receive the first item (Add item). 8. You will see that the next item has the same public note. 9. Apply this patch and repeat step 7 - the public note is not used for the next note. Sponsored-by: kohawbibliotece.pl Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Thanks for all the hard work! Pushed to main for the next 24.11.00 release as RM Assistant
Backported to 24.05.x for upcoming 24.05.06