From 7f38d556485883f142f442292f1675b83b743531 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 21:28:17 +0200 Subject: [PATCH] better fix --- htdocs/comm/action/class/actioncomm.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c92adc0a413..b9cd825ad49 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1128,12 +1128,15 @@ class ActionComm extends CommonObject $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { $sql .= ", fk_action = ".(int)$this->type_id; - $cactioncomm = new CActionComm($this->db); - $result = $cactioncomm->fetch($this->type_id); - if ($result>=0) { - $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; + if (empty($this->type_code)) { + $cactioncomm = new CActionComm($this->db); + $result = $cactioncomm->fetch($this->type_id); + if ($result>=0) { + $this->type_code = $cactioncomm->code; + } } } + $sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null"); $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');