diff --git a/htdocs/accountancy/class/accountancyaccount.class.php b/htdocs/accountancy/class/accountancyaccount.class.php index 069f85e0e7b439f192cb133863008b9d75a4e50e..6190969abd3e5ea99b94cac7eb4fa77a1a7d35bb 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 c0db453f0534bb045055894b2c1ea4949f341338..0ff01eb9aafb6824962be588e176c165dd4b1a28 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 59ed0b36e84989d1e355529279a8de569babed6a..af4276bf0cd96727d61a6fc59471891480772f63 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 7dd82f9a6a584d350bb9c8a2133ea44f49beb940..afebddf0bb613b014d11307881f35100268548bb 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 c88e2014665a43ee4623824d332e31319b0289e3..c4d0e0c312c6f2ea968202b95d3277da8e17a3bf 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 896d29f05dd937bb426336f6766671dc36c25ff1..a0094c2f3f64ca1f9534099c0231fc510e379377 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 377b3c98413e6716761ae429be64473a8395ee8d..acf01db977592e8842a08123a83768215b4eb621 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 aec7c54d53ad03f0e16d4b353b256da47f8d9d3a..4e83b84bb64511e57b4ac0dadd50566563c89ea1 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 86ff46d2a535e6391c41f2529498af9d59319af5..7bec03f774bbea30c680313c8a5e3d1363789bf7 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 018bbdb9d40eb7f2c70fc12e49a935a1fc3a2a88..aba6d7ee3eeddc0347bb7dd66c990b1042dd21f8 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 77bafae3603d1636038aec20a5ec3b6a9cefee72..c49cef23e44341395caad1b2d61d65f8e1193a6e 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 2aff98a2322cd420ef14ed1f664b6b8c1d6e4cac..49e2d1eb65bd7946bef3090f7db7af945da0ebb4 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 8ddfad8c3f195f8c9a76d22eb5dbab801b5343cf..d9ba93188bd11d5b77265ca3e149d861160936fb 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 c357d2ee8d95af038dc1ccb731b42eb514ec108a..26819e1580a9a246421e9d9b4529930073c9a734 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 38576f7e764c798e001ca8db877983bd206a87a4..da0dc33a2719c8e7b33113a7dc0a72155d7782e0 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 2f42fc39c77ff2569876c6c73ed25e6bca33bf9b..d3d20761bc3054e9e47039cffcb010b006dcd2ae 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 468530303b8cdf3d14588aa779122f2c84ee5a47..ede7615a65a1d60ca1135594e240b9ec36581520 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 f221cf46ef3b586249697b397954b41651e7d352..317f0d3832b39054ea62ed2c296be0c5aaaebf6e 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 abf124b02f36d903c650370c150b52c97d75bbe1..f24b9fe63de856cb279e9bf7c232b6ee187b20e6 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 b5b0676b77d45e5ceeb657a913b6c108e8171be6..f8cb36e4044543edc6c7aabf33b6e9d16fa4aace 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."<br>\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 de21a157c7449b7f3e0eb196239abbd5609897a6..083f3a745484405ed6f6bb450a52f159e0e0e927 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 83d01def7ace690d3f45f177241318cbd33a9510..19db345f2cc47382c4f13e59f52041d3d9710cdf 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 bd1306b0cf69dc800a8d10a0103b8d74786e3641..3a1dc898d0e77a05579a90a267257addb089c6af 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 ecf163da81d6c3c1d38f3fdf3ecd37ad25386853..3bcbfb436193ee8b9b7116e1086a184794f7b54a 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 380a16bd1298d5a5375b50571694b068a335350b..31fa501e8732c316646696b3de5008d7c0ae8126 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 2bcb244690e3bc8557599ccd8e1eeb9a5198327e..8a49edfaef6ac8496c52d5ba708a65f754fe31ed 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 57f00161f8a808f5809215820b8f47dd80b314bf..a2b7b4e7e35949e55563104e8d0b7f3bc268eea2 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 5e2f20729cc83fe3e28714c5b075a41ef53a27bc..bf2b20843a1af8873d226194231d612318cc4a4e 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -429,7 +429,12 @@ if ($id > 0 || ! empty($ref)) print '</td></tr>'; // Progress - print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">'; + print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">'; + print $object->progress.' %'; + print '</td></tr>'; + + // Progress + print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td colspan="3">'; print $object->progress.' %'; print '</td></tr>'; diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 0f1091b37cead4fa8a93a1b10b50d3a389f9a62e..272baf034c36c8860befe1fa6e2b5b3667781895 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -83,7 +83,7 @@ class Address $now=dol_now(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_address (label, fk_soc, name, datec, fk_user_creat) "; - $sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', ".$this->db->idate($now).", '".$user->id."')"; + $sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', '".$this->db->idate($now)."', '".$user->id."')"; $result=$this->db->query($sql); if ($result) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 19bb0bd4de9a4a749b5fe9329c5ab5a24cd78146..a8f6bbe8d56c185da78cf99b5567be76f8c10dd9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1230,9 +1230,9 @@ class Societe extends CommonObject } // Ecrit trace dans historique des remises - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise "; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; $sql.= " (datec, fk_soc, remise_client, note, fk_user_author)"; - $sql.= " VALUES (".$this->db->idate($now).", ".$this->id.", '".$remise."',"; + $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->id.", '".$remise."',"; $sql.= " '".$this->db->escape($note)."',"; $sql.= " ".$user->id; $sql.= ")"; @@ -1241,7 +1241,7 @@ class Societe extends CommonObject if (! $resql) { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; }