diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6d2892cddad..67c78bf2915 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -216,6 +216,7 @@ Value=Value PersonalValue=Personal value NewObject=New %s NewValue=New value +OldValue=Old value %s CurrentValue=Current value Code=Code Type=Type diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 2bb9332c2ae..97977406a48 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -20,9 +20,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; @@ -66,7 +65,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'; print ''; print ''."\n"; + $listofstatus = array_keys($listofoppstatus); + // Complete with values found into database and not into the dictionary + foreach($valsamount as $key => $val) { + if (!in_array($key, $listofstatus)) { + $listofstatus[] = $key; + } + } + foreach ($listofstatus as $status) { $labelStatus = ''; @@ -74,6 +81,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code); if (empty($labelStatus)) $labelStatus = $listofopplabel[$status]; + if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';
'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'