Cahnged get_base_sales_type()
[fa-stable.git] / includes / errors.inc
index bfa213d5514d96ab1ac59e87e22fa8ffcc2619ba..fc8f4fb692fca3205b277009755fd70291cf90df 100644 (file)
@@ -17,7 +17,7 @@ $before_box = ''; // temporary container for output html data before error box
 //    display in message box.
 
 function error_handler($errno, $errstr, $file, $line) {
-    global $messages, $go_debug;
+    global $messages, $go_debug, $SysPrefs;
 
        // skip well known warnings we don't care about.
        // Please use restrainedly to not risk loss of important messages
@@ -33,7 +33,8 @@ function error_handler($errno, $errstr, $file, $line) {
                        $messages[] = array($errno, $errstr, $file, $line);
        else if($errno&~E_NOTICE)// log all not displayed messages 
                error_log(user_company() . ':' . $_SESSION["wa_current_user"]->loginname.':'
-                        . basename($file) .":$line: $errstr");
+                        . basename($file) .":$line:" . ( $SysPrefs->db_ok ? '':'[before upgrade]')
+                        . " $errstr");
        
     return true;
 }
@@ -94,7 +95,12 @@ function error_box() {
        Helper to avoid sparse log notices.
 */
 function end_flush () {
-               if (ob_get_level()) ob_end_flush();
+       global $Ajax;
+
+       if (isset($Ajax))
+               $Ajax->run();
+
+       if (ob_get_level()) ob_end_flush();
 }
 
 function display_db_error($msg, $sql_statement=null, $exit=true)
@@ -135,7 +141,7 @@ function frindly_db_error($db_error)
        global $db_duplicate_error_code;
        
        if ($db_error == $db_duplicate_error_code) 
-       {
+       {       
                display_error(_("The entered information is a duplicate. Please go back and enter different values."));
                return true;
        }
@@ -145,13 +151,13 @@ function frindly_db_error($db_error)
 
 function check_db_error($msg, $sql_statement, $exit_if_error=true, $rollback_if_error=true)
 {
-       global $db;
+       global $db, $go_debug;
        $db_error = db_error_no();
        
        if ($db_error != 0) 
        {
                
-               if (!frindly_db_error($db_error)) {
+               if ($go_debug || !frindly_db_error($db_error)) {
                                display_db_error($msg, $sql_statement, false);
                }