You are here

function uc_recurring_get_fees_for_renew in UC Recurring Payments and Subscriptions 7.2

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

Get all pending fees that should be renewed.

1 call to uc_recurring_get_fees_for_renew()
uc_recurring_cron in ./uc_recurring.module
Implements hook_cron().

File

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

Code

function uc_recurring_get_fees_for_renew() {
  $fees = array();
  $result = db_query("SELECT * FROM {uc_recurring_users} WHERE remaining_intervals <> :remaining_intervals AND next_charge <= :next_charge AND status = :status AND own_handler = :own_handler ORDER BY order_id DESC", array(
    ':remaining_intervals' => 0,
    ':next_charge' => REQUEST_TIME,
    ':status' => UC_RECURRING_FEE_STATUS_ACTIVE,
    ':own_handler' => 0,
  ));
  foreach ($result as $fee) {
    $fee->data = unserialize($fee->data);
    $fees[$fee->rfid] = $fee;
  }
  return $fees;
}