[Koha-bugs] [Bug 13640] Holds To Pull List includes items unreserveable items
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Sep 21 09:31:34 CEST 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13640
--- Comment #9 from Magnus Enger <magnus at libriotech.no> ---
I think I managed to take the 'Default holds policy by item type' into account
in this report:
SELECT min(reservedate) as l_reservedate,
reserves.reserve_id,
reserves.borrowernumber as borrowernumber,
GROUP_CONCAT(DISTINCT items.holdingbranch
ORDER BY items.itemnumber SEPARATOR '|') l_holdingbranch,
reserves.biblionumber,
reserves.branchcode as l_branch,
reserves.itemnumber,
items.holdingbranch,
items.homebranch,
GROUP_CONCAT(DISTINCT items.itype
ORDER BY items.itemnumber SEPARATOR '|') l_item_type,
GROUP_CONCAT(DISTINCT items.location
ORDER BY items.itemnumber SEPARATOR '|') l_location,
GROUP_CONCAT(DISTINCT items.itemcallnumber
ORDER BY items.itemnumber SEPARATOR '<br/>') l_itemcallnumber,
GROUP_CONCAT(DISTINCT items.enumchron
ORDER BY items.itemnumber SEPARATOR '<br/>') l_enumchron,
GROUP_CONCAT(DISTINCT items.copynumber
ORDER BY items.itemnumber SEPARATOR '<br/>') l_copynumber,
biblio.title,
biblio.author,
count(DISTINCT items.itemnumber) as icount,
count(DISTINCT reserves.borrowernumber) as rcount,
borrowers.firstname,
borrowers.surname
FROM reserves
LEFT JOIN items ON items.biblionumber=reserves.biblionumber
LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber
LEFT JOIN biblioitems ON biblio.biblionumber=biblioitems.biblionumber
LEFT JOIN branchtransfers ON items.itemnumber=branchtransfers.itemnumber
LEFT JOIN issues ON items.itemnumber=issues.itemnumber
LEFT JOIN borrowers ON reserves.borrowernumber=borrowers.borrowernumber
LEFT JOIN default_branch_item_rules ON
items.itype=default_branch_item_rules.itemtype
WHERE
reserves.found IS NULL
AND (reserves.itemnumber IS NULL OR reserves.itemnumber = items.itemnumber)
AND items.itemnumber NOT IN (SELECT itemnumber FROM branchtransfers where
datearrived IS NULL)
AND items.itemnumber NOT IN (select itemnumber FROM reserves where found IS
NOT NULL)
AND issues.itemnumber IS NULL
AND reserves.priority <> 0
AND reserves.suspend = 0
AND notforloan = 0 AND damaged = 0 AND itemlost = 0 AND withdrawn = 0
AND default_branch_item_rules.holdallowed != 0
GROUP BY reserves.biblionumber ORDER BY biblio.title
What is changed compared to the "Holds to pull" SQL are these two lines:
- LEFT JOIN default_branch_item_rules ON
items.itype=default_branch_item_rules.itemtype
- AND default_branch_item_rules.holdallowed != 0
However, default_branch_item_rules.holdallowed is of the "bit" type:
http://schema.koha-community.org/18_05/tables/default_branch_item_rules.html
I gotta confess I'm not familiar with that. Any special tricks to consider?
When I look in the database, the value of that column is 0 or 2. Why not a
boolean "0 or 1" value?
--
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