You are here

function pm_attribute_edit_submit in Drupal PM (Project Management) 7

Submit function for attribute edit form.

File

./pm.admin.inc, line 388
List functions for the Project Management module.

Code

function pm_attribute_edit_submit($form, &$form_state) {
  if ($form_state['values']['isdefault']) {
    $query = db_update('pmattribute')
      ->fields(array(
      'isdefault' => 0,
    ))
      ->condition('domain', $form_state['values']['domain'])
      ->execute();
  }
  $query_main = db_update('pmattribute')
    ->fields(array(
    'domain' => $form_state['values']['domain'],
    'akey' => $form_state['values']['akey'],
    'avalue' => $form_state['values']['avalue'],
    'parent_domain' => $form_state['values']['parent_domain'],
    'weight' => $form_state['values']['weight'],
    'isactive' => $form_state['values']['isactive'],
    'isdefault' => $form_state['values']['isdefault'],
  ))
    ->condition('aid', $form_state['values']['aid'])
    ->execute();
  if (isset($_REQUEST['destination'])) {
    $destination = urldecode($_REQUEST['destination']);
  }
  else {
    $destination = 'pm/attributes';
  }
  drupal_goto($destination);
}