Parcourir la source

Updating API to include v2.1 improvements: commits eb19a57..a89f289

Lacey Sanderson il y a 7 ans
Parent
commit
2a22113b19

+ 1 - 1
legacy/tripal_feature/tripal_feature.install

@@ -136,7 +136,7 @@ function tripal_feature_uninstall() {
       ),
       'phase' => array(
         'type' => 'int',
-        'not null' => TRUE,
+        'not null' => FALSE,
       ),
       'strand' => array(
         'type' => 'int',

+ 12 - 2
legacy/tripal_pub/includes/tripal_pub.chado_node.inc

@@ -46,6 +46,16 @@ function tripal_pub_node_info() {
 function chado_pub_form($node, $form_state) {
   $form = array();
 
+  // Check to make sure that the tripal_pub vocabulary is loaded. If not, then
+  // warn the user that they should load it before continuing.
+  $pub_cv = chado_select_record('cv', array('cv_id'), array('name' => 'tripal_pub'));
+  if (count($pub_cv) == 0) {
+    drupal_set_message(t('The Tripal Pub vocabulary is currently not loaded. ' .
+        'This vocabulary is required to be loaded before adding ' .
+        'publications.  <br>Please !import',
+        array('!import' => l('load the Tripal Publication vocabulary', 'admin/tripal/loaders/obo_loader'))), 'warning');
+  }
+
   // Default values can come in the following ways:
   //
   // 1) as elements of the $node object.  This occurs when editing an existing pub
@@ -190,7 +200,7 @@ function chado_pub_form($node, $form_state) {
   );
 
   $type_cv = tripal_get_default_cv('pub', 'type_id');
-  if ($type_cv->name == 'tripal_pub') {
+  if ($type_cv and $type_cv->name == 'tripal_pub') {
 
     // get the list of publication types.  In the Tripal publication
     // ontologies these are all grouped under the term 'Publication Type'
@@ -262,7 +272,7 @@ function chado_pub_form($node, $form_state) {
   $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
   // if the poperty cv is 'tripal_pub' then we need to pass in our own select_options
   // for only a subset of the vocabulary
-  if ($prop_cv->name == 'tripal_pub') {
+  if ($prop_cv and $prop_cv->name == 'tripal_pub') {
     $select_options[] = 'Select a Property';
     $sql = "
       SELECT

+ 2 - 6
tripal_chado/api/tripal_chado.query.api.inc

@@ -969,7 +969,7 @@ function chado_delete_record($table, $match, $options = NULL) {
   $fields = $table_desc['fields'];
   if (empty($table_desc)) {
     tripal_report_error('tripal_chado', TRIPAL_WARNING,
-      'chado_insert_record; There is no table description for !table_name',
+      'chado_delete_record; There is no table description for !table_name',
       array('!table_name' => $table), array('print' => $print_errors)
     );
   }
@@ -1229,8 +1229,6 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
     return FALSE;
   }
 
-  $select = '';
-  $from = '';
   $where = array();
   $args = array();
 
@@ -1328,8 +1326,6 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
       return array();
     }
 
-    $select[] = $field;
-
     // CASE 1: We have an array for a value.
     if (is_array($value)) {
 
@@ -1907,4 +1903,4 @@ function chado_db_select($table, $alias = NULL, array $options = array()) {
   $conninfo = Database::getConnectionInfo();
   $conn = new ChadoDatabaseConnection($conninfo['default']);
   return $conn->select($table, $alias, $options);
-}
+}

+ 1 - 1
tripal_chado/includes/TripalImporter/GFF3Importer.inc

@@ -2180,4 +2180,4 @@ class GFF3Importer extends TripalImporter {
           array('%target' => $tags['Target'][0]), TRIPAL_ERROR);
     }
   }
-}
+}

+ 11 - 0
tripal_chado/includes/loaders/tripal_chado.pub_importers.inc

@@ -14,6 +14,17 @@ require_once('tripal_chado.pub_importer_PMID.inc');
  * @ingroup tripal_pub
  */
 function tripal_pub_importers_list() {
+
+  // Check to make sure that the tripal_pub vocabulary is loaded. If not, then
+  // warn the user that they should load it before continuing.
+  $pub_cv = chado_select_record('cv', array('cv_id'), array('name' => 'tripal_pub'));
+  if (count($pub_cv) == 0) {
+    drupal_set_message(t('The Tripal Pub vocabulary is currently not loaded. ' .
+        'This vocabulary is required to be loaded before importing of ' .
+        'publications.  <br>Please !import',
+        array('!import' => l('load the Tripal Publication vocabulary', 'admin/tripal/loaders/obo_loader'))), 'warning');
+  }
+
   // clear out the session variable when we view the list.
   unset($_SESSION['tripal_pub_import']);