|
@@ -649,6 +649,12 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
|
|
|
$results = tripal_pub_get_pubs_by_dbxref($pub_details['Publication Dbxref']);
|
|
|
if(count($results) == 1) {
|
|
|
$pub_id = $results[0];
|
|
|
+ if ($pub_id and !$update_if_exists) {
|
|
|
+ watchdog('tripal_pub', "A publication with this Dbxref already exists... Skipping: %dbxref",
|
|
|
+ array('%dbxref' => $pub_details['Publication Dbxref']), WATCHDOG_WARNING);
|
|
|
+ $action = 'skipped';
|
|
|
+ return $pub_id;
|
|
|
+ }
|
|
|
}
|
|
|
elseif (count($results) > 1) {
|
|
|
watchdog('tripal_pub', "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
|
|
@@ -666,6 +672,13 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
|
|
|
$results = tripal_pub_get_pubs_by_title_type_pyear_series($pub_details['Title'], NULL, $pub_details['Year']);
|
|
|
if (count($results) == 1) {
|
|
|
$pub_id = $results[0];
|
|
|
+ if ($pub_id and !$update_if_exists) {
|
|
|
+ watchdog('tripal_pub', "The publication with the same title, type and year already exists. Skipping. ".
|
|
|
+ " Title: '%title'. Type: '%type'. Year: '%year'",
|
|
|
+ array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']), WATCHDOG_WARNING);
|
|
|
+ $action = 'skipped';
|
|
|
+ return $pub_id;
|
|
|
+ }
|
|
|
}
|
|
|
elseif (count($results) > 1) {
|
|
|
watchdog('tripal_pub', "The publication with the same title, type and year is present multiple times. Cannot ".
|
|
@@ -675,12 +688,6 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
|
|
|
return FALSE;
|
|
|
}
|
|
|
}
|
|
|
- //print "PUB ID: $pub_id\n";
|
|
|
- // if there is a pub id and we've been told not to update then return
|
|
|
- if ($pub_id and !$update_if_exists) {
|
|
|
- $action = 'skipped';
|
|
|
- return $pub_id;
|
|
|
- }
|
|
|
|
|
|
// get the publication type (use the first publication type, any others will get stored as properties)
|
|
|
if (is_array($pub_details['Publication Type'])) {
|