You are here

function payment_webform_load in Payment for Webform 7

Loads a PID of a Payment available for referencing.

3 calls to payment_webform_load()
PaymentWebformTestQueueWebTestCase::testQueueCRUD in tests/PaymentWebformTestQueueWebTestCase.test
PaymentWebformTestQueueWebTestCase::testQueueWebformImplementation in tests/PaymentWebformTestQueueWebTestCase.test
payment_webform_page_payment_access in ./payment_webform.module
Check if a user has access to the redirect page.
1 string reference to 'payment_webform_load'
_webform_render_payment_webform in ./payment_webform.webform.inc
Implements _webform_render_[component]().

File

./payment_webform.module, line 119
Hook implementations and shared functions.

Code

function payment_webform_load($cid, $uid) {
  $query = db_select('payment_webform', 'pw');
  $query
    ->addJoin('INNER', 'payment', 'p', 'p.pid = pw.pid');
  $query
    ->addJoin('INNER', 'payment_status_item', 'psi', 'p.psiid_last = psi.psiid');
  $query
    ->fields('pw', array(
    'pid',
  ))
    ->condition('cid', $cid)
    ->condition('status', array_merge(payment_status_info(PAYMENT_STATUS_SUCCESS)
    ->descendants(), array(
    PAYMENT_STATUS_SUCCESS,
  )))
    ->condition('uid', $uid)
    ->orderBy('pid')
    ->range(0, 1);
  return $query
    ->execute()
    ->fetchField();
}