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: Some performance enhancements.
|
||||||
- New: Can attach files onto trip and expenses modules.
|
- New: Can attach files onto trip and expenses modules.
|
||||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR
|
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR
|
||||||
|
- New: Can define a hierarchical responsible on user
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- System of menu managers has been rewritten to reduce code to do same things.
|
- System of menu managers has been rewritten to reduce code to do same things.
|
||||||
|
|||||||
@ -994,7 +994,7 @@ class Form
|
|||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
// If no preselected user defined, we take current user
|
// 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
|
// Permettre l'exclusion d'utilisateurs
|
||||||
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
|
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
|
||||||
@ -1043,7 +1043,7 @@ class Form
|
|||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
|
$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);
|
$userstatic=new User($this->db);
|
||||||
|
|
||||||
|
|||||||
@ -114,3 +114,4 @@ YourRole=Your roles
|
|||||||
YourQuotaOfUsersIsReached=Your quota of active users is reached !
|
YourQuotaOfUsersIsReached=Your quota of active users is reached !
|
||||||
NbOfUsers=Nb of users
|
NbOfUsers=Nb of users
|
||||||
DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
|
DontDowngradeSuperAdmin=Only a superadmin can downgrade a superadmin
|
||||||
|
HierarchicalResponsible=Hierarchical responsible
|
||||||
@ -114,3 +114,4 @@ YourRole=Vos rôles
|
|||||||
YourQuotaOfUsersIsReached=Votre quota d'utilisateurs actifs est atteint !
|
YourQuotaOfUsersIsReached=Votre quota d'utilisateurs actifs est atteint !
|
||||||
NbOfUsers=Nb d'utilisateurs
|
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.= ", note = '".$this->db->escape($this->note)."'";
|
||||||
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
$sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||||
$sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"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.= ", entity = '".$this->entity."'";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -327,6 +327,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
$object->job = GETPOST("job");
|
$object->job = GETPOST("job");
|
||||||
$object->signature = GETPOST("signature");
|
$object->signature = GETPOST("signature");
|
||||||
$object->openid = GETPOST("openid");
|
$object->openid = GETPOST("openid");
|
||||||
|
$object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0;
|
||||||
|
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach($_POST as $key => $value)
|
foreach($_POST as $key => $value)
|
||||||
@ -1049,6 +1050,8 @@ else
|
|||||||
*/
|
*/
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
|
$rowspan=16;
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -1058,7 +1061,6 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$rowspan=15;
|
|
||||||
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++;
|
if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++;
|
||||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||||
@ -1146,22 +1148,6 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
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
|
// Type
|
||||||
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
||||||
$type=$langs->trans("Internal");
|
$type=$langs->trans("Internal");
|
||||||
@ -1170,7 +1156,7 @@ else
|
|||||||
if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')';
|
if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// ldap sid
|
// Ldap sid
|
||||||
if ($object->ldap_sid)
|
if ($object->ldap_sid)
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Type").'</td><td>';
|
||||||
@ -1203,6 +1189,18 @@ else
|
|||||||
print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false);
|
print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false);
|
||||||
print "</td></tr>\n";
|
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
|
// Statut
|
||||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1274,6 +1272,22 @@ else
|
|||||||
print '</tr>'."\n";
|
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
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$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)))
|
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="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="entity" value="'.$object->entity.'">';
|
print '<input type="hidden" name="entity" value="'.$object->entity.'">';
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
|
|
||||||
$rowspan=13;
|
|
||||||
|
|
||||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||||
if (! empty($conf->adherent->enabled)) $rowspan++;
|
if (! empty($conf->adherent->enabled)) $rowspan++;
|
||||||
|
|
||||||
@ -1693,21 +1707,6 @@ else
|
|||||||
print '</td></tr>';
|
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
|
// Type
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Type").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Type").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1806,12 +1805,34 @@ else
|
|||||||
print '</td></tr>';
|
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
|
// Statut
|
||||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $object->getLibStatut(4);
|
print $object->getLibStatut(4);
|
||||||
print '</td></tr>';
|
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
|
// Company / Contact
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user