function chado_organism_update

2.x tripal_organism.chado_node.inc chado_organism_update($node)
3.x tripal_organism.chado_node.inc chado_organism_update($node)
1.x tripal_organism.module chado_organism_update($node)

Update organisms

Related topics

File

tripal_organism/tripal_organism.module, line 340
tripal_organism Organism Module

Code

function chado_organism_update($node) {
  if ($node->revision) {
    // there is no way to handle revisions in Chado but leave
    // this here just to make not we've addressed it.
  }
  $match = array(
    'organism_id' => chado_get_id_for_node('organism', $node),
  );
  $values = array(
    'genus' => $node->genus,
    'species' => $node->species,
    'abbreviation' => $node->abbreviation,
    'common_name' => $node->common_name,
    'comment' => $node->description
  );
  $org_status = tripal_core_chado_update('organism', $match, $values);

  // set the title for the node
  $record = new stdClass();
  $record->title = "$node->genus $node->species";
  $record->nid = $node->nid;
  drupal_write_record('node', $record, 'nid');
  drupal_write_record('node_revisions', $record, 'nid');

  // add the image
  chado_organism_add_image($node);
}