function chado_pub_validate_check_uniquename
2.x tripal_pub.chado_node.inc | chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) |
3.x tripal_pub.chado_node.inc | chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) |
Validate the publication uniquename. To be called from hook_validate().
Parameters
$uniquename: The uniquename of the publication
$pub_id: If an update, provide the pub_id so we don't check for a matching uniquename of the pub we are editing
Related topics
1 call to chado_pub_validate_check_uniquename()
- chado_pub_validate in legacy/
tripal_pub/ includes/ tripal_pub.chado_node.inc - Implements hook_validate().
File
- legacy/
tripal_pub/ includes/ tripal_pub.chado_node.inc, line 460 - Implements Drupal Node hooks to create the chado_analysis node content type.
Code
function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
// check to see if a pub exists with this uniquename
$pub = tripal_get_publication(array('uniquename' => $uniquename));
if ($pub) {
// if a $pub_id is provided to the function then this is an update
// if the pub_id's don't match then a different pub with the same
// uniquename already exists.
if ($pub->pub_id != $pub_id) {
$message = t('A publication with this unique citation already exists.');
form_set_error('uniquename', $message);
}
}
}