You are here

function support_install in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.install \support_install()

Install support database schema.

File

./support.install, line 359
Install, update and uninstall functions for the ._support module.

Code

function support_install() {

  // State: new
  db_insert('support_states')
    ->fields(array(
    'state' => 'new',
    'weight' => 0,
    'phase1' => 1,
    'phase2' => 0,
    'isdefault' => 1,
  ))
    ->execute();

  // State: active
  db_insert('support_states')
    ->fields(array(
    'state' => 'active',
    'weight' => 1,
    'phase1' => 0,
    'phase2' => 1,
  ))
    ->execute();

  // State: pending
  db_insert('support_states')
    ->fields(array(
    'state' => 'pending',
    'weight' => 2,
    'phase1' => 0,
    'phase2' => 1,
  ))
    ->execute();

  // State: closed
  db_insert('support_states')
    ->fields(array(
    'state' => 'closed',
    'weight' => 3,
    'phase1' => 0,
    'phase2' => 1,
    'isclosed' => 1,
  ))
    ->execute();

  // Priority: low
  db_insert('support_priority')
    ->fields(array(
    'priority' => 'low',
    'weight' => 0,
  ))
    ->execute();

  // Priority: normal
  db_insert('support_priority')
    ->fields(array(
    'priority' => 'normal',
    'weight' => 1,
    'isdefault' => 1,
  ))
    ->execute();

  // Priority: high
  db_insert('support_priority')
    ->fields(array(
    'priority' => 'high',
    'weight' => 2,
  ))
    ->execute();

  // Priority: critical
  db_insert('support_priority')
    ->fields(array(
    'priority' => 'critical',
    'weight' => 3,
  ))
    ->execute();

  // default comment settings
  variable_set('comment_default_mode_support_ticket', COMMENT_MODE_THREADED);

  // TODO: Is there a replacement for this

  //variable_set('comment_default_order_support_ticket', COMMENT_ORDER_OLDEST_FIRST);

  // Set default weight
  db_update('system')
    ->fields(array(
    'weight' => 10,
  ))
    ->condition('name', 'support')
    ->execute();

  // Add body field to support_ticket type.
  node_types_rebuild();
  $types = node_type_get_types();
  node_add_body_field($types['support_ticket']);

  // Set up a file field for uploads.
  _support_ensure_upload_field();
}