2
0
forked from Wavyzz/dolibarr

Fix color of task progression

This commit is contained in:
Laurent Destailleur
2019-11-01 23:16:08 +01:00
parent b19593bb8e
commit 8608c5db9c
6 changed files with 32 additions and 23 deletions

View File

@@ -1029,7 +1029,7 @@ class ExtraFields
{ {
$morecss = 'minwidth100imp'; $morecss = 'minwidth100imp';
} }
elseif ($type == 'datetime') elseif ($type == 'datetime' || $type == 'link')
{ {
$morecss = 'minwidth200imp'; $morecss = 'minwidth200imp';
} }

View File

@@ -1122,13 +1122,20 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$out="\n".'<!-- dol_get_fiche_head --><div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
if ($morehtmlright) $out.='<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
// Show title // Show title
$showtitle=1; $showtitle=1;
if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0; if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0;
$out = "\n".'<!-- dol_get_fiche_head -->';
if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
$out.= '<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
}
// Show right part
if ($morehtmlright) $out.='<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
// Show title
if (! empty($title) && $showtitle) if (! empty($title) && $showtitle)
{ {
$limittitle=30; $limittitle=30;
@@ -1138,6 +1145,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out.='</a>'; $out.='</a>';
} }
// Show tabs
// Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs). // Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs).
$maxkey=-1; $maxkey=-1;
if (is_array($links) && ! empty($links)) if (is_array($links) && ! empty($links))
@@ -1149,16 +1158,15 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
if (! empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD=2; if (! empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD=2;
// Show tabs // Show tabs
$bactive=false;
// if =0 we don't use the feature // if =0 we don't use the feature
$limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD); $limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD);
$displaytab=0; $displaytab=0;
$nbintab=0; $nbintab=0;
$popuptab=0; $outmore=''; $popuptab=0;
$outmore='';
for ($i = 0 ; $i <= $maxkey ; $i++) for ($i = 0 ; $i <= $maxkey ; $i++)
{ {
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
{
// If active tab is already present // If active tab is already present
if ($i >= $limittoshow) $limittoshow--; if ($i >= $limittoshow) $limittoshow--;
} }
@@ -1166,13 +1174,10 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
for ($i = 0 ; $i <= $maxkey ; $i++) for ($i = 0 ; $i <= $maxkey ; $i++)
{ {
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) {
{
$isactive=true; $isactive=true;
$bactive=true;
} }
else else {
{
$isactive=false; $isactive=false;
} }
@@ -1258,7 +1263,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out.="</script>"; $out.="</script>";
} }
if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) {
$out.="</div>\n"; $out.="</div>\n";
}
if (! $notab || $notab == -1 || $notab == -2) $out.="\n".'<div class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : ' tabBarWithBottom')).'">'."\n"; if (! $notab || $notab == -1 || $notab == -2) $out.="\n".'<div class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : ' tabBarWithBottom')).'">'."\n";

View File

@@ -1996,6 +1996,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
* @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null * @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null
* @param spaced $spaced bool used to add space at bottom (made by css) * @param spaced $spaced bool used to add space at bottom (made by css)
* @return string * @return string
* @see getTaskProgressBadge()
*/ */
function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false) function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false)
{ {
@@ -2033,7 +2034,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>'; $diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
} }
elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 1% elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$progressBarClass = 'progress-bar-warning'; $progressBarClass = 'progress-bar-warning';
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>'; $diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
@@ -2116,6 +2117,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
* @param label $label string empty = auto (progress), string = replace output * @param label $label string empty = auto (progress), string = replace output
* @param tooltip $tooltip string empty = auto , string = replace output * @param tooltip $tooltip string empty = auto , string = replace output
* @return string * @return string
* @see getTaskProgressView()
*/ */
function getTaskProgressBadge($task, $label = '', $tooltip = '') function getTaskProgressBadge($task, $label = '', $tooltip = '')
{ {
@@ -2135,10 +2137,10 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
// this conf is actually hidden, by default we use 10% for "be carefull or warning" // this conf is actually hidden, by default we use 10% for "be carefull or warning"
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
if($progressCalculated > doubleval($task->progress)){ if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$badgeClass.= 'badge-danger'; $badgeClass.= 'badge-danger';
} }
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1% elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$badgeClass.= 'badge-warning'; $badgeClass.= 'badge-warning';
} }
else{ else{

View File

@@ -163,7 +163,7 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticbom->getNomUrl(1, 32).'</td>'; print '<td>'.$staticbom->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticbom->getLibStatut(5).'</td>'; print '<td class="right">'.$staticbom->getLibStatut(3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
@@ -216,7 +216,7 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticmo->getNomUrl(1, 32).'</td>'; print '<td>'.$staticmo->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticmo->getLibStatut(5).'</td>'; print '<td class="right">'.$staticmo->getLibStatut(3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@@ -509,7 +509,7 @@ if ($action == 'create' && $user->rights->projet->creer)
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfieldcreate">';
$defaultref=''; $defaultref='';
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;

View File

@@ -171,7 +171,7 @@ print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppst
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Last modified projects // Latest modified projects
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.tms as datem,"; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.tms as datem,";
$sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas"; $sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
@@ -243,7 +243,7 @@ if ($resql)
} }
print '</td>'; print '</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'day').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem), 'day').'</td>';
print '<td class="right">'.$projectstatic->LibStatut($obj->fk_statut, 5).'</td>'; print '<td class="right">'.$projectstatic->LibStatut($obj->fk_statut, 3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }