->fields(
array(
'nid' => $nid,
+ 'owner' => $node->uid,
'uid' => $user->uid,
'status' => MUAMBA_REQUESTED,
'thread_id' => $thread_id,
*
* @param $uid
* Requester user uid.
- *
- * @todo
*/
function muamba_get_transactions($uid, $type = 'sent', $status = MUAMBA_REQUESTED) {
$uid = (int) $uid;
if ($type = 'sent') {
- // TODO
$query
->condition('m.uid', $uid, '=')
->condition('m.status', $status, '=');
}
else {
- // TODO
+ $query
+ ->condition('m.owner', $uid, '=')
+ ->condition('m.status', $status, '=');
}
return $query->execute();
'not null' => TRUE,
'default' => 0,
),
+ // This assumes that the node won't have his author changed,
+ // which might be reasonable depending on the application.
+ 'owner' => array(
+ 'description' => t('The {user}.owner owner of an item.'),
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ ),
'uid' => array(
'description' => t('The {user}.uid requesting an item.'),
'type' => 'int',
'table' => 'node',
'columns' => array('nid' => 'nid'),
),
+ 'owner' => array(
+ 'table' => 'users',
+ 'columns' => array('owner' => 'uid'),
+ ),
'requester' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
)
);
}
+
+
+/**
+ * Adds owner field.
+ */
+function muamba_update_7002(&$sandbox) {
+ db_add_field('muamba', 'owner',
+ array(
+ 'description' => t('The {user}.owner owner of an item.'),
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ )
+ );
+}