/** * Return list of outstanding checkouts for a user * * @param int $pn_user_id * @param string $ps_display_template Display template evaluated relative to each ca_object_checkouts records; return in array with key '_display' * @param array $pa_options Array of options. Options include * db = A Db instance to use for database operations. If omitted a new Db instance will be used. [Default=null] * @return array */ public static function getOutstandingReservationsForUser($pn_user_id, $ps_display_template = null, $pa_options = null) { if (!($o_db = caGetOption('db', $pa_options, null))) { $o_db = new Db(); } $qr_res = $o_db->query("\n\t\t\tSELECT checkout_id\n\t\t\tFROM ca_object_checkouts\n\t\t\tWHERE\n\t\t\t\tcheckout_date IS NULL\n\t\t\t\tAND\n\t\t\t\treturn_date IS NULL\n\t\t\t\tAND\n\t\t\t\tuser_id = ?\n\t\t\t\tAND\n\t\t\t\tdeleted = 0\n\t\t\tORDER BY\n\t\t\t\tcheckout_date ASC\n\t\t", array($pn_user_id)); return ca_object_checkouts::_collectCheckoutData(caMakeSearchResult('ca_object_checkouts', $qr_res->getAllFieldValues('checkout_id')), $ps_display_template); }