[Bug 43344] New: OPAC does not show the On order item status when acquisition details are enabled
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 Bug ID: 43344 Summary: OPAC does not show the On order item status when acquisition details are enabled Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 36018 Target Milestone: --- When OPACAcquisitionDetails is enabled, the OPAC checks active acquisition orders for each item. For an item linked to an outstanding order, this check logs the following SQL error: Unknown column 'me.quantity' in 'WHERE' The order count returns no value, so the item is not displayed with the On order status. Steps to reproduce: 1. Set OPACAcquisitionDetails to Show. 2. Set AcqCreateItem to create an item when placing an order. 3. Create a basket and add an order for a bibliographic record, including an item. 4. Close the basket so the order is active and outstanding. 5. Open the bibliographic record in the OPAC. Expected result: The item is displayed with the On order status and no SQL error is logged. Actual result: The On order status is not displayed and the SQL error is logged. Technical note: item-status.inc calls item.orders.filter_by_active.count. item->orders is a many-to-many DBIx::Class resultset whose current source alias is ordernumber. filter_by_active hard-codes me.quantity, so the generated SQL refers to an alias that is not present in this query. This was introduced by the Bug 36018 follow-up that qualified quantity to avoid ambiguity in REST API joins. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36018 [Bug 36018] Improve consistency in Acquisition/Order(s) regarding active/current orders -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |nugged@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 --- Comment #1 from Andrii Nugged <nugged@gmail.com> --- Created attachment 203830 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203830&action=edit Bug 43344: Use the current source alias in filter_by_active Bug 36018 qualified the quantity column with the default "me" alias to avoid ambiguity when joined tables also have a quantity column. DBIx::Class does not always use "me" for related resultsets. The many-to-many item_orders relationship uses "ordernumber", so evaluating item.orders.filter_by_active from the OPAC refers to a non-existent me.quantity column. Use current_source_alias to qualify quantity with the alias of the actual resultset. Add regression coverage for filtering active orders through the item relationship. Test plan: Before applying the patch: 1. Set OPACAcquisitionDetails to Show. 2. Set AcqCreateItem to create an item when placing an order. 3. Create a basket and add an order for a bibliographic record, including an item. 4. Close the basket so the order is active and outstanding. 5. Open the bibliographic record in the OPAC. 6. Confirm the item is not shown as On order and the log contains an Unknown column 'me.quantity' error. Apply the patch. After applying the patch: 1. Open the same bibliographic record in the OPAC again. 2. Confirm the item is shown as On order and the SQL error is gone. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 Olivia Reynolds <olivia.reynolds@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 Olivia Reynolds <olivia.reynolds@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203830|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43344 --- Comment #2 from Olivia Reynolds <olivia.reynolds@openfifth.co.uk> --- Created attachment 203836 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203836&action=edit Bug 43344: Use the current source alias in filter_by_active Bug 36018 qualified the quantity column with the default "me" alias to avoid ambiguity when joined tables also have a quantity column. DBIx::Class does not always use "me" for related resultsets. The many-to-many item_orders relationship uses "ordernumber", so evaluating item.orders.filter_by_active from the OPAC refers to a non-existent me.quantity column. Use current_source_alias to qualify quantity with the alias of the actual resultset. Add regression coverage for filtering active orders through the item relationship. Test plan: Before applying the patch: 1. Set OPACAcquisitionDetails to Show. 2. Set AcqCreateItem to create an item when placing an order. 3. Create a basket and add an order for a bibliographic record, including an item. 4. Close the basket so the order is active and outstanding. 5. Open the bibliographic record in the OPAC. 6. Confirm the item is not shown as On order and the log contains an Unknown column 'me.quantity' error. Apply the patch. After applying the patch: 1. Open the same bibliographic record in the OPAC again. 2. Confirm the item is shown as On order and the SQL error is gone. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: Olivia Reynolds <olivia.reynolds@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org