function commerce_file_license_order_update_status in Commerce File 7
Update the status of licenses for files in an order
2 calls to commerce_file_license_order_update_status()
- commerce_file_rules_action_order_update_status in ./
commerce_file.rules.inc - Rules action: Update state of all licenses associated with the order
- commerce_file_rules_action_revoke_order_licenses in ./
commerce_file.rules.inc - Rules action: Revoke file licenses' limits for order owner based on a line item
File
- includes/
commerce_file.entities.inc, line 1116 - Handles file licenses and file license logs
Code
function commerce_file_license_order_update_status($order, $updated_status = 'pending') {
$line_items = field_get_items('commerce_order', $order, 'commerce_line_items');
if (empty($line_items)) {
return;
}
// revoke line items for the order
foreach ($line_items as $delta => $field_item) {
// try to avoid any locking issues
try {
$line_item = commerce_line_item_load($field_item['line_item_id']);
if (!empty($line_item)) {
commerce_file_license_line_item_update_status($line_item, $order, $updated_status);
}
} catch (Exception $e) {
}
}
}