https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34639
--- Comment #5 from Lari Taskula <lari.task...@hypernova.fi> --- The WHERE condition in "current_branchtransfers" is completely ignored when prefetching current transfers. Tracing the query reveals this: $schema->storage->debug(1); my $items = Koha::Items->search( { 'me.itemnumber' => $transfer_item->itemnumber }, { prefetch => ['current_branchtransfers'] } ); warn $items->next; 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`.`deleted_on`, `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`, `current_branchtransfers`.`branchtransfer_id`, `current_branchtransfers`.`itemnumber`, `current_branchtransfers`.`daterequested`, `current_branchtransfers`.`datesent`, `current_branchtransfers`.`frombranch`, `current_branchtransfers`.`datearrived`, `current_branchtransfers`.`datecancelled`, `current_branchtransfers`.`tobranch`, `current_branchtransfers`.`comments`, `current_branchtransfers`.`reason`, `current_branchtransfers`.`cancellation_reason` FROM `items` `me` LEFT JOIN `branchtransfers` `current_branchtransfers` ON `current_branchtransfers`.`itemnumber` = `me`.`itemnumber` WHERE ( `me`.`itemnumber` = ? ) ORDER BY `me`.`itemnumber`: '1857' So all transfers are fetched instead regardless of their status. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/