Browse Source

Small fixes to the node title api

Lacey Sanderson 10 năm trước cách đây
mục cha
commit
f6ea56ac65

+ 5 - 2
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -481,8 +481,9 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
     $select[] = 'cvterm.name as cvtname';
     $joins[] = "LEFT JOIN {cvterm} cvterm ON $base_table.type_id = cvterm.cvterm_id";
     foreach ($types as $type) {
-      $where_clauses['type'][] = "cvterm.name = :type_name_$type";
-      $where_args['type'][":type_name_$type"] = $type;
+      $sanitized_type = str_replace(' ','_',$type);
+      $where_clauses['type'][] = "cvterm.name = :type_name_$sanitized_type";
+      $where_args['type'][":type_name_$sanitized_type"] = $type;
     }
   }
 
@@ -542,6 +543,8 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
   $query = substr($query, 0, -4); // remove the trailing 'AND'
   $query .- " ORDER BY " . $base_table_id;
 
+print $query."\n";
+
   // If Maximum number to Sync is supplied
   if ($max_sync) {
     $query .= " LIMIT $max_sync";

+ 3 - 3
tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -155,13 +155,13 @@ function chado_add_admin_form_set_title(&$form, &$form_state, $details) {
   $details['content_type'] = (isset($details['content_type'])) ? $details['content_type'] : $details['module'];
 
   $tokens = array();
-  $details['default_option'] = (isset($details['default_option'])) ? $details['default_option'] : chado_node_get_title_format($details['content_type'], $tokens);
   if (empty($tokens)) {
     $tokens = chado_node_generate_tokens($chado_node_api['base_table']);
   }
   $tokens = array_merge($tokens, $details['custom_tokens']);
   $token_list = chado_node_format_tokens($tokens);
-
+  $details['default_option'] = (isset($details['default_option'])) ? $details['default_option'] : chado_node_get_title_format($details['content_type'], $tokens);
+  
   // FORM PROPER
   $msg = t(
     'Each synced %singular must have a unique page title, however, %plural may have the
@@ -198,7 +198,7 @@ function chado_add_admin_form_set_title(&$form, &$form_state, $details) {
       array('%plural' => $chado_node_api['record_type_title']['plural'])),
     '#required'      => FALSE,
     '#options'       => $details['options'],
-    '#default_value' => $details['default_option'],
+    '#default_value' => (isset($details['options'][$details['default_option']])) ? $details['default_option'] : 'custom',
   );
 
   $form['set_titles']['title_format_variable'] = array(