diff --git a/htdocs/accountancy/class/accountancyaccount.class.php b/htdocs/accountancy/class/accountancyaccount.class.php
index 069f85e0e7b..6190969abd3 100644
--- a/htdocs/accountancy/class/accountancyaccount.class.php
+++ b/htdocs/accountancy/class/accountancyaccount.class.php
@@ -63,7 +63,7 @@ class AccountancyAccount
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
- $sql.= " VALUES (".$this->db->idate($now).",".$user->id.",'".$this->numero."','".$this->intitule."')";
+ $sql.= " VALUES ('".$this->db->idate($now)."',".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php
index c0db453f053..0ff01eb9aaf 100644
--- a/htdocs/accountancy/class/accountancysystem.class.php
+++ b/htdocs/accountancy/class/accountancysystem.class.php
@@ -62,7 +62,7 @@ class AccountancySystem
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
- $sql.= " VALUES (".$this->db->idate($now).",".$user->id.",'".$this->numero."','".$this->intitule."')";
+ $sql.= " VALUES ('".$this->db->idate($now)."',".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 59ed0b36e84..af4276bf0cd 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -101,8 +101,8 @@ $now=dol_now();
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.entity IN (".getEntity().")";
-//$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate($now).')';
-$sql.= " AND d.statut = 1 AND d.datefin >= ".$db->idate($now);
+//$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')";
+$sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'";
$sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type";
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 7dd82f9a6a5..afebddf0bb6 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -411,11 +411,11 @@ if ($rowid > 0)
}
if ($filter == 'uptodate')
{
- $sql.=" AND datefin >= ".$db->idate($now);
+ $sql.=" AND datefin >= '".$db->idate($now)."'";
}
if ($filter == 'outofdate')
{
- $sql.=" AND datefin < ".$db->idate($now);
+ $sql.=" AND datefin < '".$db->idate($now)."'";
}
// Count total nb of records
$nbtotalofrecords = 0;
diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php
index c88e2014665..c4d0e0c312c 100644
--- a/htdocs/bookmarks/class/bookmark.class.php
+++ b/htdocs/bookmarks/class/bookmark.class.php
@@ -116,7 +116,7 @@ class Bookmark
if ($this->fk_soc) $sql.=",fk_soc";
$sql.= ") VALUES (";
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
- $sql.= " ".$this->db->idate($now).",";
+ $sql.= " '".$this->db->idate($now)."',";
$sql.= " '".$this->url."', '".$this->target."',";
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
$sql.= ", '".$conf->entity."'";
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 896d29f05dd..a0094c2f3f6 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -102,7 +102,7 @@ class Mailing extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
$sql .= " (date_creat, fk_user_creat, entity)";
- $sql .= " VALUES (".$this->db->idate($now).", ".$user->id.", ".$conf->entity.")";
+ $sql .= " VALUES ('".$this->db->idate($now)."', ".$user->id.", ".$conf->entity.")";
if (! $this->titre)
{
@@ -334,7 +334,7 @@ class Mailing extends CommonObject
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
- $sql .= " SET statut = 1, date_valid = ".$this->db->idate($now).", fk_user_valid=".$user->id;
+ $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("Mailing::valid sql=".$sql, LOG_DEBUG);
diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php
index 377b3c98413..acf01db9775 100644
--- a/htdocs/compta/localtax/class/localtax.class.php
+++ b/htdocs/compta/localtax/class/localtax.class.php
@@ -84,9 +84,9 @@ class Localtax extends CommonObject
$sql.= "fk_user_creat,";
$sql.= "fk_user_modif";
$sql.= ") VALUES (";
- $sql.= " ".$this->db->idate($this->tms).",";
- $sql.= " ".$this->db->idate($this->datep).",";
- $sql.= " ".$this->db->idate($this->datev).",";
+ $sql.= " '".$this->db->idate($this->tms)."',";
+ $sql.= " '".$this->db->idate($this->datep)."',";
+ $sql.= " '".$this->db->idate($this->datev)."',";
$sql.= " '".$this->amount."',";
$sql.= " '".$this->label."',";
$sql.= " '".$this->note."',";
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index aec7c54d53a..4e83b84bb64 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -143,8 +143,8 @@ class RemiseCheque extends CommonObject
$sql.= ", nbcheque";
$sql.= ", ref_ext";
$sql.= ") VALUES (";
- $sql.= $this->db->idate($now);
- $sql.= ", ".$this->db->idate($now);
+ $sql.= "'".$this->db->idate($now)."'";
+ $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$user->id;
$sql.= ", ".$account_id;
$sql.= ", 0";
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 86ff46d2a53..7bec03f774b 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -578,7 +578,7 @@ class Paiement extends CommonObject
if (!empty($date) && $this->statut!=1)
{
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
- $sql.= " SET datep = ".$this->db->idate($date);
+ $sql.= " SET datep = '".$this->db->idate($date)."'";
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update_date sql=".$sql);
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 018bbdb9d40..aba6d7ee3ee 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -967,7 +967,7 @@ class BonPrelevement extends CommonObject
*/
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande";
$sql.= " SET traite = 1";
- $sql.= ", date_traite = ".$this->db->idate($now);
+ $sql.= ", date_traite = '".$this->db->idate($now)."'";
$sql.= ", fk_prelevement_bons = ".$prev_id;
$sql.= " WHERE rowid = ".$fac[1];
diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php
index 77bafae3603..c49cef23e44 100644
--- a/htdocs/compta/prelevement/class/rejetprelevement.class.php
+++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php
@@ -104,7 +104,7 @@ class RejetPrelevement
$sql.= ", '".$this->db->idate($date_rejet)."'";
$sql.= ", ".$motif;
$sql.= ", ".$user->id;
- $sql.= ", ".$this->db->idate($now);
+ $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$facturation;
$sql.= ")";
diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php
index 2aff98a2322..49e2d1eb65b 100644
--- a/htdocs/compta/salaries/class/paymentsalary.class.php
+++ b/htdocs/compta/salaries/class/paymentsalary.class.php
@@ -106,15 +106,15 @@ class PaymentSalary extends CommonObject
$sql.= ") VALUES (";
- $sql.= " ".$this->db->idate($this->tms).",";
+ $sql.= " '".$this->db->idate($this->tms).",";
$sql.= " '".$this->fk_user."',";
- $sql.= " ".$this->db->idate($this->datep).",";
- $sql.= " ".$this->db->idate($this->datev).",";
+ $sql.= " '".$this->db->idate($this->datep)."',";
+ $sql.= " '".$this->db->idate($this->datev)."',";
$sql.= " '".$this->amount."',";
$sql.= " '".$this->label."',";
- $sql.= " ".$this->db->idate($this->datesp).",";
- $sql.= " ".$this->db->idate($this->dateep).",";
- $sql.= " '".$this->note."',";
+ $sql.= " '".$this->db->idate($this->datesp)."',";
+ $sql.= " '".$this->db->idate($this->dateep)."',";
+ $sql.= " '".$this->note."',";
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").",";
$sql.= " '".$this->fk_user_creat."',";
$sql.= " '".$this->fk_user_modif."'";
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index 8ddfad8c3f1..d9ba93188bd 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -100,9 +100,9 @@ class Tva extends CommonObject
$sql.= ") VALUES (";
- $sql.= " ".$this->db->idate($this->tms).",";
- $sql.= " ".$this->db->idate($this->datep).",";
- $sql.= " ".$this->db->idate($this->datev).",";
+ $sql.= " '".$this->db->idate($this->tms)."',";
+ $sql.= " '".$this->db->idate($this->datep)."',";
+ $sql.= " '".$this->db->idate($this->datev)."',";
$sql.= " '".$this->amount."',";
$sql.= " '".$this->label."',";
$sql.= " '".$this->note."',";
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index c357d2ee8d9..26819e1580a 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -718,7 +718,7 @@ class Contrat extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
$sql.= " ref, entity, note_private, note_public)";
- $sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id;
+ $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
$sql.= ",".$this->db->idate($this->date_contrat);
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php
index 38576f7e764..da0dc33a271 100644
--- a/htdocs/contrat/liste.php
+++ b/htdocs/contrat/liste.php
@@ -66,9 +66,9 @@ llxHeader();
$sql = 'SELECT';
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
-$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= ".$db->idate($now).")",1,0).') as nb_running,';
-$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now).")",1,0).') as nb_expired,';
-$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now - $conf->contrat->services->expires->warning_delay).")",1,0).') as nb_late,';
+$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
+$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,';
+$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,';
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid as socid";
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index 2f42fc39c77..d3d20761bc3 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -107,8 +107,8 @@ if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service).
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
-if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." ".$db->idate($filter_date1);
-if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." ".$db->idate($filter_date2);
+if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'";
+if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
$sql .= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index 468530303b8..ede7615a65a 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -154,7 +154,7 @@ class DiscountAbsolute
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " fk_facture_source";
$sql.= ")";
- $sql.= " VALUES (".$this->db->idate($this->datec!=''?$this->datec:dol_now()).", ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',";
+ $sql.= " VALUES ('".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null");
$sql.= ")";
diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php
index f221cf46ef3..317f0d3832b 100644
--- a/htdocs/core/class/events.class.php
+++ b/htdocs/core/class/events.class.php
@@ -127,7 +127,7 @@ class Events // extends CommonObject
$sql.= " ".$conf->entity.",";
$sql.= " '".$_SERVER['REMOTE_ADDR']."',";
$sql.= " ".($_SERVER['HTTP_USER_AGENT']?"'".dol_trunc($_SERVER['HTTP_USER_AGENT'],250)."'":'NULL').",";
- $sql.= " ".$this->db->idate($this->dateevent).",";
+ $sql.= " '".$this->db->idate($this->dateevent)."',";
$sql.= " ".($user->id?"'".$user->id."'":'NULL').",";
$sql.= " '".$this->db->escape($this->description)."'";
$sql.= ")";
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index abf124b02f3..f24b9fe63de 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -225,7 +225,7 @@ class Notify
$sendto = htmlentities($sendto);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)";
- $sql.= " VALUES (".$this->db->idate($now).", ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
+ $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
dol_syslog("Notify::send sql=".$sql);
if (! $this->db->query($sql) )
{
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index b5b0676b77d..f8cb36e4044 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -534,24 +534,29 @@ class DoliDBPgsql extends DoliDB
*/
function query($query,$usesavepoint=0,$type='auto')
{
+ global $conf;
+
$query = trim($query);
// Convert MySQL syntax to PostgresSQL syntax
$query=$this->convertSQLFromMysql($query,$type,($this->unescapeslashquot && $this->standard_conforming_strings));
//print "After convertSQLFromMysql:\n".$query."
\n";
- // Fix bad formed requests. If request contains a date without quotes, we fix this but this should not occurs.
-/* $loop=true;
- while ($loop)
+ if (! empty($conf->global->MAIN_DB_AUTOFIX_BAD_SQL_REQUEST))
{
- if (preg_match('/([^\'])([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9])/',$query))
+ // Fix bad formed requests. If request contains a date without quotes, we fix this but this should not occurs.
+ $loop=true;
+ while ($loop)
{
- $query=preg_replace('/([^\'])([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9])/','\\1\'\\2\'',$query);
- dol_syslog("Warning: Bad formed request converted into ".$query,LOG_WARNING);
+ if (preg_match('/([^\'])([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9])/',$query))
+ {
+ $query=preg_replace('/([^\'])([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9])/','\\1\'\\2\'',$query);
+ dol_syslog("Warning: Bad formed request converted into ".$query,LOG_WARNING);
+ }
+ else $loop=false;
}
- else $loop=false;
}
-*/
+
if ($usesavepoint && $this->transaction_opened)
{
@pg_query($this->db, 'SAVEPOINT mysavepoint');
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index de21a157c74..083f3a74548 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -516,7 +516,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
$sql.= " AND pa.datep <= '".$db->idate(dol_get_last_day($y,12,false))."'";
}
if ($q) $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")";
- if ($date_start && $date_end) $sql.= " AND pa.datep >= ".$db->idate($date_start)." AND pa.datep <= ".$db->idate($date_end);
+ if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index 83d01def7ac..19db345f2cc 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -95,6 +95,8 @@ class Cronjob extends CommonObject
global $conf, $langs;
$error=0;
+ $now=dol_now();
+
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
@@ -189,7 +191,7 @@ class Cronjob extends CommonObject
$sql.= ") VALUES (";
- $sql.= " ".$this->db->idate(dol_now()).",";
+ $sql.= " '".$this->db->idate($now)."',";
$sql.= " ".(! isset($this->jobtype)?'NULL':"'".$this->db->escape($this->jobtype)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
$sql.= " ".(! isset($this->command)?'NULL':"'".$this->db->escape($this->command)."'").",";
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index bd1306b0cf6..3a1dc898d0e 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -812,7 +812,7 @@ class Fichinter extends CommonObject
if ($user->rights->ficheinter->creer)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
- $sql.= " SET datei = ".$this->db->idate($date_delivery);
+ $sql.= " SET datei = '".$this->db->idate($date_delivery)."'";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 0";
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index ecf163da81d..3bcbfb43619 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -877,7 +877,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->socid;
$sql.= ", '".$this->db->idate($now)."'";
- //$sql.= ", ".$this->db->idate($now);
+ //$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$user->id;
$sql.= ", 0";
$sql.= ", " . $this->source;
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index 380a16bd129..31fa501e873 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -146,8 +146,8 @@ class PaiementFourn extends Paiement
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
- $sql.= ' VALUES ('.$this->db->idate($now).',';
- $sql.= " ".$this->db->idate($this->datepaye).", '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
+ $sql.= " VALUES ('".$this->db->idate($now).',';
+ $sql.= " '".$this->db->idate($this->datepaye)."', '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
dol_syslog("PaiementFourn::create sql=".$sql);
$resql = $this->db->query($sql);
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 2bcb244690e..8a49edfaef6 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -2569,7 +2569,7 @@ function migrate_project_user_resp($db,$langs,$conf)
$sql2.= ", fk_c_type_contact";
$sql2.= ", fk_socpeople";
$sql2.= ") VALUES (";
- $sql2.= $db->idate(dol_now());
+ $sql2.= "'".$db->idate(dol_now())."'";
$sql2.= ", '4'";
$sql2.= ", ".$obj->rowid;
$sql2.= ", '160'";
@@ -2664,7 +2664,7 @@ function migrate_project_task_actors($db,$langs,$conf)
$sql2.= ", fk_c_type_contact";
$sql2.= ", fk_socpeople";
$sql2.= ") VALUES (";
- $sql2.= $db->idate(dol_now());
+ $sql2.= "'".$db->idate(dol_now())."'";
$sql2.= ", '4'";
$sql2.= ", ".$obj->fk_projet_task;
$sql2.= ", '180'";
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 57f00161f8a..a2b7b4e7e35 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -121,7 +121,7 @@ class Livraison extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->socid;
$sql.= ", '".$this->db->escape($this->ref_customer)."'";
- $sql.= ", ".$this->db->idate($now);
+ $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$user->id;
$sql.= ", ".($this->date_delivery?"'".$this->db->idate($this->date_delivery)."'":"null");
$sql.= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
@@ -392,7 +392,7 @@ class Livraison extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison SET";
$sql.= " ref='".$this->db->escape($numref)."'";
$sql.= ", fk_statut = 1";
- $sql.= ", date_valid = ".$this->db->idate($now);
+ $sql.= ", date_valid = '".$this->db->idate($now)."'";
$sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND fk_statut = 0";
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 5e2f20729cc..bf2b20843a1 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -429,7 +429,12 @@ if ($id > 0 || ! empty($ref))
print '';
// Progress
- print '