diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 0dbad6754b1517daaa05a340b638e5ebd171b59c..2c278030a62bbcbec5236356d8f4f595f758a19a 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -58,9 +58,11 @@ class AccountancySystem */ function create($user) { + $now=dol_now(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingsystem"; $sql.= " (date_creation, fk_user_author, numero,intitule)"; - $sql.= " VALUES (".$this->db->idate(mktime()).",".$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/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index d7b4390890eda61b76c2d6f9e9509097f998721d..e5aae08ca3cec625b8f198de2ae89d037b32544e 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -816,7 +816,7 @@ if ($rowid) print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($company->name).'">'; print "<table class=\"border\" width=\"100%\">\n"; - $today=mktime(); + $today=dol_now(); $datefrom=0; $dateto=0; $paymentdate=-1; @@ -841,7 +841,7 @@ if ($rowid) } else { - $datefrom=mktime(); + $datefrom=dol_now(); } } $form->select_date($datefrom,'','','','',"cotisation"); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index da6bc37bd87f8e51977d43b4832b5b55799df0e3..b841ff04419813732af112d5b5451998a8430fc7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1250,6 +1250,7 @@ class Adherent extends CommonObject global $langs,$conf; $error=0; + $now=dol_now(); // Check parameters if ($this->statut == 1) @@ -1262,7 +1263,7 @@ class Adherent extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql.= " statut = 1"; - $sql.= ", datevalid = ".$this->db->idate(mktime()); + $sql.= ", datevalid = ".$this->db->idate($now); $sql.= ", fk_user_valid=".$user->id; $sql.= " WHERE rowid = ".$this->id; diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index f53eb509657cac123be8caec728aec93bf8b9300..4a07b5dd9c9d57603a245fc089248b304ac8e155 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -65,6 +65,9 @@ class Cotisation extends CommonObject function create($userid) { global $langs; + + $now=dol_now(); + // Check parameters if ($this->datef <= $this->dateh) { @@ -73,7 +76,7 @@ class Cotisation extends CommonObject } $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)"; - $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate(mktime())."',"; + $sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->dateh)."',"; $sql.= " '".$this->db->idate($this->datef)."',"; $sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')"; diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index e2f2bacc853777e9f61efb4a3860b9d0203b6dbe..02c505ebfb0d95cf96fcefe004345f24f2a1733c 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -37,6 +37,8 @@ if (! $user->rights->adherent->export) accessforbidden(); llxHeader(); +$now=dol_now(); + if ($sortorder == "") { $sortorder="ASC"; } if ($sortfield == "") { $sortfield="d.login"; } if (! isset($statut)) @@ -56,7 +58,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d "; $sql .= " WHERE d.statut = $statut "; if ($cotis==1) { - $sql .= " AND datefin > '".$db->idate(mktime())."'"; + $sql .= " AND datefin > '".$db->idate($now)."'"; } $sql.= $db->order($sortfield,$sortorder); //$sql.=$db->plimit($conf->liste_limit, $offset); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index eb93f7d44a3ddc4e17be382bfd3d677d34d437af..16203fecde3e589bc156e02b5b6ff668cab88e99 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -336,6 +336,8 @@ if ($rowid > 0) // Show list of members (nearly same code than in page liste.php) $membertypestatic=new AdherentType($db); + + $now=dol_now(); $sql = "SELECT d.rowid, d.login, d.prenom as firstname, d.nom as lastname, d.societe, "; $sql.= " d.datefin,"; @@ -376,11 +378,11 @@ if ($rowid > 0) } if ($filter == 'uptodate') { - $sql.=" AND datefin >= ".$db->idate(mktime()); + $sql.=" AND datefin >= ".$db->idate($now); } if ($filter == 'outofdate') { - $sql.=" AND datefin < ".$db->idate(mktime()); + $sql.=" AND datefin < ".$db->idate($now); } // Count total nb of records $nbtotalofrecords = 0; diff --git a/htdocs/boutique/index.php b/htdocs/boutique/index.php index b3391f05d91e616b6d271f93c8027116cb87dee6..e44533e007ed163fa19073b8086694e687e5ebef 100644 --- a/htdocs/boutique/index.php +++ b/htdocs/boutique/index.php @@ -49,10 +49,12 @@ print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">'; print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>'; print '<td align="right">'.$langs->trans("Total").'</td></tr>'; +$now=dol_now(); + $sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois"; $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t"; $sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id"; -$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate(mktime()).")"; +$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")"; $sql .= " GROUP BY mois ORDER BY mois"; $result=$dbosc->query($sql); diff --git a/htdocs/boutique/promotion/class/promotion.class.php b/htdocs/boutique/promotion/class/promotion.class.php index 5ee5a743a3fd6fa50c64d315b96e8a35d5a2eab7..5631f30207c75e0753d51689d6f0d483e35fcc1b 100644 --- a/htdocs/boutique/promotion/class/promotion.class.php +++ b/htdocs/boutique/promotion/class/promotion.class.php @@ -73,11 +73,13 @@ class Promotion $newprice = $percent * $this->price_init; - $date_exp = "2003-05-01"; + $date_exp = "2003-05-01"; // TODO ???? + + $now=dol_now(); $sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials "; $sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) "; - $sql .= " VALUES ($pid, $newprice, '".$this->db->idate(mktime())."', NULL, '".$this->db->idate(mktime()+3600*24*365)."', NULL, 1)"; + $sql .= " VALUES ($pid, $newprice, '".$this->db->idate($now)."', NULL, '".$this->db->idate($now+3600*24*365)."', NULL, 1)"; if ($this->db->query($sql) ) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index accc3314bd00f463f85bc25b6d1d025463091eee..14545c7ae840d57f640fe292b23e3b690a0af1a1 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -46,6 +46,7 @@ if ($user->societe_id > 0) } $max=5; +$now=dol_now(); /* * Actions @@ -58,7 +59,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark') { dol_print_error($db); } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socid"].", ".$db->idate(mktime()).",".$user->id.");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socid"].", ".$db->idate($now).",".$user->id.");"; if (! $db->query($sql) ) { dol_print_error($db); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 44aaea758a215b747e8d3255c1191aa8633ff2f5..9df558ac901397d7d584edf6c8a60c5329472226 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -95,10 +95,12 @@ class Mailing extends CommonObject $this->error = $langs->trans("ErrorMailFromRequired"); return -1; } + + $now=dol_now(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing"; $sql .= " (date_creat, fk_user_creat, entity)"; - $sql .= " VALUES (".$this->db->idate(mktime()).", ".$user->id.", ".$conf->entity.")"; + $sql .= " VALUES (".$this->db->idate($now).", ".$user->id.", ".$conf->entity.")"; if (! $this->titre) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 9d20775a2879acd1cfdb692c12f710ea528dcef3..d5a0afc3043499db9b438c6a6f0b56c2d6aac5e5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1468,11 +1468,12 @@ class Propal extends CommonObject $this->statut = $statut; $error=0; + $now=dol_now(); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id; + $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; $sql.= " WHERE rowid = ".$this->id; $resql=$this->db->query($sql); @@ -1497,11 +1498,12 @@ class Propal extends CommonObject $this->statut = $statut; $error=0; + $now=dol_now(); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id; + $sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id; $sql.= " WHERE rowid = ".$this->id; $resql=$this->db->query($sql); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index dd7f10677c8c37af07401ae3d2698e0c57fbf17c..bd7926bfeac1ce710650f93503b49247ac4cb1c0 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -380,8 +380,9 @@ if ($resql) print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'&orig_account='.$acct->id.'">'; print img_edit(); print '</a> '; - - if ($db->jdate($objp->do) <= mktime()) { + + $now=dol_now(); + if ($db->jdate($objp->do) <= $now) { print '<a href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?action=del&rowid='.$objp->rowid.'&account='.$acct->id.'">'; print img_delete(); print '</a>'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 6a976f9ea4acb8a8fccc0913448be91b72ac70c4..df946ca345d43a011883d4548c9caf848350d96d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -88,6 +88,7 @@ class FactureRec extends Facture global $conf, $langs; $error=0; + $now=dol_now(); // Clean parameters $this->titre=trim($this->titre); @@ -125,7 +126,7 @@ class FactureRec extends Facture $sql.= "'".$this->titre."'"; $sql.= ", '".$facsrc->socid."'"; $sql.= ", ".$conf->entity; - $sql.= ", ".$this->db->idate(mktime()); + $sql.= ", ".$this->db->idate($now); $sql.= ", '".$facsrc->amount."'"; $sql.= ", '".$facsrc->remise."'"; $sql.= ", '".$this->db->escape($this->note)."'"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 27dca55e1e439dfe43044bb4ae24d56cfbb19e9f..1efc6c41d108f725a7cdc2dce25a43c380c859f6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2897,11 +2897,13 @@ class Facture extends CommonObject $row = $this->db->fetch_row($resql); if ($row[0] == 0) { + $now=dol_now(); + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)'; $sql .= ' VALUES ('.$this->id; $sql .= ",'".price2num($this->total_ttc)."'"; - $sql .= ",".$this->db->idate(mktime()).",".$user->id; + $sql .= ",".$this->db->idate($now).",".$user->id; $sql .= ",'".$soc->bank_account->code_banque."'"; $sql .= ",'".$soc->bank_account->code_guichet."'"; $sql .= ",'".$soc->bank_account->number."'"; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 24bf6de375e7bd94a632504eb76d10f8e38a249e..272096348f9337e06a79fc115b3a95151c4fa299 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -112,7 +112,8 @@ if ($action == "builddoc" && $user->rights->facture->lire) if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); if ($pagecount) { - $file=$diroutputpdf.'/'.$filename.'_'.dol_print_date(mktime(),'dayhourlog').'.pdf'; + $now=dol_now(); + $file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; $pdf->Output($file,'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index bd40daa678098efbff1a151718ef592aa5d05108..872f5474da6ed0a0bb90c0f104fd7a57629a8e4d 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -57,12 +57,14 @@ if ($user->societe_id > 0) if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark') { + $now=dol_now(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socid." AND fk_user=".$user->id; if (! $db->query($sql) ) { dol_print_error($db); } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$socid.", ".$db->idate(mktime()).",".$user->id.");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$socid.", ".$db->idate($now).",".$user->id.");"; if (! $db->query($sql) ) { dol_print_error($db); diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index aecebcba2634c8a51d5ca1c6f01a16c2284fd67d..557f72771f29473b85f5e805420a99e3a0f10b3e 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -864,6 +864,8 @@ class BonPrelevement extends CommonObject * We create withdraw receipt and build withdraw into disk */ $this->db->begin(); + + $now=dol_now(); /* * Traitements @@ -900,7 +902,7 @@ class BonPrelevement extends CommonObject $sql.= ") VALUES ("; $sql.= "'".$ref."'"; $sql.= ", ".$conf->entity; - $sql.= ", '".$this->db->idate(mktime())."'"; + $sql.= ", '".$this->db->idate($now)."'"; $sql.= ")"; dol_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG); @@ -960,7 +962,7 @@ class BonPrelevement extends CommonObject */ $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande"; $sql.= " SET traite = 1"; - $sql.= ", date_traite = ".$this->db->idate(mktime()); + $sql.= ", date_traite = ".$this->db->idate($now); $sql.= ", fk_prelevement_bons = ".$prev_id; $sql.= " WHERE rowid = ".$fac[1]; @@ -1137,8 +1139,10 @@ class BonPrelevement extends CommonObject if ($this->DeleteNotification($user, $action) == 0) { + $now=dol_now(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES (".$db->idate(mktime()).",".$user.", 'NULL', 'NULL', '".$action."')"; + $sql .= " VALUES (".$db->idate($now).",".$user.", 'NULL', 'NULL', '".$action."')"; dol_syslog("adnotiff: ".$sql); if ($this->db->query($sql)) diff --git a/htdocs/compta/prelevement/class/rejet-prelevement.class.php b/htdocs/compta/prelevement/class/rejet-prelevement.class.php index fcdb9dab7039e429c730f15a87caaef87e0d4286..1d8737d6cffdca08c02807bb993657b45c2d874b 100644 --- a/htdocs/compta/prelevement/class/rejet-prelevement.class.php +++ b/htdocs/compta/prelevement/class/rejet-prelevement.class.php @@ -84,6 +84,7 @@ class RejetPrelevement $error = 0; $this->id = $id; $this->bon_id = $bonid; + $now=dol_now(); dol_syslog("RejetPrelevement::Create id $id"); $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; @@ -104,7 +105,7 @@ class RejetPrelevement $sql.= ", '".$this->db->idate($date_rejet)."'"; $sql.= ", ".$motif; $sql.= ", ".$user->id; - $sql.= ", ".$this->db->idate(mktime()); + $sql.= ", ".$this->db->idate($now); $sql.= ", ".$facturation; $sql.= ")"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 8fef71e5ff8e7664a813677372fcdc5bd31a5c49..bab35674fabd6902b302c62544014ea3bf9d44d6 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -216,9 +216,10 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) print "<td>".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."</td>"; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { + $now=dol_now(); $annee_decalage=$annee; - if($mois>12) {$annee_decalage=$annee+1;} - $casenow = dol_print_date(mktime(),"%Y-%m"); + if ($mois>12) {$annee_decalage=$annee+1;} + $casenow = dol_print_date($now,"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage-1),"%Y-%m"); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2a16039a3516664ca5a2dd0db24b4362b87ef472..ff9496898bfde53cabd12449ebd0474fb10dbcdf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -244,7 +244,7 @@ class Contrat extends CommonObject // Close line not already closed if ($contratline->statut != 5) { - $contratline->date_cloture=mktime(); + $contratline->date_cloture=dol_now(); $contratline->fk_user_cloture=$user->id; $contratline->statut='5'; $result=$contratline->update($user); @@ -618,12 +618,14 @@ class Contrat extends CommonObject if (! $paramsok) return -1; $this->db->begin(); + + $now=dol_now(); // Insert contract $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)"; - $sql.= " VALUES (".$this->db->idate(mktime()).",".$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/fiche.php b/htdocs/contrat/fiche.php index 70726cde3108d5041292286f22d44b6c73bec7ce..081b89e26c617e8de7a32be0eb627ce1962d1d3b 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1195,7 +1195,7 @@ else $dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit); } } - $now=mktime(); + $now=dol_now(); if ($dateactend > $now) $dateactend=$now; print '<tr '.$bc[$var].'><td colspan="2">'; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 90aaa6082fdba92da5d2ca7dc65cc0d19d55088e..0c5fe3db50e74d063278456101e55e939b69c64c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -217,10 +217,11 @@ class Notify if ($mailfile->sendfile()) { + $now=dol_now(); $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(mktime()).", ".$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/datepicker.php b/htdocs/core/datepicker.php index 54f811ef3e880805b2d060d0875b18850bdc284c..4db6de685ace9116295106af84a4e00568da8578 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -145,7 +145,7 @@ function displayBox($selectedDate,$month,$year) //print "$selectedDate,$month,$year"; $thedate=dol_mktime(12,0,0,$month,1,$year); //print "thedate=$thedate"; - $today=mktime(); + $today=dol_now(); $todayArray=dol_getdate($today); if($selectedDate != "00000000") { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 14c511385f28cc2f487bb8df7acc8cd9455264f0..78f584773c860e61d75b56fd628aad87556b3bf6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2190,7 +2190,8 @@ function dol_print_error_email() global $langs,$conf; $langs->load("errors"); - print '<br><div class="error">'.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date(mktime(),'%Y%m%d')).'</div>'; + $now=dol_now(); + print '<br><div class="error">'.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date($now,'%Y%m%d')).'</div>'; } /** diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 6d5c71f2410df1e8b81cc586032be230485cd067..48928163f9cca80fad9ff1acda5e6fa99404d0e7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -410,7 +410,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m else $valueforccc=$objsoc->code_client; // Clean parameters - if ($date == '') $date=mktime(); // We use local year and month of PHP server to search numbers + if ($date == '') $date=dol_now(); // We use local year and month of PHP server to search numbers // but we should use local year and month of user // Extract value for mask counter, mask raz and mask offset diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4d43f0cd416db64b157d817e60c8cc0d05b24fa3..810aacb78ccbd1c27af89131bf1d3cdad44d274e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -321,10 +321,12 @@ class Fichinter extends CommonObject if ($this->statut != 1) { $this->db->begin(); + + $now=dol_now(); $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql.= " SET fk_statut = 1"; - $sql.= ", date_valid = ".$this->db->idate(mktime()); + $sql.= ", date_valid = ".$this->db->idate($now); $sql.= ", fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 3ea68f6b3d54033caeb37d0531bca1d1383b9a0d..0956980ce9cac7a9e7f2cb8c7f9af4455c6cf33f 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1097,7 +1097,8 @@ else if ($id > 0 || ! empty($ref)) // Date intervention print '<td align="center" nowrap="nowrap">'; - $timearray=dol_getdate(mktime()); + $now=dol_now(); + $timearray=dol_getdate($now); if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'),GETPOST('disec','int'),GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); $form->select_date($timewithnohour,'di',1,1,0,"addinter"); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 79650676cc11aecaaabf189876d63887bc9d4f23..d212b70c4b0a1a0cba312993b7747b1739dbab96 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -142,9 +142,11 @@ class PaiementFourn extends Paiement if ($this->total <> 0) // On accepte les montants negatifs { + $now=dol_now(); + $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(mktime()).','; + $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); diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index e709dc4d6db8aa50f95677eda867fd01361543fc..b63fdba5302ff24dc9790b436eea3d297522fdcf 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -345,6 +345,8 @@ class Livraison extends CommonObject if (is_readable(DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php')) { require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php'; + + $now=dol_now(); // Recuperation de la nouvelle reference $objMod = new $modName($this->db); @@ -379,7 +381,7 @@ class Livraison extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sql.= " ref='".$this->db->escape($this->ref)."'"; $sql.= ", fk_statut = 1"; - $sql.= ", date_valid = ".$this->db->idate(mktime()); + $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/product/class/product.class.php b/htdocs/product/class/product.class.php index 8380d390a96d3ecdd5ceaf657ecfce6c930779d2..2b80ce5360b1002537b941672e77b0de1a2590aa 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1897,11 +1897,13 @@ class Product extends CommonObject function clone_fournisseurs($fromId, $toId) { $this->db->begin(); + + $now=dol_now(); // les fournisseurs /*$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur (" . " datec, fk_product, fk_soc, ref_fourn, fk_user_author )" - . " SELECT '".$this->db->idate(mktime())."', ".$toId.", fk_soc, ref_fourn, fk_user_author" + . " SELECT '".$this->db->idate($now)."', ".$toId.", fk_soc, ref_fourn, fk_user_author" . " FROM ".MAIN_DB_PREFIX."product_fournisseur" . " WHERE fk_product = ".$fromId; @@ -1914,7 +1916,7 @@ class Product extends CommonObject // les prix de fournisseurs. $sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price ("; $sql.= " datec, fk_product, fk_soc, price, quantity, fk_user)"; - $sql.= " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user"; + $sql.= " SELECT '".$this->db->idate($now)."', ".$toId. ", fk_soc, price, quantity, fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE fk_product = ".$fromId; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d838f61b8698ca3043c4871a2c9e9052d0502272..58c3ad97ca842c17073ccfcc92cacc56db35bdfe 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -707,7 +707,7 @@ class Project extends CommonObject { global $user, $langs, $conf; - $now = mktime(); + $now=dol_now(); // Charge tableau des produits prodids $prodids = array(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index b93598b600f8522f29285a9115008b9caf599803..59c6325dd3ba2e9564675a8103d48d4b900bc009 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -956,7 +956,9 @@ class Task extends CommonObject $error=0; - $now = dol_mktime(0,0,0,idate('m',mktime()),idate('d',mktime()),idate('Y',mktime())); + $now=dol_now(); + + $datec = dol_mktime(0,0,0,idate('m',$now),idate('d',$now),idate('Y',$now)); $clone_task=new Task($this->db); @@ -970,7 +972,7 @@ class Task extends CommonObject $clone_task->id = 0; $clone_task->fk_project = $project_id; $clone_task->fk_task_parent = $parent_task_id; - $clone_task->date_c = $now; + $clone_task->date_c = $datec; //Manage Task Date if ($clone_change_dt) diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index b4c456a1b05c45a38563920eb1a9acaf2714c5a5..819ee46d0c371dc5976ea8380747091b749c3762 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -85,8 +85,10 @@ class Address if ($result >= 0) { + $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(mktime()).", '".$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 c1ed2932d707d3fe01e0e528e936ec463b83f8b9..b385f4970b7b6a43f860c247361ad0b3844497a3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1000,6 +1000,8 @@ class Societe extends CommonObject if ($this->id) { $this->db->begin(); + + $now=dol_now(); // Positionne remise courante $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; @@ -1016,7 +1018,7 @@ class Societe extends CommonObject // Ecrit trace dans historique des remises $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise "; $sql.= " (datec, fk_soc, remise_client, note, fk_user_author)"; - $sql.= " VALUES (".$this->db->idate(mktime()).", ".$this->id.", '".$remise."',"; + $sql.= " VALUES (".$this->db->idate($now).", ".$this->id.", '".$remise."',"; $sql.= " '".$this->db->escape($note)."',"; $sql.= " ".$user->id; $sql.= ")";