diff --git a/html/admin/setup.php b/html/admin/setup.php
index 747de087a..f9c75d581 100644
--- a/html/admin/setup.php
+++ b/html/admin/setup.php
@@ -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 '
';
}
}
- if (DEBUG=='false') ob_end_clean();
+ if (! DEBUG) ob_end_clean();
echo "Voilà tout est installé ;-)
";
?>
Connectez-vous à PhpCompta
diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php
index 6e4fd3459..7a62b85ac 100644
--- a/html/ajax_ledger.php
+++ b/html/ajax_ledger.php
@@ -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();
diff --git a/include/class_database.php b/include/class_database.php
index 418677af8..02921d1e0 100644
--- a/include/class_database.php
+++ b/include/class_database.php
@@ -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 "
";
} // 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 ";
$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 '';
diff --git a/include/constant.php b/include/constant.php
index 8caf65b47..dfb8db1b8 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -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);