Browse Source

Merge branch '6.x-1.x' of git.drupal.org:sandbox/spficklin/1337878 into 6.x-1.x

spficklin 12 years ago
parent
commit
e332937b6a

+ 15 - 0
tripal_bulk_loader/tripal_bulk_loader.admin.templates.inc

@@ -872,6 +872,21 @@ function tripal_bulk_loader_edit_template_record_form(&$form_state = NULL) {
   return $form;
 }
 
+function tripal_bulk_loader_edit_template_record_form_validate($form, $form_state) {
+
+  // Don't worry about validation when Cancel button is clicked
+  if ($form_state['clicked_button']['#value'] == 'Edit Record') {
+    $is_unique = tripal_bulk_loader_is_record_name_unique(
+      $form_state['values']['record_name'],
+      $form_state['values']['template_id'],
+      $form_state['storage']['template_array']
+    );
+    if (!$is_unique) {
+      form_set_error('record_name', "New Record Name must be unique. '" . $form_state['values']['record_name'] . "' is not unique.");
+    }
+  }
+
+}
 
 /**
  * Edit Record Form Submit

+ 1 - 0
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -687,6 +687,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
 					$record = tripal_core_chado_insert($table, $values, $options);
 				}
 				else {
+				  $options['return_record'] = TRUE;
   		    $record = tripal_core_chado_update($table, $match, $values, $options);
   		  }
   	  }