mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
Clean code
This commit is contained in:
@@ -4424,7 +4424,7 @@ abstract class CommonObject
|
||||
//Eliminate copied source object extra_fields that do not exist in target object
|
||||
$new_array_options=array();
|
||||
foreach ($this->array_options as $key => $value) {
|
||||
if (in_array(substr($key,8), array_keys($target_extrafields)))
|
||||
if (in_array(substr($key,8), array_keys($target_extrafields))) // We remove the 'options_' from $key
|
||||
$new_array_options[$key] = $value;
|
||||
}
|
||||
|
||||
@@ -4510,6 +4510,7 @@ abstract class CommonObject
|
||||
$sql.=",".$attributeKey;
|
||||
}
|
||||
$sql .= ") VALUES (".$this->id;
|
||||
|
||||
foreach($new_array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
|
||||
@@ -1336,7 +1336,7 @@ class ExtraFields
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=(abs($list)!=1 ? 1 : 0);
|
||||
|
||||
if ($hidden) return '';
|
||||
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
||||
|
||||
// If field is a computed field, value must become result of compute
|
||||
if ($computed)
|
||||
|
||||
@@ -42,6 +42,9 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Discard if extrafield is a hidden field
|
||||
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
|
||||
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
||||
|
||||
@@ -163,7 +163,8 @@ class User extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a user from database with its id or ref (login)
|
||||
* Load a user from database with its id or ref (login).
|
||||
* This function does not load permissions, only user properties. Use getrights() for this just after the fetch.
|
||||
*
|
||||
* @param int $id If defined, id to used for search
|
||||
* @param string $login If defined, login to used for search
|
||||
|
||||
Reference in New Issue
Block a user