diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7609d7b759b..8e78e4e45be 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2147,16 +2147,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) print_liste_field_titre("OpportunityStatus", "", "", "", "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", '', $sortfield, $sortorder, 'right '); + if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('projectstatus', $hiddenfields)) print_liste_field_titre("Status", "", "", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; $total_plannedworkload = 0; @@ -2179,8 +2180,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $projectstatic->datee = $db->jdate($objp->datee); $projectstatic->dateo = $db->jdate($objp->dateo); - print ''; + print ''; print $projectstatic->getNomUrl(1); if (!in_array('projectlabel', $hiddenfields)) print '
'.dol_trunc($objp->title, 24); @@ -2194,8 +2195,35 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print $thirdpartystatic->getNomUrl(1); } print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + // 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)) { + if ($langs->trans("OppStatus" . $oppStatusCode) != "OppStatus" . $oppStatusCode) { + print $langs->trans("OppStatus" . $oppStatusCode); + } + } else { + if (isset($statusOppList[$objp->opp_status])) { + $oppStatusCode = $statusOppList[$objp->opp_status]['code']; + $oppStatusColor = $statusOppList[$objp->opp_status]['color']; + } else { + $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); + $oppStatusColor = ''; + } + if ($oppStatusCode) { + if (!empty($oppStatusColor)) { + print ''; + } else { + print '' . $oppStatusCode . ''; + } + } + } + print ''; + } + print ''; if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); print ''; @@ -2207,6 +2235,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print ''; } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { print ''.$objp->nb.''; @@ -2228,23 +2257,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } } - print ''; - //print $projectstatic->getLibStatut(3); - if (isset($statusOppList[$objp->opp_status])) { - $oppStatusCode = $statusOppList[$objp->opp_status]['code']; - $oppStatusColor = $statusOppList[$objp->opp_status]['color']; - } else { - $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); - $oppStatusColor = ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + print $projectstatic->getLibStatut(3); + print ''; } - if ($oppStatusCode) { - if (!empty($oppStatusColor)) { - print ''; - } else { - print '' . $oppStatusCode . ''; - } - } - print ''; + print "\n"; $total_task = $total_task + $objp->nb; @@ -2258,6 +2276,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print ''.$langs->trans("Total").""; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + } print ''.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).''; print ''.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).''; } @@ -2267,7 +2288,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!in_array('plannedworkload', $hiddenfields)) print ''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').''; if (!in_array('declaredprogress', $hiddenfields)) print ''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').''; } - print ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + } print ''; $db->free($resql); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 9ab79a3b677..0613fd75e8f 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; // List of draft projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress')); +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress', 'prospectionstatus', 'projectstatus')); print '
'; @@ -274,17 +274,25 @@ if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN ( if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql .= " GROUP BY s.nom, s.rowid"; $sql .= $db->order($sortfield, $sortorder); +//$sql .= $db->plimit($max + 1, 0); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; + $othernb = 0; while ($i < $num) { $obj = $db->fetch_object($resql); + if ($i >= $max) { + $othernb += $obj->nb; + $i++; + continue; + } + print ''; print ''; if ($obj->socid) @@ -296,6 +304,7 @@ if ($resql) else { print $langs->trans("OthersNotLinkedToThirdParty"); + $i--; } print ''; print ''; @@ -306,6 +315,16 @@ if ($resql) $i++; } + if ($othernb) { + print ''; + print ''; + print '...'; + print ''; + print ''; + print $othernb; + print ''; + print "\n"; + } $db->free($resql); } @@ -316,10 +335,10 @@ else print ""; print '
'; -if (!empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) +if (empty($conf->global->PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA)) { - // This list can be very long, so we don't show it by default on task area. We prefer to use the list page. - // Add constant PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA to show this list + // This list can be very long, so we allow to hide it to prefer to use the list page. + // Add constant PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA to show this list print '
'; @@ -329,7 +348,7 @@ if (!empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) print '
'; $parameters = array('user' => $user); -$reshook = $hookmanager->executeHooks('dashboardProjects', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardProjects', $parameters, $projectstatic); // Note that $action and $object may have been modified by hook // End of page llxFooter();