Fix creation of project
This commit is contained in:
parent
8091cff009
commit
483d017fc5
@ -1570,6 +1570,14 @@ class EmailCollector extends CommonObject
|
|||||||
$projecttocreate->note_private = $descriptionfull;
|
$projecttocreate->note_private = $descriptionfull;
|
||||||
$projecttocreate->entity = $conf->entity;
|
$projecttocreate->entity = $conf->entity;
|
||||||
|
|
||||||
|
// Overwrite values with values extracted from source email.
|
||||||
|
// This may overwrite any $projecttocreate->xxx properties.
|
||||||
|
$savesocid = $projecttocreate->socid;
|
||||||
|
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header);
|
||||||
|
|
||||||
|
// Set project ref if not yet defined
|
||||||
|
if (empty($projecttocreate->ref))
|
||||||
|
{
|
||||||
// Get next project Ref
|
// Get next project Ref
|
||||||
$defaultref='';
|
$defaultref='';
|
||||||
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
||||||
@ -1593,13 +1601,25 @@ class EmailCollector extends CommonObject
|
|||||||
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
|
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
|
||||||
$modProject = new $classname;
|
$modProject = new $classname;
|
||||||
|
|
||||||
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
|
if ($savesocid > 0)
|
||||||
|
{
|
||||||
|
if ($savesocid != $projecttocreate->socid)
|
||||||
|
{
|
||||||
|
$errorforactions++;
|
||||||
|
setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($projecttocreate->socid > 0)
|
||||||
|
{
|
||||||
|
$thirdpartystatic->fetch($projecttocreate->socid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
|
||||||
|
}
|
||||||
$projecttocreate->ref = $defaultref;
|
$projecttocreate->ref = $defaultref;
|
||||||
|
}
|
||||||
// Overwrite values with values extracted from source email
|
|
||||||
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header);
|
|
||||||
|
|
||||||
if ($errorforthisaction)
|
if ($errorforthisaction)
|
||||||
{
|
{
|
||||||
@ -1610,7 +1630,7 @@ class EmailCollector extends CommonObject
|
|||||||
if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0))
|
if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0))
|
||||||
{
|
{
|
||||||
$errorforactions++;
|
$errorforactions++;
|
||||||
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref with numbering template '.$modele;
|
$this->error = 'Failed to create project: Can\'t get a valid value for project Ref with numbering template '.$modele.' thirdpartyid';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user