Align color of graph of status on status color

This commit is contained in:
Laurent Destailleur 2020-03-24 13:06:59 +01:00
parent f56de9f177
commit 2b33ef7e46
10 changed files with 81 additions and 57 deletions

View File

@ -3613,7 +3613,7 @@ class Commande extends CommonOrder
if ($status == self::STATUS_CANCELED) {
$labelStatus = $langs->trans('StatusOrderCanceled');
$labelStatusShort = $langs->trans('StatusOrderCanceledShort');
$statusType = 'status5';
$statusType = 'status9';
}
elseif ($status == self::STATUS_DRAFT) {
$labelStatus = $langs->trans('StatusOrderDraft');
@ -3628,7 +3628,7 @@ class Commande extends CommonOrder
elseif ($status == self::STATUS_SHIPMENTONPROCESS) {
$labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
$labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
$statusType = 'status3';
$statusType = 'status4';
}
elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
$labelStatus = $langs->trans('StatusOrderToBill');

View File

@ -72,7 +72,6 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
{
// Search customer orders
$var = false;
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
@ -88,7 +87,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
* Statistics
*/
$sql = "SELECT count(c.rowid), c.fk_statut";
$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -117,7 +116,7 @@ if ($resql)
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{
if (! isset($vals[$row[1]])) $vals[$row[1]]=0;
$vals[$row[1].$bool]+=$row[0];
$vals[$row[1]]+=$row[0];
$totalinprocess+=$row[0];
}
$total+=$row[0];
@ -125,13 +124,32 @@ if ($resql)
$i++;
}
$db->free($resql);
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</th></tr>'."\n";
$listofstatus=array(0,1,2,3,-1);
foreach ($listofstatus as $status)
{
$dataseries[]=array($commandestatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
$dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Commande::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0;
if ($status == Commande::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1;
if ($status == Commande::STATUS_SHIPMENTONPROCESS) $colorseries[$status] = $badgeStatus4;
if ($status == Commande::STATUS_CLOSED && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) $colorseries[$status] = $badgeStatus6;
if ($status == Commande::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) $colorseries[$status] = $badgeStatus6;
if ($status == Commande::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9;
if (empty($conf->use_javascript_ajax))
{
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($status, 0, 0, 1).'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).' ';
print $commandestatic->LibStatut($status, 0, 3, 1);
print '</a></td>';
print "</tr>\n";
}
}
if ($conf->use_javascript_ajax)
{
@ -140,6 +158,7 @@ if ($resql)
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
@ -149,19 +168,6 @@ if ($resql)
print '</td></tr>';
}
else
{
foreach ($listofstatus as $status)
{
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($status, $bool, 0).'</td>';
print '<td class="right"><a href="list.php?viewstatut='.$status.'">'.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' ';
print $commandestatic->LibStatut($status, $bool, 3);
print '</a>';
print '</td>';
print "</tr>\n";
}
}
//if ($totalinprocess != $total)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'.$total.'</td></tr>';
print "</table></div><br>";
@ -202,7 +208,6 @@ if (!empty($conf->commande->enabled))
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
@ -241,7 +246,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max = 5;
/*
* Last modified orders
* Lattest modified orders
*/
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
@ -272,7 +277,6 @@ if ($resql)
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
@ -320,6 +324,7 @@ if ($resql)
}
else dol_print_error($db);
$max = 10;
/*
* Orders to process
@ -335,7 +340,7 @@ if (!empty($conf->commande->enabled))
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_statut = 1";
$sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED;
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " ORDER BY c.rowid DESC";
@ -344,16 +349,16 @@ if (!empty($conf->commande->enabled))
if ($resql)
{
$num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></th></tr>';
print '<th colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut='.Commande::STATUS_VALIDATED.'"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
@ -395,6 +400,9 @@ if (!empty($conf->commande->enabled))
print '</tr>';
$i++;
}
if ($i < $num) {
print '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td><td></td></tr>';
}
}
print "</table></div><br>";
@ -403,7 +411,7 @@ if (!empty($conf->commande->enabled))
}
/*
* Orders thar are in a shipping process
* Orders that are in process
*/
if (!empty($conf->commande->enabled))
{
@ -416,7 +424,7 @@ if (!empty($conf->commande->enabled))
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_statut = 2 ";
$sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED;
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " ORDER BY c.rowid DESC";
@ -429,13 +437,12 @@ if (!empty($conf->commande->enabled))
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2"><span class="badge">'.$num.'</span></a></th></tr>';
print '<th colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut='.Commande::STATUS_ACCEPTED.'"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
@ -477,6 +484,9 @@ if (!empty($conf->commande->enabled))
print '</tr>';
$i++;
}
if ($i < $num) {
print '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td><td></td></tr>';
}
}
print "</table></div><br>";
}

View File

@ -830,7 +830,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
{
print '<tr class="oddeven trforbreak">'."\n";
print '<tr class="oddeven trforbreak nobold">'."\n";
print '<td colspan="11">';
print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
if ($projectstatic->title)
@ -1449,7 +1449,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
}
print '<tr class="oddeven trforbreak">'."\n";
print '<tr class="oddeven trforbreak nobold">'."\n";
print '<td colspan="'.(11 + $addcolspan).'">';
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
@ -1797,7 +1797,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
{
print '<tr class="oddeven trforbreak">'."\n";
print '<tr class="oddeven trforbreak nobold">'."\n";
print '<td colspan="'.(6 + count($TWeek)).'">';
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);

View File

@ -606,8 +606,8 @@ if (!empty($arrayfields['t.progress']['checked']))
/*print '<td class="right maxwidth100">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td class="right maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td class="right maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</th>';
print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</th>';
print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></th>';
print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</th>';
print '<th class="center leftborder">'.$langs->trans("HourStart").'</td>';
// By default, we can edit only tasks we are assigned to

View File

@ -500,8 +500,8 @@ print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").
/*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</td>';
foreach ($TWeek as $week_number)
{

View File

@ -660,8 +660,8 @@ if (!empty($arrayfields['t.progress']['checked']))
/*print '<td class="maxwidth75 right">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td class="maxwidth75 right">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td class="maxwidth75 right">'.$langs->trans("TimeSpentByUser").'</td>';*/
print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</th>';
print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</th>';
print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></th>';
print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</th>';
for ($idw = 0; $idw < 7; $idw++)
{

View File

@ -1557,7 +1557,7 @@ if ($action == 'create')
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdate_livraison') {
print '<form name="editdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<form name="editdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" class="formconsumeproduce">';
print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
print '<input type="hidden" name="action" value="setdate_livraison">';
print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison");
@ -1806,12 +1806,13 @@ if ($action == 'create')
if ($action == 'statut')
{
// Form to set proposal accepted/refused
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '<p class="notice">'.$langs->trans('SupplierProposalRefFournNotice').'</p>'; // TODO Suggest a permanent checkbox instead of option
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST" id="formacceptrefuse" class="formconsumeproduce">';
$form_close .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$form_close .= '<input type="hidden" name="action" value="setstatut">';
if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '<p class="notice">'.$langs->trans('SupplierProposalRefFournNotice').'</p>'; // TODO Suggest a permanent checkbox instead of option
$form_close .= '<table class="border centpercent">';
$form_close .= '<tr><td width="150" class="left">' . $langs->trans("CloseAs") . '</td><td class="left">';
$form_close .= '<input type="hidden" name="action" value="setstatut">';
$form_close .= '<select id="statut" name="statut" class="flat">';
$form_close .= '<option value="0">&nbsp;</option>';
$form_close .= '<option value="2">' . $langs->trans('SupplierProposalStatusSigned') . '</option>';
@ -1882,7 +1883,7 @@ if ($action == 'create')
// Set accepted/refused
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a></div>';
}

View File

@ -2232,7 +2232,7 @@ class SupplierProposal extends CommonObject
$statusnew = '';
if ($status == self::STATUS_DRAFT) $statusnew = 'status0';
elseif ($status == self::STATUS_VALIDATED) $statusnew = 'status1';
elseif ($status == self::STATUS_SIGNED) $statusnew = 'status3';
elseif ($status == self::STATUS_SIGNED) $statusnew = 'status4';
elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status5';
elseif ($status == self::STATUS_CLOSE) $statusnew = 'status6';

View File

@ -19,9 +19,9 @@
*/
/**
* \file htdocs/comm/propal/index.php
* \ingroup propal
* \brief Home page of proposal area
* \file htdocs/supplier_proposal/index.php
* \ingroup supplier_proposal
* \brief Home page of vendor proposal area
*/
require '../main.inc.php';
@ -104,6 +104,7 @@ if ($resql)
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
while ($i < $num)
@ -122,20 +123,28 @@ if ($resql)
}
$db->free($resql);
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'</th></tr>'."\n";
$listofstatus = array(0, 1, 2, 3, 4);
foreach ($listofstatus as $status)
{
$dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if (!$conf->use_javascript_ajax)
{
print '<tr class="oddeven">';
print '<td>'.$supplier_proposalstatic->LibStatut($status, 0).'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
print "</tr>\n";
}
$dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == SupplierProposal::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0;
if ($status == SupplierProposal::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1;
if ($status == SupplierProposal::STATUS_SIGNED) $colorseries[$status] = $badgeStatus4;
if ($status == SupplierProposal::STATUS_NOTSIGNED) $colorseries[$status] = $badgeStatus9;
if ($status == SupplierProposal::STATUS_CLOSE) $colorseries[$status] = $badgeStatus6;
if (empty($conf->use_javascript_ajax))
{
print '<tr class="oddeven">';
print '<td>'.$supplier_proposalstatic->LibStatut($status, 0).'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
print "</tr>\n";
}
}
if ($conf->use_javascript_ajax)
{
@ -144,6 +153,7 @@ if ($resql)
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));

View File

@ -3224,6 +3224,9 @@ td.evenodd, tr.nohoverpair td, #trlinefordates td {
border-bottom: 1pt solid black !important;
/* background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinebreak)); ?> !important; */
}
.trforbreak.nobold td a, .trforbreak.nobold span.secondary {
font-weight: normal !important;
}
table.dataTable td {
padding: 5px 8px 5px 8px !important;