You are here

function commerce_tax_ui_update_7000 in Commerce Core 7

Add a rounding mode column to the tax type table.

File

modules/tax/commerce_tax_ui.install, line 168

Code

function commerce_tax_ui_update_7000() {

  // Define and add the new database column.
  $spec = array(
    'description' => 'Integer indicating what type of rounding (if any) should be done for taxes of this type.',
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => 0,
  );
  db_add_field('commerce_tax_type', 'round_mode', $spec);

  // Update the default VAT tax type to round the half up.
  db_update('commerce_tax_type')
    ->fields(array(
    'round_mode' => COMMERCE_ROUND_HALF_UP,
  ))
    ->condition('name', 'vat')
    ->execute();
  return t('A new rounding mode option has been added to tax types, letting you specify how taxes of a given type should be rounded.');
}