reduce complexity of user class
This commit is contained in:
parent
ab0f842db6
commit
4120d0f92c
@ -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>';
|
||||||
|
|
||||||
@ -2199,7 +2197,7 @@ class User extends CommonObject
|
|||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink';
|
if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
||||||
|
|
||||||
@ -2348,7 +2346,7 @@ class User extends CommonObject
|
|||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($option == 'nolink')
|
if ($option == 'nolink')
|
||||||
{
|
{
|
||||||
$linkstart = '';
|
$linkstart = '';
|
||||||
$linkend='';
|
$linkend='';
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2511,7 +2508,7 @@ class User extends CommonObject
|
|||||||
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
||||||
}
|
}
|
||||||
// Set LDAP password if possible
|
// Set LDAP password if possible
|
||||||
else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||||
{
|
{
|
||||||
@ -2524,7 +2521,7 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Use $this->pass_indatabase value if exists
|
// Use $this->pass_indatabase value if exists
|
||||||
else if (! empty($this->pass_indatabase))
|
elseif (! empty($this->pass_indatabase))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
|
if (! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
|
||||||
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
|
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
|
||||||
@ -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);
|
||||||
@ -3077,7 +3074,7 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
$langs->load("user");
|
$langs->load("user");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user