function uc_order_can_delete in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_can_delete()
- 6.2 uc_order/uc_order.module \uc_order_can_delete()
Access callback for admin/store/orders/%uc_order/delete.
Returns TRUE if an order can be deleted by the current user.
4 calls to uc_order_can_delete()
- uc_order_actions in uc_order/
uc_order.module - Returns the actions a user may perform on an order.
- uc_order_delete_confirm_form in uc_order/
uc_order.admin.inc - Confirmation form to delete an order.
- uc_order_edit_form in uc_order/
uc_order.admin.inc - Displays the order edit screen, constructed via hook_uc_order_pane().
- uc_order_order_entity_access in uc_order/
uc_order.module - Entity API "access callback" for uc_order entity.
1 string reference to 'uc_order_can_delete'
- uc_order_menu in uc_order/
uc_order.module - Implements hook_menu().
File
- uc_order/
uc_order.module, line 2178
Code
function uc_order_can_delete($order, $account = NULL) {
if (user_access('unconditionally delete orders', $account)) {
// Unconditional deletion perms are always TRUE.
return TRUE;
}
elseif (user_access('delete orders', $account)) {
// Only users with unconditional deletion perms can delete completed orders.
$state = uc_order_status_data($order->order_status, 'state');
if ($state == 'completed') {
return FALSE;
}
else {
$can_delete = TRUE;
// See if any modules have a say in this order's eligibility for deletion.
foreach (module_implements('uc_order') as $module) {
$function = $module . '_uc_order';
if (function_exists($function) && $function('can_delete', $order, NULL) === FALSE) {
$can_delete = FALSE;
break;
}
}
return $can_delete;
}
}
else {
return FALSE;
}
}