Merge pull request #7768 from hregis/develop_bug
Fix: move transversal mode management in multicompany module
This commit is contained in:
commit
8a8842c8f0
@ -68,7 +68,8 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire))
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','useragenda','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -48,19 +48,13 @@ if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherent
|
|||||||
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','aZ09');
|
||||||
$mode = GETPOST('mode','alpha');
|
$mode = GETPOST('mode','alpha');
|
||||||
$confirm = GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$subaction = GETPOST('subaction','alpha');
|
$subaction = GETPOST('subaction','alpha');
|
||||||
$group = GETPOST("group","int",3);
|
$group = GETPOST("group","int",3);
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Users/Groups management only in master entity if transverse mode
|
|
||||||
if (($action == 'create' || $action == 'adduserldap') && ! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
|
||||||
{
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define value to know what current user can do on users
|
// Define value to know what current user can do on users
|
||||||
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
|
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
|
||||||
$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire);
|
$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire);
|
||||||
@ -106,7 +100,8 @@ $extrafields = new ExtraFields($db);
|
|||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +109,7 @@ $hookmanager->initHooks(array('usercard','globalcard'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array('id'=>$socid);
|
$parameters=array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $caneditgroup);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
@ -279,7 +274,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action add usergroup
|
// Action add usergroup
|
||||||
if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
|
if (($action == 'addgroup' || $action == 'removegroup') && $caneditgroup)
|
||||||
{
|
{
|
||||||
if ($group)
|
if ($group)
|
||||||
{
|
{
|
||||||
@ -289,10 +284,10 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($action == 'addgroup') {
|
if ($action == 'addgroup') {
|
||||||
$result = $object->SetInGroup($group, (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? GETPOST('entity', 'int') : $editgroup->entity));
|
$result = $object->SetInGroup($group, $editgroup->entity);
|
||||||
}
|
}
|
||||||
if ($action == 'removegroup') {
|
if ($action == 'removegroup') {
|
||||||
$result = $object->RemoveFromGroup($group, (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? GETPOST('entity', 'int') : $editgroup->entity));
|
$result = $object->RemoveFromGroup($group, $editgroup->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -1706,7 +1701,7 @@ else
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
|
|
||||||
if (GETPOST('action','aZ09') != 'presend' && GETPOST('action','aZ09') != 'send')
|
if ($action != 'presend' && $action != 'send')
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* List of groups of user
|
* List of groups of user
|
||||||
@ -1724,12 +1719,9 @@ else
|
|||||||
|
|
||||||
if (! empty($groupslist))
|
if (! empty($groupslist))
|
||||||
{
|
{
|
||||||
if (! (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)))
|
foreach($groupslist as $groupforuser)
|
||||||
{
|
{
|
||||||
foreach($groupslist as $groupforuser)
|
$exclude[]=$groupforuser->id;
|
||||||
{
|
|
||||||
$exclude[]=$groupforuser->id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1741,99 +1733,61 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Groups").'</th>'."\n";
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
// Other form for add user to group
|
||||||
|
$parameters=array('caneditgroup' => $caneditgroup, 'groupslist' => $groupslist, 'exclude' => $exclude);
|
||||||
|
$reshook=$hookmanager->executeHooks('formAddUserToGroup',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print '<th class="liste_titre">'.$langs->trans("Entity").'</td>';
|
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Groups").'</th>'."\n";
|
||||||
}
|
print '<th class="liste_titre" align="right">';
|
||||||
print '<th class="liste_titre" align="right">';
|
if ($caneditgroup)
|
||||||
if ($caneditgroup)
|
|
||||||
{
|
|
||||||
// Users/Groups management only in master entity if transverse mode
|
|
||||||
if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
|
||||||
{
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
|
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
|
||||||
print ' ';
|
print ' ';
|
||||||
// Multicompany
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||||
if (! empty($conf->multicompany->enabled))
|
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />';
|
||||||
|
}
|
||||||
|
print '</th></tr>'."\n";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Groups assigned to user
|
||||||
|
*/
|
||||||
|
if (! empty($groupslist))
|
||||||
|
{
|
||||||
|
foreach($groupslist as $group)
|
||||||
{
|
{
|
||||||
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
if ($caneditgroup)
|
||||||
{
|
{
|
||||||
print '</td><td>'.$langs->trans("Entity").'</td>';
|
print '<a href="'.DOL_URL_ROOT.'/user/group/card.php?id='.$group->id.'">'.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.'</a>';
|
||||||
print "<td>".$mc->select_entities($conf->entity);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
print img_object($langs->trans("ShowGroup"),"group").' '.$group->name;
|
||||||
}
|
}
|
||||||
}
|
print '</td>';
|
||||||
else
|
print '<td align="right">';
|
||||||
{
|
if ($caneditgroup)
|
||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
|
||||||
}
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</th></tr>'."\n";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Groups assigned to user
|
|
||||||
*/
|
|
||||||
if (! empty($groupslist))
|
|
||||||
{
|
|
||||||
foreach($groupslist as $group)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td>';
|
|
||||||
if ($caneditgroup)
|
|
||||||
{
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/user/group/card.php?id='.$group->id.'">'.img_object($langs->trans("ShowGroup"),"group").' '.$group->name.'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print img_object($langs->trans("ShowGroup"),"group").' '.$group->name;
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
|
||||||
{
|
|
||||||
print '<td class="valeur">';
|
|
||||||
if (! empty($group->usergroup_entity))
|
|
||||||
{
|
{
|
||||||
$nb=0;
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removegroup&group='.$group->id.'">';
|
||||||
foreach($group->usergroup_entity as $group_entity)
|
print img_delete($langs->trans("RemoveFromGroup"));
|
||||||
{
|
print '</a>';
|
||||||
$mc->getInfo($group_entity);
|
|
||||||
print ($nb > 0 ? ', ' : '').$mc->label;
|
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removegroup&group='.$group->id.'&entity='.$group_entity.'">';
|
|
||||||
print img_delete($langs->trans("RemoveFromGroup"));
|
|
||||||
print '</a>';
|
|
||||||
$nb++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
print '<td align="right">';
|
|
||||||
if ($caneditgroup && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removegroup&group='.$group->id.'">';
|
|
||||||
print img_delete($langs->trans("RemoveFromGroup"));
|
|
||||||
print '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
print "</td></tr>\n";
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -94,7 +94,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','userdoc','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -135,7 +136,7 @@ if ($object->id)
|
|||||||
if ($user->rights->user->user->lire || $user->admin) {
|
if ($user->rights->user->user->lire || $user->admin) {
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
@ -163,7 +164,7 @@ if ($object->id)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -65,159 +65,167 @@ $extrafields = new ExtraFields($db);
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$hookmanager->initHooks(array('groupcard','globalcard'));
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||||
|
$contextpage=array('groupcard','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action remove group
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($action == 'confirm_delete' && $confirm == "yes")
|
|
||||||
{
|
|
||||||
if ($caneditperms)
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
$object->delete();
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$parameters=array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms);
|
||||||
* Action add group
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
*/
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
if ($action == 'add')
|
|
||||||
{
|
|
||||||
if ($caneditperms)
|
|
||||||
{
|
|
||||||
if (! $_POST["nom"]) {
|
|
||||||
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
|
|
||||||
$action="create"; // Go back to create page
|
|
||||||
} else {
|
|
||||||
$object->nom = trim($_POST["nom"]); // For backward compatibility
|
|
||||||
$object->name = trim($_POST["nom"]);
|
|
||||||
$object->note = trim($_POST["note"]);
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
if (empty($reshook)) {
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
|
||||||
if ($ret < 0) $error++;
|
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;
|
// Action remove group
|
||||||
else $object->entity = $_POST["entity"];
|
if ($action == 'confirm_delete' && $confirm == "yes")
|
||||||
|
{
|
||||||
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->delete();
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$db->begin();
|
// Action add group
|
||||||
|
if ($action == 'add')
|
||||||
|
{
|
||||||
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
if (! $_POST["nom"]) {
|
||||||
|
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
|
||||||
|
$action="create"; // Go back to create page
|
||||||
|
} else {
|
||||||
|
$object->nom = trim($_POST["nom"]); // For backward compatibility
|
||||||
|
$object->name = trim($_POST["nom"]);
|
||||||
|
$object->note = trim($_POST["note"]);
|
||||||
|
|
||||||
$id = $object->create();
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($id > 0)
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;
|
||||||
{
|
else $object->entity = $_POST["entity"];
|
||||||
$db->commit();
|
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
$db->begin();
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
|
|
||||||
$langs->load("errors");
|
$id = $object->create();
|
||||||
setEventMessages($langs->trans("ErrorGroupAlreadyExists",$object->name), null, 'errors');
|
|
||||||
$action="create"; // Go back to create page
|
if ($id > 0)
|
||||||
}
|
{
|
||||||
}
|
$db->commit();
|
||||||
}
|
|
||||||
else
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
{
|
exit;
|
||||||
$langs->load("errors");
|
}
|
||||||
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
else
|
||||||
}
|
{
|
||||||
}
|
$db->rollback();
|
||||||
|
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorGroupAlreadyExists",$object->name), null, 'errors');
|
||||||
|
$action="create"; // Go back to create page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add/Remove user into group
|
||||||
|
if ($action == 'adduser' || $action =='removeuser')
|
||||||
|
{
|
||||||
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
if ($userid > 0)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->oldcopy = clone $object;
|
||||||
|
|
||||||
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($userid);
|
||||||
|
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,$object->entity);
|
||||||
|
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,$object->entity);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($edituser->error, $edituser->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($action == 'update')
|
||||||
|
{
|
||||||
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
// Add/Remove user into group
|
|
||||||
if ($action == 'adduser' || $action =='removeuser')
|
|
||||||
{
|
|
||||||
if ($caneditperms)
|
|
||||||
{
|
|
||||||
if ($userid > 0)
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
$object->oldcopy = clone $object;
|
$object->oldcopy = clone $object;
|
||||||
|
|
||||||
$edituser = new User($db);
|
$object->name = trim($_POST["group"]);
|
||||||
$edituser->fetch($userid);
|
$object->nom = $object->name; // For backward compatibility
|
||||||
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,(! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?GETPOST('entity','int'):$object->entity));
|
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||||
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,(! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?GETPOST('entity','int'):$object->entity));
|
|
||||||
|
|
||||||
if ($result > 0)
|
// Fill array 'array_options' with data from add form
|
||||||
{
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
if ($ret < 0) $error++;
|
||||||
exit;
|
|
||||||
}
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;
|
||||||
else
|
else $object->entity = $_POST["entity"];
|
||||||
{
|
|
||||||
setEventMessages($edituser->error, $edituser->errors, 'errors');
|
$ret=$object->update();
|
||||||
}
|
|
||||||
}
|
if ($ret >= 0 && ! count($object->errors))
|
||||||
}
|
{
|
||||||
else
|
setEventMessages($langs->trans("GroupModified"), null, 'mesgs');
|
||||||
{
|
$db->commit();
|
||||||
$langs->load("errors");
|
}
|
||||||
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
|
else
|
||||||
}
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actions to build doc
|
||||||
|
$upload_dir = $conf->usergroup->dir_output;
|
||||||
|
$permissioncreate=$user->rights->user->user->creer;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'update')
|
|
||||||
{
|
|
||||||
if ($caneditperms)
|
|
||||||
{
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$object->fetch($id);
|
|
||||||
|
|
||||||
$object->oldcopy = clone $object;
|
|
||||||
|
|
||||||
$object->name = trim($_POST["group"]);
|
|
||||||
$object->nom = $object->name; // For backward compatibility
|
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
|
||||||
if ($ret < 0) $error++;
|
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;
|
|
||||||
else $object->entity = $_POST["entity"];
|
|
||||||
|
|
||||||
$ret=$object->update();
|
|
||||||
|
|
||||||
if ($ret >= 0 && ! count($object->errors))
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("GroupModified"), null, 'mesgs');
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
$db->rollback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actions to build doc
|
|
||||||
$upload_dir = $conf->usergroup->dir_output;
|
|
||||||
$permissioncreate=$user->rights->user->user->creer;
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -384,117 +392,87 @@ else
|
|||||||
// On selectionne les users qui ne sont pas deja dans le groupe
|
// On selectionne les users qui ne sont pas deja dans le groupe
|
||||||
$exclude = array();
|
$exclude = array();
|
||||||
|
|
||||||
if (! empty($object->members))
|
|
||||||
{
|
|
||||||
if (! (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)))
|
|
||||||
{
|
|
||||||
foreach($object->members as $useringroup)
|
|
||||||
{
|
|
||||||
$exclude[]=$useringroup->id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($caneditperms)
|
|
||||||
{
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="adduser">';
|
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
|
||||||
print '<tr class="liste_titre"><td class="titlefield liste_titre">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
|
|
||||||
print ' ';
|
|
||||||
// Multicompany
|
|
||||||
if (! empty($conf->multicompany->enabled) && is_object($mc))
|
|
||||||
{
|
|
||||||
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
|
||||||
{
|
|
||||||
print '</td><td class="tdtop">'.$langs->trans("Entity").'</td>';
|
|
||||||
print "<td>".$mc->select_entities($conf->entity);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
|
||||||
}
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
|
||||||
print '</td></tr>'."\n";
|
|
||||||
print '</table></form>'."\n";
|
|
||||||
print '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Group members
|
|
||||||
*/
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
|
|
||||||
print '<td class="liste_titre">'.$langs->trans("Lastname").'</td>';
|
|
||||||
print '<td class="liste_titre">'.$langs->trans("Firstname").'</td>';
|
|
||||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1)
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre">'.$langs->trans("Entity").'</td>';
|
|
||||||
}
|
|
||||||
print '<td class="liste_titre" width="5" align="center">'.$langs->trans("Status").'</td>';
|
|
||||||
print '<td class="liste_titre" width="5" align="right"> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
if (! empty($object->members))
|
if (! empty($object->members))
|
||||||
{
|
{
|
||||||
foreach($object->members as $useringroup)
|
foreach($object->members as $useringroup)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
$exclude[]=$useringroup->id;
|
||||||
print '<td>';
|
|
||||||
print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login');
|
|
||||||
if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
|
||||||
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$useringroup->lastname.'</td>';
|
|
||||||
print '<td>'.$useringroup->firstname.'</td>';
|
|
||||||
if (! empty($conf->multicompany->enabled) && is_object($mc) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
|
||||||
{
|
|
||||||
print '<td class="valeur">';
|
|
||||||
if (! empty($useringroup->usergroup_entity))
|
|
||||||
{
|
|
||||||
$nb=0;
|
|
||||||
foreach($useringroup->usergroup_entity as $group_entity)
|
|
||||||
{
|
|
||||||
$mc->getInfo($group_entity);
|
|
||||||
print ($nb > 0 ? ', ' : '').$mc->label;
|
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'&entity='.$group_entity.'">';
|
|
||||||
print img_delete($langs->trans("RemoveFromGroup"));
|
|
||||||
print '</a>';
|
|
||||||
$nb++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print '<td align="center">'.$useringroup->getLibStatut(3).'</td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
if (! empty($user->admin) && empty($conf->multicompany->enabled))
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'">';
|
|
||||||
print img_delete($langs->trans("RemoveFromGroup"));
|
|
||||||
print '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "-";
|
|
||||||
}
|
|
||||||
print "</td></tr>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// Other form for add user to group
|
||||||
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
$parameters=array('caneditperms' => $caneditperms, 'exclude' => $exclude);
|
||||||
}
|
$reshook=$hookmanager->executeHooks('formAddUserToGroup',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print "</table>";
|
print $hookmanager->resPrint;
|
||||||
print "<br>";
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="adduser">';
|
||||||
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
print '<tr class="liste_titre"><td class="titlefield liste_titre">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
|
||||||
|
print ' ';
|
||||||
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
print '</table></form>'."\n";
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Group members
|
||||||
|
*/
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
|
||||||
|
print '<td class="liste_titre">'.$langs->trans("Lastname").'</td>';
|
||||||
|
print '<td class="liste_titre">'.$langs->trans("Firstname").'</td>';
|
||||||
|
print '<td class="liste_titre" width="5" align="center">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td class="liste_titre" width="5" align="right"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if (! empty($object->members))
|
||||||
|
{
|
||||||
|
foreach($object->members as $useringroup)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login');
|
||||||
|
if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
||||||
|
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
||||||
|
print '</td>';
|
||||||
|
print '<td>'.$useringroup->lastname.'</td>';
|
||||||
|
print '<td>'.$useringroup->firstname.'</td>';
|
||||||
|
print '<td align="center">'.$useringroup->getLibStatut(3).'</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
if (! empty($user->admin))
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'">';
|
||||||
|
print img_delete($langs->trans("RemoveFromGroup"));
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "-";
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<br>";
|
||||||
|
|
||||||
|
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents generes
|
* Documents generes
|
||||||
|
|||||||
@ -46,7 +46,9 @@ $object->fetch($id, '', '', 1);
|
|||||||
$object->getrights();
|
$object->getrights();
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','userldap','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -50,7 +50,8 @@ if ($user->id == $id) $feature2=''; // A user can always read its own card
|
|||||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','usernote','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -96,11 +97,11 @@ if ($id)
|
|||||||
if ($user->rights->user->user->lire || $user->admin) {
|
if ($user->rights->user->user->lire || $user->admin) {
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,8 @@ $form = new Form($db);
|
|||||||
$formadmin=new FormAdmin($db);
|
$formadmin=new FormAdmin($db);
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('usercard','globalcard'));
|
$contextpage=array('usercard','userihm','globalcard');
|
||||||
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -188,9 +189,9 @@ if ($action == 'edit')
|
|||||||
if ($user->rights->user->user->lire || $user->admin) {
|
if ($user->rights->user->user->lire || $user->admin) {
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{/*
|
{/*
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
@ -204,7 +205,7 @@ if ($action == 'edit')
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';*/
|
</script>';*/
|
||||||
}
|
}
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
@ -213,16 +214,16 @@ if ($action == 'edit')
|
|||||||
{
|
{
|
||||||
if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
|
if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
|
||||||
else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
|
else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
|
||||||
|
|
||||||
if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
|
if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
|
||||||
else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
|
else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
|
||||||
|
|
||||||
if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
|
if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
|
||||||
else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
|
else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
|
||||||
|
|
||||||
if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
|
if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
|
||||||
else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
|
else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
|
||||||
|
|
||||||
if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
|
if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
|
||||||
else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
|
else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ if ($action == 'edit')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -245,7 +246,7 @@ if ($action == 'edit')
|
|||||||
print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td> </td><td>'.$langs->trans("PersonalValue").'</td></tr>';
|
print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td> </td><td>'.$langs->trans("PersonalValue").'</td></tr>';
|
||||||
|
|
||||||
// Landing page
|
// Landing page
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE);
|
print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE);
|
||||||
@ -257,9 +258,9 @@ if ($action == 'edit')
|
|||||||
print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
|
print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
|
||||||
//print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
|
//print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Langue par defaut
|
// Langue par defaut
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
||||||
@ -274,7 +275,7 @@ if ($action == 'edit')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Taille max des listes
|
// Taille max des listes
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
|
||||||
print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
|
print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
|
||||||
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"");
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"");
|
||||||
@ -300,18 +301,18 @@ if ($action == 'edit')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_fiche_head($head, 'guisetup', $title, -1, 'user');
|
dol_fiche_head($head, 'guisetup', $title, -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td> </td><td>'.$langs->trans("PersonalValue").'</td></tr>';
|
print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td> </td><td>'.$langs->trans("PersonalValue").'</td></tr>';
|
||||||
|
|
||||||
// Landing page
|
// Landing page
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE);
|
print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE);
|
||||||
@ -327,9 +328,9 @@ else
|
|||||||
else print $object->conf->MAIN_LANDING_PAGE;
|
else print $object->conf->MAIN_LANDING_PAGE;
|
||||||
//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
|
//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
$s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
|
||||||
@ -343,7 +344,7 @@ else
|
|||||||
print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($object->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT):''));
|
print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($object->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT):''));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
|
||||||
print '<td>'.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').'</td>';
|
print '<td>'.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').'</td>';
|
||||||
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
|
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
|
||||||
|
|||||||
@ -73,7 +73,7 @@ $object->getrights();
|
|||||||
$entity=$conf->entity;
|
$entity=$conf->entity;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$contextpage=array('usercard','globalcard');
|
$contextpage=array('usercard','userperms','globalcard');
|
||||||
$hookmanager->initHooks($contextpage);
|
$hookmanager->initHooks($contextpage);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user