You are here

function commerce_avatax_install_helper in Drupal Commerce Connector for AvaTax 7.5

Helper function to define and create the required fields & instances.

2 calls to commerce_avatax_install_helper()
commerce_avatax_flush_caches in ./commerce_avatax.module
Implements hook_flush_caches().
commerce_avatax_install in ./commerce_avatax.install
Implements hook_install().

File

./commerce_avatax.install, line 72
Installation functions for Commerce Avatax module.

Code

function commerce_avatax_install_helper() {
  drupal_load('module', 'commerce_avatax');
  drupal_load('module', 'commerce_product');

  // Configure the Avatax codes Taxonomy vocabulary.
  $t = get_t();
  $vocabulary = taxonomy_vocabulary_machine_name_load('avatax_codes');
  if (!$vocabulary) {
    $vocabulary = (object) array(
      'name' => $t('AvaTax codes'),
      'machine_name' => 'avatax_codes',
    );
    taxonomy_vocabulary_save($vocabulary);
    taxonomy_term_save((object) array(
      'name' => 'P0000000',
      'vid' => $vocabulary->vid,
    ));
    taxonomy_term_save((object) array(
      'name' => 'NT',
      'vid' => $vocabulary->vid,
    ));
  }
  _commerce_avatax_configure_tax_code_field();
  _commerce_avatax_configure_tax_exemption_field();
  _commerce_avatax_configure_vat_id_field();
}