Merge pull request #21108 from FHenry/15_fix_actioncomm_code_not_updated

fix: actioncomm.code have to be updated with correct c_actioncomm code (like in create)
This commit is contained in:
Laurent Destailleur 2022-06-07 11:38:41 +02:00 committed by GitHub
commit 78af5b9be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1127,8 +1127,16 @@ 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;
if (empty($this->type_code)) {
$cactioncomm = new CActionComm($this->db);
$result = $cactioncomm->fetch($this->type_id);
if ($result >= 0 && !empty($cactioncomm->code)) {
$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');