Browse Source

Merge branch '7.x-3.x' of github.com:tripal/tripal into 7.x-3.x

Stephen Ficklin 7 years ago
parent
commit
be20c8ef08
32 changed files with 135 additions and 69 deletions
  1. 2 3
      .github/ISSUE-TEMPLATE.md
  2. 1 1
      legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc
  3. 1 1
      legacy/tripal_cv/api/tripal_cv.api.inc
  4. 1 1
      legacy/tripal_feature/tripal_feature.drush.inc
  5. 1 1
      legacy/tripal_organism/includes/tripal_organism.chado_node.inc
  6. 2 2
      tripal/api/tripal.files.api.inc
  7. 3 1
      tripal/includes/TripalBundleUIController.inc
  8. 3 3
      tripal/includes/TripalEntityCollection.inc
  9. 1 1
      tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc
  10. 1 1
      tripal/includes/TripalFields/TripalField.inc
  11. 1 1
      tripal/includes/TripalFields/rdfs__type/rdfs__type.inc
  12. 42 0
      tripal/includes/tripal.fields.inc
  13. 2 2
      tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc
  14. 16 6
      tripal_chado/api/tripal_chado.custom_tables.api.inc
  15. 1 1
      tripal_chado/api/tripal_chado.entity.api.inc
  16. 6 2
      tripal_chado/api/tripal_chado.mviews.api.inc
  17. 3 3
      tripal_chado/api/tripal_chado.query.api.inc
  18. 1 1
      tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc
  19. 1 1
      tripal_chado/includes/TripalImporter/OBOImporter.inc
  20. 2 2
      tripal_chado/includes/loaders/tripal_chado.pub_importer_AGL.inc
  21. 1 1
      tripal_chado/includes/loaders/tripal_chado.pub_importer_PMID.inc
  22. 5 5
      tripal_chado/includes/setup/tripal_chado.chado_v1.2.inc
  23. 9 9
      tripal_chado/includes/setup/tripal_chado.chado_vx_x.inc
  24. 19 9
      tripal_chado/includes/setup/tripal_chado.setup.inc
  25. 1 1
      tripal_chado/includes/tripal_chado.bundle.inc
  26. 2 2
      tripal_chado/includes/tripal_chado.field_storage.inc
  27. 1 1
      tripal_chado/includes/tripal_chado.migrate.inc
  28. 1 2
      tripal_chado/tripal_chado.module
  29. 1 1
      tripal_chado_views/includes/tripal_chado_views_integration_UI.inc
  30. 1 1
      tripal_chado_views/includes/tripal_chado_views_integration_port.inc
  31. 1 1
      tripal_ws/includes/TripalWebService.inc
  32. 2 2
      tripal_ws/includes/TripalWebServiceResource.inc

+ 2 - 3
.github/ISSUE-TEMPLATE.md

@@ -1,13 +1,12 @@
 INSTRUCTIONS: The following template is meant to provide the information that will help other Tripal developers diagnose and reproduce your issue. Follow the directions below to complete the template. If the template is not appropriate for your issue you may remove it and describe your issue.
 
 ### System information
-<!--Please enter the following information (if known)  -->
+<!--Please enter the following information (if able). All information is available in your site's administrator report area (Administration Toolbar > Reports > Status Report) -->
 
 * Tripal Version:
 * Drupal Version:
 * PostgreSQL Version:
 * PHP Version:
-* Operating System:
 
 
 ### Issue description
@@ -16,4 +15,4 @@ Some information you might want to include: the page you're seeing the issue on,
 
 
 
-<-- PS. Also feel free to ask questions, start discussions, suggest improvements We welcome any and all feedback! -->
+<-- PS. Also feel free to ask questions, start discussions, suggest improvements We welcome any and all feedback! -->

+ 1 - 1
legacy/tripal_core/api/tripal_core.chado_nodes.title_and_path.inc

@@ -1217,7 +1217,7 @@ function chado_node_get_unique_constraint_format($base_table, $format_type = 'ti
     tripal_report_error(
       'tripal_node_api',
       TRIPAL_ERROR,
-      'Unable to determine the format for the unique contraint since the format type (%format-type) is not supported (only "title" and "url" are at this time).',
+      'Unable to determine the format for the unique constraint since the format type (%format-type) is not supported (only "title" and "url" are at this time).',
       array('%format-type' => $format_type)
     );
   }

+ 1 - 1
legacy/tripal_cv/api/tripal_cv.api.inc

@@ -16,7 +16,7 @@
  */
 
 /**
- * Retreives the default vocabulary for a given table and field.
+ * Retrieves the default vocabulary for a given table and field.
  *
  * Each table in Chado that has a 'type_id' (or foreign key constraint to
  * the cvterm table) will have a default vocabulary assigned. This indicates to

+ 1 - 1
legacy/tripal_feature/tripal_feature.drush.inc

@@ -43,7 +43,7 @@ function tripal_feature_drush_command() {
       'parent'   => dt('Set this argument to 1 to retrieve the sequence from the parent in an alignment rather than the residues column of the feature itself.'),
       'agg'      => dt('Set this argument to 1 to aggregate sub features into a single sequence.  This is useful, for example, for obtaining CDS sequence from an mRNA'),
       'child'    => dt('Set this argument to the exact sequence ontology term for the children to aggregate.  This is useful in the case where a gene has exons as well as CDSs and UTRs.  You may sepcify as many feature types as desired by separating each with a single comma (no spaces). Term matching is case-sensitive.'),
-      'relationship'  => dt('Retreives the sequence of any feature in the specified relationship with the matched features.'),
+      'relationship'  => dt('Retrieves the sequence of any feature in the specified relationship with the matched features.'),
       'rel_part' => dt('If a relationship is provided, then this will be "subject" or "object" indicating the side of the relationship for the matched features. If the matched features are the "object" then the "subject" features will have their sequences included in the output (and vice versa).'),
       'width'    => dt('The number of nucleotides per row (defaults to 50).')
     ),

+ 1 - 1
legacy/tripal_organism/includes/tripal_organism.chado_node.inc

@@ -209,7 +209,7 @@ function chado_organism_form($node, $form_state) {
       $terms = tripal_get_cvterm_select_options($cv->cv_id);
 
       // Unfortunately the taxonomic_rank vocabulary is not properly organized
-      // such that we an only include terms below 'species'. Therefore we will
+      // such that we only include terms below 'species'. Therefore we will
       // just list them here and hope we haven't missed one.
       $valid_terms = array('subspecies', 'varietas', 'subvariety', 'forma', 'subforma');
       foreach  ($terms as $cvterm_id => $name) {

+ 2 - 2
tripal/api/tripal.files.api.inc

@@ -65,7 +65,7 @@ function tripal_create_files_dir($module_name, $path = FALSE) {
 }
 
 /**
- * Retreives the Drupal relative directory for a Tripal module.
+ * Retrieves the Drupal relative directory for a Tripal module.
  *
  * Each Tripal module has a unique data directory which was created using the
  * tripal_create_files_dir function during installation.  This function
@@ -97,7 +97,7 @@ function tripal_get_files_dir($module_name = FALSE) {
 }
 
 /**
- * Retreives the Drupal stream (e.g. public://...) for a Tripal module.
+ * Retrieves the Drupal stream (e.g. public://...) for a Tripal module.
  *
  * Each Tripal module has a unique data directory which was created using the
  * tripal_create_files_dir function during installation.  This function

+ 3 - 1
tripal/includes/TripalBundleUIController.inc

@@ -661,7 +661,7 @@ function tripal_admin_add_type_form_ajax_callback($form, $form_state) {
  */
 function tripal_admin_add_type_form_validate($form, &$form_state) {
   $stores = module_invoke_all('vocab_storage_info');
-  $store_select = $form_state['values']['store_select'];
+  $store_select = (isset($form_state['values']['store_select'])) ? $form_state['values']['store_select'] : NULL;
 
   if (array_key_exists('clicked_button', $form_state) and
       $form_state['clicked_button']['#name'] =='use_cvterm') {
@@ -768,6 +768,7 @@ function tripal_admin_add_type_form_submit($form, &$form_state) {
  * Checks access permissions for a given entity.
  */
 function tripal_admin_access($entity) {
+
   if ($entity) {
     $bundle_name = $entity->name;
   }
@@ -793,5 +794,6 @@ function tripal_admin_access($entity) {
   foreach($roles as $role => $value){
     user_role_change_permissions($role, $permission_for_role);
   }
+
   return TRUE;
 }

+ 3 - 3
tripal/includes/TripalEntityCollection.inc

@@ -242,7 +242,7 @@ class TripalEntityCollection {
    * Retrieves the list of entity IDs.
    *
    * @return
-   *   An array of numeric enity IDs.
+   *   An array of numeric entity IDs.
    */
   public function getEntityIDs(){
     return $this->ids;
@@ -275,7 +275,7 @@ class TripalEntityCollection {
   }
 
   /**
-   * Retreives the name of the collection.
+   * Retrieves the name of the collection.
    *
    * @return
    *   A string containing the name of the collection.
@@ -295,7 +295,7 @@ class TripalEntityCollection {
   }
 
   /**
-   * Retreives the collection description
+   * Retrieves the collection description
    *
    * @return
    *   A string containing the description of the collection.

+ 1 - 1
tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc

@@ -169,7 +169,7 @@ abstract class TripalFieldDownloader {
   abstract protected function formatEntity($entity);
 
   /**
-   *  Retreives header lines
+   *  Retrieves header lines
    *
    *  This function should be implemented by a child class.  It should return
    *  the header lines for an output file.

+ 1 - 1
tripal/includes/TripalFields/TripalField.inc

@@ -17,7 +17,7 @@ class TripalField {
   // The default description for this field.
   public static $default_description = 'The generic base class for all Tripal fields. Replace this text as appropriate for the child implementation.';
 
-  // Provide a list of global settings. These can be accessed witihn the
+  // Provide a list of global settings. These can be accessed within the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
   // Once instances exist for a field type then these settings cannot be

+ 1 - 1
tripal/includes/TripalFields/rdfs__type/rdfs__type.inc

@@ -8,7 +8,7 @@ class rdfs__type extends TripalField {
   // The default description for this field.
   public static $description = 'The resource content type.';
 
-  // Provide a list of global settings. These can be accessed witihn the
+  // Provide a list of global settings. These can be accessed within the
   // globalSettingsForm.  When the globalSettingsForm is submitted then
   // Drupal will automatically change these settings for all fields.
   public static $default_settings = array();

+ 42 - 0
tripal/includes/tripal.fields.inc

@@ -348,6 +348,48 @@ function tripal_form_field_ui_field_overview_form_submit($form, &$form_state) {
         if (function_exists($function)) {
           $function($form_values['_add_new_field'], $bundle);
         }
+        // Otherwise, we should make a good attempt on our own.
+        // Especially in the case of fields added via the Library directory.
+        else {
+          $new_field = $form_values['_add_new_field'];
+
+          // Create the field.
+          $field = array(
+            'field_name' => $new_field['field_name'],
+            'type' => $new_field['type'],
+            'cardinality' => FIELD_CARDINALITY_UNLIMITED, // @hard-coded
+            'locked' => FALSE,
+            'storage' => array(
+              'type' => $type::$default_settings['storage']
+            ),
+          );
+          field_create_field($field);
+
+          // Then create the instance.
+          $instance =  array(
+            'field_name' => $new_field['field_name'],
+            'entity_type' => $bundle->type,
+            'bundle' => $bundle->name,
+            'label' => $new_field['label'],
+            'description' => $type::$default_description,
+            'required' => FALSE,
+            'settings' => array(
+              'auto_attach' => $type::$default_instance_settings['auto_attach'],
+            ),
+            'widget' => array(
+              'type' => $new_field['widget_type'],
+              'settings' => array(),
+            ),
+            'display' => array(
+              'default' => array(
+                'label' => 'hidden',
+                'type' => $type::$default_formatter,
+                'settings' => array(),
+              ),
+            ),
+          );
+          field_create_instance($instance);
+        }
         $destinations[] = $admin_path . '/fields/' . $field_name . '/field-shcef';
         $destinations[] = $admin_path . '/fields/' . $field_name;
 

+ 2 - 2
tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc

@@ -155,7 +155,7 @@ function tripal_bulk_loader_modify_template_base_form($form, &$form_state = NULL
     '#collapsible' => TRUE,
     '#weight' => 2,
     '#description' => t('A "Record" is an entry in a database table. Each of the records '
-      . 'added to the bulk loader will be added per constant set and per line of you '
+      . 'added to the bulk loader will be added per constant set and per line of your '
       . 'input file when a Tripal Bulk Loading Job is created using this template. '
       . 'Furthermore, if you add two records for the same table (i.e. feature table) then '
       . 'two distinct entries will be created per line (i.e. if recordA specifies a parent '
@@ -2172,7 +2172,7 @@ function tripal_bulk_loader_template_field_form($form, &$form_state = NULL) {
     '#description' => 'You can use standard php regular expressions in this field to specify a '
       .'pattern. Only if this pattern matches the value in the data file does the replacement '
       .'pattern get applied to the value. To capture a section of your value for use in the '
-      .'replacement patten surround with round brackets. For example, <i>GI:(\d+)</i> will match '
+      .'replacement pattern surround with parentheses. For example, <i>GI:(\d+)</i> will match '
       .' NCBI gi numbers and will capture the numerical digits for use in the replacement pattern. '
       .' To match and capture any value use <i>.*</i>',
     '#default_value' => $pattern_default,

+ 16 - 6
tripal_chado/api/tripal_chado.custom_tables.api.inc

@@ -117,12 +117,16 @@ function chado_edit_custom_table($table_id, $table_name, $schema, $skip_if_exist
  *   it's mview_id. This paramter is intended only when this function
  *   is called by the tripal_add_mview() function. When creating a custom
  *   table you shouldn't need to use this parameter.
+ * @param $redirect
+ *   Optional (default: TRUE). By default this function redirects back to
+ *   admin pages. However, when called by Drush we don't want to redirect. This
+ *   parameter allows this to be used as a true API function.
  * @return
  *   TRUE on success, FALSE on failure
  *
  * @ingroup tripal_custom_tables_api
  */
-function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE, $mview_id = NULL) {
+function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE, $mview_id = NULL, $redirect = TRUE) {
   global $databases;
   $created = 0;
   $recreated = 0;
@@ -206,6 +210,7 @@ function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE, $mvi
       array('%table_name' => $table, '%message' => $error['!message'])), 'error');
     return FALSE;
   }
+
   if ($created) {
     drupal_set_message("Custom table, '" . $table . "' ,  created successfully.", 'status');
   }
@@ -216,12 +221,17 @@ function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE, $mvi
     drupal_set_message("Custom table, '" . $table . "' , already exists. Table structure not changed, but definition array has been saved.", 'status');
   }
 
-  if ($mview_id) {
-    drupal_goto('admin/tripal/storage/chado/mviews/');
-  }
-  else {
-    drupal_goto('admin/tripal/storage/chado/custom_tables');
+  // Only redirect if asked to. This allows us to not try to redirect when this
+  // function is called by Drush.
+  if ($redirect) {
+    if ($mview_id) {
+      drupal_goto('admin/tripal/storage/chado/mviews/');
+    }
+    else {
+      drupal_goto('admin/tripal/storage/chado/custom_tables');
+    }
   }
+
   return TRUE;
 }
 

+ 1 - 1
tripal_chado/api/tripal_chado.entity.api.inc

@@ -108,7 +108,7 @@ function chado_get_record_entity_by_table($data_table, $record_id) {
  * table should always be unique.
  *
  * @param $bundle
- *   A bundle object (as retreieved from tripal_load_bundle_entity().
+ *   A bundle object (as retrieved from tripal_load_bundle_entity().
  *
  * @return
  *   The name of the mapping table that Chado uses to map entities to records.

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

@@ -33,10 +33,14 @@
  *   The SQL query that loads the materialized view with data
  * @param $comment
  *   A string containing a description of the materialized view
+ * @param $redirect
+ *   Optional (default: TRUE). By default this function redirects back to
+ *   admin pages. However, when called by Drush we don't want to redirect. This
+ *   parameter allows this to be used as a true API function.
  *
  * @ingroup tripal_mviews_api
  */
-function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NULL) {
+function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NULL, $redirect = TRUE) {
 
   if (!array_key_exists('table', $mv_schema)) {
      tripal_report_error('tripal_chado', TRIPAL_ERROR,
@@ -77,7 +81,7 @@ function tripal_add_mview($name, $modulename, $mv_schema, $query, $comment = NUL
           chado_query($sql);
         }
         // create the table
-        chado_create_custom_table($mv_table, $mv_schema, 0, $record->mview_id);
+        chado_create_custom_table($mv_table, $mv_schema, 0, $record->mview_id, $redirect);
       }
     }
     catch (Exception $e) {

+ 3 - 3
tripal_chado/api/tripal_chado.query.api.inc

@@ -508,7 +508,7 @@ function chado_insert_record($table, $values, $options = array()) {
     if ($ukeys) {
       foreach ($ukeys as $name => $fields) {
         foreach ($fields as $index => $field) {
-          // build the arrays for performing a select that will check the contraint
+          // build the arrays for performing a select that will check the constraint
           $ukselect_cols[] = $field;
           if (!array_key_exists($field, $insert_values)) {
             if (array_key_exists('default', $table_desc['fields'][$field])) {
@@ -1265,7 +1265,7 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
       foreach ($fields as $field) {
         if (array_key_exists($field, $values)) {
           $new_values[$field] = $values[$field];
-          // if there is no primary key then use the unique contraint fields
+          // if there is no primary key then use the unique constraint fields
           if (!$has_pkey) {
             array_push($new_columns, $field);
           }
@@ -1821,7 +1821,7 @@ function chado_pager_get_count($element) {
  * This function is used by chado_select_record, chado_insert_record,
  * and chado_update_record to iterate through the associate array of
  * values that gets passed to each of those routines.  The values array
- * is nested where foreign key contraints are used to specify a value that.  See
+ * is nested where foreign key constraints are used to specify a value that.  See
  * documentation for any of those functions for further information.
  *
  * @param $table_desc

+ 1 - 1
tripal_chado/includes/TripalFields/obi__organism/obi__organism.inc

@@ -226,7 +226,7 @@ class obi__organism extends ChadoField {
         'elements' => array(
           'rdfs:label' => array(
             'searchable' => TRUE,
-            'name' => 'scientfic_name',
+            'name' => 'scientific_name',
             'operations' => array('eq', 'ne', 'contains', 'starts'),
             'sortable' => FALSE,
             'type' => 'xs:string',

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

@@ -983,7 +983,7 @@ class OBOImporter extends TripalImporter {
   }
 
   /**
-   * Retreives the term array from the temp loading table for a given term id.
+   * Retrieves the term array from the temp loading table for a given term id.
    *
    * @param id
    *   The id of the term to retrieve

+ 2 - 2
tripal_chado/includes/loaders/tripal_chado.pub_importer_AGL.inc

@@ -405,7 +405,7 @@ function tripal_pub_remote_search_AGL($search_array, $num_to_retrieve, $page) {
 }
 
 /**
- * Retreives a range of publications from AGL
+ * Retrieves a range of publications from AGL
  *
  * @param $yazc
  *   The YAZC connection object.
@@ -475,7 +475,7 @@ function tripal_pub_AGL_range($yazc, $search_str, $start, $num_to_retrieve, $tot
 }
 
 /**
- * Retreives the total number of publications that match the search string.
+ * Retrieves the total number of publications that match the search string.
  *
  * @param $yazc
  *   The YAZC connection object.

+ 1 - 1
tripal_chado/includes/loaders/tripal_chado.pub_importer_PMID.inc

@@ -262,7 +262,7 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
 }
 
 /**
- * Retreives from PubMed a set of publications from the
+ * Retrieves from PubMed a set of publications from the
  * previously initiated query.
  *
  * @param $query_key

+ 5 - 5
tripal_chado/includes/setup/tripal_chado.chado_v1.2.inc

@@ -64,7 +64,7 @@ function tripal_chado_add_contactprop_table(){
       ),
     ),
   );
-  chado_create_custom_table('contactprop', $schema, TRUE);
+  chado_create_custom_table('contactprop', $schema, TRUE, NULL, FALSE);
 }
 
 /**
@@ -129,7 +129,7 @@ function tripal_chado_add_featuremap_dbxref_table(){
     'referring_tables' => NULL,
   );
 
-  chado_create_custom_table('featuremap_dbxref', $schema, TRUE);
+  chado_create_custom_table('featuremap_dbxref', $schema, TRUE, NULL, FALSE);
 
 }
 
@@ -201,7 +201,7 @@ function tripal_chado_add_featuremapprop_table(){
       ),
     ),
   );
-  chado_create_custom_table('featuremapprop', $schema, TRUE);
+  chado_create_custom_table('featuremapprop', $schema, TRUE, NULL, FALSE);
 }
 
 /**
@@ -266,7 +266,7 @@ function tripal_chado_add_featureposprop_table(){
       ),
     ),
   );
-  chado_create_custom_table('featureposprop', $schema, TRUE);
+  chado_create_custom_table('featureposprop', $schema, TRUE, NULL, FALSE);
 }
 
 
@@ -317,5 +317,5 @@ function tripal_chado_add_pubauthor_contact_table() {
       ),
     ),
   );
-  chado_create_custom_table('pubauthor_contact', $schema, TRUE);
+  chado_create_custom_table('pubauthor_contact', $schema, TRUE, NULL, FALSE);
 }

+ 9 - 9
tripal_chado/includes/setup/tripal_chado.chado_vx_x.inc

@@ -31,7 +31,7 @@ function tripal_chado_add_tripal_gff_temp_table() {
       'tripal_gff_temp_uq1' => array('uniquename', 'organism_id', 'type_name'),
     ),
   );
-  chado_create_custom_table('tripal_gff_temp', $schema, TRUE);
+  chado_create_custom_table('tripal_gff_temp', $schema, TRUE, NULL, FALSE);
 }
 
 /**
@@ -71,7 +71,7 @@ function tripal_chado_add_tripal_gffcds_temp_table() {
       'tripal_gff_temp_idx0' => array('parent_id'),
     ),
   );
-  chado_create_custom_table('tripal_gffcds_temp', $schema);
+  chado_create_custom_table('tripal_gffcds_temp', $schema, TRUE, NULL, FALSE);
 }
 
 /**
@@ -106,7 +106,7 @@ function tripal_chado_add_tripal_gffprotein_temp_table() {
       'tripal_gff_temp_uq0' => array('feature_id'),
     ),
   );
-  chado_create_custom_table('tripal_gffprotein_temp', $schema, TRUE);
+  chado_create_custom_table('tripal_gffprotein_temp', $schema, TRUE, NULL, FALSE);
 }
 
 /**
@@ -205,7 +205,7 @@ function tripal_chado_add_organism_stock_count_mview() {
         O.Organism_id, O.genus, O.species, O.common_name, CVT.cvterm_id, CVT.name
   ";
 
-  tripal_add_mview($view_name, 'tripal_stock', $schema, $sql, $comment);
+  tripal_add_mview($view_name, 'tripal_stock', $schema, $sql, $comment, FALSE);
 }
 
 
@@ -261,7 +261,7 @@ function tripal_chado_add_library_feature_count_mview(){
     GROUP BY L.library_id, L.name, CVT.name
   ";
 
-  tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment);
+  tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment, FALSE);
 }
 
 
@@ -344,7 +344,7 @@ function tripal_chado_add_organism_feature_count_mview() {
         O.Organism_id, O.genus, O.species, O.common_name, CVT.cvterm_id, CVT.name
   ";
 
-  tripal_add_mview($view_name, 'tripal_feature', $schema, $sql, $comment);
+  tripal_add_mview($view_name, 'tripal_feature', $schema, $sql, $comment, FALSE);
 }
 
 
@@ -404,7 +404,7 @@ function tripal_chado_add_analysis_organism_mview() {
   );
 
   // add the view
-  tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment);
+  tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment, FALSE);
 }
 
 /**
@@ -463,7 +463,7 @@ function tripal_chado_add_db2cv_mview_mview() {
   ";
 
   // Create the MView
-  tripal_add_mview($mv_name, 'tripal_chado', $schema, $sql, $comment);
+  tripal_add_mview($mv_name, 'tripal_chado', $schema, $sql, $comment, FALSE);
 }
 /**
  * Add a materialized view of root terms for all chado cvs.
@@ -515,6 +515,6 @@ function tripal_chado_add_cv_root_mview_mview() {
   ";
 
   // Create the MView
-  tripal_add_mview($mv_name, 'tripal_chado', $schema, $sql, $comment);
+  tripal_add_mview($mv_name, 'tripal_chado', $schema, $sql, $comment, FALSE);
 }
 

+ 19 - 9
tripal_chado/includes/setup/tripal_chado.setup.inc

@@ -254,7 +254,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Organism" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -277,7 +278,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Analysis" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -300,7 +302,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Project" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -323,7 +326,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Map" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     // Add cvterm mapping for the Map entity type
@@ -357,7 +361,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Publication" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     // Add cvterm mapping for the Publication entity type
@@ -400,7 +405,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Gene" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -424,7 +430,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered  creating "mRNA" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -447,7 +454,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Biological Sample" Tripal Content Type.';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -470,7 +478,8 @@ function tripal_chado_prepare_chado($job = NULL) {
     }
     if (!$term or !$bundle) {
       if (!tripal_create_bundle($args, $error)) {
-        throw new Exception($error['!message']);
+        $msg = (isset($error['!message'])) ? $error['!message'] : 'Error Encountered creating "Phylogenetic tree" Tripal Content Type';
+        throw new Exception($msg);
       }
     }
     if ($report_progress) {
@@ -537,6 +546,7 @@ function tripal_chado_add_vx_x_custom_tables(){
   tripal_chado_add_analysis_organism_mview();
   tripal_chado_add_cv_root_mview_mview();
   tripal_chado_add_db2cv_mview_mview();
+
 }
 
 /**

+ 1 - 1
tripal_chado/includes/tripal_chado.bundle.inc

@@ -70,7 +70,7 @@ function tripal_chado_bundle_create($bundle, $storage_args) {
  * Creates the table that tripal_chado uses to link Chado records with entities.
  *
  * @param $bundle
- *   A bundle object (as retreieved from tripal_load_bundle_entity().
+ *   A bundle object (as retrieved from tripal_load_bundle_entity().
  */
 function tripal_chado_create_bundle_table($bundle) {
 

+ 2 - 2
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -696,7 +696,7 @@ function tripal_chado_field_storage_query($query) {
 function tripal_chado_field_storage_bundle_mapping_form($form, &$form_state,
     $term, &$submit_disabled) {
 
-  $selected_term_id = $term->cvterm_id;
+  $selected_term_id = (is_object($term)) ? $term->cvterm_id : NULL;
 
   // Initialize the form.
   $form = array();
@@ -886,7 +886,7 @@ function tripal_chado_field_storage_bundle_mapping_form_add_type(&$form,
   // Get the list of columns in the default table.
   $schema = chado_get_schema($default['table']);
   $column_options = array('none' => '--None--');
-  $cvt_fkeys = array_keys($schema['foreign keys']['cvterm']['columns']);
+  $cvt_fkeys = (isset($schema['foreign keys']['cvterm'])) ? array_keys($schema['foreign keys']['cvterm']['columns']) : array();
   foreach ($schema['fields'] as $column_name => $column_details) {
     if (in_array($column_name, $cvt_fkeys)) {
       $column_options[$column_name] = $column_name;

+ 1 - 1
tripal_chado/includes/tripal_chado.migrate.inc

@@ -770,7 +770,7 @@ function tripal_chado_delete_selected_types($tv2_content_types = array(), $job_i
   foreach ($tv2_content_types AS $type) {
     $sql = "DELETE FROM $type";
     db_query($sql);
-    chado_cleanup_orphaned_nodes(str_replace('chado_', '', $type), $job_id);
+    chado_cleanup_orphaned_nodes(str_replace('chado_', '', $type), 25000, NULL, NULL, $job_id);
   }
 }
 

+ 1 - 2
tripal_chado/tripal_chado.module

@@ -1118,7 +1118,6 @@ function tripal_feature_match_features_page($id) {
     // iterate through the matches and build the table for showing matches
     $header = array('Uniquename', 'Name', 'Type', 'Species', 'Synonyms');
     $rows = array();
-    $curr_match;
     while ($match = $results->fetchObject()) {
       $curr_match = $match;
       $synonyms = $match->synonyms;
@@ -1132,7 +1131,7 @@ function tripal_feature_match_features_page($id) {
       }
       // If we didn't find an entity ID we need to check nodes for
       // backwards compatibility with Tv2.
-      if (!$entity_id and module_exists(tripal_feature)) {
+      if (!$entity_id and module_exists('tripal_feature')) {
         $nid = chado_get_nid_from_id('feature', $curr_match->feature_id);
         $link = "node/" . $nid;
       }

+ 1 - 1
tripal_chado_views/includes/tripal_chado_views_integration_UI.inc

@@ -403,7 +403,7 @@ function tripal_chado_views_integration_form($form, &$form_state) {
       .'default core and module definitions. The views integration definition with the '
       .'lightest priority will be used. For example, if there is a definition created by '
       .'core with a priority of 10 and another by a custom module of 5 and yours is -1 then '
-      .'you definition will be used for that table because -1 is lighter then both 5 and 10.'),
+      .'your definition will be used for that table because -1 is lighter than both 5 and 10.'),
     '#options' => $priorities,
     '#default_value' => $default,
   );

+ 1 - 1
tripal_chado_views/includes/tripal_chado_views_integration_port.inc

@@ -66,7 +66,7 @@ function tripal_chado_views_integration_import_form() {
       .'default core and module definitions. The views integration definition with the '
       .'lightest priority will be used. For example, if there is a definition created by '
       .'core with a priority of 10 and another by a custom module of 5 and yours is -1 then '
-      .'you definition will be used for that table because -1 is lighter then both 5 and 10.'),
+      .'your definition will be used for that table because -1 is lighter than both 5 and 10.'),
     '#options' => $priorities,
     '#default_value' => -1,
   );

+ 1 - 1
tripal_ws/includes/TripalWebService.inc

@@ -258,7 +258,7 @@ class TripalWebService {
   }
 
   /**
-   * Retreives the service URL for this service.
+   * Retrieves the service URL for this service.
    */
   public function getServicePath() {
     $class = get_class($this);

+ 2 - 2
tripal_ws/includes/TripalWebServiceResource.inc

@@ -220,7 +220,7 @@ class TripalWebServiceResource {
   }
 
   /**
-   * Retreives the IRI for an entity of a given ID in this web service.
+   * Retrieves the IRI for an entity of a given ID in this web service.
    *
    * @param $id
    *   The unique identifier for the resource.
@@ -259,7 +259,7 @@ class TripalWebServiceResource {
   }
 
   /**
-   * Retreives the type of this resource.
+   * Retrieves the type of this resource.
    *
    * @return
    *   The name of the resource.