fix(mssql): when updating an object by id, omit the id itself

It is a useless update and id is an identity column in MSSQL,
which is not updatable and throws an error if you try.

This affects the following seven objects (Models):
- Category
- CustomFilter
- Group
- Project
- Subtask
- TaskExternalLink
- User
This commit is contained in:
Joe Nahmias
2022-07-08 17:38:45 -04:00
committed by Frédéric Guillot
parent 29df527979
commit 3df89f9df2
7 changed files with 21 additions and 7 deletions

View File

@@ -483,8 +483,10 @@ class ProjectModel extends Base
$this->helper->model->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end', 'task_limit'));
$updates = $values;
unset($updates['id']);
return $this->exists($values['id']) &&
$this->db->table(self::TABLE)->eq('id', $values['id'])->save($values);
$this->db->table(self::TABLE)->eq('id', $values['id'])->save($updates);
}
/**