Fix error management when renaming a project with existing ref.
This commit is contained in:
parent
5842d1ee41
commit
e6846f5c01
@ -270,8 +270,9 @@ if (empty($reshook))
|
||||
$result=$object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors,'errors');
|
||||
$error++;
|
||||
if ($result == -4) setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
|
||||
else setEventMessages($object->error, $object->errors, 'errors');
|
||||
}else {
|
||||
// Category association
|
||||
$categories = GETPOST('categories');
|
||||
|
||||
@ -334,12 +334,19 @@ class Project extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::update error -2 " . $this->error, LOG_ERR);
|
||||
$result = -2;
|
||||
}
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$result = -4;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = -2;
|
||||
}
|
||||
dol_syslog(get_class($this)."::update error " . $result . " " . $this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user