diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php
index dbbe9d84c1c..1b212e0a5d7 100755
--- a/dev/examples/code/create_invoice.php
+++ b/dev/examples/code/create_invoice.php
@@ -66,8 +66,9 @@ $obj = new Facture($db);
$obj->ref = 'ABCDE';
$obj->socid = 4; // Put id of third party (rowid in llx_societe table)
-$obj->date = mktime();
-$obj->note = 'A comment';
+$obj->date = dol_now();
+$obj->note_public = 'A public comment';
+$obj->note_private = 'A private comment';
$obj->cond_reglement_id = 1;
$line1=new FactureLigne($db);
diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php
index 30265d5462e..703254ad5e9 100755
--- a/dev/examples/code/create_order.php
+++ b/dev/examples/code/create_order.php
@@ -66,8 +66,9 @@ $com = new Commande($db);
$com->ref = 'ABCDE';
$com->socid = 4; // Put id of third party (rowid in llx_societe table)
-$com->date_commande = mktime();
-$com->note = 'A comment';
+$com->date = dol_now();
+$com->note_public = 'A public comment';
+$com->note_private = 'A private comment';
$com->source = 1;
$com->remise_percent = 0;
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index 684ef337fcd..9be5607b62d 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -407,7 +407,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
print "
".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")." | ";
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
- $casenow = dol_print_date(mktime(),"%Y-%m");
+ $casenow = dol_print_date(dol_now(),"%Y-%m");
$case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m");
$caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m");
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index b22473ec483..10d34afd867 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -1397,7 +1397,8 @@ class Ldap
//Parse flags to text
$retval = array();
- while (list($flag, $val) = each($flags)) {
+ //while (list($flag, $val) = each($flags)) {
+ foreach ($flags as $flag => $val) {
if ($uacf >= $val) {
$uacf -= $val;
$retval[$val] = $flag;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e938f1a00d8..dff1d84dddc 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2102,8 +2102,6 @@ function dol_now($mode = 'gmt')
{
$ret = 0;
- // Note that gmmktime and mktime return same value (GMT) when used without parameters
- //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
if ($mode == 'gmt') $ret = time(); // Time for now at greenwich.
elseif ($mode == 'tzserver') // Time for now with PHP server timezone added
{
@@ -2119,7 +2117,7 @@ function dol_now($mode = 'gmt')
}*/
elseif ($mode == 'tzuser') // Time for now with user timezone added
{
- //print 'time: '.time().'-'.mktime().'-'.gmmktime();
+ //print 'time: '.time();
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60;
$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60;
$ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst));
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 05272aa2ff7..14ab2b88f22 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1486,7 +1486,7 @@ class ExpenseReport extends CommonObject
{
// phpcs:enable
$error = 0;
- $this->date_cancel = $this->db->idate(gmmktime());
+ $this->date_cancel = $this->db->idate(dol_now());
if ($this->fk_statut != self::STATUS_CANCELED)
{
$this->db->begin();
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 93d5e3339b1..3d1a23ee26d 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -353,7 +353,7 @@ if (empty($reshook))
$desc .= '
';
$desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';
- $timearray = dol_getdate(mktime());
+ $timearray = dol_getdate(dol_now());
$date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
if ($product_type == Product::TYPE_PRODUCT) {