function commerce_file_license_status_update in Commerce File 7
Updates the status of a license to the specified status.
Parameters
$entity: The fully loaded license object to update.
$name: The machine readable name string of the status to update to.
$skip_save: TRUE to skip saving the after updating the status; used when the entity would be saved elsewhere after the update.
Return value
The updated entity.
3 calls to commerce_file_license_status_update()
- commerce_file_license_form_submit in includes/
commerce_file_license.forms.inc - Submit callback for commerce_file_license_form().
- commerce_file_license_rules_action_update_state in ./
commerce_file.rules.inc - Rules action: Update a license state
- commerce_file_license_rules_action_update_status in ./
commerce_file.rules.inc - Rules action: Update a license status
File
- includes/
commerce_file.entities.inc, line 617 - Handles file licenses and file license logs
Code
function commerce_file_license_status_update($entity, $name, $skip_save = FALSE) {
// Do not update the status if the entity is already at it.
if ($entity->status != $name) {
try {
$entity->status = $name;
if (!$skip_save) {
$entity
->save();
}
} catch (Exception $e) {
}
}
return $entity;
}