AND (h.hold_type IN ('R','F') or exists (select 1 from asset.copy acp where acp.id=hm.target_copy and acp.holdable) )
That would result in only Recall and Force holds being included when a copy isn't holdable because of the asset.copy holdable field.
The performance impact of that addition seems to be minor when I try it out, but I think that would take care of the above issue with a rental item that isn't holdable.
This wouldn't help if an item isn't holdable because of shelving location, but that could also be added. I wouldn't think that status would apply in this instance, since this isn't for targeting.
An age hold protection filter can probably also be added this way, but that has more variables to pull in.
I don't know if this is really a good solution though, since it moves permit hold logic into the nearest hold section. It may make things less understandable in the future.
One simple way to pre-filter would be to hook into the best hold selection sort.
To keep non R and F holds from being evaluated for non holdable copies, something like this could be done.
And the following to the best hold selection sort query - http:// git.evergreen- ils.org/ ?p=Evergreen. git;a=blob; f=Open- ILS/src/ perlmods/ lib/OpenILS/ Application/ Storage/ Publisher/ action. pm#l581
AND (h.hold_type IN ('R','F') or exists (select 1 from asset.copy acp where acp.id= hm.target_ copy and acp.holdable) )
That would result in only Recall and Force holds being included when a copy isn't holdable because of the asset.copy holdable field.
The performance impact of that addition seems to be minor when I try it out, but I think that would take care of the above issue with a rental item that isn't holdable.
This wouldn't help if an item isn't holdable because of shelving location, but that could also be added. I wouldn't think that status would apply in this instance, since this isn't for targeting.
An age hold protection filter can probably also be added this way, but that has more variables to pull in.
I don't know if this is really a good solution though, since it moves permit hold logic into the nearest hold section. It may make things less understandable in the future.
Josh