NEW getCommonSubstitutionArray to have more substitute keys

This commit is contained in:
VESSILLER 2022-12-06 16:19:14 +01:00
parent fc44801581
commit f510357f85

View File

@ -881,8 +881,24 @@ class EmailCollector extends CommonObject
*/
private function overwritePropertiesOfObject(&$object, $actionparam, $messagetext, $subject, $header, &$operationslog)
{
global $conf, $langs;
$errorforthisaction = 0;
// set output lang
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($newlang);
}
// Overwrite values with values extracted from source email
// $this->actionparam = 'opportunity_status=123;abc=EXTRACT:BODY:....'
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
@ -978,7 +994,8 @@ class EmailCollector extends CommonObject
if ($regforregex[1] == 'SET' || empty($valuecurrent)) {
$valuetouse = $regforregex[2];
$substitutionarray = array();
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$matcharray = array();
preg_match_all('/__([a-z0-9]+(?:_[a-z0-9]+)?)__/i', $valuetouse, $matcharray);
//var_dump($tmpproperty.' - '.$object->$tmpproperty.' - '.$valuetouse); var_dump($matcharray);