function commerce_license_commerce_line_item_delete in Commerce License 7
Implements hook_commerce_line_item_delete().
Deletes the associated license when removing a line item.
File
- ./
commerce_license.module, line 421 - Provides a framework for selling access to local or remote resources.
Code
function commerce_license_commerce_line_item_delete($line_item) {
if (!empty($line_item->commerce_license)) {
$license = entity_load_single('commerce_license', $line_item->commerce_license[LANGUAGE_NONE][0]['target_id']);
if ($license && $license->status == COMMERCE_LICENSE_CREATED && variable_get('commerce_license_line_item_cleanup', TRUE)) {
entity_delete('commerce_license', $license->license_id);
}
}
}