Fix into badges visibility
This commit is contained in:
parent
718e9a7226
commit
2e5cc98e59
@ -59,7 +59,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
|
|||||||
$object->old_name='';
|
$object->old_name='';
|
||||||
$object->old_firstname='';
|
$object->old_firstname='';
|
||||||
// Logo/Photo save
|
// Logo/Photo save
|
||||||
$dir= $conf->societe->dir_output.'/contact/' . get_exdir($object->id,2,0,1,$object,'contact').'/photos';
|
$dir= $conf->societe->dir_output.'/contact/' . get_exdir($object->id,0,0,1,$object,'contact').'/photos';
|
||||||
|
|
||||||
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||||
if ($file_OK)
|
if ($file_OK)
|
||||||
@ -68,8 +68,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
|
|||||||
if (GETPOST('deletephoto'))
|
if (GETPOST('deletephoto'))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
$fileimg=$conf->societe->dir_output.'/contact/'.get_exdir($object->id,2,0,1,$object,'contact').'/photos/'.$object->photo;
|
$fileimg=$conf->societe->dir_output.'/contact/'.get_exdir($object->id,0,0,1,$object,'contact').'/photos/'.$object->photo;
|
||||||
$dirthumbs=$conf->societe->dir_output.'/contact/'.get_exdir($object->id,2,0,1,$object,'contact').'/photos/thumbs';
|
$dirthumbs=$conf->societe->dir_output.'/contact/'.get_exdir($object->id,0,0,1,$object,'contact').'/photos/thumbs';
|
||||||
dol_delete_file($fileimg);
|
dol_delete_file($fileimg);
|
||||||
dol_delete_dir_recursive($dirthumbs);
|
dol_delete_dir_recursive($dirthumbs);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,11 +93,17 @@ function project_prepare_head($object)
|
|||||||
// Then tab for sub level of projet, i mean tasks
|
// Then tab for sub level of projet, i mean tasks
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Tasks");
|
$head[$h][1] = $langs->trans("Tasks");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
|
$taskstatic=new Task($db);
|
||||||
|
$nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0));
|
||||||
|
if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
|
||||||
$head[$h][2] = 'tasks';
|
$head[$h][2] = 'tasks';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Gantt");
|
$head[$h][1] = $langs->trans("Gantt");
|
||||||
|
if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
|
||||||
$head[$h][2] = 'gantt';
|
$head[$h][2] = 'gantt';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -116,7 +122,7 @@ function project_prepare_head($object)
|
|||||||
*/
|
*/
|
||||||
function task_prepare_head($object)
|
function task_prepare_head($object)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $db, $langs, $conf, $user;
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
@ -156,8 +162,10 @@ function task_prepare_head($object)
|
|||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||||
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
|
$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$listoffiles=dol_dir_list($filesdir,'files',1,'','thumbs');
|
$nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||||
$head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents'));
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||||
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||||
$head[$h][2] = 'task_document';
|
$head[$h][2] = 'task_document';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
|||||||
@ -299,25 +299,28 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
if (empty($id))
|
||||||
|
|
||||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
|
||||||
{
|
{
|
||||||
if ($object->public || $userWrite > 0)
|
print '<div class="tabsAction">';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans('AddTask').'</a>';
|
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
||||||
}
|
{
|
||||||
else
|
if ($object->public || $userWrite > 0)
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans('AddTask').'</a>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('AddTask').'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user