New: Can define a hierarchical responsible on users.
This commit is contained in:
parent
145573ea79
commit
b1ee14ce60
@ -7,6 +7,7 @@ For users:
|
||||
- New: Some performance enhancements.
|
||||
- New: Can attach files onto trip and expenses modules.
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR
|
||||
- New: Can define a hierarchical responsible on user
|
||||
|
||||
For developers:
|
||||
- System of menu managers has been rewritten to reduce code to do same things.
|
||||
|
||||
@ -994,7 +994,7 @@ class Form
|
||||
global $conf,$user,$langs;
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if ($selected < -1 && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
if ((is_numeric($selected) && ($selected < -1 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
|
||||
// Permettre l'exclusion d'utilisateurs
|
||||
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
|
||||
@ -1043,7 +1043,7 @@ class Form
|
||||
if ($num)
|
||||
{
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected="selected"':'').'> </option>'."\n";
|
||||
|
||||
$userstatic=new User($this->db);
|
||||
|
||||
|
||||
@ -113,4 +113,5 @@ NameToCreate=Name of third party to create
|
||||
YourRole=Your roles
|
||||
YourQuotaOfUsersIsReached=Your quota of active users is reached !
|
||||
NbOfUsers=Nb of users
|
||||
DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
|
||||
DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
|
||||
HierarchicalResponsible=Hierarchical responsible
|
||||
@ -113,4 +113,5 @@ NameToCreate=Nom du tiers à créer
|
||||
YourRole=Vos rôles
|
||||
YourQuotaOfUsersIsReached=Votre quota d'utilisateurs actifs est atteint !
|
||||
NbOfUsers=Nb d'utilisateurs
|
||||
DontDowngradeSuperAdmin=Seul un superadmin peut rétrograder un superadmin
|
||||
DontDowngradeSuperAdmin=Seul un superadmin peut rétrograder un superadmin
|
||||
HierarchicalResponsible=Responsable hierarchique
|
||||
@ -1140,6 +1140,7 @@ class User extends CommonObject
|
||||
$sql.= ", note = '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||
$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");
|
||||
$sql.= ", fk_user = ".($this->fk_user > 0?"'".$this->db->escape($this->fk_user)."'":"null");
|
||||
$sql.= ", entity = '".$this->entity."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
|
||||
@ -327,6 +327,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
$object->job = GETPOST("job");
|
||||
$object->signature = GETPOST("signature");
|
||||
$object->openid = GETPOST("openid");
|
||||
$object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0;
|
||||
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
@ -1049,6 +1050,8 @@ else
|
||||
*/
|
||||
if ($action != 'edit')
|
||||
{
|
||||
$rowspan=16;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -1058,7 +1061,6 @@ else
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$rowspan=15;
|
||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
@ -1146,22 +1148,6 @@ else
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">';
|
||||
if ($object->admin && ! $object->entity)
|
||||
{
|
||||
print $langs->trans("AllEntities");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mc->getInfo($object->entity);
|
||||
print $mc->label;
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
||||
$type=$langs->trans("Internal");
|
||||
@ -1170,7 +1156,7 @@ else
|
||||
if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// ldap sid
|
||||
// Ldap sid
|
||||
if ($object->ldap_sid)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
||||
@ -1202,7 +1188,19 @@ else
|
||||
print '<tr><td valign="top">'.$langs->trans('Signature').'</td><td>';
|
||||
print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false);
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
// Hierarchy
|
||||
print '<tr><td valign="top">'.$langs->trans("HierarchicalResponsible").'</td>';
|
||||
print '<td>';
|
||||
if (empty($object->fk_user)) print $langs->trans("None");
|
||||
else {
|
||||
$huser=new User($db);
|
||||
$huser->fetch($object->fk_user);
|
||||
print $huser->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Statut
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
@ -1225,7 +1223,7 @@ else
|
||||
print '<td>'.$object->openid.'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
// Company / Contact
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
@ -1274,6 +1272,22 @@ else
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">';
|
||||
if ($object->admin && ! $object->entity)
|
||||
{
|
||||
print $langs->trans("AllEntities");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mc->getInfo($object->entity);
|
||||
print $mc->label;
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="2"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -1512,14 +1526,14 @@ else
|
||||
|
||||
if ($action == 'edit' && ($canedituser || ($user->id == $object->id)))
|
||||
{
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">';
|
||||
$rowspan=14;
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="entity" value="'.$object->entity.'">';
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
$rowspan=13;
|
||||
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||
|
||||
@ -1693,21 +1707,6 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($object->entity);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||
}
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Type").'</td>';
|
||||
print '<td>';
|
||||
@ -1788,7 +1787,7 @@ else
|
||||
print '<td>';
|
||||
print '<textarea name="signature" rows="5" cols="90">'.dol_htmlentitiesbr_decode($object->signature).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// openid
|
||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode))
|
||||
{
|
||||
@ -1806,12 +1805,34 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Hierarchy
|
||||
print '<tr><td valign="top">'.$langs->trans("HierarchicalResponsible").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id));
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Statut
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $object->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($object->entity);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||
}
|
||||
}
|
||||
|
||||
// Company / Contact
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user