function chado_pub_delete

2.x tripal_pub.chado_node.inc chado_pub_delete(&$node)
3.x tripal_pub.chado_node.inc chado_pub_delete(&$node)
1.x tripal_pub.module chado_pub_delete(&$node)

Implementation of tripal_pub_delete().

This function takes a node and if the delete button has been chosen by the user, the publication and it's details will be removed.Following,given the node-ID, the instance will be deleted from the 'chado_pub' table.

@parm $node Then node which contains the information stored within the node-ID

File

tripal_pub/tripal_pub.module, line 740
The Tripal Publication module allows you to search the PubMed databse for academic articles, that relate to user specified tpoic\s. As well, it allows management of publications so that a user can enter specified details regarding a desired…

Code

function chado_pub_delete(&$node) {

  $pub_id = chado_get_id_for_node('pub', $node);

  // if we don't have a pub id for this node then this isn't a node of
  // type chado_pub or the entry in the chado_pub table was lost.
  if (!$pub_id) {
    return;
  }

  // Remove data from {chado_pub}, {node} and {node_revisions} tables of
  // drupal database
  $sql_del = "DELETE FROM {chado_pub} " .
    "WHERE nid = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node_revisions} " .
    "WHERE nid = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node} " .
    "WHERE nid = %d " .
    "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);

  // Remove data from pub and pubprop tables of chado database as well
  chado_query("DELETE FROM {pubprop} WHERE pub_id = %d", $pub_id);
  chado_query("DELETE FROM {pub} WHERE pub_id = %d", $pub_id);
}