You are here

function uc_recurring_get_extension_list in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 uc_recurring.module \uc_recurring_get_extension_list()

Retuns a list of all the extensions for a specific recurring fee.

Parameters

$fee_id: The id of the recurring fee to get extensions.

1 call to uc_recurring_get_extension_list()
uc_recurring_payment_form in ./uc_recurring.admin.inc
Recurring payment settings form.

File

./uc_recurring.module, line 585
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_get_extension_list($fee_id = NULL) {
  if ($fee_id === NULL) {

    // TODO Please convert this statement to the D7 database API syntax.
    $result = db_query("SELECT * FROM {uc_recurring_extensions} WHERE pfid IS NULL ORDER BY pfid DESC, rebill_attempt ASC");
  }
  else {
    $result = db_query("SELECT * FROM {uc_recurring_extensions} WHERE (pfid = :pfid OR pfid IS NULL) ORDER BY pfid DESC, rebill_attempt ASC", array(
      ':pfid' => $fee_id,
    ));
  }
  $extensions = array();
  foreach ($result as $extension) {
    if (!isset($extensions[$extension->rebill_attempt])) {
      $extensions[$extension->rebill_attempt] = $extension;
    }
  }
  return $extensions;
}