Procházet zdrojové kódy

Fixed bug in getting publication year from AGL importer

spficklin před 12 roky
rodič
revize
b0ae5533c5
1 změnil soubory, kde provedl 9 přidání a 5 odebrání
  1. 9 5
      tripal_pub/includes/pub_form.inc

+ 9 - 5
tripal_pub/includes/pub_form.inc

@@ -165,7 +165,7 @@ function chado_pub_form($node, $form_state) {
 /*
  * 
  */
-function chado_pub_validate($node) {
+function chado_pub_validate($node, &$form) {
   
   // get the submitted values
   $title        = trim($node->title);
@@ -182,7 +182,7 @@ function chado_pub_validate($node) {
   $pubplace     = trim($node->pubplace);
   $is_obsolete  = $node->is_obsolete;
   $pub_id       = $node->pub_id;
-  
+
   // if this is a delete then don't validate
   if($node->op == 'Delete') {
     return;
@@ -199,7 +199,8 @@ function chado_pub_validate($node) {
   $options = array('statement_name' => 'sel_pub_ty');
   $cvterm = tripal_core_chado_select('cvterm', array('name'), $values, $options);
   if (count($cvterm) == 0) {
-    form_set_error('type_id', t('Invalided publication type.'));
+    $message = t('Invalided publication type.');
+    form_set_error('type_id', $message);
     return;
   }
 
@@ -207,7 +208,9 @@ function chado_pub_validate($node) {
   if (!$pub_id) {
     $results = tripal_pub_get_pubs_by_title_type_pyear($title, $cvterm[0]->name, $pyear);   
     if (count($results) > 0) {
-      form_set_error('pyear',t('A publication with this title, type and publication year, already exists.  Cannot add this publication'));
+      $message = t('A publication with this title, type and publication year, already exists.  Cannot add this publication');
+      form_set_error('pyear', $message);
+      return;
     }
   }
   
@@ -234,7 +237,8 @@ function chado_pub_validate($node) {
         }
       }         
       if (count($results) > 0) {
-        form_set_error('pyear',t('A publication with this title and publication year, already exists.  Cannot update this publication'));       
+        $message = t('A publication with this title and publication year, already exists.  Cannot update this publication'); 
+        form_set_error('pyear', $message);
       }
     }
   }