This breaks the 'Holds to pull' report in 21.05.09 if there are no holds "Fixed" by bug 3142 in 21.05.11 and master The problem is essentially that calculation of @bibs_or_items can be empty if no holds are passed, so our SQL Abstract call ends up with an emptpy -or block, which in turn leads to our where beginning with "AND" DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND `itemlost` = '0' AND `itemnumber` NOT IN ( '156269' ) AND 1=1 AND `notforloa' at line 1 [for Statement "SELECT `me`.`itemnumber`, `me`.`biblionumber`, `me`.`biblioitemnumber`, `me`.`barcode`, `me`.`dateaccessioned`, `me`.`booksellerid`, `me`.`homebranch`, `me`.`price`, `me`.`replacementprice`, `me`.`replacementpricedate`, `me`.`datelastborrowed`, `me`.`datelastseen`, `me`.`stack`, `me`.`notforloan`, `me`.`damaged`, `me`.`damaged_on`, `me`.`itemlost`, `me`.`itemlost_on`, `me`.`withdrawn`, `me`.`withdrawn_on`, `me`.`itemcallnumber`, `me`.`coded_location_qualifier`, `me`.`issues`, `me`.`renewals`, `me`.`reserves`, `me`.`restricted`, `me`.`itemnotes`, `me`.`itemnotes_nonpublic`, `me`.`holdingbranch`, `me`.`timestamp`, `me`.`location`, `me`.`permanent_location`, `me`.`onloan`, `me`.`cn_source`, `me`.`cn_sort`, `me`.`ccode`, `me`.`materials`, `me`.`uri`, `me`.`itype`, `me`.`more_subfields_xml`, `me`.`enumchron`, `me`.`copynumber`, `me`.`stocknumber`, `me`.`new_status`, `me`.`exclude_from_local_holds_priority` FROM `items` `me` WHERE ( ( AND `itemlost` = ? AND `itemnumber` NOT IN ( ? ) AND 1=1 AND `notforloan` = ? AND `onloan` IS NULL AND `withdrawn` = ? ) )" with ParamValues: 0=0, 1=156269, 2=0, 3=0] at /usr/share/koha/lib/Koha/Objects.pm line 145
Created attachment 131024 [details] [review] Bug 30155: Don't get items that can fillholds if there are no holds This makes two changes: 1 - We no longer call get_items_that_can_fill if there are no holds 2 - The subroutine will return an empty Koha::Items object if there are no holds passed
To test: - apply patch, restart services - prove t/db_dependent/Koha/Holds.t - it passes!
Created attachment 131485 [details] [review] Bug 30155: Don't get items that can fillholds if there are no holds This makes two changes: 1 - We no longer call get_items_that_can_fill if there are no holds 2 - The subroutine will return an empty Koha::Items object if there are no holds passed Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Created attachment 131524 [details] [review] Bug 30155: Don't get items that can fillholds if there are no holds This makes two changes: 1 - We no longer call get_items_that_can_fill if there are no holds 2 - The subroutine will return an empty Koha::Items object if there are no holds passed Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.05