diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php
index 339ffe68b96..f11ccbf512e 100644
--- a/htdocs/accountancy/expensereport/index.php
+++ b/htdocs/accountancy/expensereport/index.php
@@ -112,7 +112,7 @@ if ($action == 'validatehistory') {
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
- $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity);
+ $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity).",";
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 1390c1b4254..8a4c189766f 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -733,15 +733,15 @@ if ($rowid > 0) {
}
print '
';
- print '
';
+ print '';
print '
';
- print '
';
+ print '';
print '
';
print '
';
- print '
';
+ print '';
print '
';
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index f43912237cc..01964313ea3 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -997,7 +997,26 @@ class CMailFile
$this->dump_mail();
}
- $result = $this->smtps->getErrors();
+ if (! $result) {
+ $smtperrorcode = $this->smtps->lastretval; // SMTP error code
+ dol_syslog("CMailFile::sendfile: mail SMTP error code ".$smtperrorcode, LOG_WARNING);
+
+ if ($smtperrorcode == '421') { // Try later
+ // TODO Add a delay and try again
+ /*
+ dol_syslog("CMailFile::sendfile: Try later error, so we wait and we retry");
+ sleep(2);
+
+ $result = $this->smtps->sendMsg();
+
+ if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+ $this->dump_mail();
+ }
+ */
+ }
+ }
+
+ $result = $this->smtps->getErrors(); // applicative error code (not SMTP error code)
if (empty($this->error) && empty($result)) {
dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
$res = true;
@@ -1268,7 +1287,11 @@ class CMailFile
if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir
$srcfile = $dolibarr_main_data_root."/dolibarr_mail.log";
- $destfile = $dolibarr_main_data_root."/dolibarr_mail.err";
+ if (getDolGlobalString('MAIN_MAIL_DEBUG_ERR_WITH_DATE')) {
+ $destfile = $dolibarr_main_data_root."/dolibarr_mail.".dol_print_date(dol_now(), 'dayhourlog', 'gmt').".err";
+ } else {
+ $destfile = $dolibarr_main_data_root."/dolibarr_mail.err";
+ }
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_move($srcfile, $destfile, 0, 1, 0, 0);
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 46193e1efea..c6eb249be5c 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -228,6 +228,7 @@ class SMTPs
// @CHANGE LDR
public $log = '';
+ public $lastretval = '';
private $_errorsTo = '';
private $_deliveryReceipt = 0;
private $_trackId = '';
@@ -564,7 +565,7 @@ class SMTPs
// Most servers expect a 2nd pass of EHLO after TLS is established to get another time
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
if (! $_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
- $this->_setErr(126, '"'.$hosth.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
+ $this->_setErr(126, '"'.$hosth.'" does not support authenticated connections or temporary error. Error after 2nd sending EHLO '.$hosth.' : '.$this->lastretval);
return $_retVal;
}
}
@@ -614,7 +615,7 @@ class SMTPs
$this->_setErr(130, 'Invalid Authentication Credentials.');
}
} else {
- $this->_setErr(126, '"'.$host.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
+ $this->_setErr(126, '"'.$host.'" does not support authenticated connections or temporary error. Error after sending EHLO '.$hosth.' : '.$this->lastretval);
}
return $_retVal;
@@ -670,10 +671,11 @@ class SMTPs
}
}
+ // Send the HELO message to the SMTP server
$_retVal = $this->socket_send_str('HELO '.$hosth, '250');
}
- // Well, did we get to the server?
+ // Well, did we get the server answer with correct code ?
if ($_retVal) {
// From this point onward most server response codes should be 250
// Specify who the mail is from....
@@ -716,8 +718,11 @@ class SMTPs
// Now tell the server we are done and close the socket...
fputs($this->socket, 'QUIT');
- fclose($this->socket);
+ } else {
+ // We got error code into $this->lastretval
}
+
+ fclose($this->socket);
}
return $_retVal;
@@ -1871,7 +1876,9 @@ class SMTPs
* using SMTP Extensions
*
* @param resource $socket Socket handler
- * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
+ * @param string $response Expected response ('250', ...). Example of response we can get:
+ * "421 4.7.0 Try again later, closing connection. (EHLO) nb21-20020a1709071c9500b0093d0d964affsm869534ejc.73 - gsmtp"
+ * "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
* @return boolean True or false
*/
public function server_parse($socket, $response)
@@ -1898,8 +1905,10 @@ class SMTPs
$limit++;
}
+ $this->lastretval = substr($server_response, 0, 3);
+
if (!(substr($server_response, 0, 3) == $response)) {
- $this->_setErr(120, "Ran into problems sending Mail.\r\nResponse:".$server_response);
+ $this->_setErr(120, "Ran into problems sending Mail.\r\nResponse: ".$server_response);
$_retVal = false;
}
@@ -1911,9 +1920,9 @@ class SMTPs
* Send str
*
* @param string $_strSend String to send
- * @param string $_returnCode Return code
+ * @param string $_returnCode Expected return code
* @param string $CRLF CRLF
- * @return boolean|null True or false
+ * @return boolean|null True or false
*/
public function socket_send_str($_strSend, $_returnCode = null, $CRLF = "\r\n")
{
@@ -1929,6 +1938,8 @@ class SMTPs
if ($_returnCode) {
return $this->server_parse($this->socket, $_returnCode);
}
+
+ return null;
}
// =============================================================
@@ -1950,7 +1961,7 @@ class SMTPs
}
/**
- * Returns errors codes and messages for Class
+ * Returns applicative errors codes and messages for Class (not the SMTP error code)
*
* @return string $_errMsg Error Message
*/
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql
index b447431cca5..bbee48ad0cf 100644
--- a/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql
+++ b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql
@@ -20,8 +20,8 @@ CREATE TABLE llx_opensurvey_comments (
id_sondage CHAR(16) NOT NULL,
comment text NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- usercomment text
+ usercomment text,
date_creation datetime NOT NULL,
- ip varchar(250), --ip used to create record (for public submission page)
+ ip varchar(250) --ip used to create record (for public submission page)
) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql
index 26de6ff8a21..5d3b132c8dd 100644
--- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql
+++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql
@@ -20,7 +20,7 @@ CREATE TABLE llx_opensurvey_user_studs (
nom VARCHAR(64) NOT NULL,
id_sondage VARCHAR(16) NOT NULL,
reponses VARCHAR(200) NOT NULL, -- Not used for 'F' surveys
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
date_creation datetime NOT NULL,
- ip varchar(250), --ip used to create record (for public submission page)
+ ip varchar(250) --ip used to create record (for public submission page)
) ENGINE=innodb;
diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index 87402b77050..3251618032f 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -212,7 +212,7 @@ AmountOfSubscriptions=Amount collected from contributions
TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation)
DefaultAmount=Default amount of contribution (used only if no amount is defined at member type level)
MinimumAmount=Minimum amount (used only when contribution amount is free)
-CanEditAmount=Subscription amount is free
+CanEditAmount=Subscription amount can be defined by the member
CanEditAmountDetail=Visitor can choose/edit amount of its contribution regardless of the member type
AmountIsLowerToMinimumNotice=sur un dû total de %s
MEMBER_NEWFORM_PAYONLINE=After the online registration, switch automatically on the online payment page
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index a4225a0a14a..b0e0b84202a 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -938,6 +938,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (isModEnabled('productbatch')) {
print '