Best hold selection: fix a checkin-busting bug affecting Holds-go-home
Several subselects within SQL auxiliary queries can possibly return
multiple rows in situations where outer code requires that they return
only one or zero rows.
When you're using a best-hold order that includes htime or shtime, (such
as those with Holds-go-home) and if there are mutiple circs or transits
related to the copy in hand with certain characteristics, you can
trigger this bug. The end user at the staff client gets one of those
nasty "Network error" dialogs, and the error in the SQL logs is:
> ERROR: more than one row returned by a subquery used as an expression
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>