aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-09-26 21:16:30 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-09-26 21:16:30 -0300
commitb74600a75946c09159d02f39dfe807ee892cdf71 (patch)
treee74dcb33f8c384ae4ce97797855020c9c4f931ee
parent461a0d5737e8aec766758c9887904d53eb177e8f (diff)
downloadmuamba-b74600a75946c09159d02f39dfe807ee892cdf71.tar.gz
muamba-b74600a75946c09159d02f39dfe807ee892cdf71.tar.bz2
Making muamba_get_transactions() work for all status
-rw-r--r--muamba.db.inc17
1 files changed, 8 insertions, 9 deletions
diff --git a/muamba.db.inc b/muamba.db.inc
index bd2322f..0e29ca6 100644
--- a/muamba.db.inc
+++ b/muamba.db.inc
@@ -52,21 +52,20 @@ function muamba_check_user_request($nid, $uid) {
* @return
* Array of existing transactions.
*/
-function muamba_get_transactions($uid, $type = 'sent', $status = MUAMBA_REQUESTED) {
+function muamba_get_transactions($uid, $type = 'sent', $status = NULL) {
$uid = (int) $uid;
$query = db_select('muamba', 'm');
+ $query->fields('m', array('mid', 'nid', 'uid', 'owner', 'status', 'thread_id'));
if ($type == 'sent') {
- $query
- ->condition('m.uid', $uid, '=')
- ->condition('m.status', $status, '=')
- ->fields('m', array('mid', 'nid', 'uid', 'owner', 'thread_id'));
+ $query->condition('m.uid', $uid, '=');
}
else {
- $query
- ->condition('m.owner', $uid, '=')
- ->condition('m.status', $status, '=')
- ->fields('m', array('mid', 'nid', 'uid', 'owner', 'status', 'thread_id'));
+ $query->condition('m.owner', $uid, '=');
+ }
+
+ if ($status != NULL) {
+ $query->condition('m.status', $status, '=');
}
$rows = array();