You are here

function paymentreference_load_instance in Payment 7

Check if a payment is available for referencing.

Parameters

integer $pid: The PID of the payment to check.

integer $uid: The UID of the user that should be the payment's owner.

Return value

false|array FALSE if the payment is not available. Otherwise an array with keys "entity_type", "bundle", and "field_name" to identify the instance with the payment is for.

2 calls to paymentreference_load_instance()
paymentreference_field_validate in modules/paymentreference/paymentreference.module
Implements hook_field_validate().
paymentreference_page_finish in modules/paymentreference/paymentreference.module
Menu page callback to call after a payment reference payment has finished.

File

modules/paymentreference/paymentreference.module, line 321
Hook implementations and general functions.

Code

function paymentreference_load_instance($pid, $uid) {
  $query = db_select('paymentreference', 'pr');
  $query
    ->addJoin('INNER', 'payment', 'p', 'p.pid = pr.pid');
  return $query
    ->fields('pr', array(
    'entity_type',
    'bundle',
    'field_name',
  ))
    ->condition('pr.pid', $pid)
    ->condition('uid', $uid)
    ->execute()
    ->fetchAssoc();
}