diff --git a/ChangeLog b/ChangeLog
index eab9834e9c8..a11e8f68ec4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -119,6 +119,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar.
New: Added es_CL language
Fix: Margin tabs bad data show
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
+Fix: [ bug #1388 ] Wrong date when invoicing several orders
***** ChangeLog for 3.5 compared to 3.4.* *****
For users:
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 146d9e777c2..b96ea931f21 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1362,7 +1362,7 @@ class Commande extends CommonOrder
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
- $this->db->free();
+ $this->db->free($result);
/*
* Lines
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index aa2883ccb96..7b79a16bec1 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -413,7 +413,7 @@ if ($action == 'create' && empty($mesgs))
// Date invoice
print '
| '.$langs->trans('Date').' | ';
- $html->select_date(0,'','','','',"add",1,1);
+ $html->select_date('','','','','',"add",1,1);
print ' |
';
// Payment term
print '| '.$langs->trans('PaymentConditionsShort').' | ';
diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php
index 227a70a020f..50ef7ac4151 100644
--- a/htdocs/core/db/mysql.class.php
+++ b/htdocs/core/db/mysql.class.php
@@ -1079,8 +1079,16 @@ class DoliDBMysql extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
- dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
- return -1;
+ if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
+ {
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
+ return -1;
+ }
+ else
+ {
+ // If user already exists, we continue to set permissions
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
+ }
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index c2400a43b7e..96b85633e7a 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -1073,8 +1073,16 @@ class DoliDBMysqli extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
- dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
- return -1;
+ if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
+ {
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
+ return -1;
+ }
+ else
+ {
+ // If user already exists, we continue to set permissions
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
+ }
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|