function commerce_license_renew_action in Commerce License 7
Renews the provided license.
File
- ./
commerce_license.module, line 1330 - Provides a framework for selling access to local or remote resources.
Code
function commerce_license_renew_action($license, $context = array()) {
// Commerce License Billing handles renewals automatically. Don't allow
// the user to interfere with that.
if (module_exists('commerce_license_billing')) {
$product = $license->wrapper->product
->value();
if (!empty($product->cl_billing_cycle_type)) {
$license_id = $license->license_id;
drupal_set_message("Can't renew license #{$license_id}, it is managed by Commerce License Billing.");
return;
}
}
$new_expiration = $license->expires + $context['extension'];
$license
->renew($new_expiration);
}