function uc_recurring_save_extensions in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 uc_recurring.module \uc_recurring_save_extensions()
Save a set of extensions.
Parameters
$extensions: String of comma seperated day values to extend the extension.
$extend_seconds: The number of seconds to extend the order by.
1 call to uc_recurring_save_extensions()
- uc_recurring_payment_form_save_extensions in ./
uc_recurring.admin.inc - Saves the extension options.
File
- ./
uc_recurring.module, line 611 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_save_extensions($extensions, $fee_id = NULL) {
db_delete('uc_recurring_extensions')
->isNull('pfid')
->execute();
$extend = explode(',', $extensions);
$count = 0;
foreach ($extend as $days_to_extend) {
$seconds = $days_to_extend * (24 * 60 * 60);
$id = db_insert('uc_recurring_extensions')
->fields(array(
'rebill_attempt' => $count,
'time_to_extend' => $seconds,
))
->execute();
$count++;
}
// Last extension set extension to 0 to expire.
$id = db_insert('uc_recurring_extensions')
->fields(array(
'rebill_attempt' => $count,
'time_to_extend' => 0,
))
->execute();
}