DEBUG is false or true (boolean value)

Hide ugly error from SQL 
0000138: Changement date période fermée
This commit is contained in:
Dany De Bontridder 2010-11-20 17:05:14 +00:00
parent 08f34100e8
commit 00a285d948
4 changed files with 17 additions and 16 deletions

View file

@ -332,7 +332,7 @@ $account=$cn->count_sql("select * from pg_database where datname=lower('".domain
if ($account == 0 ) {
echo "Creation of ".domaine."account_repository";
if ( DEBUG=='false') ob_start();
if ( ! DEBUG) ob_start();
$cn->exec_sql("create database ".domaine."account_repository encoding='utf8'");
$cn=new Database();
$cn->start();
@ -341,10 +341,10 @@ if ($account == 0 ) {
$cn->execute_script("sql/account_repository/constraint.sql");
$cn->commit($cn);
if ( DEBUG=='false') ob_end_clean();
if ( ! DEBUG) ob_end_clean();
echo "Creation of Modele1";
if ( DEBUG=='false') ob_start();
if ( ! DEBUG) ob_start();
$cn->exec_sql("create database ".domaine."mod1 encoding='utf8'");
$cn=new Database(1,'mod');
@ -354,19 +354,19 @@ if ($account == 0 ) {
$cn->execute_script('sql/mod1/constraint.sql');
$cn->commit();
if ( DEBUG=='false') ob_end_clean();
if ( ! DEBUG) ob_end_clean();
echo "Creation of Modele2";
$cn->exec_sql("create database ".domaine."mod2 encoding='utf8'");
$cn=new Database(2,'mod');
$cn->start();
if ( DEBUG=='false') { ob_start(); }
if ( ! DEBUG) { ob_start(); }
$cn->execute_script('sql/mod1/schema.sql');
$cn->execute_script('sql/mod2/data.sql');
$cn->execute_script('sql/mod1/constraint.sql');
$cn->commit();
if ( DEBUG=='false') ob_end_clean();
if ( ! DEBUG) ob_end_clean();
}// end if
// Add a french accountancy model
@ -423,7 +423,7 @@ echo '<hr>';
}
}
if (DEBUG=='false') ob_end_clean();
if (! DEBUG) ob_end_clean();
echo "<h2 class=\"info\">Voil&agrave; tout est install&eacute; ;-) </H2>";
?>
<A HREF="../index.php">Connectez-vous à PhpCompta</A>

View file

@ -372,7 +372,8 @@ case 'save':
}
catch (Exception $e)
{
echo $e->getMessage();
if ( DEBUG ) echo $e->getMessage();
alert( "Changement impossible: on ne peut pas changer la date dans une période fermée");
}
$html=ob_get_contents();
ob_clean();

View file

@ -118,11 +118,11 @@ class Database
$this->array=$p_array;
if ( $p_array==null )
{
$this->ret=pg_query($this->db,$p_string);
$this->ret=@pg_query($this->db,$p_string);
}
else
{
$this->ret=pg_query_params($this->db,$p_string,$p_array);
$this->ret=@pg_query_params($this->db,$p_string,$p_array);
}
if ( ! $this->ret )
{
@ -215,7 +215,7 @@ class Database
function execute_script($script)
{
if ( DEBUG=='false' ) ob_start();
if ( ! DEBUG ) ob_start();
$hf=fopen($script,'r');
if ( $hf == false )
{
@ -279,7 +279,7 @@ class Database
if ( $this->exec_sql($sql) == false )
{
$this->rollback();
if ( DEBUG=='false' ) ob_end_clean();
if ( ! DEBUG ) ob_end_clean();
print "ERROR : $sql";
exit();
}
@ -288,7 +288,7 @@ class Database
print "<hr>";
} // while (feof)
fclose($hf);
if ( DEBUG=='false' ) ob_end_clean();
if ( ! DEBUG ) ob_end_clean();
}
/*!
* \brief Get version of a database, the content of the
@ -346,7 +346,7 @@ class Database
" from the version ".$this->get_version()." to $to</h3> </li>";
$this->execute_script($add.'sql/patch/upgrade'.$i.'.sql');
if ( DEBUG=='false' ) ob_start();
if ( ! DEBUG ) ob_start();
// specific for version 4
if ( $i == 4 )
{
@ -425,7 +425,7 @@ class Database
$country=$this->get_value ("select pr_value from parameter where pr_id='MY_COUNTRY'");
$this->execute_script($add."sql/patch/upgrade61.".$country.".sql");
}
if ( DEBUG == 'false') ob_end_clean();
if ( ! DEBUG ) ob_end_clean();
}
}
echo '</ul>';

View file

@ -48,7 +48,7 @@ define ('MAX_ARTICLE',9);
define ('MAX_CAT',15);
define ('MAX_FORECAST_ITEM',10);
define ("DEBUG","false");
define ("DEBUG",false);
// Erreur
define ("NOERROR",0);