Merge branch 'develop' of github.com:Dolibarr/dolibarr into new-mail-template-substitute-project-title

This commit is contained in:
lvessiller
2022-07-21 14:20:21 +02:00
290 changed files with 9482 additions and 3596 deletions

View File

@@ -3343,6 +3343,17 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
//ex: +61_A_BCDE_FGHI
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4);
}
} elseif (strtoupper($countrycode) == "LU") {
// Luxembourg
if (dol_strlen($phone) == 10) {// fixe 6 chiffres +352_AA_BB_CC
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2);
} elseif (dol_strlen($phone) == 11) {// fixe 7 chiffres +352_AA_BB_CC_D
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 1);
} elseif (dol_strlen($phone) == 12) {// fixe 8 chiffres +352_AA_BB_CC_DD
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
} elseif (dol_strlen($phone) == 13) {// mobile +352_AAA_BB_CC_DD
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
}
}
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
@@ -3876,15 +3887,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (strpos($pictowithouttext, 'fontawesome_') !== false || preg_match('/^fa-/', $pictowithouttext)) {
// This is a font awesome image 'fonwtawesome_xxx' or 'fa-xxx'
$pictowithouttext = str_replace('fontawesome_', '', $pictowithouttext);
$pictowithouttext = str_replace('fa-', '', $pictowithouttext);
$pictowithouttextarray = explode('_', $pictowithouttext);
$marginleftonlyshort = 0;
if (!empty($pictowithouttextarray[1])) {
$fakey = 'fa-'.$pictowithouttextarray[1];
$fa = empty($pictowithouttextarray[2]) ? 'fa' : $pictowithouttextarray[2];
$facolor = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
$fasize = empty($pictowithouttextarray[4]) ? '' : $pictowithouttextarray[4];
// Syntax is 'fontawesome_fakey_faprefix_facolor_fasize' or 'fa-fakey_faprefix_facolor_fasize'
$fakey = 'fa-'.$pictowithouttextarray[0];
$fa = empty($pictowithouttextarray[1]) ? 'fa' : $pictowithouttextarray[1];
$facolor = empty($pictowithouttextarray[2]) ? '' : $pictowithouttextarray[2];
$fasize = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
} else {
$fakey = 'fa-'.$pictowithouttext;
$fa = 'fa';
@@ -5458,9 +5472,10 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
* @param boolean $addpercent Add a percent % sign in output
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
* @param int $html Used for html output
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
*/
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, $html = 0)
{
$morelabel = '';
@@ -5468,9 +5483,11 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
$rate = str_replace('%', '', $rate);
$addpercent = true;
}
$reg = array();
if (preg_match('/\((.*)\)/', $rate, $reg)) {
$morelabel = ' ('.$reg[1].')';
$rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate);
$morelabel = ' '.($html ? '<span class="opacitymedium">' : '').'('.$reg[1].')'.($html ? '</span>' : '');
}
if (preg_match('/\*/', $rate)) {
$rate = str_replace('*', '', $rate);
@@ -7167,6 +7184,8 @@ function dol_textishtml($msg, $option = 0)
}
return false;
} else {
// Remove all urls because 'http://aa?param1=abc&amp;param2=def' must not be used inside detection
$msg = preg_replace('/https?:\/\/[^"\'\s]+/i', '', $msg);
if (preg_match('/<html/i', $msg)) {
return true;
} elseif (preg_match('/<body/i', $msg)) {
@@ -7188,6 +7207,7 @@ function dol_textishtml($msg, $option = 0)
} elseif (preg_match('/<h[0-9]>/i', $msg)) {
return true;
} elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) {
// TODO If content is 'A link https://aaa?param=abc&amp;param2=def', it return true but must be false
return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
} elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) {
return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
@@ -7831,6 +7851,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
} else {
if (! $msgishtml) {
$valueishtml = dol_textishtml($value, 1);
//var_dump("valueishtml=".$valueishtml);
if ($valueishtml) {
$text = dol_htmlentitiesbr($text);
@@ -8580,7 +8601,8 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
if ($onlysimplestring == '1') {
// We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL'
// We must accept: '$conf->barcode->enabled && preg_match(\'/^(AAA|BBB)/\',$leftmenu)'
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/', '/').']/i', $s)) {
// We must accept: '$user->rights->cabinetmed->read && $object->canvas=="patient@cabinetmed"'
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
@@ -9001,6 +9023,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
if ($values[0] != $type) {
continue;
}
//var_dump(verifCond($values[4]));
if (verifCond($values[4])) {
if ($values[3]) {