[Koha-bugs] [Bug 32928] New: Filters missing in SQL builder on Orders::filter_by_active

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 9 16:21:01 CET 2023


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 at lists.koha-community.org
          Reporter: thibaud.guillot at biblibre.com
        QA Contact: testopia at 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.


More information about the Koha-bugs mailing list