From 2e5cc98e5974f4b1ffce583d8456a06f8d0752c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Mar 2016 20:06:01 +0200 Subject: [PATCH] Fix into badges visibility --- htdocs/contact/perso.php | 6 +++--- htdocs/core/lib/project.lib.php | 14 ++++++++++--- htdocs/projet/tasks/time.php | 37 ++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 89b8be57e35..dc5db9445bb 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -59,7 +59,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact $object->old_name=''; $object->old_firstname=''; // 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']); if ($file_OK) @@ -68,8 +68,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact if (GETPOST('deletephoto')) { 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; - $dirthumbs=$conf->societe->dir_output.'/contact/'.get_exdir($object->id,2,0,1,$object,'contact').'/photos/thumbs'; + $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,0,0,1,$object,'contact').'/photos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 92229a72d23..479e46258be 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -93,11 +93,17 @@ function project_prepare_head($object) // Then tab for sub level of projet, i mean tasks $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; $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].= ' '.($nbTasks).''; $head[$h][2] = 'tasks'; $h++; $head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id; $head[$h][1] = $langs->trans("Gantt"); + if ($nbTasks > 0) $head[$h][1].= ' '.($nbTasks).''; $head[$h][2] = 'gantt'; $h++; } @@ -116,7 +122,7 @@ function project_prepare_head($object) */ function task_prepare_head($object) { - global $langs, $conf, $user; + global $db, $langs, $conf, $user; $h = 0; $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':''); $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $listoffiles=dol_dir_list($filesdir,'files',1,'','thumbs'); - $head[$h][1] = (count($listoffiles)?$langs->trans('DocumentsNb',count($listoffiles)):$langs->trans('Documents')); + $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview\.png)$')); + $nbLinks=Link::count($db, $object->element, $object->id); + $head[$h][1] = $langs->trans('Documents'); + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; $head[$h][2] = 'task_document'; $h++; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 976e0013431..29c3cd85bad 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -299,25 +299,28 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* * Actions */ - print '
'; - - if ($user->rights->projet->all->creer || $user->rights->projet->creer) + if (empty($id)) { - if ($object->public || $userWrite > 0) - { - print ''.$langs->trans('AddTask').''; - } - else - { - print ''.$langs->trans('AddTask').''; - } + print '
'; + + if ($user->rights->projet->all->creer || $user->rights->projet->creer) + { + if ($object->public || $userWrite > 0) + { + print ''.$langs->trans('AddTask').''; + } + else + { + print ''.$langs->trans('AddTask').''; + } + } + else + { + print ''.$langs->trans('AddTask').''; + } + + print '
'; } - else - { - print ''.$langs->trans('AddTask').''; - } - - print '
'; } }