You are here

function commerce_coupon_can_delete in Commerce Coupon 7

Determines whether or not the give coupon can be deleted.

Parameters

$coupon: The coupon to be checked for deletion.

Return value

Boolean indicating whether or not the coupon can be deleted.

See also

commerce_product_can_delete()

1 call to commerce_coupon_can_delete()
CommerceCouponEntityController::delete in classes/commerce_coupon.inc
Deletes multiple coupons by ID.

File

./commerce_coupon.module, line 740
Coupon System for Drupal Commerce.

Code

function commerce_coupon_can_delete($coupon) {

  // Return FALSE if the given coupon does not have an ID; it need not be
  // deleted, which is functionally equivalent to cannot be deleted as far as
  // code depending on this function is concerned.
  if (empty($coupon->coupon_id)) {
    return FALSE;
  }

  // If any module implementing hook_commerce_coupon_can_delete() returns FALSE
  // the coupon cannot be deleted. Return TRUE if none return FALSE.
  return !in_array(FALSE, module_invoke_all('commerce_coupon_can_delete', $coupon));
}