2
0
forked from Wavyzz/dolibarr

Fix default contact id for update and clone actions in event card

This commit is contained in:
Lionel VESSILLER
2019-03-06 12:00:55 +01:00
parent 5a07281bb3
commit b56cd11f02
2 changed files with 11 additions and 3 deletions

View File

@@ -160,6 +160,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
{
if ($id > 0) {
$object->fetch($id);
if (!empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
}
$result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid'));
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
@@ -431,6 +435,10 @@ if ($action == 'update')
$object->socpeopleassigned = array();
foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid);
$object->contactid = GETPOST("contactid", 'int');
if (empty($object->contactid) && !empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
}
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", "none"); // deprecated
$object->note_private= GETPOST("note", "none");

View File

@@ -270,7 +270,7 @@ class ActionComm extends CommonObject
$this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency);
}
if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
//if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
$userownerid=$this->userownerid;
@@ -656,7 +656,7 @@ class ActionComm extends CommonObject
$this->fk_project = $obj->fk_project; // To have fetch_project method working
$this->societe->id = $obj->fk_soc; // deprecated
$this->contact->id = $obj->fk_contact; // deprecated
//$this->contact->id = $obj->fk_contact; // deprecated
$this->fk_element = $obj->elementid;
$this->elementid = $obj->elementid;
@@ -867,7 +867,7 @@ class ActionComm extends CommonObject
}
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
$contactid=($this->contactid?$this->contactid:0);
$userownerid=($this->userownerid?$this->userownerid:0);
$userdoneid=($this->userdoneid?$this->userdoneid:0);