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_public = (string) GETPOST("note_public", 'restricthtml');
$object->note_private = (string) GETPOST("note_private", 'restricthtml'); $object->note_private = (string) GETPOST("note_private", 'restricthtml');
if (GETPOSTISSET("roles")) { $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
$object->roles = GETPOST("roles", 'array');
}
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);

View File

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