X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Ferrors.inc;h=f2cfe1c0fc1b113c6fee2e58706969c0b2484b27;hb=dc98038dfc9d5a6d54ffe6566bc566a433e59ccb;hp=1bbc71ff3ea917dc1af36380dd72109958100804;hpb=bb218a322637d3c15a65866d1c236779560ca484;p=fa-stable.git diff --git a/includes/errors.inc b/includes/errors.inc index 1bbc71ff..f2cfe1c0 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -84,9 +84,9 @@ function error_box() { global $before_box; echo "
"; - $before_box = ob_get_clean(); // save html content before error box + // Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2 - register_shutdown_function('end_flush'); + $before_box = ob_get_clean(); // save html content before error box ob_start('output_html'); echo "
"; } @@ -94,7 +94,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(); + // flush all output buffers (works also with exit inside any div levels) + while(ob_get_level()) ob_end_flush(); } function display_db_error($msg, $sql_statement=null, $exit=true) @@ -130,15 +135,13 @@ function display_db_error($msg, $sql_statement=null, $exit=true) exit; } -function frindly_db_error($db_error, $sql) +function frindly_db_error($db_error) { - global $db_duplicate_error_code, $go_debug; + global $db_duplicate_error_code; if ($db_error == $db_duplicate_error_code) - { $msg = _("The entered information is a duplicate. Please go back and enter different values."); - if ($go_debug) - $msg .= '
Sql that failed was :
'.$sql; - display_error($msg); + { + display_error(_("The entered information is a duplicate. Please go back and enter different values.")); return true; } @@ -147,13 +150,13 @@ function frindly_db_error($db_error, $sql) 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, $sql_statement)) { + if ($go_debug || !frindly_db_error($db_error)) { display_db_error($msg, $sql_statement, false); }