Merge branch 'develop' into develop_NEW_Service_DefaultWorkstation

This commit is contained in:
Laurent Destailleur
2022-09-13 01:38:49 +02:00
committed by GitHub
1088 changed files with 8461 additions and 4806 deletions

View File

@@ -1443,7 +1443,7 @@ function dol_escape_json($stringtoescape)
* @param string $stringtoescape String to escape
* @param int $keepb 1=Keep b tags, 0=remove them completely
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value). Set to 1 when escaping for a <textarea>.
* @param string $noescapetags '' or 'common' or list of tags to not escape. TODO Does not works yet when there is attributes to tag.
* @param string $noescapetags '' or 'common' or list of tags to not escape. TODO Does not works yet when there is attributes into tag.
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @return string Escaped string
* @see dol_string_nohtmltag(), dol_string_nospecial(), dol_string_unaccent()
@@ -1456,9 +1456,9 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
// escape quotes and backslashes, newlines, etc.
if ($escapeonlyhtmltags) {
$tmp = htmlspecialchars_decode($stringtoescape, ENT_COMPAT);
$tmp = htmlspecialchars_decode((string) $stringtoescape, ENT_COMPAT);
} else {
$tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8');
$tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8');
}
if (!$keepb) {
$tmp = strtr($tmp, array("<b>"=>'', '</b>'=>''));
@@ -1471,7 +1471,7 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
return htmlspecialchars($tmp, ENT_COMPAT, 'UTF-8');
} else {
// Escape tags to keep
// TODO Does not works yet when there is attributes to tag
// TODO Does not works yet when there is attributes into tag
$tmparrayoftags = array();
if ($noescapetags) {
$tmparrayoftags = explode(',', $noescapetags);
@@ -2272,7 +2272,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
// Add if object was dispatched "into accountancy"
if (!empty($conf->accounting->enabled) && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) {
if (isModEnabled('accounting') && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) {
// Note: For 'chargesociales', 'salaries'... this is the payments that are dispatched (so element = 'bank')
if (method_exists($object, 'getVentilExportCompta')) {
$accounted = $object->getVentilExportCompta();
@@ -4955,8 +4955,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= "<br>\n";
}
// Return a http error code if possible
// Return a http header with error code if possible
if (!headers_sent()) {
top_httphead();
http_response_code(500);
}
@@ -7294,9 +7295,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (empty($exclude) || !in_array('user', $exclude)) {
// Add SIGNATURE into substitutionarray first, so, when we will make the substitution,
// this will include signature content first and then replace var found into content of signature
$signature = $user->signature;
//var_dump($onlykey);
$emailsendersignature = $user->signature; // dy default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray()
$usersignature = $user->signature;
$substitutionarray = array_merge($substitutionarray, array(
'__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '')
'__SENDEREMAIL_SIGNATURE__' => (string) ((empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''),
'__USER_SIGNATURE__' => (string) (($usersignature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($usersignature), 30) : $usersignature) : '')
));
if (is_object($user)) {
@@ -7927,13 +7931,13 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
}
}
// Make substitition for array $substitutionarray
// Make substitution for array $substitutionarray
foreach ($substitutionarray as $key => $value) {
if (!isset($value)) {
continue; // If value is null, it same than not having substitution key at all into array, we do not replace.
}
if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) {
if (($key == '__USER_SIGNATURE__' || $key == '__SENDEREMAIL_SIGNATURE__') && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) {
$value = ''; // Protection
}