From f6e53b40dac2138cb700ffa1279df640527d56e0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 15:20:00 +0200 Subject: [PATCH 1/6] fix: actioncomm.code have to be updated with correct c_actioncomm code (like in create) until we decide to remove this column --- htdocs/comm/action/class/actioncomm.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1e640f7afbe..6369fe82cb7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1128,6 +1128,12 @@ class ActionComm extends CommonObject $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'"; + $cactioncomm = new CActionComm($this->db); + $result = $cactioncomm->fetch($this->type_id); + if ($result>=0) { + $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; + } + } $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); From d73982d1eb6f551856f2a15b4be9629388b085bf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 13:26:06 +0000 Subject: [PATCH 2/6] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6369fe82cb7..2c130117154 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1133,7 +1133,6 @@ class ActionComm extends CommonObject if ($result>=0) { $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; } - } $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); From 43207429aefda6537385e2ff157cc17642ae945f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 15:32:16 +0200 Subject: [PATCH 3/6] fix: actioncomm.code have to be updated with correct c_actioncomm code (like in create) until we decide to remove this column --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6369fe82cb7..f21face045f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'"; + $sql .= ", fk_action = ".(int)$this->type_id; $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id); if ($result>=0) { From 19dc0f124ce65b1c1f5a320b6471bccbec9b65e9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 13:37:55 +0000 Subject: [PATCH 4/6] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c92adc0a413..efb6d618e6f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = ".(int)$this->type_id; + $sql .= ", fk_action = ".(int) $this->type_id; $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id); if ($result>=0) { From 7f38d556485883f142f442292f1675b83b743531 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 21:28:17 +0200 Subject: [PATCH 5/6] 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'); From e48ce5b159c7d14dce501821de393505dee2ce41 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 19:34:39 +0000 Subject: [PATCH 6/6] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fe5769473c7..a5c8a11ade0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = ".(int)$this->type_id; + $sql .= ", fk_action = ".(int) $this->type_id; if (empty($this->type_code)) { $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id);