Fix update default contact type

This commit is contained in:
Laurent Destailleur 2021-01-22 14:10:08 +01:00
parent 93ca27d808
commit 7e8d06e8b8
2 changed files with 3 additions and 5 deletions

View File

@ -400,9 +400,7 @@ if (empty($reshook))
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
if (GETPOSTISSET("roles")) {
$object->roles = GETPOST("roles", 'array');
}
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);

View File

@ -1747,14 +1747,14 @@ class Contact extends CommonObject
if (count($this->roles) > 0) {
foreach ($this->roles as $keyRoles => $valRoles) {
$idrole = 0;
if (is_array($idrole)) {
if (is_array($valRoles)) {
$idrole = $valRoles['id'];
} else {
$idrole = $valRoles;
}
$socid = 0;
if (is_array($idrole)) {
if (is_array($valRoles)) {
$socid = $valRoles['socid'];
} else {
$socid = $this->socid;