You are here

function uc_recurring_get_fees_for_expiration 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_expiration()

Get all pending fees that should be expired.

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

File

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

Code

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