[Bug 44221] New: Items added in the acquisitions and serials forms are created in random order
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44221 Bug ID: 44221 Summary: Items added in the acquisitions and serials forms are created in random order Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org Target Milestone: --- The forms that add several items before saving (placing an order with items created on order, receiving an order with items created on receipt, and receiving serials with "Create an item record when receiving this serial") create the items in random order. Each item block in the form gets an itemid, and acqui/addorder.pl, acqui/finishreceive.pl and serials/serials-edit.pl group the submitted subfields in a hash by itemid, then create the items with foreach ( keys %itemhash ). Perl hash order is random, so the items are not created in the order of the form: - the itemnumbers do not follow the order in which the items were added, so the items are listed in a different order; - the barcodes generated on save (autoBarcode with an empty barcode field) are assigned in random order: the first item added can get the highest number. To reproduce: 1. Create a basket that creates the items when placing an order 2. Add an order from a new empty record with quantity 6, and add 6 items with call numbers 1, 2, 3, 4, 5 and 6, in that order 3. Save and look at the items of the record, sorted by itemnumber (or by the generated barcodes) => The call numbers are not in order (e.g. 3, 1, 2, 5, 6, 4) The same happens when receiving an order whose basket creates the items on receipt, and when receiving several serial issues at once. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44221 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44221 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 212305 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212305&action=edit Bug 44221: Create the items of an order, a receipt or a serial in the order they were added acqui/addorder.pl, acqui/finishreceive.pl and serials/serials-edit.pl group the subfields of the items in a hash by itemid, and create the items looping over keys %itemhash, which is in random order. Keep the order in which each itemid first appears in the form, and create the items in that order. Test plan: 1. Create a basket that creates the items when placing an order (Create items when: placing an order) 2. Add an order from a new empty record with quantity 6, and add 6 items with call numbers 1, 2, 3, 4, 5 and 6, in that order 3. Save the order and look at the items of the record => The items are not created in the order you added them: sorted by itemnumber (or by barcode, if they were generated on save), the call numbers are in random order 4. Repeat with a basket that creates the items when receiving: close it, receive the order with 6 items with call numbers 1 to 6 => Same problem 5. Create a subscription with "Create an item record when receiving this serial", generate several expected issues, select them all in the serial collection, click "Edit serials", set them to Arrived and give each item the call number of its issue => Same problem: the items are created in random order 6. Apply the patch 7. Repeat steps 2 to 5 => The items are created in the order they are in the form: the itemnumbers follow the order of the call numbers (in the serials form the newest issue is shown first, so its item is created first) 8. Sign off Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org