From dde3b3ef6523f9d8f26c5fd26821d878638acb37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 3 Oct 2014 18:25:38 +0200 Subject: [PATCH] Fix: Event update --- htdocs/comm/action/card.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 970eb1d4725..2b59b6cf622 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -396,7 +396,7 @@ if ($action == 'update') $tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); foreach($tmplist1 as $key => $val) { - if ($val['id'] && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; + if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 01ebadceb2e..692ce2058d3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -417,7 +417,9 @@ class ActionComm extends CommonObject while ($obj = $this->db->fetch_object($resql2)) { $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency); + if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this) } + return 1; } else @@ -528,6 +530,8 @@ 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)); + $userownerid=($this->userownerid?$this->userownerid:((isset($this->usertodo->id) && $this->usertodo->id > 0) ? $this->usertodo->id : 0)); + $userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0)); $this->db->begin(); @@ -547,8 +551,8 @@ class ActionComm extends CommonObject $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); $sql.= ", transparency = '".$this->transparency."'"; $sql.= ", fk_user_mod = '".$user->id."'"; - $sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); - $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); + $sql.= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'":"null"); + $sql.= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'":"null"); if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null"); if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null"); $sql.= " WHERE id=".$this->id; -- GitLab