From fdfe199f9b2b185ce95aa51a5d644be821d87d03 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 16 Nov 2011 14:27:32 -0200 Subject: Optional uid parameter at muamba_check_availability() --- muamba.db.inc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/muamba.db.inc b/muamba.db.inc index f06e3be..1c1894e 100644 --- a/muamba.db.inc +++ b/muamba.db.inc @@ -169,10 +169,16 @@ function muamba_current_transactions($data, $uid = NULL) { * @param $data * Item nid or node object. * + * @param $uid + * Optional uid parameter to check if item is currently + * available to the user. + * * @return - * TRUE if item is borrowed, FALSE otherwise. + * TRUE if item is available, FALSE otherwise. */ -function muamba_check_availability($data) { +function muamba_check_availability($data, $uid = NULL) { + global $user; + if (is_object($data)) { $nid = (int) $data->nid; } @@ -193,6 +199,9 @@ function muamba_check_availability($data) { if (empty($current)) { return TRUE; } + elseif ($uid !== NULL && $current['uid'] == $user->uid) { + return TRUE; + } return FALSE; } -- cgit v1.2.3