diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 1e550fb7f65..75c9c731810 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -370,6 +370,7 @@ if ($search_lastname) $param .= "&search_lastname=".urlencode($search_lastname)
if ($search_gender) $param .= "&search_gender=".urlencode($search_gender);
if ($search_login) $param .= "&search_login=".urlencode($search_login);
if ($search_email) $param .= "&search_email=".urlencode($search_email);
+if ($search_categ) $param .= "&search_categ=".urlencode($search_categ);
if ($search_company) $param .= "&search_company=".urlencode($search_company);
if ($search_address != '') $param .= "&search_address=".urlencode($search_address);
if ($search_town != '') $param .= "&search_town=".urlencode($search_town);
@@ -545,7 +546,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
print '
';
print ' | ';
}
-
+// End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) {
print '';
print ' | ';
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 27e64973ddf..feca9bf582e 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -77,6 +77,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
@@ -156,6 +157,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val(0);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0);
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").val(0);
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").prop("disabled", true);
@@ -187,6 +190,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED.');
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").val(0);
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").prop("disabled", true);
@@ -211,6 +216,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED.');
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").val('.$conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED.');
jQuery("#MAIN_MAIL_EMAIL_DKIM_ENABLED").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").removeAttr("disabled");
@@ -233,12 +240,16 @@ if ($action == 'edit')
initfields();
});
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
- if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val() == 1)
+ if (jQuery("#MAIN_MAIL_EMAIL_TLS").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val(0);
+ else
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0);
});
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").change(function() {
- if (jQuery("#MAIN_MAIL_EMAIL_TLS").val() == 1)
+ if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
+ else
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0);
});
})';
print ''."\n";
@@ -406,6 +417,17 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '';
+ // SMTP_ALLOW_SELF_SIGNED
+ print '| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | ';
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
+ {
+ if (function_exists('openssl_open'))
+ {
+ print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1);
+ } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ } else print yn(0).' ('.$langs->trans("NotSupported").')';
+ print ' |
';
+
// DKIM
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").' | ';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
@@ -571,6 +593,17 @@ if ($action == 'edit')
} else print ''.yn(0).' ('.$langs->trans("NotSupported").')';
print ' |
';
+ // SMTP_ALLOW_SELF_SIGNED
+ print '| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | ';
+ if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
+ {
+ if (function_exists('openssl_open'))
+ {
+ print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED);
+ } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ } else print ''.yn(0).' ('.$langs->trans("NotSupported").')';
+ print ' |
';
+
if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
{
diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php
index 7b8265f93f9..b97437216d6 100644
--- a/htdocs/admin/mails_emailing.php
+++ b/htdocs/admin/mails_emailing.php
@@ -68,6 +68,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING"), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@@ -147,6 +148,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").prop("disabled", true);
';
if ($linuxlike)
{
@@ -173,6 +176,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
@@ -187,6 +192,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
@@ -199,13 +206,17 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
initfields();
});
- jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
- if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
+ jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").change(function() {
+ if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
+ else
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
});
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").change(function() {
- if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
+ if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
+ else
+ jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
});
})';
print ''."\n";
@@ -359,6 +370,18 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '';
+ // SMTP_ALLOW_SELF_SIGNED_EMAILING
+
+ print '| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | ';
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
+ {
+ if (function_exists('openssl_open'))
+ {
+ print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1);
+ } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ } else print yn(0).' ('.$langs->trans("NotSupported").')';
+ print ' |
';
+
print '';
dol_fiche_end();
@@ -437,6 +460,17 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '';
+
+ // SMTP_ALLOW_SELF_SIGNED_EMAILING
+ print '| '.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' | ';
+ if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
+ {
+ if (function_exists('openssl_open'))
+ {
+ print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING);
+ } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ } else print yn(0).' ('.$langs->trans("NotSupported").')';
+ print ' |
';
}
print '';
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index ab2c1dcadb1..fbecc1df335 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -60,6 +60,9 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
$selected_type = GETPOST('search_type', 'int');
if ($selected_type == '') $selected_type = -1;
+// Hook
+$hookmanager->initHooks(array('cabyprodservlist'));
+
// Date range
$year = GETPOST("year");
$month = GETPOST("month");
diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index ab71b147b50..a02d87a8392 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -61,6 +61,9 @@ if ($user->socid > 0) $socid = $user->socid;
if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
+// Hook
+$hookmanager->initHooks(array('casoclist'));
+
// Date range
$year = GETPOST("year", 'int');
$month = GETPOST("month", 'int');
diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php
index 5911daaba45..83a3cb70a00 100644
--- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php
+++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php
@@ -57,6 +57,9 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
$selected_type = GETPOST('search_type', 'int');
if ($selected_type == '') $selected_type = -1;
+// Hook
+$hookmanager->initHooks(array('supplierturnoverbyprodservlist'));
+
// Date range
$year = GETPOST("year");
$month = GETPOST("month");
diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php
index 60d65049800..7a624284cdf 100644
--- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php
+++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php
@@ -50,6 +50,9 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true;
}
+// Hook
+$hookmanager->initHooks(array('supplierturnoverbythirdpartylist'));
+
// Security check
if ($user->socid > 0) $socid = $user->socid;
if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index a90e3a2cf26..10c539a48de 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -294,6 +294,16 @@ class CMailFile
$addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
}
+ $keyforsslseflsigned ='MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED';
+ if (!empty($this->sendcontext)) {
+ $smtpContextKey = strtoupper($this->sendcontext);
+ $keyForSMTPSendMode = 'MAIN_MAIL_SENDMODE_' . $smtpContextKey;
+ $smtpContextSendMode = $conf->global->{$keyForSMTPSendMode};
+ if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') {
+ $keyforsslseflsigned ='MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_' . $smtpContextKey;
+ }
+ }
+
// We set all data according to choosed sending method.
// We also set a value for ->msgid
if ($this->sendmode == 'mail')
@@ -404,6 +414,7 @@ class CMailFile
$smtps->setBCC($this->addr_bcc);
$smtps->setErrorsTo($this->errors_to);
$smtps->setDeliveryReceipt($this->deliveryreceipt);
+ if (!empty($conf->global->$keyforsslseflsigned)) $smtps->setOptions(array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)));
$host = dol_getprefix('email');
$this->msgid = time().'.SMTPs-dolibarr-'.$this->trackid.'@'.$host;
@@ -642,17 +653,19 @@ class CMailFile
$keyforsmtppw = 'MAIN_MAIL_SMTPS_PW';
$keyfortls = 'MAIN_MAIL_EMAIL_TLS';
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS';
+ $keyforsslseflsigned ='MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED';
if (!empty($this->sendcontext)) {
$smtpContextKey = strtoupper($this->sendcontext);
$keyForSMTPSendMode = 'MAIN_MAIL_SENDMODE_'.$smtpContextKey;
$smtpContextSendMode = $conf->global->{$keyForSMTPSendMode};
if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') {
- $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_'.$smtpContextKey;
- $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_'.$smtpContextKey;
- $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_'.$smtpContextKey;
- $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_'.$smtpContextKey;
- $keyfortls = 'MAIN_MAIL_EMAIL_TLS_'.$smtpContextKey;
- $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_'.$smtpContextKey;
+ $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_' . $smtpContextKey;
+ $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_' . $smtpContextKey;
+ $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_' . $smtpContextKey;
+ $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_' . $smtpContextKey;
+ $keyfortls = 'MAIN_MAIL_EMAIL_TLS_' . $smtpContextKey;
+ $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_' . $smtpContextKey;
+ $keyforsslseflsigned ='MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_' . $smtpContextKey;
}
}
@@ -849,6 +862,7 @@ class CMailFile
if (!empty($conf->global->$keyforsmtpid)) $this->transport->setUsername($conf->global->$keyforsmtpid);
if (!empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw);
+ if (! empty($conf->global->$keyforsslseflsigned)) $this->transport->setStreamOptions(array('ssl' => array('allow_self_signed' => true, 'verify_peer' => false)));;
//$smtps->_msgReplyTo = 'reply@web.com';
// Switch content encoding to base64 - avoid the doubledot issue with quoted-printable
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 87ce3c22e80..3adbf4af4d5 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -228,6 +228,21 @@ class SMTPs
private $_trackId = '';
private $_moreInHeader = '';
+ /**
+ * An array of options for stream_context_create()
+ */
+ private $_options = [];
+
+ /**
+ * Set delivery receipt
+ *
+ * @param array $_options An array of options for stream_context_create()
+ * @return void
+ */
+ public function setOptions($_options = [])
+ {
+ $this->_options = $_options;
+ }
/**
* Set delivery receipt
@@ -373,14 +388,31 @@ class SMTPs
$this->_setErr(99, $host.' is either offline or is an invalid host name.');
$_retVal = false;
} else {
- //See if we can connect to the SMTP server
- if ($this->socket = @fsockopen(
- preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain
+ if (function_exists('stream_socket_client') && !empty($this->_options)) {
+ $socket_context = stream_context_create($this->_options); // An array of options for stream_context_create()
+ set_error_handler([$this, 'errorHandler']);
+ $this->socket = @stream_socket_client(
+ preg_replace('@tls://@i', '', $this->getHost()) . // Host to 'hit', IP or domain
+ ':' . $this->getPort(), // which Port number to use
+ $this->errno, // actual system level error
+ $this->errstr, // and any text that goes with the error
+ $this->_smtpTimeout, // timeout for reading/writing data over the socket
+ STREAM_CLIENT_CONNECT,
+ $socket_context // Options for connection
+ );
+ } else {
+ $this->socket = @fsockopen(
+ preg_replace('@tls://@i', '', $this->getHost()), // Host to 'hit', IP or domain
$this->getPort(), // which Port number to use
$this->errno, // actual system level error
$this->errstr, // and any text that goes with the error
$this->_smtpTimeout // timeout for reading/writing data over the socket
- )) {
+ );
+ }
+
+ //See if we can connect to the SMTP server
+ if (is_resource($this->socket))
+ {
// Fix from PHP SMTP class by 'Chris Ryan'
// Sometimes the SMTP server takes a little longer to respond
// so we will give it a longer timeout for the first read
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index c3417702c6a..7c314c08be1 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -6119,25 +6119,25 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (is_object($object) && $object->element == 'adherent' && $object->id > 0)
{
- $substitutionarray['__MEMBER_ID__'] = $object->id;
+ $substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : '');
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
- $substitutionarray['__MEMBER_FIRSTNAME__'] = $object->firstname;
- $substitutionarray['__MEMBER_LASTNAME__'] = $object->lastname;
+ $substitutionarray['__MEMBER_FIRSTNAME__'] = (isset($object->firstname) ? $object->firstname : '');
+ $substitutionarray['__MEMBER_LASTNAME__'] = (isset($object->lastname) ? $object->lastname : '');
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__'] = $object->getFullName($outputlangs);
- $substitutionarray['__MEMBER_COMPANY__'] = $object->societe;
- $substitutionarray['__MEMBER_ADDRESS__'] = $object->address;
- $substitutionarray['__MEMBER_ZIP__'] = $object->zip;
- $substitutionarray['__MEMBER_TOWN__'] = $object->town;
- $substitutionarray['__MEMBER_COUNTRY__'] = $object->country;
- $substitutionarray['__MEMBER_EMAIL__'] = $object->email;
- $substitutionarray['__MEMBER_BIRTH__'] = $birthday;
- $substitutionarray['__MEMBER_PHOTO__'] = $object->photo;
- $substitutionarray['__MEMBER_LOGIN__'] = $object->login;
- $substitutionarray['__MEMBER_PASSWORD__'] = $object->pass;
- $substitutionarray['__MEMBER_PHONE__'] = $object->phone;
- $substitutionarray['__MEMBER_PHONEPRO__'] = $object->phone_perso;
- $substitutionarray['__MEMBER_PHONEMOBILE__'] = $object->phone_mobile;
- $substitutionarray['__MEMBER_TYPE__'] = $object->type;
+ $substitutionarray['__MEMBER_COMPANY__'] = (isset($object->societe) ? $object->societe : '');
+ $substitutionarray['__MEMBER_ADDRESS__'] = (isset($object->address) ? $object->address : '');
+ $substitutionarray['__MEMBER_ZIP__'] = (isset($object->zip) ? $object->zip : '');
+ $substitutionarray['__MEMBER_TOWN__'] = (isset($object->town) ? $object->town : '');
+ $substitutionarray['__MEMBER_COUNTRY__'] = (isset($object->country) ? $object->country : '');
+ $substitutionarray['__MEMBER_EMAIL__'] = (isset($object->email) ? $object->email : '');
+ $substitutionarray['__MEMBER_BIRTH__'] = (isset($birthday) ? $birthday : '');
+ $substitutionarray['__MEMBER_PHOTO__'] = (isset($object->photo) ? $object->photo : '');
+ $substitutionarray['__MEMBER_LOGIN__'] = (isset($object->login) ? $object->login : '');
+ $substitutionarray['__MEMBER_PASSWORD__'] = (isset($object->pass) ? $object->pass : '');
+ $substitutionarray['__MEMBER_PHONE__'] = (isset($object->phone) ? $object->phone : '');
+ $substitutionarray['__MEMBER_PHONEPRO__'] = (isset($object->phone_perso) ? $object->phone_perso : '');
+ $substitutionarray['__MEMBER_PHONEMOBILE__'] = (isset($object->phone_mobile) ? $object->phone_mobile : '');
+ $substitutionarray['__MEMBER_TYPE__'] = (isset($object->type) ? $object->type : '');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc');
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index f721d7d4c5c..2c3549cdea9 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -223,26 +223,22 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'submenus' => array(),
);
- // Commercial
+ // Commercial (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
$tmpentry = array(
- 'enabled'=>(!empty($conf->propal->enabled) ||
- !empty($conf->commande->enabled) ||
- !empty($conf->fournisseur->enabled) ||
- !empty($conf->supplier_proposal->enabled) ||
- !empty($conf->supplier_order->enabled) ||
- !empty($conf->contrat->enabled) ||
- !empty($conf->ficheinter->enabled)
- ) ? 1 : 0,
- 'perms'=>(!empty($user->rights->propal->lire) ||
- !empty($user->rights->commande->lire) ||
- !empty($user->rights->fournisseur->lire) ||
- !empty($user->rights->supplier_proposal->lire) ||
- !empty($user->rights->supplier_order->lire) ||
- !empty($user->rights->contrat->lire) ||
- !empty($user->rights->ficheinter->lire) ||
- !empty($user->rights->supplier_order->lire) ||
- !empty($user->rights->fournisseur->commande->lire)
- ),
+ 'enabled'=>(!empty($conf->propal->enabled)
+ || !empty($conf->commande->enabled)
+ || !empty($conf->supplier_proposal->enabled)
+ || !empty($conf->supplier_order->enabled)
+ || !empty($conf->contrat->enabled)
+ || !empty($conf->ficheinter->enabled)
+ ) ? 1 : 0,
+ 'perms'=>(!empty($user->rights->propal->lire)
+ || !empty($user->rights->commande->lire)
+ || !empty($user->rights->supplier_proposal->lire)
+ || !empty($user->rights->supplier_order->lire)
+ || !empty($user->rights->contrat->lire)
+ || !empty($user->rights->ficheinter->lire)
+ ),
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
);
@@ -893,7 +889,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
/*
- * Menu COMMERCIAL
+ * Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
*/
if ($mainmenu == 'commercial')
{
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 4c529329c4c..658635e639e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -289,6 +289,7 @@ MAIN_MAIL_SMTPS_ID=SMTP ID (if sending server requires authentication)
MAIN_MAIL_SMTPS_PW=SMTP Password (if sending server requires authentication)
MAIN_MAIL_EMAIL_TLS=Use TLS (SSL) encryption
MAIN_MAIL_EMAIL_STARTTLS=Use TLS (STARTTLS) encryption
+MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED=Authorise les certificats auto-signés
MAIN_MAIL_EMAIL_DKIM_ENABLED=Use DKIM to generate email signature
MAIN_MAIL_EMAIL_DKIM_DOMAIN=Email Domain for use with dkim
MAIN_MAIL_EMAIL_DKIM_SELECTOR=Name of dkim selector
diff --git a/htdocs/langs/en_US/supplier_proposal.lang b/htdocs/langs/en_US/supplier_proposal.lang
index ce5bdf0425a..ca75eddb7df 100644
--- a/htdocs/langs/en_US/supplier_proposal.lang
+++ b/htdocs/langs/en_US/supplier_proposal.lang
@@ -13,6 +13,7 @@ SupplierProposalArea=Vendor proposals area
SupplierProposalShort=Vendor proposal
SupplierProposals=Vendor proposals
SupplierProposalsShort=Vendor proposals
+AskPrice=Price request
NewAskPrice=New price request
ShowSupplierProposal=Show price request
AddSupplierProposal=Create a price request
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 311c366d9e5..d7842084c17 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -289,6 +289,7 @@ MAIN_MAIL_SMTPS_ID=ID SMTP (si le serveur d'envoi nécessite une authentificatio
MAIN_MAIL_SMTPS_PW=Mot de passe SMTP (si le serveur d'envoi nécessite une authentification)
MAIN_MAIL_EMAIL_TLS=Utilisation du chiffrement TLS (SSL)
MAIN_MAIL_EMAIL_STARTTLS=Utiliser le cryptage TTS (STARTTLS)
+MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED=Authorise les certificats auto-signés
MAIN_MAIL_EMAIL_DKIM_ENABLED=Utiliser DKIM pour signer les emails
MAIN_MAIL_EMAIL_DKIM_DOMAIN=Nom de domaine pour la signature DKIM
MAIN_MAIL_EMAIL_DKIM_SELECTOR=Nom du sélecteur DKIM
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 7f1711b13bb..18e6e1c3500 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -210,8 +210,8 @@ $arrayfields = array(
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>52),
'stock_virtual'=>array('label'=>$langs->trans("VirtualStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service' && $virtualdiffersfromphysical), 'position'=>53),
'p.tobatch'=>array('label'=>$langs->trans("ManageLotSerial"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>60),
- 'p.fk_country'=>array('label'=>$langs->trans("Country").' ('.$langs->trans("Country").')', 'checked'=>0, 'position'=>100),
- 'p.fk_state'=>array('label'=>$langs->trans("State").' ('.$langs->trans("State").')', 'checked'=>0, 'position'=>101),
+ 'p.fk_country'=>array('label'=>$langs->trans("Country"), 'checked'=>0, 'position'=>100),
+ 'p.fk_state'=>array('label'=>$langs->trans("State"), 'checked'=>0, 'position'=>101),
'p.accountancy_code_sell'=>array('label'=>$langs->trans("ProductAccountancySellCode"), 'checked'=>0, 'position'=>400),
'p.accountancy_code_sell_intra'=>array('label'=>$langs->trans("ProductAccountancySellIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
'p.accountancy_code_sell_export'=>array('label'=>$langs->trans("ProductAccountancySellExportCode"), 'checked'=>0, 'position'=>402),
@@ -1445,7 +1445,9 @@ if ($resql)
// State
if (!empty($arrayfields['p.fk_state']['checked']))
{
- print ''.getState($obj->fk_state, 0, $db).' | ';
+ print '';
+ if (!empty($obj->fk_state)) print getState($obj->fk_state, 0, $db);
+ print ' | ';
if (!$i) $totalarray['nbfield']++;
}
// Accountancy code sell
diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php
index 88a6d3fb96e..d5280ee80dd 100644
--- a/htdocs/societe/class/api_contacts.class.php
+++ b/htdocs/societe/class/api_contacts.class.php
@@ -98,6 +98,48 @@ class Contacts extends DolibarrApi
return $this->_cleanObjectDatas($this->contact);
}
+ /**
+ * Get properties of a contact object by Email
+ *
+ * @param string $email Email of contact
+ * @param int $includecount Count and return also number of elements the contact is used as a link for
+ * @return array|mixed data without useless information
+ *
+ * @url GET email/{email}
+ *
+ * @throws RestException 401 Insufficient rights
+ * @throws RestException 404 User or group not found
+ */
+ public function getByEmail($email, $includecount = 0)
+ {
+ if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
+ {
+ throw new RestException(401, 'No permission to read contacts');
+ }
+ if (empty($email)) {
+ $result = $this->contact->initAsSpecimen();
+ } else {
+ $result = $this->contact->fetch('', '', '', $email);
+ }
+
+ if (!$result)
+ {
+ throw new RestException(404, 'Contact not found');
+ }
+
+ if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe'))
+ {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
+
+ if ($includecount)
+ {
+ $this->contact->load_ref_elements();
+ }
+
+ return $this->_cleanObjectDatas($this->contact);
+ }
+
/**
* List contacts
*
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 92a9517f08a..ad9813c4fec 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -613,6 +613,11 @@ if ($user->rights->societe->creer && $contextpage != 'poslist')
}
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter);
+} elseif ($user->rights->societe->creer && $contextpage == 'poslist')
+{
+ $label = 'MenuNewCustomer';
+
+ $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&type=c&contextpage=poslist&optioncss=print&backtopage='.$_SERVER["PHP_SELF"].'?contextpage=poslist&nomassaction=1&optioncss=print&place='.urlencode($place));
}
print '