This commit is contained in:
Laurent Destailleur 2018-11-16 16:55:53 +01:00
parent 5d596fe584
commit 028be21070
2 changed files with 4 additions and 16 deletions

View File

@ -141,7 +141,7 @@ if (GETPOST('addoperation','alpha'))
{ {
$emailcollectoroperation = new EmailCollectorAction($db); $emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->type = GETPOST('operationtype','az09'); $emailcollectoroperation->type = GETPOST('operationtype','az09');
$emailcollectoroperation->actionparam = GETPOST('actionparam', 'alpha'); $emailcollectoroperation->actionparam = GETPOST('operationparam', 'none');
$emailcollectoroperation->fk_emailcollector = $object->id; $emailcollectoroperation->fk_emailcollector = $object->id;
$emailcollectoroperation->status = 1; $emailcollectoroperation->status = 1;
$result = $emailcollectoroperation->create($user); $result = $emailcollectoroperation->create($user);

View File

@ -1108,12 +1108,13 @@ class EmailCollector extends CommonObject
dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
// Search and create thirdparty // Search and create thirdparty
if ($operation['type'] == 'loadthirdparty' && $operation['type'] == 'loadandcreatethirdparty') if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty')
{ {
if (empty($operation['actionparam'])) if (empty($operation['actionparam']))
{ {
$errorforactions++; $errorforactions++;
$this->errors = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'VALUE:xxx' or 'REGEX:(body|subject):regex' to extract"; $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'VALUE:xxx' or 'REGEX:(body|subject):regex' to define how to extract data";
$this->errors[] = $this->error;
} }
else else
{ {
@ -1124,19 +1125,6 @@ class EmailCollector extends CommonObject
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty) foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
{ {
$tmpclass=''; $tmpproperty='';
$tmparray=explode('.', $propertytooverwrite);
if (count($tmparray) == 2)
{
$tmpclass=$tmparray[0];
$tmpproperty=$tmparray[1];
}
else
{
$tmpproperty=$tmparray[0];
}
//if ($tmpclass && ($tmpclass != $object->element)) continue; // Property is for another type of object
$sourcestring=''; $sourcestring='';
$sourcefield=''; $sourcefield='';
$regexstring=''; $regexstring='';