Add badge with nb of imported calendard on user tab

This commit is contained in:
Laurent Destailleur 2017-05-06 12:43:45 +02:00
parent e8c60642e6
commit 44bdf91715
12 changed files with 48 additions and 29 deletions

View File

@ -59,6 +59,11 @@ function user_prepare_head($object)
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserGUISetup");
$head[$h][2] = 'guisetup';
$h++;
if ($canreadperms)
{
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
@ -67,15 +72,27 @@ function user_prepare_head($object)
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserGUISetup");
$head[$h][2] = 'guisetup';
$h++;
if (! empty($conf->agenda->enabled))
{
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$i=1;
$nbagenda = 0;
while ($i <= $MAXAGENDA)
{
$key=$i;
$name='AGENDA_EXT_NAME_'.$object->id.'_'.$key;
$src='AGENDA_EXT_SRC_'.$object->id.'_'.$key;
$offsettz='AGENDA_EXT_OFFSETTZ_'.$object->id.'_'.$key;
$color='AGENDA_EXT_COLOR_'.$object->id.'_'.$key;
$i++;
if (! empty($object->conf->$name)) $nbagenda++;
}
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
$head[$h][1] = $langs->trans("ExtSites");
$head[$h][1] = $langs->trans("ExtSites").($nbagenda ? ' <span class="badge">'.$nbagenda.'</span>' : '');
$head[$h][2] = 'extsites';
$h++;
}

View File

@ -202,7 +202,7 @@ $user_id = $user->id;
if ($id > 0)
{
// Charge utilisateur edite
$fuser->fetch($id);
$fuser->fetch($id, '', '', 1);
$fuser->getrights();
$user_id = $fuser->id;
}

View File

@ -42,7 +42,7 @@ $actiontest=GETPOST('test','alpha');
$actionsave=GETPOST('save','alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
// List of available colors
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5');
@ -50,7 +50,8 @@ $colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5')
// Security check
$id = GETPOST('id','int');
$object = new User($db);
$object->fetch($id);
$object->fetch($id, '', '', 1);
$object->getrights();
// Security check
$socid=0;
@ -81,12 +82,12 @@ if (empty($reshook)) {
if ($actionsave) {
$db->begin();
$i = 1;
$errorsaved = 0;
$error = 0;
$tabparam = array();
// Save agendas
$i = 1;
while ($i <= $MAXAGENDA) {
$name = trim(GETPOST('AGENDA_EXT_NAME_'.$id.'_'.$i, 'alpha'));
$src = trim(GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$i, 'alpha'));
@ -110,7 +111,7 @@ if (empty($reshook)) {
$tabparam['AGENDA_EXT_COLOR_'.$id.'_'.$i]=$color;
$tabparam['AGENDA_EXT_ENABLED_'.$id.'_'.$i]=$enabled;
$i ++;
$i++;
}
if (!$error) {
@ -167,7 +168,6 @@ print "<br>\n";
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
$var=true;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
@ -180,7 +180,6 @@ print '<td align="right">'.$langs->trans("Color").'</td>';
print "</tr>";
$i=1;
$var=true;
while ($i <= $MAXAGENDA)
{
$key=$i;
@ -189,7 +188,7 @@ while ($i <= $MAXAGENDA)
$offsettz='AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key;
$color='AGENDA_EXT_COLOR_'.$id.'_'.$key;
print '<tr class="oddeven">';
// Nb
print '<td class="maxwidth50onsmartphone">'.$langs->trans("AgendaExtNb",$key)."</td>";

View File

@ -50,7 +50,8 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
$object = new User($db);
if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
}
/*

View File

@ -1140,7 +1140,7 @@ else
if ($id > 0)
{
$object->fetch($id);
$object->fetch($id, '', '', 1);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
$res=$object->fetch_optionals($object->id,$extralabels);

View File

@ -83,7 +83,8 @@ llxHeader("","ClickToDial");
if ($id > 0)
{
$object = new User($db);
$object->fetch($id);
$object->fetch($id, '', '', 1);
$object->getrights();
$object->fetch_clicktodial();

View File

@ -86,7 +86,7 @@ if (! $sortfield) $sortfield="name";
$object = new User($db);
if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
$entitytouseforuserdir = $object->entity;
if (empty($entitytouseforuserdir)) $entitytouseforuserdir=1;

View File

@ -34,7 +34,7 @@ $id = GETPOST('id','int');
$object = new User($db);
if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
}

View File

@ -42,7 +42,7 @@ if ($user->id == $id) $feature2=''; // A user can always read its own card
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
$object = new User($db);
$object->fetch($id);
$object->fetch($id, '', '', 1);
$object->getrights();
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array

View File

@ -36,7 +36,7 @@ $langs->load("bills");
$langs->load("users");
$object = new User($db);
$object->fetch($id);
$object->fetch($id, '', '', 1);
$object->getrights();
// If user is not user read and no permission to read other users, we stop
@ -53,9 +53,9 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
$hookmanager->initHooks(array('usercard','globalcard'));
/******************************************************************************/
/* Actions */
/******************************************************************************/
/*
* Actions
*/
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -76,9 +76,9 @@ if (empty($reshook)) {
}
/******************************************************************************/
/* Affichage fiche */
/******************************************************************************/
/*
* View
*/
llxHeader();

View File

@ -122,7 +122,8 @@ if ($action == 'delete')
$form = new Form($db);
$object = new User($db);
$result=$object->fetch($id);
$result=$object->fetch($id, '', '', 1);
$object->getrights();
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notification");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notification");

View File

@ -68,7 +68,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && ! $canreaduser) accessforbidden();
$object = new User($db);
$object->fetch($id);
$object->fetch($id, '', '', 1);
$object->getrights();
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array