Browse Source

converted all watchdog calls to the new Tripal API function

Stephen Ficklin 11 years ago
parent
commit
6d5887d2d3
33 changed files with 380 additions and 675 deletions
  1. 4 4
      tripal_analysis/includes/tripal_analysis.chado_node.inc
  2. 6 6
      tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc
  3. 1 1
      tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
  4. 5 4
      tripal_contact/api/tripal_contact.api.inc
  5. 5 3
      tripal_contact/includes/tripal_contact.chado_node.inc
  6. 1 1
      tripal_core/api/tripal_core.chado_general.api.inc
  7. 4 8
      tripal_core/api/tripal_core.chado_nodes.properties.api.inc
  8. 37 76
      tripal_core/api/tripal_core.chado_query.api.inc
  9. 5 5
      tripal_core/api/tripal_core.chado_schema.api.inc
  10. 16 15
      tripal_core/api/tripal_core.chado_variables.api.inc
  11. 10 7
      tripal_core/api/tripal_core.custom_tables.api.inc
  12. 2 2
      tripal_core/api/tripal_core.files.api.inc
  13. 2 1
      tripal_core/api/tripal_core.mviews.api.inc
  14. 1 1
      tripal_core/tripal_core.install
  15. 25 26
      tripal_cv/api/tripal_cv.api.inc
  16. 4 4
      tripal_cv/includes/obo_loader.inc
  17. 10 16
      tripal_db/api/tripal_db.api.inc
  18. 4 4
      tripal_example/includes/tripal_example.chado_node.inc
  19. 28 28
      tripal_feature/api/tripal_feature.api.inc
  20. 12 13
      tripal_feature/includes/tripal_feature.chado_node.inc
  21. 38 37
      tripal_feature/includes/tripal_feature.fasta_loader.inc
  22. 81 81
      tripal_feature/includes/tripal_feature.gff_loader.inc
  23. 2 2
      tripal_featuremap/api/tripal_featuremap.api.inc
  24. 7 7
      tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  25. 9 11
      tripal_organism/includes/tripal_organism.chado_node.inc
  26. 28 28
      tripal_pub/api/tripal_pub.api.inc
  27. 7 7
      tripal_pub/includes/importers/tripal_pub.PMID.inc
  28. 1 1
      tripal_stock/api/tripal_stock.api.inc
  29. 11 24
      tripal_stock/includes/tripal_stock.chado_node.inc
  30. 6 244
      tripal_stock/includes/tripal_stock.sync_stocks.inc
  31. 5 4
      tripal_views/api/tripal_views.api.inc
  32. 1 1
      tripal_views/includes/tripal_views_integration.inc
  33. 2 3
      tripal_views/tripal_views.views.inc

+ 4 - 4
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -390,8 +390,8 @@ function chado_analysis_insert($node) {
     $analysis = tripal_core_chado_insert('analysis', $values);
     if (!$analysis) {
       drupal_set_message(t('Unable to add analysis.', 'warning'));
-      watchdog('tripal_analysis', 'Insert analysis: Unable to create analysis where values:%values',
-      array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_analysis', TRIPAL_ERROR, 'Insert analysis: Unable to create analysis where values:%values',
+        array('%values' => print_r($values, TRUE)));
       return;
     }
     $analysis_id = $analysis['analysis_id'];
@@ -500,8 +500,8 @@ function chado_analysis_update($node) {
   $status = tripal_core_chado_update('analysis', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update analysis.', 'warning'));
-    watchdog('tripal_analysis', 'Update analysis: Unable to update analysis where values: %values',
-    array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_analysis', TRIPAL_ERROR, 'Update analysis: Unable to update analysis where values: %values',
+    array('%values' => print_r($values, TRUE)));
   }
 
   // now add in the properties by first removing any the analysis

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

@@ -1133,10 +1133,10 @@ function tripal_bulk_loader_edit_template_record_form_submit($form, &$form_state
     }
     else {
       drupal_set_message(t('Unable to Save Template!'), 'error');
-      watchdog('T_bulk_loader',
+      tripal_core_report_error('T_bulk_loader',
+        TRIPAL_ERROR,
         'Unable to save bulk loader template: %template',
-        array('%template' => print_r($form_state['storage']['template'], TRUE)),
-        WATCHDOG_ERROR
+        array('%template' => print_r($form_state['storage']['template'], TRUE))
       );
     }
   }
@@ -2212,10 +2212,10 @@ function tripal_bulk_loader_template_field_form_submit($form, &$form_state) {
     }
     else {
       drupal_set_message(t('Unable to Save Template!'), 'error');
-      watchdog('T_bulk_loader',
+      tripal_core_report_error('T_bulk_loader',
+        TRIPAL_ERROR,
         'Unable to save bulk loader template: %template',
-        array('%template' => print_r($form_state['storage']['template'], TRUE)),
-        WATCHDOG_ERROR
+        array('%template' => print_r($form_state['storage']['template'], TRUE))
       );
     }
   }

+ 1 - 1
tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc

@@ -990,7 +990,7 @@ function tripal_bulk_loader_regex_tranform_values($values, $table_data, $line) {
     return $values;
   }
 
-  //watchdog('T_bulk_loader','Regex Transformation:<pre>'.print_r($table_data['regex_transform'], TRUE).'</pre>', array(), TRIPAL_NOTICE);
+  //tripal_core_report_error('T_bulk_loader', TRIPAL_NOTICE,'Regex Transformation:<pre>'.print_r($table_data['regex_transform'], TRUE).'</pre>', array());
 
   foreach ($table_data['regex_transform'] as $field => $regex_array) {
     if (!array_key_exists('replace', $regex_array) or

+ 5 - 4
tripal_contact/api/tripal_contact.api.inc

@@ -120,8 +120,8 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
   if (count($contact) == 0) {
     $cvterm = tripal_cv_get_cvterm_by_name($type, NULL, 'tripal_contact');
     if (!$cvterm) {
-      watchdog('tripal_contact',"Cannot find contact type '%type'",
-        array('%type' => $type), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, "Cannot find contact type '%type'",
+        array('%type' => $type));
       return FALSE;
     }
     $values =  array(
@@ -132,7 +132,7 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
     $options = array('statement_name' => 'ins_contact_nadety');
     $contact = tripal_core_chado_insert('contact', $values, $options);
     if (!$contact) {
-      watchdog('tripal_contact','Could not add the contact', array(), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 'Could not add the contact', array());
       return FALSE;
     }
   }
@@ -150,7 +150,8 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
   foreach ($properties as $key => $value) {
     $success = tripal_contact_insert_property($contact['contact_id'], $key,$value, TRUE);
     if (!$success) {
-      watchdog('tripal_contact',"Could not add the contact property '%prop'", array('%prop' => $key), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_contact', TRIPAL_ERROR,
+        "Could not add the contact property '%prop'", array('%prop' => $key));
       return FALSE;
     }
   }

+ 5 - 3
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -359,8 +359,9 @@ function chado_contact_insert($node) {
     $contact = tripal_core_chado_insert('contact', $values);
     if (!$contact) {
       drupal_set_message(t('Unable to add contact.', 'warning'));
-      watchdog('tripal_contact', 'Insert contact: Unable to create contact where values: %values',
-      array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 
+        'Insert contact: Unable to create contact where values: %values',
+        array('%values' => print_r($values, TRUE)));
       return;
     }
     $contact_id = $contact['contact_id'];
@@ -435,7 +436,8 @@ function chado_contact_update($node) {
   $status = tripal_core_chado_update('contact', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating contact", "error");
-    watchdog('t_contact', "Error updating contact", array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 
+      "Error updating contact", array());
     return;
   }
 

+ 1 - 1
tripal_core/api/tripal_core.chado_general.api.inc

@@ -86,7 +86,7 @@ function tripal_core_set_globals() {
  *     - TRIPAL_DEBUG: Debug-level messages.
  * @param $options
  *   An array of options. Some available options include:
- *     - print: prints the error message to the screen. Useful when display is the command-line
+ *     - print: prints the error message to the terminal screen. Useful when display is the command-line
  *
  * @ingroup tripal_chado_api
  */

+ 4 - 8
tripal_core/api/tripal_core.chado_nodes.properties.api.inc

@@ -214,8 +214,8 @@ $cv_name, $value, $update_if_present = 0) {
   $options = array();
   $term = tripal_core_chado_select('cvterm', array('cvterm_id'), $values, $options);
   if (!$term or count($term) == 0) {
-    watchdog('tripal_core', "Cannot find property '%prop_name' in vocabulary '%cvname'.",
-    array('%prop_name' => $property, '%cvname' => $cv_name), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, "Cannot find property '%prop_name' in vocabulary '%cvname'.",
+    array('%prop_name' => $property, '%cvname' => $cv_name));
     return FALSE;
   }
 
@@ -995,14 +995,10 @@ function chado_node_properties_form_update_properties($node, $details, $retrieve
         );
 
         if (!$success) {
-          watchdog(
-            'tripal_' . $details['base_table'],
+          tripal_core_report_error('tripal_' . $details['base_table'], TRIPAL_ERROR,
             $details['base_table'] . ' Insert: Unable to insert property type_id %cvterm with value %value.',
-            array('%cvterm' => $type_id, '%value' => $value),
-            WATCHDOG_ERROR
-          );
+            array('%cvterm' => $type_id, '%value' => $value));
         }
-
       }
     }
   }

+ 37 - 76
tripal_core/api/tripal_core.chado_query.api.inc

@@ -214,22 +214,16 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
   $print_errors = (isset($options['print_errors'])) ? $options['print_errors'] : FALSE;
 
   if (!is_array($values)) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
-      'Cannot pass non array as values for inserting.',
-      array(),
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
+      'Cannot pass non array as values for inserting.', array(),
       array('print' => $print_errors)
     );
     return FALSE;
   }
   if (count($values)==0) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'Cannot pass an empty array as values for inserting.',
-      array(),
-      array('print' => $print_errors)
+      array(),array('print' => $print_errors)
     );
     return FALSE;
   }
@@ -272,9 +266,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
     // make sure the field is in the table description. If not then return an error
     // message
     if (!array_key_exists($field, $table_desc['fields'])) {
-      tripal_core_report_error(
-        'tripal_core',
-        TRIPAL_ERROR,
+      tripal_core_report_error('tripal_core', TRIPAL_ERROR,
         "tripal_core_chado_insert; The field '%field' does not exist " .
           "for the table '%table'.  Cannot perform insert. Values: %array",
         array('%field' => $field, '%table' => $table, '%array' => print_r($values, 1)),
@@ -288,18 +280,14 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
       $results = tripal_core_chado_get_foreign_key($table_desc, $field, $value);
 
       if (sizeof($results) > 1) {
-        tripal_core_report_error(
-          'tripal_core',
-          TRIPAL_ERROR,
+        tripal_core_report_error('tripal_core', TRIPAL_ERROR,
           'tripal_core_chado_insert: Too many records match the criteria supplied for !foreign_key foreign key constraint (!criteria)',
           array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)),
           array('print' => $print_errors)
         );
       }
       elseif (sizeof($results) < 1) {
-        tripal_core_report_error(
-          'tripal_core',
-          TRIPAL_DEBUG,
+        tripal_core_report_error('tripal_core', TRIPAL_DEBUG,
           'tripal_core_chado_insert: no record matches criteria supplied for !foreign_key foreign key constraint (!criteria)',
           array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)),
           array('print' => $print_errors)
@@ -367,9 +355,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
     // make sure required fields have a value
     if (!is_array($table_desc['fields'])) {
       $table_desc['fields'] = array();
-      tripal_core_report_error(
-        'tripal_core',
-        TRIPAL_WARNING,
+      tripal_core_report_error('tripal_core', TRIPAL_WARNING,
         "tripal_core_chado_insert; %table missing fields: \n %schema",
         array('%table' => $table, '%schema' => print_r($table_desc, 1)),
         array('print' => $print_errors)
@@ -382,9 +368,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
           !array_key_exists($field, $insert_values) and
           !array_key_exists('default', $def) and
           strcmp($def['type'], serial) != 0) {
-        tripal_core_report_error(
-          'tripal_core',
-          TRIPAL_ERROR,
+        tripal_core_report_error('tripal_core', TRIPAL_ERROR,
           "tripal_core_chado_insert; Field %table.%field cannot be NULL: %values",
           array('%table' => $table, '%field' => $field, '%values' => print_r($values, 1)),
           array('print' => $print_errors)
@@ -423,9 +407,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
         $results = chado_query($sql);
         $value = $results->fetchField();
         if (!$value) {
-          tripal_core_report_error(
-            'tripal_core',
-            TRIPAL_ERROR,
+          tripal_core_report_error('tripal_core', TRIPAL_ERROR,
             "tripal_core_chado_insert; not able to retrieve primary key after insert: %sql",
             array('%sql' => $sql),
             array('print' => $print_errors)
@@ -441,9 +423,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
     return TRUE;
   }
   else {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'tripal_core_chado_insert; Cannot insert record into "%table": %values',
       array('%table' => $table, '%values' => print_r($values, 1)),
       array('print' => $print_errors)
@@ -522,43 +502,31 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
   $print_errors = (isset($options['print_errors'])) ? $options['print_errors'] : FALSE;
 
   if (!is_array($values)) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'Cannot pass non array as values for updating.',
-      array(),
-      array('print' => $print_errors)
+      array(), array('print' => $print_errors)
     );
     return FALSE;
   }
   if (count($values)==0) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'Cannot pass an empty array as values for updating.',
-      array(),
-      array('print' => $print_errors)
+      array(), array('print' => $print_errors)
     );
     return FALSE;
   }
 
   if (!is_array($match)) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'Cannot pass non array as values for matching.',
-      array(),
-      array('print' => $print_errors)
+      array(), array('print' => $print_errors)
     );
     return FALSE;
   }
   if (count($match)==0) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'Cannot pass an empty array as values for matching.',
-      array(),
-      array('print' => $print_errors)
+      array(), array('print' => $print_errors)
     );
     return FALSE;
   }
@@ -614,7 +582,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
         );
       }
       elseif (sizeof($results) < 1) {
-        tripal_core_report_error('tripal_core',TRIPAL_DEBUG,
+        tripal_core_report_error('tripal_core', TRIPAL_DEBUG,
           'tripal_core_chado_update: When trying to find record to update, no record matches criteria supplied for !foreign_key foreign key constraint (!criteria)',
           array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)),
           array('print' => $print_errors)
@@ -636,18 +604,14 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
       // select the value from the foreign key relationship for this value
       $results = tripal_core_chado_get_foreign_key($table_desc, $field, $value, $foreign_options);
       if (sizeof($results) > 1) {
-        tripal_core_report_error(
-          'tripal_core',
-          TRIPAL_ERROR,
+        tripal_core_report_error('tripal_core', TRIPAL_ERROR,
           'tripal_core_chado_update: When trying to find update values, too many records match the criteria supplied for !foreign_key foreign key constraint (!criteria)',
           array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)),
           array('print' => $print_errors)
         );
       }
       elseif (sizeof($results) < 1) {
-        tripal_core_report_error(
-          'tripal_core',
-          TRIPAL_DEBUG,
+        tripal_core_report_error('tripal_core', TRIPAL_DEBUG,
           'tripal_core_chado_update: When trying to find update values, no record matches criteria supplied for !foreign_key foreign key constraint (!criteria)',
           array('!foreign_key' => $field, '!criteria' => print_r($value,TRUE)),
           array('print' => $print_errors)
@@ -708,9 +672,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
     return TRUE;
   }
   else {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       "tripal_core_chado_update: Cannot update record in %table table.  \nMatch: %match \nValues: %values",
       array('%table' => table, '%match' => print_r($match,TRUE), '%values' => print_r($values, 1)),
       array('print' => $print_errors)
@@ -779,13 +741,13 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
 function tripal_core_chado_delete($table, $match, $options = NULL) {
 
   if (!is_array($match)) {
-    watchdog('tripal_core', 'Cannot pass non array as values for matching.', array(),
-      WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      'Cannot pass non array as values for matching.', array());
     return FALSE;
   }
   if (count($match)==0) {
-    watchdog('tripal_core', 'Cannot pass an empty array as values for matching.', array(),
-      WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      'Cannot pass an empty array as values for matching.', array());
     return FALSE;
   }
 
@@ -812,10 +774,12 @@ function tripal_core_chado_delete($table, $match, $options = NULL) {
       else {
         $results = tripal_core_chado_get_foreign_key($table_desc, $field, $value);
         if (sizeof($results) > 1) {
-          watchdog('tripal_core', 'tripal_core_chado_delete: When trying to find record to delete, too many records match the criteria supplied for !foreign_key foreign key constraint (!criteria)', array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)), WATCHDOG_ERROR);
+          tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+            'tripal_core_chado_delete: When trying to find record to delete, too many records match the criteria supplied for !foreign_key foreign key constraint (!criteria)', 
+            array('!foreign_key' => $field, '!criteria' => print_r($value, TRUE)));
         }
         elseif (sizeof($results) < 1) {
-          //watchdog('tripal_core', 'tripal_core_chado_delete: When trying to find record to delete, no record matches criteria supplied for !foreign_key foreign key constraint (!criteria)', array('!foreign_key' => $field, '!criteria' => print_r($value,TRUE)), WATCHDOG_ERROR);
+          //tripal_core_report_error('tripal_core', TRIPAL_ERROR, 'tripal_core_chado_delete: When trying to find record to delete, no record matches criteria supplied for !foreign_key foreign key constraint (!criteria)', array('!foreign_key' => $field, '!criteria' => print_r($value,TRUE)));
         }
         else {
           $delete_matches[$field] = $results[0];
@@ -863,7 +827,8 @@ function tripal_core_chado_delete($table, $match, $options = NULL) {
     return TRUE;
   }
   else {
-    watchdog('tripal_core', "Cannot delete record in $table table.  Match:" . print_r($match, 1) . ". Values: " . print_r($values, 1), array(), 'WATCHDOG_ERROR');
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      "Cannot delete record in $table table.  Match:" . print_r($match, 1) . ". Values: " . print_r($values, 1), array());
     return FALSE;
   }
   return FALSE;
@@ -1010,9 +975,7 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
 
   // check that our columns and values arguments are proper arrays
   if (!is_array($columns)) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'tripal_core_chado_select; the $columns argument must be an array. Columns:%columns',
       array('%columns' => print_r($columns, TRUE)),
       array('print' => $print_errors)
@@ -1020,9 +983,7 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
     return FALSE;
   }
   if (!is_array($values)) {
-    tripal_core_report_error(
-      'tripal_core',
-      TRIPAL_ERROR,
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       'tripal_core_chado_select; the $values argument must be an array. Values:%values',
       array('%values' => print_r($values, TRUE)),
       array('print' => $print_errors)
@@ -1465,7 +1426,7 @@ function tripal_core_chado_get_foreign_key($table_desc, $field, $values, $option
           . "implemented and defined this foreign key when it wasn't supposed to. Modules "
           . "this hook was implemented in: " . implode(', ',
         module_implements("chado_" . $table_desc['table'] . "_schema")) . ".";
-        watchdog('tripal_core', $message);
+        tripal_core_report_error('tripal_core', $message);
         drupal_set_message(check_plain($message), 'error');
         continue;
       }
@@ -1501,7 +1462,7 @@ function tripal_core_chado_get_foreign_key($table_desc, $field, $values, $option
        key referrs to (<foreign table>) and then implement
        hook_chado_chado_schema_v<version>_<foreign table>(). See
        tripal_feature_chado_v1_2_schema_feature for an example. Chado version: $version");
-    watchdog('tripal_core', $message);
+    tripal_core_report_error('tripal_core', $message);
     drupal_set_message(check_plain($message), 'error');
   }
 

+ 5 - 5
tripal_core/api/tripal_core.chado_schema.api.inc

@@ -27,8 +27,8 @@
 
 /**
  * Check that any given Chado table exists.  This function
- * is necessary because Drupa's db_table_exists function
- * hardcodes the 'public'
+ * is necessary because Drupa's db_table_exists will not
+ * look in any other schema but the one were Drupal is installed
  *
  * @return
  *   TRUE/FALSE depending upon whether it exists
@@ -271,9 +271,9 @@ function tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FA
 }
 
 /**
- * Retrieves the list tables in the Chado schema.  By default it only retursn
- * the default Chado tables, but may also return custom tables added to the
- * Chado schema as well.
+ * Retrieves the list of tables in the Chado schema.  By default it only returns
+ * the default Chado tables, but can return custom tables added to the
+ * Chado schema if requested
  *
  * @param $include_custom
  *   Optional.  Set as TRUE to include any custom tables created in the

+ 16 - 15
tripal_core/api/tripal_core.chado_variables.api.inc

@@ -210,9 +210,10 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
   // get description for the current table----------------------------------------------------------
   $table_desc = tripal_core_get_chado_table_schema($table);
   if (!$table_desc or count($table_desc) == 0) {
-    watchdog('tripal_core', "tripal_core_generate_chado_var: The table '%table' has not been defined. " .
-             "and cannot be expanded. If this is a custom table, please add it using the Tripal " .
-             "custom table interface.", array('%table' => $table), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      "tripal_core_generate_chado_var: The table '%table' has not been defined. " .
+      "and cannot be expanded. If this is a custom table, please add it using the Tripal " .
+      "custom table interface.", array('%table' => $table));
     if ($return_array) {
       return array();
     }
@@ -499,7 +500,8 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
 
   // make sure we have a value
   if (!$object) {
-    watchdog('tripal_core', 'Cannot pass non array as argument, $object, to tripal_core_expand_chado_vars function.', array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      'Cannot pass non array as argument, $object, to tripal_core_expand_chado_vars function.', array());
     return $object;
   }
 
@@ -546,8 +548,9 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
         }
       }
       else {
-        watchdog('tripal_core', 'tripal_core_expand_chado_vars: Field (%field) not in the right format. " .
-          "It should be <tablename>.<fieldname>', WATCHDOG_ERROR);
+        tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+          'tripal_core_expand_chado_vars: Field (%field) not in the right format. " .
+          "It should be <tablename>.<fieldname>');
       }
       break;
     case "table": //--------------------------------------------------------------------------------
@@ -626,10 +629,10 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
         // if we did not expand this table we should return a message that the foreign table
         // could not be expanded
         if (!$did_expansion) {
-          watchdog('tripal_core', 'tripal_core_expand_chado_vars: Could not expand table, %table. It is ' .
+          tripal_core_report_error('tripal_core', TRIPAL_ERROR, 'tripal_core_expand_chado_vars: Could not expand table, %table. It is ' .
             'not in a foreign key relationship with the base object nor with any other expanded table. ' .
             'Check the table definition to ensure that a proper foreign key relationship is present.',
-            array('%table' => $foreign_table), WATCHDOG_ERROR);
+            array('%table' => $foreign_table));
         }
       }
       break;
@@ -649,8 +652,8 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
           $object = $node;
         }
         else {
-          watchdog('tripal_core', 'tripal_core_expand_chado_vars: No node matches the nid (%nid) supplied.',
-            array('%nid' => $object->nid), WATCHDOG_ERROR);
+          tripal_core_report_error('tripal_core', TRIPAL_ERROR, 'tripal_core_expand_chado_vars: No node matches the nid (%nid) supplied.',
+            array('%nid' => $object->nid));
         } //end of if node
       }
       else {
@@ -667,8 +670,8 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
       }
       break;
     default:
-      watchdog('tripal_core', 'tripal_core_expand_chado_vars: Unrecognized type (%type). Should be one of "field", "table", "node".',
-        array('%type' => $type), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_core', TRIPAL_ERROR, 'tripal_core_expand_chado_vars: Unrecognized type (%type). Should be one of "field", "table", "node".',
+        array('%type' => $type));
       return FALSE;
   }
 
@@ -695,11 +698,9 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
     else {
       // if there is an expandable array then we've reached the base object
       // if we get here and don't have anything expanded then something went wrong
-      //      watchdog(
-      //        'tripal_core',
+      //      tripal_core_report_error('tripal_core', TRIPAL_ERROR,
       //        'tripal_core_expand_chado_vars: Unable to expand the %type %to_expand',
       //        array('%type'=>$type, '%to_expand'=>$to_expand),
-      //        WATCHDOG_ERROR
       //      );
     } //end of it we've reached the base object
   }

+ 10 - 7
tripal_core/api/tripal_core.custom_tables.api.inc

@@ -120,7 +120,8 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
     }
     catch (Exception $e) {
       $error = $e->getMessage();
-      watchdog('tripal_core', "Error adding custom table: @message", array('@message' => $error), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+        "Error adding custom table: @message", array('@message' => $error));
       drupal_set_message("Could not add custom table. $error.", "error");
       return FALSE;
     }
@@ -138,8 +139,9 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
     }
     catch (Exception $e) {
       $error = $e->getMessage();
-      watchdog('tripal_core', "Error adding custom table: @message",
-        array('@message' => $error), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+        "Error adding custom table: @message",
+        array('@message' => $error));
       drupal_set_message("Could not add custom table. $error.", "error");
       return FALSE;
     }
@@ -157,8 +159,9 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
   }
   $success = drupal_write_record('tripal_custom_tables', $record);
   if (!$success) {
-    watchdog('tripal_core', "Error adding custom table %table_name.",
-      array('%table_name' => $table), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+      "Error adding custom table %table_name.",
+      array('%table_name' => $table));
     drupal_set_message(t("Could not add custom table %table_name.
       Please check the schema array.", array('%table_name' => $table)), 'error');
     return FALSE;
@@ -184,8 +187,8 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
         }
         catch (Exception $e) {
           $error = $e->getMessage();
-          watchdog('tripal_core', "Error, could not add foreign key contraint to custom table: %error",
-            array('%error' => $error), WATCHDOG_ERROR);
+          tripal_core_report_error('tripal_core', TRIPAL_ERROR, "Error, could not add foreign key contraint to custom table: %error",
+            array('%error' => $error));
           drupal_set_message("Could not add foreign key contraint to table: $error", 'error');
           return FALSE;
         }

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

@@ -45,7 +45,7 @@ function tripal_create_moddir($module_name) {
                "behave correctly without this directory.  Please  create " .
                "the directory manually or fix the problem and reinstall.";
     drupal_set_message(check_plain(t($message)), 'error');
-    watchdog('tripal_core', $message, array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, $message, array());
   }
 }
 
@@ -66,7 +66,7 @@ function tripal_create_mod_subdir($module_name, $path) {
   if (!file_prepare_directory($sub_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
     $message = "Cannot create directory $sub_dir. ";
     drupal_set_message(check_plain(t($message)), 'error');
-    watchdog('tripal_core', $message, array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, $message, array());
   }
 }
 

+ 2 - 1
tripal_core/api/tripal_core.mviews.api.inc

@@ -111,7 +111,8 @@ function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NU
   $mv_table = $schema_arr['table'];
 
   if (!$mv_table) {
-     watchdog('tripal_core', 'Must have a table name when creating an mview.', array(), WATCHDOG_ERROR);
+     tripal_core_report_error('tripal_core', TRIPAL_ERROR, 
+       'Must have a table name when creating an mview.', array());
      return NULL;
   }
 

+ 1 - 1
tripal_core/tripal_core.install

@@ -19,7 +19,7 @@ function tripal_core_install() {
                "behave correctly without this directory.  Please  create " .
                "the directory manually or fix the problem and reinstall.";
     drupal_set_message(check_plain($message), 'error');
-    watchdog('tripal_core', $message, array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_core', TRIPAL_ERROR, $message, array());
   }
 
 }

+ 25 - 26
tripal_cv/api/tripal_cv.api.inc

@@ -59,18 +59,16 @@ function tripal_cv_get_cv($select_values) {
     return $results[0];
   }
   elseif (empty($results)) {
-    watchdog('tripal_cv',
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING,
       'tripal_cv_get_cv: No cv matches criteria values:%values',
       array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
     );
     return FALSE;
   }
   else {
-    watchdog('tripal_cv',
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING,
       'tripal_cv_get_cv: 2+ cvs match criteria values:%values',
       array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
     );
   }
 
@@ -247,8 +245,9 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
     return FALSE;
   }
   if (count($r) > 1) {
-    watchdog('tripal_cv', "Cannot find a unique term for the term '%name' in the vocabulary '%cv'. Multiple entries exist for this name",
-      array('%name' => $name, '%cv' => $cv_name ? $cv_name : $cv_id), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_cv', TRIPAL_ERROR, 
+      "Cannot find a unique term for the term '%name' in the vocabulary '%cv'. Multiple entries exist for this name",
+      array('%name' => $name, '%cv' => $cv_name ? $cv_name : $cv_id));
     return FALSE;
   }
   if (count($r) == 0) {
@@ -370,7 +369,7 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
   catch (Exception $e) {
     tripal_db_set_active($previous);
     $error = $e->getMessage();
-    watchdog('tripal_cv', "Could not fill cvtermpath table: @error", array('@error' => $error), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_cv', TRIPAL_ERROR, "Could not fill cvtermpath table: @error", array('@error' => $error));
     return FALSE;
   }
 
@@ -409,7 +408,7 @@ function tripal_cv_add_cv($name, $definition) {
     $ins_options = array('statement_name' => 'ins_cv_nade');
     $success = tripal_core_chado_insert('cv', $ins_values, $ins_options);
     if (!$success) {
-      watchdog('tripal_cv', "Failed to create the CV record", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to create the CV record", NULL);
       return FALSE;
     }
     $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
@@ -419,7 +418,7 @@ function tripal_cv_add_cv($name, $definition) {
     $upd_options = array('statement_name' => 'upd_cv_nade');
     $success = tripal_core_chado_update('cv', $sel_values, $ins_values, $upd_options);
     if (!$success) {
-      watchdog('tripal_cv', "Failed to update the CV record", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the CV record", NULL);
       return FALSE;
     }
     $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
@@ -508,7 +507,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     }
   }
   if (!$name and !$id) {
-    watchdog('tripal_cv', "Cannot find cvterm without 'id' or 'name'", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find cvterm without 'id' or 'name'", NULL);
     return 0;
   }
   if (!$id) {
@@ -527,11 +526,11 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
 
   // check that we have a database name, give a different message if it's a relationship
   if ($is_relationship and !$dbname) {
-    watchdog('tripal_cv', "A database name is not provided for this relationship term: $id", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "A database name is not provided for this relationship term: $id", NULL);
     return 0;
   }
   if (!$is_relationship and !$dbname) {
-    watchdog('tripal_cv', "A database identifier is missing from the term: $id", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "A database identifier is missing from the term: $id", NULL);
     return 0;
   }
 
@@ -541,7 +540,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $cv = tripal_cv_add_cv($cvname, '');
   }
   if (!$cv) {
-    watchdog('tripal_cv', "Cannot find namespace '$cvname' when adding/updating $id", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find namespace '$cvname' when adding/updating $id", NULL);
     return 0;
   }
 
@@ -566,7 +565,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $db = tripal_db_add_db($dbname);
   }
   if (!$db) {
-    watchdog('tripal_cv', "Cannot find database '$dbname' in Chado.", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find database '$dbname' in Chado.", NULL);
     return 0;
   }
 
@@ -622,8 +621,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         $options = array('statement_name' => 'upd_cvterm_db');
         $success = tripal_core_chado_update('cvterm', $match, $values, $options);
         if (!$success) {
-          watchdog('tripal_cv', "Failed to correct the dbxref id for the cvterm " .
-            "'$name' (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to correct the dbxref id for the cvterm " .
+            "'$name' (id: $accession), for database $dbname", NULL);
           return 0;
         }
       }
@@ -645,8 +644,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       // get/add the dbxref fort his term
       $dbxref_new =  tripal_db_add_dbxref($db->db_id, $accession);
       if (!$dbxref_new) {
-        watchdog('tripal_cv', "Failed to find or insert the dbxref record for cvterm, " .
-          "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+        tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
+          "$name (id: $accession), for database $dbname", NULL);
         return 0;
       }
 
@@ -667,8 +666,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         );
         $success = tripal_core_chado_insert('cvterm_dbxref', $values, $options);
         if (!$success) {
-          watchdog('tripal_cv', "Failed to find or insert the cvterm_dbxref record for a " .
-            "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the cvterm_dbxref record for a " .
+            "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL);
           return 0;
         }
       }
@@ -690,8 +689,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // check to see if the dbxref exists if not, add it
     $dbxref =  tripal_db_add_dbxref($db->db_id, $accession);
     if (!$dbxref) {
-      watchdog('tripal_cv', "Failed to find or insert the dbxref record for cvterm, " .
-        "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
+        "$name (id: $accession), for database $dbname", NULL);
       return 0;
     }
 
@@ -714,18 +713,18 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       $success = tripal_core_chado_insert('cvterm', $ins_values, $ins_options);
       if (!$success) {
         if (!$is_relationship) {
-          watchdog('tripal_cv', "Failed to insert the term: $name ($dbname)", NULL, WATCHDOG_WARNING);
+          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the term: $name ($dbname)", NULL);
           return 0;
         }
         else {
-          watchdog('tripal_cv', "Failed to insert the relationship term: $name (cv: " . $cvname . " db: $dbname)", NULL, WATCHDOG_WARNING);
+          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the relationship term: $name (cv: " . $cvname . " db: $dbname)", NULL);
           return 0;
         }
       }
     }
     // this dbxref already exists in the cvterm table
     else {
-      watchdog('tripal_cv', "The dbxref already exists for another cvterm record: $name (cv: " . $cvname . " db: $dbname)", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "The dbxref already exists for another cvterm record: $name (cv: " . $cvname . " db: $dbname)", NULL);
       return 0;
     }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));
@@ -743,7 +742,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $upd_options = array('statement_name' => 'upd_cvterm_nadeisis');
     $success = tripal_core_chado_update('cvterm', $match, $upd_values, $upd_options);
     if (!$success) {
-      watchdog('tripal_cv', "Failed to update the term: $name", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the term: $name", NULL);
       return 0;
     }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));

+ 4 - 4
tripal_cv/includes/obo_loader.inc

@@ -280,7 +280,7 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
  */
 function tripal_cv_obo_quiterror($message) {
 
-  watchdog("T_obo_loader", $message, array(), WATCHDOG_ERROR);;
+  tripal_core_report_error("T_obo_loader", TRIPAL_ERROR, $message, array());
   exit;
 
 }
@@ -808,7 +808,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
         $options = array('statement_name' => 'ins_tripalobotemp_all');
         $success = tripal_core_chado_insert('tripal_obo_temp', $values, $options);
         if (!$success) {
-          watchdog('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
+          tripal_core_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
           exit;
         }
 
@@ -857,7 +857,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
     $options = array('statement_name' => 'ins_tripalobotemp_all');
     tripal_core_chado_insert('tripal_obo_temp', $values, $options);
     if (!$success) {
-      watchdog('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
+      tripal_core_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
       exit;
     }
     $percent = sprintf("%.2f", ($num_read / $filesize) * 100);
@@ -881,7 +881,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
 
   if (!$accession) {
     tripal_cv_obo_quiterror();
-    watchdog("T_obo_loader", "Cannot add a dbxref without an accession: '$xref'", NULL, WATCHDOG_WARNING);
+    tripal_core_report_error("T_obo_loader", TRIPAL_WARNING, "Cannot add a dbxref without an accession: '$xref'", NULL);
     return FALSE;
   }
 

+ 10 - 16
tripal_db/api/tripal_db.api.inc

@@ -56,19 +56,15 @@ function tripal_db_get_db($select_values) {
     return $results[0];
   }
   elseif (empty($results)) {
-    watchdog('tripal_cdb',
+    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_db: No db matches criteria values:%values',
-      array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
-    );
+      array('%values' => print_r($select_values, TRUE)));
     return FALSE;
   }
   else {
-    watchdog('tripal_db',
+    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_db: 2+ dbs match criteria values:%values',
-      array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
-    );
+      array('%values' => print_r($select_values, TRUE)));
   }
 
 }
@@ -221,18 +217,16 @@ function tripal_db_get_dbxref($select_values) {
     return $dbxref;
   }
   elseif (empty($results)) {
-    watchdog('tripal_db',
+    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_dbxref: No dbxref matches criteria values:%values',
       array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
     );
     return FALSE;
   }
   else {
-    watchdog('tripal_db',
+    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_dbxref: 2+ dbxrefs match criteria values:%values',
       array('%values' => print_r($select_values, TRUE)),
-      WATCHDOG_WARNING
     );
   }
 
@@ -309,7 +303,7 @@ function tripal_db_add_db($dbname, $description = '', $url = '',
     $ins_options = array('statement_name' => 'ins_db_nadeurur');
     $success = tripal_core_chado_insert('db', $ins_values, $ins_options);
     if (!$success) {
-      watchdog('tripal_db', "Cannot create db '$dbname'.", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Cannot create db '$dbname'.", NULL);
       return 0;
     }
     $result = tripal_core_chado_select('db', array('*'), $sel_values, $sel_options);
@@ -319,7 +313,7 @@ function tripal_db_add_db($dbname, $description = '', $url = '',
     $upd_options = array('statement_name' => 'upd_db_nadeurur');
     $success = tripal_core_chado_update('db', $sel_values, $ins_values, $upd_options);
     if (!$success) {
-      watchdog('tripal_db', "Cannot update db '$dbname'.", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Cannot update db '$dbname'.", NULL);
       return 0;
     }
     $result = tripal_core_chado_select('db', array('*'), $sel_values, $sel_options);
@@ -354,7 +348,7 @@ function tripal_db_add_dbxref($db_id, $accession, $version = '', $description =
   if (!$result) {
     $success = tripal_core_chado_insert('dbxref', $ins_values);
     if (!$success) {
-      watchdog('tripal_cv', "Failed to insert the dbxref record $accession", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the dbxref record $accession", NULL);
       return 0;
     }
     $result = tripal_core_chado_select('dbxref', array('*'), $sel_values);
@@ -384,7 +378,7 @@ function tripal_db_add_dbxref_link($linking_table, $dbxref_id, $foreignkey_name,
   if (!$result) {
     $success = tripal_core_chado_insert($linking_table, $values);
     if (!$success) {
-      watchdog('tripal_db', "Failed to insert the $linking_table record $accession", NULL, WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Failed to insert the $linking_table record $accession", NULL);
       return 0;
     }
     $result = tripal_core_chado_select($linking_table, array('*'), $values);

+ 4 - 4
tripal_example/includes/tripal_example.chado_node.inc

@@ -261,8 +261,8 @@ function chado_example_insert($node) {
     //$example = tripal_core_chado_select('example', array('*'), $values);
     //if (!$example) {
     //  drupal_set_message(t('Unable to add example.'), 'warning');
-    //  watchdog('tripal_example', 'Insert example: Unable to create example where values: %values',
-    //  array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+    //  tripal_core_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
+    //    array('%values' => print_r($values, TRUE)));
     //  return;
     //}
 
@@ -346,8 +346,8 @@ function chado_example_update($node) {
 
   //if (!$status) {
   //  drupal_set_message(t('Unable to update example.'), 'warning');
-  //  watchdog('tripal_example', 'Update example: Unable to update example where values: %values',
-  //    array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+  //  tripal_core_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
+  //    array('%values' => print_r($values, TRUE)));
   //}
 
   // * Properties Form *

+ 28 - 28
tripal_feature/api/tripal_feature.api.inc

@@ -39,9 +39,9 @@ function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id =
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      watchdog('tripal_feature',
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_get_property: Both an analysis ID and feature ID should be specified',
-      array(), WATCHDOG_WARNING);
+      array());
   }
 
   // get the analysisfeature_id if one is not provided
@@ -92,9 +92,9 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
       (!$analysis_id and $feature_id)) {
-    watchdog('tripal_feature',
+    tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified',
-      array(), WATCHDOG_WARNING);
+      array());
   }
 
   // get the analysisfeature_id if one is not provided
@@ -109,9 +109,9 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
   $success = tripal_core_insert_property('analysisfeature', $analysisfeature_id,
     $property, $cv_name, $value, $update_if_present);
   if (!$success) {
-     watchdog('tripal_feature',
+     tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_insert_property: Failed to insert analysis feature property',
-       array(), WATCHDOG_WARNING);
+       array());
      return FALSE;
   }
   return $success;
@@ -160,9 +160,9 @@ function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      watchdog('tripal_feature',
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_update_property: Both an analysis ID and feature ID should be specified',
-      array(), WATCHDOG_WARNING);
+      array());
   }
 
   // get the analysisfeature_id if one is not provided
@@ -239,9 +239,9 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      watchdog('tripal_feature',
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_delete_property: Both an analysis ID and feature ID should be specified',
-        array(), WATCHDOG_WARNING);
+        array());
   }
 
   // get the analysisfeature_id if one is not provided
@@ -512,8 +512,8 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       ';
       $status = tripal_core_chado_prepare('feature_rel_get_object', $psql, array('int', 'text'));
       if (!$status) {
-        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'",
-          array('%name' => 'feature_by_subject'), 'WATCHDOG ERROR');
+        tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
+          array('%name' => 'feature_by_subject'));
       }
       $sql = "EXECUTE feature_rel_get_object(:feature_id, :relationship)";
       $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship));
@@ -534,8 +534,8 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       ';
       $status = tripal_core_chado_prepare('feature_rel_get_subject', $psql, array('int', 'text'));
       if (!$status) {
-        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'",
-          array('%name' => 'feature_by_object'), 'WATCHDOG ERROR');
+        tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
+          array('%name' => 'feature_by_object'));
       }
       $sql = "EXECUTE feature_rel_get_subject(:feature_id, :relationship)";
       $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship));
@@ -634,9 +634,9 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
     ';
     $status = tripal_core_chado_prepare('sequence_by_parent', $psql, array('int', 'int', 'int'));
     if (!$status) {
-      watchdog('tripal_feature',
+      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
-        array('%name' => 'sequence_by_parent'), 'WATCHDOG ERROR');
+        array('%name' => 'sequence_by_parent'));
     }
 
     // this query is meant to get all of the sub features of any given
@@ -653,9 +653,9 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             ORDER BY FL.fmin ASC';
     $status = tripal_core_chado_prepare('sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      watchdog('tripal_views_handler_field_sequence',
+      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
-        array('%name' => 'ssub_features'), 'WATCHDOG ERROR');
+        array('%name' => 'ssub_features'));
     }
     $psql ='PREPARE count_sub_features (int, int) AS
             SELECT count(*) as num_children
@@ -667,9 +667,9 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             WHERE FR.object_id = $1 and PF.feature_id = $2';
     $status = tripal_core_chado_prepare('count_sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      watchdog('tripal_views_handler_field_sequence',
+      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
-        array('%name' => 'count_sub_features'), 'WATCHDOG ERROR');
+        array('%name' => 'count_sub_features'));
     }
   }
 
@@ -858,9 +858,9 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     $options = array('statement_name' => 'ins_db_na');
     $success = tripal_core_chado_insert('db', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " .
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " .
         "could not be added because the database, %dbname, does not exist and cannot be added.',
-        array('%feature_id' => $feature_id, '%dbname' => $dbname), WATCHDOG_WARNING);
+        array('%feature_id' => $feature_id, '%dbname' => $dbname));
       return FALSE;
     }
   }
@@ -882,9 +882,9 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     $options = array('statement_name' => 'ins_featuredbxref_dbfe');
     $success = tripal_core_chado_insert('feature_dbxref', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' .
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' .
         'could not be added: %db:%accession.', array('%feature_id' => $feature_id, '%db' => $dbname,
-        '%accession' => $accession), WATCHDOG_WARNING);
+        '%accession' => $accession));
       return FALSE;
     }
   }
@@ -916,9 +916,9 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     $options = array('statement_name' => 'ins_cv_na');
     $success = tripal_core_chado_insert('cv', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " .
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " .
         "could not be added because the CV, %cvname, does not exist and cannot be added.',
-        array('%feature_id' => $feature_id, '%cvname' => $cvname), WATCHDOG_WARNING);
+        array('%feature_id' => $feature_id, '%cvname' => $cvname));
       return FALSE;
     }
   }
@@ -941,8 +941,8 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     $options = array('statement_name' => 'ins_featurecvterm_cvfepu');
     $success = tripal_core_chado_insert('feature_cvterm', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' .
-        'could not be added: %cvterm.', array('%feature_id' => $feature_id, '%cvterm' => $cvterm), WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' .
+        'could not be added: %cvterm.', array('%feature_id' => $feature_id, '%cvterm' => $cvterm));
       return FALSE;
     }
   }

+ 12 - 13
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -423,8 +423,8 @@ function chado_feature_insert($node) {
     $feature = tripal_core_chado_insert('feature', $values);
     if (!$feature) {
       drupal_set_message(t('Unable to add feature.'), 'warning');
-      watchdog('tripal_feature', 'Insert feature: Unable to create feature where values: %values',
-      array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'Insert feature: Unable to create feature where values: %values',
+      array('%values' => print_r($values, TRUE)));
       return;
     }
     $feature_id = $feature['feature_id'];
@@ -536,10 +536,9 @@ function chado_feature_update($node) {
   }
   else {
     drupal_set_message(t('Unable to update feature.'), 'warning');
-    watchdog('tripal_feature',
-    'Update feature: Unable to update feature where values: %values',
-    array('%values' => print_r($values, TRUE)),
-    WATCHDOG_WARNING
+    tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+     'Update feature: Unable to update feature where values: %values',
+     array('%values' => print_r($values, TRUE))
     );
   }
 
@@ -596,7 +595,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
   // remove any old synonyms
   $feature_syn_dsql = "DELETE FROM {feature_synonym} WHERE feature_id = :feature_id";
   if (!chado_query($feature_syn_dsql, array(':feature_id' => $feature_id))) {
-    watchdog('tripal_feature', "Could not remove synonyms from feature. ", array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "Could not remove synonyms from feature. ", array());
     return;
   }
 
@@ -627,7 +626,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
           )
       ";
       if (!chado_query($synonym_isql, array(':name' => $syn, ':synonym_sgml' => $syn))) {
-        watchdog('tripal_feature', "Could not add synonym. ", array(), WATCHDOG_WARNING);
+        tripal_core_report_error('tripal_feature', "Could not add synonym. ", array(), TRIPAL_WARNING);
         return;
       }
       // now get the synonym we just added
@@ -641,7 +640,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
       VALUES (:synonym_id, :feature_id, :pub_id)";
     $args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
     if (!chado_query($feature_syn_isql, $args)) {
-      watchdog('tripal_feature', "Could not associate synonym with feature. ", array(), WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_feature', "Could not associate synonym with feature. ", array(), TRIPAL_WARNING);
       return;
     }
   }
@@ -782,7 +781,7 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
   $values = array('feature_id' => $node->feature_id);
   $feature = tripal_core_chado_select('feature', array('*'), $values);
   if (!$feature) {
-    watchdog('trp-seturl', "Cannot find feature when setting URL alias for feature: %id", array('%id' => $node->feature_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find feature when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $feature = (object) $feature[0];
@@ -791,7 +790,7 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
   $values = array('organism_id' => $feature->organism_id);
   $organism  = tripal_core_chado_select('organism', array('*'), $values);
   if (!$organism) {
-    watchdog('trp-seturl', "Cannot find organism when setting URL alias for feature: %id", array('%id' => $node->feature_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $genus = preg_replace('/\s/', '_', strtolower($organism[0]->genus));
@@ -801,7 +800,7 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
   $values = array('cvterm_id' => $feature->type_id);
   $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
   if (!$cvterm) {
-    watchdog('trp-seturl', "Cannot find type when setting URL alias for feature: %id", array('%id' => $node->feature_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $type = preg_replace('/\s/', '_', $cvterm[0]->name);
@@ -817,7 +816,7 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
   // the dst field of the url_alias table is only 128 characters long.
   // if this is the case then simply return the node URL, we can't set this one
   if (strlen($url_alias) > 128) {
-    watchdog('trp-seturl', "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
     return "node/" . $node->nid;
   }
 

+ 38 - 37
tripal_feature/includes/tripal_feature.fasta_loader.inc

@@ -447,20 +447,20 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
                WHERE cv.name = :cvname and (CVT.name = :name or CVTS.synonym = :synonym)";
   $cvterm = chado_query($cvtermsql, array(':cvname' => 'sequence', ':name' => $type, ':synonym' => $type))->fetchObject();     
   if (!$cvterm) {
-    watchdog("T_fasta_loader", "Cannot find the term type: '%type'", array('%type' => $type), WATCHDOG_ERROR);
+    tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the term type: '%type'", array('%type' => $type));
     return 0;
   }
   if ($parent_type) {
     $parentcvterm = chado_query($cvtermsql, array(':cvname' => 'sequence', ':name' => $parent_type, ':synonym' => $parent_type))->fetchObject();
     if (!$parentcvterm) {
-      watchdog("T_fasta_loader", "Cannot find the paretne term type: '%type'", array('%type' => $parentcvterm), WATCHDOG_ERROR);
+      tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the paretne term type: '%type'", array('%type' => $parentcvterm));
       return 0;
     }
   }
   if ($rel_type) {
     $relcvterm = chado_query($cvtermsql, array(':cvname' => 'relationship', ':name' => $rel_type, ':synonym' => $rel_type))->fetchObject();
     if (!$relcvterm) {
-      watchdog("T_fasta_loader", "Cannot find the relationship term type: '%type'", array('%type' => $relcvterm), WATCHDOG_ERROR);
+      tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the relationship term type: '%type'", array('%type' => $relcvterm));
       return 0;
     }
   }
@@ -470,7 +470,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
   //$lines = file($dfile, FILE_SKIP_EMPTY_LINES);
   $fh = fopen($dfile, 'r');
   if (!$fh) {
-    watchdog('T_fasta_loader', "cannot open file: %dfile", array('%dfile' => $dfile), WATCHDOG_ERROR);
+    tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "cannot open file: %dfile", array('%dfile' => $dfile));
     return 0;
   }
   $filesize = filesize($dfile);
@@ -515,10 +515,10 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
       // get the feature name
       if ($re_name) {
         if (!preg_match("/$re_name/", $line, $matches)) {
-          watchdog('trp-fasta', "ERROR: Regular expression for the feature name finds nothing. Line %line.", array('%line' => $i), 'error');
+          tripal_core_report_error('trp-fasta', "ERROR: Regular expression for the feature name finds nothing. Line %line.", array('%line' => $i), 'error');
         }
         elseif (strlen($matches[1]) > $feature_tbl['fields']['name']['length']) {
-          watchdog('trp-fasta', "WARNING: Regular expression retrieves a value too long for the feature name. Line %line.", array('%line' => $i), 'error');  
+          tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves a value too long for the feature name. Line %line.", array('%line' => $i), 'error');  
         }
         else {
           $name = trim($matches[1]);
@@ -530,14 +530,14 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
         if (strcmp($match_type, 'Name')==0) {
           if (preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)) {
             if (strlen($matches[1]) > $feature_tbl['fields']['name']['length']) {
-              watchdog('trp-fasta', "WARNING: Regular expression retrieves a feature name too long for the feature name. Line %line.", array('%line' => $i), 'error');  
+              tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves a feature name too long for the feature name. Line %line.", array('%line' => $i), 'error');  
             }
             else {
               $name = trim($matches[1]);
             }
           }
           else {
-            watchdog('trp-fasta', "ERROR: Cannot find a feature name. Line %line.", array('%line' => $i), 'error');  
+            tripal_core_report_error('trp-fasta', "ERROR: Cannot find a feature name. Line %line.", array('%line' => $i), 'error');  
           }
         }
       }
@@ -545,7 +545,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
       // get the feature unique name
       if ($re_uname) {
         if (!preg_match("/$re_uname/", $line, $matches)) {
-          watchdog('trp-fasta', "ERROR: Regular expression for the feature unique name finds nothing. Line %line.", array('%line' => $i), 'error');
+          tripal_core_report_error('trp-fasta', "ERROR: Regular expression for the feature unique name finds nothing. Line %line.", array('%line' => $i), 'error');
         }
         $uname = trim($matches[1]);
       }
@@ -557,14 +557,14 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
             $uname = trim($matches[1]);
           }
           else {
-            watchdog('trp-fasta', "ERROR: Cannot find a feature unique name. Line %line.", array('%line' => $i), 'error');  
+            tripal_core_report_error('trp-fasta', "ERROR: Cannot find a feature unique name. Line %line.", array('%line' => $i), 'error');  
           }
         }
       }
       // get the accession
       preg_match("/$re_accession/", $line, $matches);
       if (strlen($matches[1]) > $dbxref_tbl['fields']['accession']['length']) {
-        watchdog('trp-fasta', "WARNING: Regular expression retrieves an accession too long for the feature name. Cannot add cross reference. Line %line.", array('%line' => $i), 'warning');  
+        tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves an accession too long for the feature name. Cannot add cross reference. Line %line.", array('%line' => $i), 'warning');  
       }
       else {
         $accession = trim($matches[1]);
@@ -621,7 +621,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     $options = array('statement_name' => 'sel_feature_ornaty');
     $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
     if (count($results) > 1) {
-      watchdog('T_fasta_loader', "Multiple features exist with the name '%name' of type 
+      tripal_core_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
@@ -640,7 +640,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     $options = array('statement_name' => 'sel_feature_oruqty');
     $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
     if (count($results) > 1) {
-      watchdog('T_fasta_loader', "Multiple features exist with the name '%name' of type 
+      tripal_core_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
@@ -650,8 +650,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     
     // if the feature exists but this is an "insert only" method then skip this feature 
     if ($feature and (strcmp($method, 'Insert only')==0)) {
-      watchdog('T_fasta_loader', "Feature already exists '%name' ('%uname') while matching on %type. Skipping insert.", 
-        array('%name' => $name, '%uname' => $uname, '%type' => drupal_strtolower($match_type)), WATCHDOG_WARNING);
+      tripal_core_report_error('T_fasta_loader', TRIPAL_WARNING, "Feature already exists '%name' ('%uname') while matching on %type. Skipping insert.", 
+        array('%name' => $name, '%uname' => $uname, '%type' => drupal_strtolower($match_type)));
       return 0;
     } 
   }
@@ -682,8 +682,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     $options = array('statement_name' => 'ins_feature_all');
     $success = tripal_core_chado_insert('feature', $values, $options);    
     if (!$success) {
-      watchdog('T_fasta_loader', "Failed to insert feature '%name (%uname)'", 
-        array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
+      tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to insert feature '%name (%uname)'", 
+        array('%name' => $name, '%uname' => $numane));
       return 0;
     }
     
@@ -700,16 +700,16 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
        $feature = $results[0];
     } 
     else {
-      watchdog('T_fasta_loader', "Failed to retreive newly inserted feature '%name (%uname)'", 
-        array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
+      tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted feature '%name (%uname)'", 
+        array('%name' => $name, '%uname' => $numane));
       return 0;  
     }     
   }
   
   // if we don't have a feature and the user wants to do an update then fail
   if (!$feature and (strcmp($method, 'Update only')==0 or drupal_strcmp($method, 'Insert and update')==0)) {
-    watchdog('T_fasta_loader', "Failed to find feature '%name' ('%uname') while matching on " . 
-      drupal_strtolower($match_type), array('%name' => $name, '%uname' => $uname), WATCHDOG_ERROR);
+    tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to find feature '%name' ('%uname') while matching on " . 
+      drupal_strtolower($match_type), array('%name' => $name, '%uname' => $uname));
     return 0;
   }
   
@@ -730,7 +730,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
         $options = array('statement_name' => 'sel_feature_oruqty');
         $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
         if (count($results) > 0) {
-          watchdog('T_fasta_loader', "Cannot update the feature '%name' with a uniquename of '%uname' and type of '%type' as it 
+          tripal_core_report_error('T_fasta_loader', "Cannot update the feature '%name' with a uniquename of '%uname' and type of '%type' as it 
             conflicts with an existing feature with the same uniquename and type.", 
             array('%name' => $name, '%uname' => $uname, '%type' => $type));
           return 0;
@@ -772,8 +772,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       // perform the update
       $success = tripal_core_chado_update('feature', $match, $values, $options);
       if (!$success) {
-        watchdog('T_fasta_loader', "Failed to update feature '%name' ('%name')", 
-          array('%name' => $name, '%uiname' => $uname), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, 
+          "Failed to update feature '%name' ('%name')", 
+          array('%name' => $name, '%uiname' => $uname));
         return 0;
       }
     }
@@ -814,8 +815,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       }
       $success = tripal_core_chado_update('feature', $match, $values, $options);
       if (!$success) {
-        watchdog('T_fasta_loader', "Failed to update feature '%name' ('%name')", 
-          array('%name' => $name, '%uiname' => $uname), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to update feature '%name' ('%name')", 
+          array('%name' => $name, '%uiname' => $uname));
         return 0;
       }
     }    
@@ -834,8 +835,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'ins_analysisfeature_anfe');
       $success = tripal_core_chado_insert('analysisfeature', $values, $ins_options);      
       if (!$success) {
-        watchdog('T_fasta_loader', "Failed to associate analysis and feature '%name' ('%name')", 
-          array('%name' => $name, '%uname' => $uname), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to associate analysis and feature '%name' ('%name')", 
+          array('%name' => $name, '%uname' => $uname));
         return 0;  
       }
     }
@@ -855,8 +856,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'ins_dbxref_dbac');
       $results = tripal_core_chado_insert('dbxref', $values, $ins_options);
       if (!$results) {
-        watchdog('T_fasta_loader', "Failed to add database accession '%accession'", 
-          array('%accession' => $accession), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add database accession '%accession'", 
+          array('%accession' => $accession));
         return 0;
       }
       $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
@@ -864,8 +865,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
         $dbxref = $results[0];
       }
       else { 
-        watchdog('T_fasta_loader', "Failed to retreive newly inserted dbxref '%name (%uname)'", 
-          array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted dbxref '%name (%uname)'", 
+          array('%name' => $name, '%uname' => $numane));
         return 0;
       }
     } 
@@ -884,8 +885,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'ins_featuredbxref_fedb');
       $success = tripal_core_chado_insert('feature_dbxref', $values, $ins_options);
       if (!$success) {
-        watchdog('T_fasta_loader', "Failed to add associate database accession '%accession' with feature", 
-          array('%accession' => $accession), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
+          array('%accession' => $accession));
         return 0;
       }
     }              
@@ -901,7 +902,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     $options = array('statement_name' => 'sel_feature_oruqty');
     $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
     if (count($results) != 1) {
-      watchdog('T_fasta_loader', "Cannot find a unique fature for the parent '%parent' of type 
+      tripal_core_report_error('T_fasta_loader', "Cannot find a unique fature for the parent '%parent' of type 
                '%type' for the feature.", array('%parent' => $parent, '%type' => $parent_type));
       return 0;
     } 
@@ -919,8 +920,8 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'ins_featurerelationship_suojty');
       $success = tripal_core_chado_insert('feature_relationship', $values, $ins_options);
       if (!$success) {
-        watchdog('T_fasta_loader', "Failed to add associate database accession '%accession' with feature", 
-          array('%accession' => $accession), WATCHDOG_ERROR);
+        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
+          array('%accession' => $accession));
         return 0;
       }
     }        

+ 81 - 81
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -335,8 +335,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
       $dfile = $gff_file;
     }
     if (!file_exists($dfile)) {
-      watchdog('T_gff3_loader', "Cannot find the file: %dfile", 
-        array('%dfile' => $dfile), WATCHDOG_ERROR);
+      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Cannot find the file: %dfile", 
+        array('%dfile' => $dfile));
       return 0;
     }
   
@@ -345,8 +345,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     //$lines = file($dfile,FILE_SKIP_EMPTY_LINES);
     $fh = fopen($dfile, 'r');
     if (!$fh) {
-      watchdog('T_gff3_loader', "cannot open file: %dfile", 
-        array('%dfile' => $dfile), WATCHDOG_ERROR);
+      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot open file: %dfile", 
+        array('%dfile' => $dfile));
       return 0;
     }
     $filesize = filesize($dfile);
@@ -355,9 +355,9 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     // default is the 'sequence' ontology
     $sql = "SELECT * FROM {cv} WHERE name = :cvname";
     $cv = chado_query($sql, array(':cvname' => 'sequence'))->fetchObject();
-    if (!$cv) {   
-      watchdog('T_gff3_loader', "Cannot find the 'sequence' ontology", 
-        array(), WATCHDOG_ERROR);
+    if (!$tripal_core_report_error) {   
+      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR "Cannot find the 'sequence' ontology", 
+        array());
       return '';
     }
   
@@ -424,8 +424,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           $result = chado_query($sel_cvterm_sql, array(':cv_id' => $cv->cv_id, ':name' => $landmark_type, ':synonym' => $landmark_type));
           $cvterm = $result->fetchObject();
           if (!$cvterm) {
-            watchdog('T_gff3_loader', 'cannot find feature type \'%landmark_type\' on line %line_num of the GFF file', 
-              array('%landmark_type' => $landmark_type, '%line_num' => $line_num), WATCHDOG_ERROR);
+            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature type \'%landmark_type\' on line %line_num of the GFF file', 
+              array('%landmark_type' => $landmark_type, '%line_num' => $line_num));
             return '';
           }
           tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $rid,
@@ -447,8 +447,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
       // get the columns
       $cols = explode("\t", $line);
       if (sizeof($cols) != 9) {
-        watchdog('T_gff3_loader', 'improper number of columns on line %line_num', 
-          array('%line_num' => $line_num), WATCHDOG_ERROR);
+        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'improper number of columns on line %line_num', 
+          array('%line_num' => $line_num));
         return '';
       }
       
@@ -489,8 +489,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
   
       $cvterm = $result->fetchObject();
       if (!$cvterm) {
-        watchdog('T_gff3_loader', 'cannot find feature term \'%type\' on line %line_num of the GFF file', 
-          array('%type' => $type, '%line_num' => $line_num), WATCHDOG_ERROR);
+        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature term \'%type\' on line %line_num of the GFF file', 
+          array('%type' => $type, '%line_num' => $line_num));
         return '';
       }
        
@@ -520,8 +520,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           continue;
         }
         if (!preg_match('/^[^\=]+\=.+$/', $attr)) {
-          watchdog('T_gff3_loader', 'Attribute is not correctly formatted on line %line_num: %attr', 
-            array('%line_num' => $line_num, '%attr' => $attr), WATCHDOG_ERROR);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'Attribute is not correctly formatted on line %line_num: %attr', 
+            array('%line_num' => $line_num, '%attr' => $attr));
           return '';
         }
   
@@ -562,14 +562,14 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
               if ($create_organism) {
                 $feature_organism = (object) tripal_core_chado_insert('organism', $values);
                 if (!$feature_organism) {
-                  watchdog('T_gff3_loader', "Could not add the organism, '%org', from line %line. Skipping this line. ",
-                    array('%org' => $attr_organism, '%line' => $line_num), WATCHDOG_ERROR); 
+                  tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add the organism, '%org', from line %line. Skipping this line. ",
+                    array('%org' => $attr_organism, '%line' => $line_num)); 
                   $skip_feature = 1; 
                 }
               } 
               else {
-                watchdog('T_gff3_loader', "The organism attribute '%org' on line %line does not exist. Skipping this line. ",
-                  array('%org' => $attr_organism, '%line' => $line_num), WATCHDOG_ERROR); 
+                tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line does not exist. Skipping this line. ",
+                  array('%org' => $attr_organism, '%line' => $line_num)); 
                 $skip_feature = 1;
               }
             }
@@ -579,9 +579,9 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
             }
           } 
           else {
-            watchdog('T_gff3_loader', "The organism attribute '%org' on line %line is not properly formated. It " .
+            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line is not properly formated. It " .
               "should be of the form: organism=Genus:species.  Skipping this line.", 
-              array('%org' => $attr_organism, '%line' => $line_num), WATCHDOG_ERROR);
+              array('%org' => $attr_organism, '%line' => $line_num));
             $skip_feature = 1;  
           }        
         }
@@ -669,21 +669,21 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           }
           $count = tripal_core_chado_select('feature', $columns, $select); 
           if (!$count or count($count) == 0 or $count[0]->num_landmarks == 0) {
-            watchdog('T_gff3_loader', "The landmark '%landmark' cannot be found for this organism (%species) " .
+            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' cannot be found for this organism (%species) " .
                   "Please add the landmark and then retry the import of this GFF3 " .
-                  "file", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species), WATCHDOG_ERROR);
+                  "file", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species));
             return '';
           }
           elseif ($count[0]->num_landmarks > 1) {
-            watchdog('T_gff3_loader', "The landmark '%landmark' has more than one entry for this organism (%species) " .
-                  "Cannot continue", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species), WATCHDOG_ERROR);
+            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' has more than one entry for this organism (%species) " .
+                  "Cannot continue", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species));
             return '';  
           }
   
         }
         if ($count[0]->num_landmarks > 1) {
-          watchdog('T_gff3_loader', "The landmark '%landmark' is not unique for this organism. " .
-                "The features cannot be associated", array('%landmark' => $landmark), WATCHDOG_ERROR);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' is not unique for this organism. " .
+                "The features cannot be associated", array('%landmark' => $landmark));
           return '';
         }  
       }
@@ -700,8 +700,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         );
         $result = tripal_core_chado_delete('feature', $match);
         if (!$result) {
-          watchdog('T_gff3_loader', "cannot delete feature %attr_uniquename", 
-            array('%attr_uniquename' => $attr_uniquename), WATCHDOG_ERROR);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot delete feature %attr_uniquename", 
+            array('%attr_uniquename' => $attr_uniquename));
         }
         $feature = 0;
         unset($result);
@@ -731,7 +731,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           if (count($results) == 0) {
             $result = tripal_core_chado_insert('tripal_gff_temp', $values);
             if (!$result) {
-              watchdog('T_gff3_loader', "Cound not save record in temporary table, Cannot continue.", array(), WATCHDOG_ERROR);
+              tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Cound not save record in temporary table, Cannot continue.", array());
               exit;
             }
           }
@@ -908,7 +908,7 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
   );
   $result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values);   
   if (count($result) == 0) {
-    watchdog("T_gff3_loader", "Cannot find subject type for feature in 'derives_from' relationship: %subject", array('%subject' => $subject), WATCHDOG_WARNING);
+    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find subject type for feature in 'derives_from' relationship: %subject", array('%subject' => $subject));
      return ''; 
   }
   $subject_type = $result[0]->type_name;
@@ -926,9 +926,9 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
   );
   $sfeature = tripal_core_chado_select('feature', array('feature_id'), $match);
   if (count($sfeature)==0) {
-    watchdog('T_gff3_loader', "Could not add 'Derives_from' relationship " .
+    tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Derives_from' relationship " .
       "for %uniquename and %subject.  Subject feature, '%subject', " .
-      "cannot be found", array('%uniquename' => $feature->uniquename, '%subject' => $subject), WATCHDOG_ERROR);
+      "cannot be found", array('%uniquename' => $feature->uniquename, '%subject' => $subject));
     return;
   }
 
@@ -952,8 +952,8 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
   // finally insert the relationship if it doesn't exist
   $ret = tripal_core_chado_insert('feature_relationship', $values);
   if (!$ret) {
-    watchdog("T_gff3_loader", "Could not add 'Derives_from' relationship for $feature->uniquename and $subject", 
-      array(), WATCHDOG_WARNING);
+    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add 'Derives_from' relationship for $feature->uniquename and $subject", 
+      array());
   }
 }
 /**
@@ -985,7 +985,7 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
     );
     $result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values);    
     if (count($result) == 0) {
-      watchdog("T_gff3_loader", "Cannot find parent: %parent", array('%parent' => $parent), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find parent: %parent", array('%parent' => $parent));
        return '';  
     }
     $parent_type = $result[0]->type_name;
@@ -1023,14 +1023,14 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
         );
         $result = tripal_core_chado_insert('feature_relationship', $values);
         if (!$result) {
-          watchdog("T_gff3_loader", "Failed to insert feature relationship '$uname' ($type) $rel_type '$parent' ($parent_type)", 
-            array(), WATCHDOG_WARNING);
+          tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature relationship '$uname' ($type) $rel_type '$parent' ($parent_type)", 
+            array());
         }
       }
     }
     else {
-      watchdog("T_gff3_loader", "Cannot establish relationship '$uname' ($type) $rel_type '$parent' ($parent_type): Cannot find the parent", 
-        array(), WATCHDOG_WARNING);      
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot establish relationship '$uname' ($type) $rel_type '$parent' ($parent_type): Cannot find the parent", 
+        array());      
     }
   }
 }
@@ -1072,7 +1072,7 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
         $db = tripal_core_chado_select('db', array('db_id'), $values);
       }
       else {
-        watchdog("T_gff3_loader", "Cannot find or add the database $dbname", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find or add the database $dbname", array());
         return 0;
       }
     }
@@ -1117,7 +1117,7 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
       );
       $success = tripal_core_chado_insert('feature_dbxref', $values);
       if (!$success) {
-        watchdog("T_gff3_loader", "Failed to insert Dbxref: $dbname:$accession", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert Dbxref: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1145,7 +1145,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
       // now look for the name without the 'DB:' prefix.
       $db = tripal_core_chado_select('db', array('db_id'), array('name' => "$dbname"));
       if (sizeof($db) == 0) {
-        watchdog("T_gff3_loader", "Database, $dbname, is not present. Cannot associate term: $dbname:$accession", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Database, $dbname, is not present. Cannot associate term: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1155,7 +1155,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
     $dbxref = tripal_core_chado_select('dbxref', array('dbxref_id'), 
       array('accession' => $accession, 'db_id' => $db->db_id));
     if (sizeof($dbxref) == 0) {
-      watchdog("T_gff3_loader", "Accession, $accession is missing for reference: $dbname:$accession", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Accession, $accession is missing for reference: $dbname:$accession", array());
       return 0;
     }
     $dbxref = $dbxref[0];
@@ -1168,7 +1168,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
       $cvterm = tripal_core_chado_select('cvterm_dbxref', array('cvterm_id'), array(
         'dbxref_id' => $dbxref->dbxref_id));
       if (sizeof($cvterm) == 0) {
-        watchdog("T_gff3_loader", "CV Term is missing for reference: $dbname:$accession", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "CV Term is missing for reference: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1191,7 +1191,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
       $success = tripal_core_chado_insert('feature_cvterm', $values);
 
       if (!$success) {
-        watchdog("T_gff3_loader", "Failed to insert ontology term: $dbname:$accession", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert ontology term: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1217,7 +1217,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
     );
     $success = tripal_core_chado_insert('cv', $values);
     if (!$success) {
-      watchdog("T_gff3_loader", "Failed to add the synonyms type vocabulary", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to add the synonyms type vocabulary", array());
       return 0;
     }
     // now that we've added the cv we need to get the record
@@ -1247,7 +1247,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
     );
     $syntype = tripal_cv_add_cvterm($term, $syncv->name, 0, 1);
     if (!$syntype) {
-      watchdog("T_gff3_loader", "Cannot add synonym type: internal:$type", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add synonym type: internal:$type", array());
       return 0;
     }
   } 
@@ -1273,7 +1273,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       );
       $success = tripal_core_chado_insert('synonym', $values);
       if (!$success) {
-        watchdog("T_gff3_loader", "Cannot add alias $alias to synonym table", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to synonym table", array());
         return 0;
       }
       $result = tripal_core_chado_select('synonym', array('*'), $select);
@@ -1299,14 +1299,14 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       ";
       $status = chado_query($psql);
       if (!$status) {
-        watchdog("T_gff3_loader", "Cannot prepare statement 'ins_pub_uniquename_typeid", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot prepare statement 'ins_pub_uniquename_typeid", array());
         return 0;
       } 
 
       // insert the null pub 
       $result = chado_query($pub_sql, array(':uname' => 'null', ':type_id' => 'null'))->fetchObject();
       if (!$result) {
-        watchdog("T_gff3_loader", "Cannot add null publication needed for setup of alias", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add null publication needed for setup of alias", array());
         return 0;
       }
       $result = tripal_core_chado_select('pub', array('*'), $select);
@@ -1334,7 +1334,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       $success = tripal_core_chado_insert('feature_synonym', $values);   
      
       if (!$success) {
-        watchdog("T_gff3_loader", "Cannot add alias $alias to feature synonym table", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to feature synonym table", array());
         return 0;
       }
     }
@@ -1391,7 +1391,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
     );
     $result = tripal_core_chado_insert('feature', $values);
     if (!$result) {
-      watchdog("T_gff3_loader", "Failed to insert feature '$uniquename' ($cvterm->name)", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature '$uniquename' ($cvterm->name)", array());
       return 0;
     }
   }
@@ -1411,7 +1411,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
     );
     $result = tripal_core_chado_update('feature', $match, $values);
     if (!$result) {
-      watchdog("T_gff3_loader", "Failed to update feature '$uniquename' ($cvterm->name)", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to update feature '$uniquename' ($cvterm->name)", array());
       return 0;
     }
   }
@@ -1438,7 +1438,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
       $af_values['significance'] = $score;
     } 
     if (!tripal_core_chado_insert('analysisfeature', $af_values)) {
-      watchdog("T_gff3_loader", "Could not add analysisfeature record: $analysis_id, $feature->feature_id", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add analysisfeature record: $analysis_id, $feature->feature_id", array());
     }    
   }
   else {
@@ -1453,7 +1453,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
     if (!$add_only) {
       $ret = tripal_core_chado_update('analysisfeature', $af_values, $new_vals);
       if (!$ret) {
-        watchdog("T_gff3_loader", "Could not update analysisfeature record: $analysis_id, $feature->feature_id", array(), WATCHDOG_WARNING);
+        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not update analysisfeature record: $analysis_id, $feature->feature_id", array());
       }
     }
   }
@@ -1514,24 +1514,24 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
             );
             $results = tripal_core_chado_insert('feature', $values);
             if (!$results) {
-              watchdog("T_gff3_loader", "Cannot find landmark feature: '%landmark', nor could it be inserted", 
-                array('%landmark' => $landmark), WATCHDOG_WARNING);
+              tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find landmark feature: '%landmark', nor could it be inserted", 
+                array('%landmark' => $landmark));
               return 0;  
             }  
             $srcfeature = new stdClass();
             $srcfeature->feature_id = $results['feature_id'];
          } 
          else {
-           watchdog("T_gff3_loader", "Cannot find unique landmark feature: '%landmark'.", 
-             array('%landmark' => $landmark), WATCHDOG_WARNING);
+           tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find unique landmark feature: '%landmark'.", 
+             array('%landmark' => $landmark));
            return 0;
          } 
        }        
     } 
     elseif (count($results) > 1) {
-       watchdog("T_gff3_loader", "multiple landmarks exist with the name: '%landmark'.  Cannot 
+       tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
          resolve which one to use. Cannot add the feature location record", 
-         array('%landmark' => $landmark), WATCHDOG_WARNING);
+         array('%landmark' => $landmark));
        return 0;    
     } 
     else {
@@ -1539,9 +1539,9 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     }   
   }
   elseif (count($results) > 1) {
-    watchdog("T_gff3_loader", "multiple landmarks exist with the name: '%landmark'.  Cannot 
+    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
       resolve which one to use. Cannot add the feature location record", 
-      array('%landmark' => $landmark), WATCHDOG_WARNING);
+      array('%landmark' => $landmark));
     return 0;  
   }
   else {
@@ -1629,7 +1629,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     }    
     $success = tripal_core_chado_insert('featureloc', $values);
     if (!$success) {
-      watchdog("T_gff3_loader", "Failed to insert featureloc", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert featureloc", array());
       exit;
       return 0;
     }
@@ -1662,7 +1662,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
     );    
     $cvterm = (object) tripal_cv_add_cvterm($term, 'feature_property', 0, 0);
     if (!$cvterm) {
-      watchdog("T_gff3_loader", "Cannot add cvterm, $property", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add cvterm, $property", array());
       return 0;  
     }
   } 
@@ -1703,7 +1703,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
     );
     $result = tripal_core_chado_insert('featureprop', $values);
     if (!$result) {
-      watchdog("T_gff3_loader", "cannot add featureprop, $property", array(), WATCHDOG_WARNING);
+      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "cannot add featureprop, $property", array());
     }
   }
 }
@@ -1745,8 +1745,8 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
         $values = array('uniquename' => $id);
         $result = tripal_core_chado_select('tripal_gff_temp', array('*'), $values); 
         if (count($result) == 0) {
-          watchdog('T_gff3_loader', 'Cannot find feature to assign FASTA sequence: %uname', 
-             array('%uname' => $id), WATCHDOG_WARNING);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
+             array('%uname' => $id));
         }
         else {
           // if we have a feature then add the residues
@@ -1770,8 +1770,8 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
   $values = array('uniquename' => $id);
   $result = tripal_core_chado_select('tripal_gff_temp', array('*'), $values); 
   if (count($result) == 0) {
-    watchdog('T_gff3_loader', 'Cannot find feature to assign FASTA sequence: %uname', 
-       array('%uname' => $id), WATCHDOG_WARNING);
+    tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
+       array('%uname' => $id));
   }
   else {
     // if we have a feature then add the residues
@@ -1839,15 +1839,15 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
           $t_organism_id = $torganism[0]->organism_id;
         }
         else {
-          watchdog('T_gff3_loader', "Cannot find organism for target %target.", 
-            array('%target' => $gff_target_organism), WATCHDOG_WARNING);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "Cannot find organism for target %target.", 
+            array('%target' => $gff_target_organism));
           $t_organism_id = '';                                   
         }
       }
       else {
-        watchdog('T_gff3_loader', "The target_organism attribute is improperly formatted: %target. 
+        tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_organism attribute is improperly formatted: %target. 
           It should be target_organism=genus:species.", 
-          array('%target' => $gff_target_organism), WATCHDOG_WARNING);
+          array('%target' => $gff_target_organism));
         $t_organism_id = '';                
       }
     }  
@@ -1867,8 +1867,8 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
         $t_type_id = $type[0]->cvterm_id;
       }
       else {
-        watchdog('T_gff3_loader', "The target type does not exist in the sequence ontology: %type. ", 
-          array('%type' => $target_type), WATCHDOG_ERROR);
+        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The target type does not exist in the sequence ontology: %type. ", 
+          array('%type' => $target_type));
         exit;  
       }
     }
@@ -1899,8 +1899,8 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
           $t_type_id = $synonym->cvterm_id;
         }
         else {
-          watchdog('T_gff3_loader', "The target_type attribute does not exist in the sequence ontology: %type. ", 
-            array('%type' => $gff_target_type), WATCHDOG_WARNING);
+          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_type attribute does not exist in the sequence ontology: %type. ", 
+            array('%type' => $gff_target_type));
           $t_type_id = '';
         }
       }
@@ -1914,7 +1914,7 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
   }
   // the target attribute is not correctly formatted
   else {
-    watchdog('T_gff3_loader', "Could not add 'Target' alignment as it is improperly formatted:  '%target'",
-      array('%target' => $tags['Target'][0]), WATCHDOG_ERROR);            
+    tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Target' alignment as it is improperly formatted:  '%target'",
+      array('%target' => $tags['Target'][0]));            
   }
 }

+ 2 - 2
tripal_featuremap/api/tripal_featuremap.api.inc

@@ -145,8 +145,8 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
   $options = array('statement_name' => 'ins_featuremapdbxref_dbpu');
   $results = tripal_core_chado_insert('featuremap_dbxref', $values, $options);
   if (!$results) {
-    watchdog('t_featuremap', "Cannot add map dbxref: %db:%accession.",
-      array('%db' => $dbname, '%accession' => $accession). WATCHDOG_ERROR);
+    tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Cannot add map dbxref: %db:%accession.",
+      array('%db' => $dbname, '%accession' => $accession));
     return FALSE;
   }
   return $results;

+ 7 - 7
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -273,8 +273,8 @@ function chado_featuremap_insert($node) {
     $featuremap = tripal_core_chado_insert('featuremap', $values);
     if(!$featuremap) {
       drupal_set_message(t('Unable to add featuremap.', 'warning'));
-      watchdog('tripal_featuremap', 'Unable to create feature map where values: %values',
-      array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_featuremap', TRIPAL_WARNING, 'Unable to create feature map where values: %values',
+      array('%values' => print_r($values, TRUE)));
       return;
     }
     $featuremap_id = $featuremap['featuremap_id'];
@@ -293,8 +293,8 @@ function chado_featuremap_insert($node) {
         $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap_id, $value);
         if (!$featuremap_dbxref) {
           drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
-          watchdog('t_featuremap', "Error cannot add featuremap cross reference: %ref",
-          array('%ref' => $value), WATCHDOG_ERROR);
+          tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
+          array('%ref' => $value));
         }
       }
       unset($properties[$map_dbxref_cvterm_id]);
@@ -355,7 +355,7 @@ function chado_featuremap_update($node) {
   $status = tripal_core_chado_update('featuremap', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating map", "error");
-    watchdog('t_featuremap', "Error updating map", array(), WATCHDOG_ERROR);
+    tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error updating map", array());
     return;
   }
 
@@ -373,8 +373,8 @@ function chado_featuremap_update($node) {
       $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap_id, $value);
       if (!$featuremap_dbxref) {
         drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
-        watchdog('t_featuremap', "Error cannot add featuremap cross reference: %ref",
-        array('%ref' => $value), WATCHDOG_ERROR);
+        tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
+        array('%ref' => $value));
       }
     }
     unset($properties[$map_dbxref_cvterm_id]);

+ 9 - 11
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -121,11 +121,10 @@ function chado_organism_validate($node, $form, &$form_state) {
     $result = chado_query($sql, $args)->fetchObject();
     if ($result) {
       form_set_error('genus', t("Update cannot proceed. The organism genus
-      '$node->genus' and species '$node->species' is already present in the database."));
-      watchdog('tripal_organism',
-      'Update organism: genus and species already exists: %values',
-      array('%values' => "genus = $node->genus, species = $node->species"),
-      WATCHDOG_WARNING);
+        '$node->genus' and species '$node->species' is already present in the database."));
+      tripal_core_report_error('tripal_organism', TRIPAL_WARNING,
+        'Update organism: genus and species already exists: %values',
+        array('%values' => "genus = $node->genus, species = $node->species"));
     }
   }
   // Validating for an insert
@@ -138,10 +137,9 @@ function chado_organism_validate($node, $form, &$form_state) {
     if (sizeof($organism) > 0) {
       form_set_error('genus', 'Cannot add the organism with this genus and species.
         The organism already exists.');
-      watchdog('tripal_organism',
-      'Insert organism: genus and species already exists: %values',
-      array('%values' => "genus = $node->genus, species = $node->species"),
-      WATCHDOG_WARNING);
+      tripal_core_report_error('tripal_organism', TRIPAL_WARNING,
+        'Insert organism: genus and species already exists: %values',
+        array('%values' => "genus = $node->genus, species = $node->species"));
     }
   }
 }
@@ -174,8 +172,8 @@ function chado_organism_insert($node) {
     $organism = tripal_core_chado_insert('organism', $values);
     if (!$organism) {
       drupal_set_message(t('Unable to add organism.', 'warning'));
-      watchdog('tripal_organism', 'Insert Organism: Unable to create organism where values:%values',
-      array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_organism', TRIPAL_ERROR, 'Insert Organism: Unable to create organism where values:%values',
+      array('%values' => print_r($values, TRUE)));
       return;
     }
     $organism_id = $organism['organism_id'];

+ 28 - 28
tripal_pub/api/tripal_pub.api.inc

@@ -495,8 +495,8 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
   $options = array('statement_name' => 'ins_pubdbxref_dbpu');
   $results = tripal_core_chado_insert('pub_dbxref', $values, $options);
   if (!$results) {
-    watchdog('tripal_pub', "Cannot add publication dbxref: %db:%accession.",
-    array('%db' => $dbname, '%accession' => $accession). WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add publication dbxref: %db:%accession.",
+    array('%db' => $dbname, '%accession' => $accession));
     return FALSE;
   }
   return $results;
@@ -685,15 +685,15 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     if(count($results) == 1) {
       $pub_id = $results[0];
       if ($pub_id and !$update_if_exists) {
-        //watchdog('tripal_pub', "A publication with this Dbxref already exists... Skipping: %dbxref",
-        //array('%dbxref' => $pub_details['Publication Dbxref']), WATCHDOG_WARNING);
+        //tripal_core_report_error('tripal_pub', TRIPAL_WARNING, "A publication with this Dbxref already exists... Skipping: %dbxref",
+        //array('%dbxref' => $pub_details['Publication Dbxref']));
         $action = 'skipped';
         return $pub_id;
       }
     }
     elseif (count($results) > 1) {
-      watchdog('tripal_pub', "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
-      array('%db' => $dbname, '%accession' => $accession), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
+      array('%db' => $dbname, '%accession' => $accession));
       $action = 'error';
       return FALSE;
     }
@@ -708,17 +708,17 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     if (count($results) == 1) {
       $pub_id = $results[0];
       if ($pub_id and !$update_if_exists) {
-        watchdog('tripal_pub', "The publication with the same title, type and year already exists. Skipping. ".
-            " Title: '%title'. Type: '%type'. Year: '%year'",
-            array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']), WATCHDOG_WARNING);
+        tripal_core_report_error('tripal_pub', TRIPAL_WARNING, "The publication with the same title, type and year already exists. Skipping. ".
+          " Title: '%title'. Type: '%type'. Year: '%year'",
+          array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']));
         $action = 'skipped';
         return $pub_id;
       }
     }
     elseif (count($results) > 1) {
-      watchdog('tripal_pub', "The publication with the same title, type and year is present multiple times. Cannot ".
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "The publication with the same title, type and year is present multiple times. Cannot ".
         "determine which to use.  Title: '%title'. Type: '%type'. Year: '%year'",
-      array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']), WATCHDOG_ERROR);
+      array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']));
       $action = 'error';
       return FALSE;
     }
@@ -733,13 +733,13 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     }
   }
   else {
-    watchdog('tripal_pub', "The Publication Type is a required property but is missing", array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "The Publication Type is a required property but is missing", array());
     $action = 'error';
     return FALSE;
   }
   if (!$pub_type) {
-    watchdog('tripal_pub', "Cannot find publication type: '%type'",
-    array('%type' => $pub_details['Publication Type'][0]), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find publication type: '%type'",
+    array('%type' => $pub_details['Publication Type'][0]));
     $action = 'error';
     return FALSE;
   }
@@ -761,8 +761,8 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     $options = array('statement_name' => 'ins_pub_tivoseispypaunty');
     $pub = tripal_core_chado_insert('pub', $values, $options);
     if (!$pub) {
-      watchdog('tripal_pub', "Cannot insert the publication with title: %title",
-      array('%title' => $pub_details['Title']), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot insert the publication with title: %title",
+      array('%title' => $pub_details['Title']));
       $action = 'error';
       return FALSE;
     }
@@ -776,8 +776,8 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     $options = array('statement_name' => 'up_pub_tivoseispypaunty');
     $success = tripal_core_chado_update('pub', $match, $values, $options);
     if (!$success) {
-      watchdog('tripal_pub', "Cannot update the publication with title: %title",
-      array('%title' => $pub_details['Title']), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot update the publication with title: %title",
+      array('%title' => $pub_details['Title']));
       $action = 'error';
       return FALSE;
     }
@@ -812,7 +812,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
       $cvterm = tripal_cv_get_cvterm_by_synonym($key, NULL, 'tripal_pub');
     }
     if (!$cvterm) {
-      watchdog('tripal_pub', "Cannot find term: '%prop'. Skipping.", array('%prop' => $key), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find term: '%prop'. Skipping.", array('%prop' => $key));
       continue;
     }
 
@@ -843,8 +843,8 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
       $success = tripal_core_insert_property('pub', $pub_id, $key, 'tripal_pub', $value, TRUE);
     }
     if (!$success) {
-      watchdog('tripal_pub', "Cannot add property '%prop' to publication. Skipping.",
-      array('%prop' => $key), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add property '%prop' to publication. Skipping.",
+      array('%prop' => $key));
       continue;
     }
   }
@@ -918,7 +918,7 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
         $options = array('statement_name' => 'ins_pubauthorcontact_puco');
         $pubauthor_contact = tripal_core_chado_insert('pubauthor_contact', $values, $options);
         if (!$pubauthor_contact) {
-          watchdog('tripal_pub', "Cannot link pub authro and contact.", array(), WATCHDOG_ERROR);
+          tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot link pub authro and contact.", array());
         }
       }
     }
@@ -1083,8 +1083,8 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   if ($citation) {
     $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value', $options);
     if (count($citation) > 1) {
-      watchdog('tripal_pub', "Publication has multiple citations already: %pub_id",
-      array('%pub_id' => $pubid), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple citations already: %pub_id",
+      array('%pub_id' => $pubid));
       return FALSE;
     }
     elseif (count($citation) == 1 and $skip_existing == TRUE) {
@@ -1122,8 +1122,8 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   $authors = tripal_core_generate_chado_var('pubprop', $values);
   $authors = tripal_core_expand_chado_vars($authors, 'field', 'pubprop.value', $options);
   if (count($authors) > 1) {
-   watchdog('tripal_pub', "Publication has multiple author lists. It should have only one list: %pub_id",
-   array('%pub_id' => $pubid), WATCHDOG_ERROR);
+   tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple author lists. It should have only one list: %pub_id",
+   array('%pub_id' => $pubid));
    return FALSE;
   }
   else if (trim($authors->value)) {
@@ -1261,8 +1261,8 @@ function tripal_pub_create_citation($pub) {
       }
     }
     if (!$pub_type) {
-      watchdog('tripal_pub', "Cannot generate citation for publication type: %types",
-        array('%types' => print_r($pub['Publication Type'], TRUE)), WATCHDOG_ERROR);
+      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot generate citation for publication type: %types",
+        array('%types' => print_r($pub['Publication Type'], TRUE)));
       return FALSE;
     }
   }

+ 7 - 7
tripal_pub/includes/importers/tripal_pub.PMID.inc

@@ -162,8 +162,8 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
   $rfh = fopen($query_url, "r");
   if (!$rfh) {
     drupal_set_message('Could not perform Pubmed query. Cannot connect to Entrez.', 'error');
-    watchdog('tpub_import', "Could not perform Pubmed query. Cannot connect to Entrez.",
-              array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform Pubmed query. Cannot connect to Entrez.",
+              array());
     return 0;
   }
 
@@ -241,8 +241,8 @@ $retmod = 'null', $start = 0, $limit = 10, $args = array()){
   $rfh = fopen($fetch_url, "r");
   if (!$rfh) {
     drupal_set_message('ERROR: Could not perform PubMed query.', 'error');
-    watchdog('tpub_import', "Could not perform PubMed query: %fetch_url.",
-              array('%fetch_url' => $fetch_url), WATCHDOG_ERROR);
+    tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform PubMed query: %fetch_url.",
+              array('%fetch_url' => $fetch_url));
     return '';
   }
   $results = '';
@@ -285,7 +285,7 @@ function tripal_pub_PMID_parse_pubxml($pub_xml) {
       switch ($element) {
         case 'ERROR':
           $xml->read(); // get the value for this element
-          watchdog('tripal_pub', "Error: %err", array('%err' => $xml->value), WATCHDOG_ERROR);
+          tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Error: %err", array('%err' => $xml->value));
           break;
         case 'PMID':
           // thre are multiple places where a PMID is present in the XML and
@@ -507,8 +507,8 @@ function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
             // see if this we can find the name using a synonym
             $pub_cvterm = tripal_cv_get_cvterm_by_synonym($value, NULL, 'tripal_pub');
             if (!$pub_cvterm) {
-              watchdog('tpub_pubmed', 'Cannot find a valid vocabulary term for the publication type: "%term".',
-              array('%term' => $value), WATCHDOG_ERROR);
+              tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, 'Cannot find a valid vocabulary term for the publication type: "%term".',
+              array('%term' => $value));
             }
           }
           else {

+ 1 - 1
tripal_stock/api/tripal_stock.api.inc

@@ -45,7 +45,7 @@ function tripal_stock_get_stock_by_stock_id($stock_id) {
     return node_load($r->nid);
   }
   else {
-    watchdog('tripal_stock', 'tripal_stock_get_stock_by_stock_id(!stock_id): no stock with that stock_id is sync\'d with drupal', array('!stock_id' => $stock_id), WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_stock', TRIPAL_WARNING, 'tripal_stock_get_stock_by_stock_id(!stock_id): no stock with that stock_id is sync\'d with drupal', array('!stock_id' => $stock_id));
   }
 
   return 0;

+ 11 - 24
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -56,9 +56,7 @@ function chado_stock_load($nodes) {
     // get the stock details from chado
     $stock_id = chado_get_id_for_node('stock', $node->nid);
     if (empty($stock_id)) {
-      tripal_core_report_error(
-        'tripal_stock',
-        TRIPAL_ERROR,
+      tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
         'Unable to retrieve stock_id for %title (NID = %nid).',
         array('%title' => $node->title, '%nid' => $node->nid)
       );
@@ -484,11 +482,9 @@ function chado_stock_insert($node) {
           $dbxref_status = tripal_core_chado_insert('dbxref', $values);
           if (!$dbxref_status) {
             drupal_set_message(t('Unable to add database reference to this stock.'), 'warning');
-            watchdog('tripal_stock',
+            tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
               'Insert Stock: Unable to create dbxref where values:%values',
-              array('%values' => print_r($values, TRUE)),
-              WATCHDOG_WARNING
-            );
+              array('%values' => print_r($values, TRUE)));
           }
         }
         else {
@@ -580,11 +576,9 @@ function chado_stock_insert($node) {
   }
   else {
     drupal_set_message(t('Error during stock creation.'), 'error');
-    watchdog('tripal_stock',
+    tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
       'Insert Stock: Unable to create stock where values:%values',
-      array('%values' => print_r($values, TRUE)),
-      WATCHDOG_WARNING
-    );
+      array('%values' => print_r($values, TRUE)));
     return FALSE;
   }
 }
@@ -653,11 +647,9 @@ function chado_stock_update($node) {
         }
         else {
           drupal_set_message(t('Unable to find stock to Update'), 'error');
-          watchdog(
-            'tripal_stock',
+          tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
             'Stock Update: Unable to find stock to update using values: %values',
-            array('%values', print_r($values, TRUE)),
-            WATCHDOG_ERROR
+            array('%values', print_r($values, TRUE))
           );
           return FALSE;
         }
@@ -665,12 +657,9 @@ function chado_stock_update($node) {
     }
 
     if (!$dbxref_status) {
-      watchdog(
-        'tripal_stock',
+      tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
         'Stock Update: Unable to %mode main stock dbxref with values: %values',
-        array('%values' => print_r($values, TRUE), '%mode' => $dbxref_mode),
-        WATCHDOG_WARNING
-      );
+        array('%values' => print_r($values, TRUE), '%mode' => $dbxref_mode));
     }
   }
 
@@ -695,11 +684,9 @@ function chado_stock_update($node) {
 
   if (!$status) {
     drupal_set_message(t('Unable to update stock'), 'error');
-    watchdog(
-      'tripal_stock',
+    tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
       'Stock Update: Unable to update stock using match values: %mvalues and update values: %uvalues',
-      array('%mvalues' => print_r(array('stock_id' => $node->stock_id), TRUE), '%uvalues' => print_r($update_values, TRUE)),
-      WATCHDOG_ERROR
+      array('%mvalues' => print_r(array('stock_id' => $node->stock_id), TRUE), '%uvalues' => print_r($update_values, TRUE))
     );
   }
   else {

+ 6 - 244
tripal_stock/includes/tripal_stock.sync_stocks.inc

@@ -186,7 +186,7 @@ function tripal_stock_set_urls($na = NULL, $job = NULL) {
       db_query('DEALLOCATE "del_url_alias_by_src"');
       db_query('DEALLOCATE "ins_url_alias_nisrds"');
       db_query("ROLLBACK");
-      watchdog('trp-seturl', "Failed Removing URL Alias: %src", array('%src' => $src), WATCHDOG_ERROR);
+      tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Failed Removing URL Alias: %src", array('%src' => $src));
       return;
     }
     $success = db_query("EXECUTE ins_url_alias_nisrds(:src, :dst)", array(':src' => $src, ':dst' => $dst));
@@ -194,7 +194,7 @@ function tripal_stock_set_urls($na = NULL, $job = NULL) {
       db_query('DEALLOCATE "del_url_alias_by_src"');
       db_query('DEALLOCATE "ins_url_alias_nisrds"');
       db_query("ROLLBACK");
-      watchdog('trp-seturl', "Failed Adding URL Alias: %dst", array('%dst' => $dst), WATCHDOG_ERROR);
+      tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Failed Adding URL Alias: %dst", array('%dst' => $dst));
       return;
     }
 
@@ -247,7 +247,7 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   $options = array('statement_name' => 'sel_stock_id');
   $stock = tripal_core_chado_select('stock', array('*'), $values, $options);
   if (!$stock) {
-    watchdog('trp-seturl', "Cannot find stock when setting URL alias for stock: %id", array('%id' => $node->stock_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find stock when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $stock = (object) $stock[0];
@@ -257,7 +257,7 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   $options = array('statement_name' => 'sel_organism_id');
   $organism  = tripal_core_chado_select('organism', array('*'), $values, $options);
   if (!$organism) {
-    watchdog('trp-seturl', "Cannot find organism when setting URL alias for stock: %id", array('%id' => $node->stock_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $genus = preg_replace('/\s/', '_', strtolower($organism[0]->genus));
@@ -268,7 +268,7 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   $options = array('statement_name' => 'sel_cvterm_id');
   $cvterm = tripal_core_chado_select('cvterm', array('name'), $values, $options);
   if (!$cvterm) {
-    watchdog('trp-seturl', "Cannot find type when setting URL alias for stock: %id", array('%id' => $node->stock_id), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $type = preg_replace('/\s/', '_', $cvterm[0]->name);
@@ -284,247 +284,9 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   // the dst field of the url_alias table is only 128 characters long.
   // if this is the case then simply return the node URL, we can't set this one
   if (strlen($url_alias) > 128) {
-    watchdog('trp-seturl', "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias), WATCHDOG_ERROR);
+    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
     return "node/" . $node->nid;
   }
 
   return $url_alias;
 }
-/**
- *
- *
- * @ingroup tripal_stock
- */
-function tripal_stock_sync_stocks($max_sync = 0, $organism_id = NULL,
-  $stock_types = NULL, $job_id = NULL) {
-  //print "Syncing stocks (max of $max_sync)\n";
-  $i = 0;
-
-  // get the list of available sequence ontology terms for which
-  // we will build drupal pages from stocks in chado.  If a stock
-  // is not one of the specified typse we won't build a node for it.
-  if (!$stock_types) {
-    $allowed_types = variable_get('chado_sync_stock_types', '');
-  }
-  else {
-    $allowed_types = $stock_types;
-  }
-  $args = array();
-  $i = 0;
-  if ($allowed_types) {
-    $allowed_types = preg_replace("/[\s\n\r]+/", " ", $allowed_types);
-    print "Looking for stocks of type: $allowed_types\n";
-
-    $so_terms = split(' ', $allowed_types);
-    $where_cvt = "";
-    foreach ($so_terms as $term) {
-      $where_cvt .= "CVT.name = :cvterm$i OR ";
-      $args[":cvterm$i"] = $term;
-    }
-    $where_cvt = drupal_substr($where_cvt, 0, drupal_strlen($where_cvt)-3);  # strip trailing 'OR'
-    $i++;
-  }
-  else {
-    $where_cvt = '1=1';
-  }
-
-  // get the list of organisms that are synced and only include stocks from
-  // those organisms
-  $orgs = tripal_organism_get_synced();
-  $where_org = "";
-  $i = 0;
-  foreach ($orgs as $org) {
-    if ($organism_id) {
-      if ($org->organism_id and $org->organism_id == $organism_id) {
-        $where_org .= "S.organism_id = :organism_id$i OR ";
-        $args[":organism_id$i"] = $org->organism_id;
-      }
-    }
-    else {
-      if ($org->organism_id) {
-        $where_org .= "S.organism_id = :organism_id$i OR ";
-        $args[":organism_id$i"] = $org->organism_id;
-      }
-    }
-    $i++;
-  }
-  $where_org = drupal_substr($where_org, 0, drupal_strlen($where_org)-3);  # strip trailing 'OR'
-
-  // use this SQL statement to get the stocks that we're going to upload
-  $sql = "
-    SELECT stock_id
-    FROM {stock} S
-      INNER JOIN {cvterm} CVT ON S.type_id = CVT.cvterm_id
-    WHERE ($where_cvt) AND ($where_org)
-    ORDER BY stock_id
-  ";
-
-  // get the list of stocks
-  $results = chado_query($sql, $args);
-
-  // load into ids array
-  $count = 0;
-  $ids = array();
-  while ($id = $results->fetchObject()) {
-    $ids[$count] = $id->stock_id;
-    $count++;
-  }
-
-  // make sure our vocabularies are set before proceeding
-//  tripal_stock_set_vocabulary();
-
-  // pre-create the SQL statement that will be used to check
-  // if a stock has already been synced.  We skip stocks
-  // that have been synced
-  $sql = "SELECT * FROM {chado_stock} WHERE stock_id = :stock_id";
-
-  // Iterate through stocks that need to be synced
-  $interval = intval($count * 0.01);
-  if ($interval < 1) {
-    $interval = 1;
-  }
-  $num_ids = sizeof($ids);
-  $i = 0;
-  foreach ($ids as $stock_id) {
-    // update the job status every 1% stocks
-    if ($job_id and $i % $interval == 0) {
-      tripal_job_set_progress($job_id, intval(($i/$count)*100));
-    }
-    // if we have a maximum number to sync then stop when we get there
-    // if not then just continue on
-    if ($max_sync and $i == $max_sync) {
-      return '';
-    }
-    if (!db_query($sql, array(':stock_id' => $stock_id))->fetchObject()) {
-
-      // parsing all the stocks can cause memory overruns
-      // we are not sure why PHP does not clean up the memory as it goes
-      // to avoid this problem we will call this script through an
-      // independent system call
-      print ($i + 1) . " of $num_ids Syncing stock id: $stock_id\n";
-      // $cmd = "php " . drupal_get_path('module', 'tripal_stock') . "/includes/tripal_stock.sync_stocks.inc -f $stock_id -t chado_stock";
-      // print "$cmd\n";
-      // system($cmd);
-      tripal_stock_sync_stock($stock_id);
-
-    }
-    $i++;
-  }
-
-  return '';
-}
-
-/**
- *
- *
- * @ingroup tripal_stock
- */
-function tripal_stock_sync_stock($stock_id) {
-
-print "\tSyncing stock $stock_id\n";
-
-global $user;
-  $create_node = 1;   // set to 0 if the node exists and we just sync and not create
-
-  // get the accession prefix
-  $aprefix = variable_get('chado_stock_accession_prefix', 'SID');
-
-  // if we don't have a stock_id then return
-  if (!$stock_id) {
-    drupal_set_message(t("Please provide a stock_id to sync"));
-    return '';
-  }
-
-  // get information about this stock
-  $fsql = "
-     SELECT S.*, O.genus, O.species,CVT.name as cvname
-     FROM {stock} S
-       INNER JOIN {cvterm} CVT ON S.type_id = CVT.cvterm_id
-       INNER JOIN {organism} O ON S.organism_id = O.organism_ID
-    WHERE S.stock_id = :stock_id
-   ";
-  $stock = chado_query($fsql, array(':stock_id' => $stock_id))->fetchObject();
-
-  // check to make sure that we don't have any nodes with this stock name as a title
-  // but without a corresponding entry in the chado_stock table if so then we want to
-  // clean up that node.  (If a node is found we don't know if it belongs to our stock or
-  // not since stocks can have the same name/title.)
-  $tsql =  "SELECT * FROM {node} N WHERE title = :title";
-  $cnsql = "SELECT * FROM {chado_stock} WHERE nid =:nid";
-  $nodes = db_query($tsql, array(':title' => $stock->name));
-  // cycle through all nodes that may have this title
-  while ($node = $nodes->fetchObject()) {
-    $stock_nid = db_query($cnsql, array(':nid' => $node->nid))->fetchObject();
-    if (!$stock_nid) {
-      drupal_set_message(t("%stock_id: A node is present but the chado_stock entry is missing... correcting", array('%stock_id' => $stock_id)));
-      node_delete($node->nid);
-    }
-  }
-
-  // check if this stock already exists in the chado_stock table.
-  // if we have a chado stock, we want to check to see if we have a node
-  $cfsql = "SELECT * FROM {chado_stock} WHERE stock_id = :stock_id";
-  $nsql =  "SELECT * FROM {node} N WHERE nid = :nid";
-  $chado_stock = db_query($cfsql, array(':stock_id' => $stock->stock_id))->fetchObject();
-  if ($chado_stock) {
-    drupal_set_message(t("%stock_id: A chado_stock entry exists", array('%stock_id' => $stock_id)));
-    $node = db_query($nsql, array(':nid' => $chado_stock->nid))->fetchObject();
-    if (!$node) {
-      // if we have a chado_stock but not a node then we have a problem and
-      // need to cleanup
-      drupal_set_message(t("%stock_id: The node is missing, but has a chado_stock entry... correcting", array('%stock_id' => $stock_id)));
-      $df_sql = "DELETE FROM {chado_stock} WHERE stock_id = :stock_id";
-      db_query($df_sql, array(':stock_id' => $stock_id));
-    }
-    else {
-      drupal_set_message(t("%stock_id: A corresponding node exists", array('%stock_id' => $stock_id)));
-      $create_node = 0;
-    }
-  }
-
-  // if we've encountered an error then just return.
-  //if ($error_msg = db_error()) {
-    //print "$error_msg\n";
-    //return '';
-  //}
-
-  // if a drupal node does not exist for this stock then we want to
-  // create one.  Note that the node_save call in this block
-  // will call the hook_submit function which
-  if ($create_node) {
-    // get the organism for this stock
-    $sql = "SELECT * FROM {organism} WHERE organism_id = :organism_id";
-    $organism = chado_query($sql, array(':organism_id' => $stock->organism_id))->fetchObject();
-
-    drupal_set_message(t("%stock_id: Creating node $stock->name", array('%stock_id' => $stock_id)));
-    $new_node = new stdClass();
-    $new_node->type = 'chado_stock';
-    $new_node->uid = $user->uid;
-    $new_node->title = "$stock->name, $stock->uniquename ($stock->cvname) $organism->genus $organism->species";
-    $new_node->sname = "$stock->name";
-    $new_node->uniquename = "$stock->uniquename";
-    $new_node->type_id = $stock->type_id;
-    $new_node->organism_id = $stock->organism_id;
-    $new_node->stock_id = $stock->stock_id;
-    $new_node->chado_stock_exists = TRUE;
-
-    // validate the node and if okay then submit
-    node_validate($new_node);
-    if ($errors = form_get_errors()) {
-      print "Error encountered validating new node. Cannot sync: $msg\n";
-      foreach ($errors as $key => $msg) {
-        watchdog('trp-fsync', "%msg", array('%msg' => $msg), WATCHDOG_ERROR);
-      }
-      exit;
-    }
-    else {
-      $node = node_submit($new_node);
-      node_save($node);
-    }
-  }
-  else {
-    $node = $chado_stock;
-  }
-
-  return '';
-}

+ 5 - 4
tripal_views/api/tripal_views.api.inc

@@ -289,7 +289,7 @@ function tripal_views_integration_add_entry($defn_array) {
   $no_errors = TRUE;
 
   if (empty($defn_array['table'])) {
-    watchdog('tripal_views','Recieved integration with no tablename: %defn', array('%defn' => print_r($defn_array,TRUE)), WATCHDOG_WARNING);
+    tripal_core_report_error('tripal_views', TRIPAL_WARNING, 'Recieved integration with no tablename: %defn', array('%defn' => print_r($defn_array,TRUE)));
     $no_errors = FALSE;
     return $no_errors;
   }
@@ -645,7 +645,8 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
   );
   // Add fields
   if (!isset($schema['fields'])) {
-    watchdog('tripal_views', 'There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name), WATCHDOG_NOTICE);
+    tripal_core_report_error('tripal_views', TRIPAL_NOTICE, 
+      'There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name));
     return FALSE;
   }
   foreach ($schema['fields'] as $field_name => $field_schema) {
@@ -841,8 +842,8 @@ function tripal_views_clone_integration($table_name, $new_priority = NULL, $temp
   $setup_id = $setup_id->fetchObject();
 
   if (empty($setup_id)) {
-    watchdog('tripal_views','Unable to clone the setup for %table in order to add the following field to the integration: %field.',
-      array('%table' => $table_name, '%field' => print_r($field_array,TRUE)),WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_views', TRIPAL_ERROR, 'Unable to clone the setup for %table in order to add the following field to the integration: %field.',
+      array('%table' => $table_name, '%field' => print_r($field_array,TRUE)));
     return FALSE;
   }
   else {

+ 1 - 1
tripal_views/includes/tripal_views_integration.inc

@@ -1292,7 +1292,7 @@ function tripal_views_integration_ajax_join_field($form, $form_state) {
     return $form['view_setup_table'][$field]['column-3'][$join_field];
   }
   else {
-    watchdog('tripal_views', 'Tripal Views Integration Ajax failed due to being unable to determine which row needs updating', array(), WATCHDOG_ERROR);
+    tripal_core_report_error('tripal_views', TRIPAL_ERROR 'Tripal Views Integration Ajax failed due to being unable to determine which row needs updating', array());
     return $form;
   }
 }

+ 2 - 3
tripal_views/tripal_views.views.inc

@@ -342,10 +342,9 @@ function tripal_views_views_data() {
 
         // warn if deprecated method of relationship addition was used (ie: through handlers)
         if (isset($data[$base_table][$base_field]['relationship'])) {
-          watchdog('tripal_views',
+          tripal_core_report_error('tripal_views', TRIPAL_NOTICE,
             'DEPRECATED: Currently using tripal_views_handlers to store relationship for %base => %left when you should be using tripal_views_joins.',
-            array('%base' => $base_table, '%left' => $left_table),
-            WATCHDOG_NOTICE);
+            array('%base' => $base_table, '%left' => $left_table));
         }
         // add relationship entry
         $fake_field = $base_field . '_to_' . $left_table;