You are here

function commerce_tax_ui_tax_type_delete in Commerce Core 7

Deletes a tax type.

Parameters

$name: The machine-name of the tax type.

$skip_reset: Boolean indicating whether or not this delete should result in entities being reset and the menu being rebuilt; defaults to FALSE. This is useful when you intend to perform many deletions at once, as menu rebuilding is very costly in terms of performance.

1 call to commerce_tax_ui_tax_type_delete()
commerce_tax_ui_tax_type_delete_form_submit in modules/tax/includes/commerce_tax_ui.admin.inc
Submit callback for commerce_tax_ui_tax_type_delete_form().

File

modules/tax/commerce_tax_ui.module, line 322
Provides a UI for creating simple tax types and rates.

Code

function commerce_tax_ui_tax_type_delete($name, $skip_reset = FALSE) {
  $tax_type = commerce_tax_type_load($name);
  db_delete('commerce_tax_type')
    ->condition('name', $name)
    ->execute();
  commerce_tax_types_reset();
  rules_config_delete(array(
    rules_config_load($tax_type['rule'])->id,
  ));

  // Clear the necessary caches and rebuild the menu items.
  if (!$skip_reset) {
    entity_defaults_rebuild();
    rules_clear_cache();
    variable_set('menu_rebuild_needed', TRUE);
  }

  // Notify other modules that this tax type has been deleted.
  module_invoke_all('commerce_tax_type_delete', $tax_type, $skip_reset);
}