Merge pull request #9529 from frederic34/patch-14
reduce complexity of user class
This commit is contained in:
commit
8c8c4bad21
@ -2169,9 +2169,7 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
|
function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
|
||||||
{
|
{
|
||||||
$result='';
|
$result ='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
|
||||||
|
|
||||||
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
|
|
||||||
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
||||||
$result.='</a>';
|
$result.='</a>';
|
||||||
|
|
||||||
@ -2388,34 +2386,33 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
elseif ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
elseif ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
|
elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
elseif ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
|
elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
elseif ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
|
elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
elseif ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
|
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
|
||||||
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
|
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2436,8 +2433,8 @@ class User extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
$dn='';
|
$dn='';
|
||||||
if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN;
|
if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN;
|
||||||
if ($mode==1) $dn=$conf->global->LDAP_USER_DN;
|
elseif ($mode==1) $dn=$conf->global->LDAP_USER_DN;
|
||||||
if ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS];
|
elseif ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS];
|
||||||
return $dn;
|
return $dn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3020,7 +3017,7 @@ class User extends CommonObject
|
|||||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||||
{
|
{
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'user'
|
'user',
|
||||||
);
|
);
|
||||||
|
|
||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user