You are here

function commerce_avatax_exemptions_pane_checkout_form in Drupal Commerce Connector for AvaTax 7.4

Implements base_checkout_form().

File

modules/commerce_avatax_exemptions/includes/commerce_avatax_exemptions.checkout_pane.inc, line 129
Commerce AvaTax Exemptions checkout panes.

Code

function commerce_avatax_exemptions_pane_checkout_form($form, $form_state, $checkout_pane, $order) {

  // Reset exemptions every time the form is loaded.
  if (isset($order->data['commerce_avatax_exemptions_category'])) {
    unset($order->data['commerce_avatax_exemptions_category']);
    commerce_order_save($order);
  }
  $checkout_form['commerce_avatax_exemptions_category'] = array(
    '#title' => t('Sales tax exemption category'),
    '#type' => 'select',
    '#options' => array(
      '0' => t('None'),
      'E' => t('Charitable or benevolent org'),
      'H' => t('Commercial agricultural production'),
      'J' => t('Direct pay permit'),
      'K' => t('Direct mail'),
      'A' => t('Federal government'),
      'D' => t('Foreign diplomat'),
      'I' => t('Industrial production / manufacturer'),
      'N' => t('Local government'),
      'B' => t('State government'),
      'C' => t('Tribe / Status Indian / Indian Band'),
      'F' => t('Religious or educational org'),
      'G' => t('Resale'),
      'L' => t('Other'),
    ),
    '#description' => check_plain(variable_get('commerce_avatax_exemptions_description', '')),
    '#default_value' => isset($order->data['commerce_avatax_exemptions_category']) ? $order->data['commerce_avatax_exemptions_category'] : '0',
  );
  $checkout_form['#access'] = FALSE;
  drupal_add_css(drupal_get_path('module', 'commerce_avatax_exemptions') . '/theme/commerce_avatax_exemptions.css');
  return $checkout_form;
}