fix set project for actioncomm (#35543)

This commit is contained in:
Frédéric FRANCE 2025-09-29 21:07:00 +02:00 committed by GitHub
parent b84969a548
commit dd67cab64f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2631,21 +2631,21 @@ abstract class CommonObject
}
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
// @phan-suppress-next-line PhanTypeMismatchProperty
if (!empty($this->fields['fk_project'])) { // Common case
if ($projectid) {
$sql .= " SET fk_project = ".((int) $projectid);
} else {
$sql .= " SET fk_project = NULL";
}
$sql .= ' WHERE rowid = '.((int) $this->id);
} elseif ($this->table_element == 'actioncomm') { // Special case for actioncomm
if ($this->table_element == 'actioncomm') { // Special case for actioncomm
if ($projectid) {
$sql .= " SET fk_project = ".((int) $projectid);
} else {
$sql .= " SET fk_project = NULL";
}
$sql .= ' WHERE id = '.((int) $this->id);
// @phan-suppress-next-line PhanTypeMismatchProperty
} elseif (!empty($this->fields['fk_project'])) { // Common case
if ($projectid) {
$sql .= " SET fk_project = ".((int) $projectid);
} else {
$sql .= " SET fk_project = NULL";
}
$sql .= ' WHERE rowid = '.((int) $this->id);
} else { // Special case for old architecture objects
if ($projectid) {
$sql .= ' SET fk_projet = '.((int) $projectid);