You are here

function pm_attribute_add_submit in Drupal PM (Project Management) 7

Submit function for attribute add form.

File

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

Code

function pm_attribute_add_submit($form, &$form_state) {
  if ($form_state['values']['isdefault']) {
    db_query("UPDATE {pmattribute} SET isdefault=0 WHERE domain='%s'", $form_state['values']['domain']);
  }
  $query = db_insert('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'],
  ))
    ->execute();
  if (isset($_REQUEST['destination'])) {
    $destination = urldecode($_REQUEST['destination']);
  }
  else {
    $destination = 'pm/attributes';
  }
  drupal_goto($destination);
}