Merge pull request #23070 from Easya-Solutions/new-emailcollector-substitute-date-now

NEW substitute date now in email collector
This commit is contained in:
Laurent Destailleur 2022-12-17 02:13:43 +01:00 committed by GitHub
commit 41d841fba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);