Fix var not always defined

This commit is contained in:
Laurent Destailleur 2020-02-25 15:36:34 +01:00
parent cb9637e38d
commit 39624f21e7

View File

@ -2035,15 +2035,19 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$listofstatus = array_keys($listofoppstatus);
$statusOppList = array();
$themeColorId = 0;
foreach ($listofstatus as $oppStatus) {
$oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
if ($oppStatusCode) {
$statusOppList[$oppStatus]['code'] = $oppStatusCode;
$statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
if (is_array($listofstatus) && ! empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
// Define $themeColorId and array $statusOppList for each $listofstatus
$themeColorId = 0;
$statusOppList = array();
foreach ($listofstatus as $oppStatus) {
$oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
if ($oppStatusCode) {
$statusOppList[$oppStatus]['code'] = $oppStatusCode;
$statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
}
$themeColorId++;
}
$themeColorId++;
}
$projectstatic = new Project($db);
@ -2203,6 +2207,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '<td class="right">';
// Because color of prospection status has no meaning yet, it is used if hidden constant is set
if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
$oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) {
print $langs->trans("OppStatus".$oppStatusCode);
}