[Bug 32928] New: Filters missing in SQL builder on Orders::filter_by_active
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Bug ID: 32928 Summary: Filters missing in SQL builder on Orders::filter_by_active Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: thibaud.guillot@biblibre.com QA Contact: testopia@bugs.koha-community.org Since version 21.xx.xx there has been a change in the way to retrieve the data of the orders to receive. The table is built from a call to the API and then the data can be filtered. Bug_20212 has integrated this change. This is a good thing but two filters are missing on the query construction in the Koha::Acquisition::Orders::filter_by_active function Here is the query in version 20.11 : <pre> SELECT aqbasket.basketno, borrowers.surname, borrowers.firstname, biblio.*, biblioitems.isbn, biblioitems.biblioitemnumber, biblioitems.publishercode, biblioitems.publicationyear, aqbasket.authorisedby, aqbasket.booksellerid, aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, aqbasketgroups.id as basketgroupid, aqbasketgroups.name as basketgroupname, aqorders.* FROM aqorders LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid = aqbasketgroups.id LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber WHERE (datecancellationprinted is NULL) AND ( ( aqbasket.is_standing AND aqorders.orderstatus IN ( "new", "ordered", "partial" ) ) OR ( ( quantity > quantityreceived OR quantityreceived is NULL ) AND aqorders.orderstatus IN ( "ordered", "partial" ) ) ) AND aqbasket.booksellerid = ? ORDER BY aqbasket.basketno'; </pre> The condition "datecancellationprinted is NULL" is missing as well as the quantity control to display the results only if there are still quantities to receive. And so the result on the same database between the different versions can be very different! -- 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=32928 Thibaud Guillot <thibaud.guillot@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |thibaud.guillot@biblibre.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Thibaud Guillot <thibaud.guillot@biblibre.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=32928 --- Comment #1 from Thibaud Guillot <thibaud.guillot@biblibre.com> --- Created attachment 146437 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146437&action=edit Bug 32928: Add filters on Orders::filter_by_active To have the same behavior than before 21.xx.xx filters must be added to the filter_by_active function. If not you can have on your list, some orders that can be cancelled, or orders with quantity totally received. Requirements: Have instances with different Koha version (20.11 VS Master for example) Test plan: 1) Apply this patch on Master Just have the same database with pending orders, and see differences between both instances on parcel.pl receptions. You will see that total of orders will be not the same -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Severity|enhancement |normal Keywords| |regression -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20212 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20212 [Bug 20212] Improve performance of acquisitions receive page -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |jonathan.druart+koha@gmail. | |com --- Comment #2 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Please provide tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Oups there is a typo. Backslash there : + 'quantityreceived' => { '<' => \'me.quantity' } -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 --- Comment #4 from Fridolin Somers <fridolin.somers@biblibre.com> --- (In reply to Fridolin Somers from comment #3)
Oups there is a typo. Backslash there : + 'quantityreceived' => { '<' => \'me.quantity' }
Forget that, it is a string ref, completely normal :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 Thibaud Guillot (thibaud_g) <thibaud.guillot@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|Failed QA |RESOLVED --- Comment #5 from Thibaud Guillot (thibaud_g) <thibaud.guillot@biblibre.com> --- *** This bug has been marked as a duplicate of bug 36018 *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32928 --- Comment #6 from Andrii Nugged <nugged@gmail.com> --- Created attachment 203831 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203831&action=edit Bug 32928: Exclude cancelled orders from active order filter The original patch on this bug added cancellation and outstanding quantity filters. Bug 36018 later added the quantity check, but the cancellation-date condition did not land. Historical orders may have datecancellationprinted set while orderstatus remains new, ordered or partial. Koha treats these records as obsolete, but filter_by_active still returns them through only_active. They can therefore appear under Pending orders even though they were cancelled. Require active orders to have no cancellation date. Test plan: These steps require an upgraded database containing an order with a cancellation date and status new, ordered or partial. Current Koha does not normally create this inconsistent state. Keep a normal outstanding order for the same vendor as a control. Before applying the patch: 1. Go to Acquisitions and find the vendor for the inconsistent order. 2. Click Receive shipments and create or open an invoice. 3. Confirm that the inconsistent cancelled order is incorrectly listed under Pending orders. Apply the patch. After applying the patch: 1. Repeat the same receiving flow for the vendor. 2. Confirm that the inconsistent cancelled order is no longer listed under Pending orders. 3. Confirm that the normal outstanding order is still listed and can be opened for receiving. 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=32928 --- Comment #7 from Andrii Nugged <nugged@gmail.com> --- Created attachment 203832 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203832&action=edit Bug 32928: Add regression tests for active order filtering TestBuilder generates values for omitted date columns, so the existing active-order fixtures do not reliably model orders without a cancellation date. Set cancellation dates explicitly. Cover ordered, partial and standing new orders whose cancellation date is set, while retaining normal active orders as controls. Add REST API coverage for the only_active query used by the Pending orders table and keep the full parcel embed path covered. Update the method documentation to include the cancellation-date condition. Test plan: 1. Run: prove t/db_dependent/Koha/Acquisition/Orders.t 2. Run: prove t/db_dependent/api/v1/acquisitions_orders.t 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=32928 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |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=32928 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203831|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=32928 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203832|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=32928 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=43345 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org