diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 0dbad6754b1..2c278030a62 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 d7b4390890e..e5aae08ca3c 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -816,7 +816,7 @@ if ($rowid) print ''; print "
| '.$langs->trans("Description").' | '; print ''.$langs->trans("Total").' | ".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")." | "; 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 2a16039a351..ff9496898bf 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 70726cde310..081b89e26c6 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 '
| ';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 90aaa6082fd..0c5fe3db50e 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 54f811ef3e8..4db6de685ac 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 14c511385f2..78f584773c8 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 ' '.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date(mktime(),'%Y%m%d')).' ';
+ $now=dol_now();
+ print ''.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date($now,'%Y%m%d')).' ';
}
/**
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 6d5c71f2410..48928163f9c 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 4d43f0cd416..810aacb78cc 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 3ea68f6b3d5..0956980ce9c 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -1097,7 +1097,8 @@ else if ($id > 0 || ! empty($ref))
// Date intervention
print ' | '; - $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 79650676cc1..d212b70c4b0 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 e709dc4d6db..b63fdba5302 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 8380d390a96..2b80ce5360b 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 d838f61b869..58c3ad97ca8 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 b93598b600f..59c6325dd3b 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 b4c456a1b05..819ee46d0c3 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 c1ed2932d70..b385f4970b7 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.= ")"; | |