function commerce_file_license_order_update_state in Commerce File 7
Update the state of licenses for files in an order
1 call to commerce_file_license_order_update_state()
- commerce_file_rules_action_order_update_state in ./
commerce_file.rules.inc - Rules action: Update state of all licenses associated with the order
File
- includes/
commerce_file.entities.inc, line 1066 - Handles file licenses and file license logs
Code
function commerce_file_license_order_update_state($order, $updated_state = 'denied') {
$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_state($line_item, $order, $updated_state);
}
} catch (Exception $e) {
}
}
}