You are here

function pm_update_7101 in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pm.install \pm_update_7101()
  2. 7.3 pm.install \pm_update_7101()
  3. 7.2 pm.install \pm_update_7101()

Enable new module dependencies. Make billing status field available to PM content types.

File

./pm.install, line 92
Install, update and uninstall functions for the Project Management module.

Code

function pm_update_7101() {

  // Enable new dependencies.
  if (!module_enable(array(
    'date',
    'entityreference',
    'list',
  ))) {
    throw new DrupalUpdateException('This version requires one or more modules that could not be enabled.');
  }

  // Combining these operations in one request means we have to clear the
  // field info cache.
  field_info_cache_clear();

  // Set up billing status field.
  field_create_field(array(
    'field_name' => 'pm_billing_status',
    'type' => 'list_text',
    'settings' => array(
      'allowed_values' => array(
        'Not billable' => 'Not billable',
        'Billable' => 'Billable',
        'Billed' => 'Billed',
      ),
    ),
  ));
}