Restore common behaviour: Draft object are on left under graph.

Open and live objects are on right
This commit is contained in:
Laurent Destailleur 2020-02-19 13:59:01 +01:00
parent f109864670
commit 0c571c0376
2 changed files with 68 additions and 26 deletions

View File

@ -2147,16 +2147,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) 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("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder);
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); 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('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", '', $sortfield, $sortorder, 'right ');
if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); 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 "</tr>\n"; print "</tr>\n";
$total_plannedworkload = 0; $total_plannedworkload = 0;
@ -2179,8 +2180,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$projectstatic->datee = $db->jdate($objp->datee); $projectstatic->datee = $db->jdate($objp->datee);
$projectstatic->dateo = $db->jdate($objp->dateo); $projectstatic->dateo = $db->jdate($objp->dateo);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24); if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24);
@ -2194,8 +2195,35 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print $thirdpartystatic->getNomUrl(1); print $thirdpartystatic->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
if (!in_array('prospectionstatus', $hiddenfields)) {
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)) {
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 '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" style="display: inline-block; width: 4px; border: 5px solid rgb(' . $oppStatusColor . '); border-radius: 2px;" title="' . $langs->trans("OppStatus" . $oppStatusCode) . '"></a>';
} else {
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" title="' . $langs->trans("OppStatus".$oppStatusCode) . '">' . $oppStatusCode . '</a>';
}
}
}
print '</td>';
}
print '<td class="right">'; print '<td class="right">';
if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
print '</td>'; print '</td>';
@ -2207,6 +2235,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
print '</td>'; print '</td>';
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print '<td class="right">'.$objp->nb.'</td>'; print '<td class="right">'.$objp->nb.'</td>';
@ -2228,23 +2257,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
} }
print '<td class="right">'; if (!in_array('projectstatus', $hiddenfields)) {
//print $projectstatic->getLibStatut(3); print '<td class="right">';
if (isset($statusOppList[$objp->opp_status])) { print $projectstatic->getLibStatut(3);
$oppStatusCode = $statusOppList[$objp->opp_status]['code']; print '</td>';
$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 '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" style="display: inline-block; width: 4px; border: 5px solid rgb(' . $oppStatusColor . '); border-radius: 2px;" title="' . $langs->trans("OppStatus" . $oppStatusCode) . '"></a>';
} else {
print '<a href="' . dol_buildpath('/projet/list.php?search_opp_status=' . $objp->opp_status, 1) . '" title="' . $langs->trans("OppStatus".$oppStatusCode) . '">' . $oppStatusCode . '</a>';
}
}
print '</td>';
print "</tr>\n"; print "</tr>\n";
$total_task = $total_task + $objp->nb; $total_task = $total_task + $objp->nb;
@ -2258,6 +2276,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '<td colspan="2">'.$langs->trans("Total")."</td>"; print '<td colspan="2">'.$langs->trans("Total")."</td>";
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
if (!in_array('prospectionstatus', $hiddenfields)) {
print '<td class="liste_total"></td>';
}
print '<td class="liste_total right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; print '<td class="liste_total right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
print '<td class="liste_total right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; print '<td class="liste_total right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
} }
@ -2267,7 +2288,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>'; if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>';
if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>'; if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>';
} }
print '<td class="liste_total"></td>'; if (!in_array('projectstatus', $hiddenfields)) {
print '<td class="liste_total"></td>';
}
print '</tr>'; print '</tr>';
$db->free($resql); $db->free($resql);

View File

@ -166,7 +166,7 @@ include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php';
// List of draft projects // 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 '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -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.")"; 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 .= " GROUP BY s.nom, s.rowid";
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
//$sql .= $db->plimit($max + 1, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$othernb = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += $obj->nb;
$i++;
continue;
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'; print '<td class="nowrap">';
if ($obj->socid) if ($obj->socid)
@ -296,6 +304,7 @@ if ($resql)
else else
{ {
print $langs->trans("OthersNotLinkedToThirdParty"); print $langs->trans("OthersNotLinkedToThirdParty");
$i--;
} }
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="right">';
@ -306,6 +315,16 @@ if ($resql)
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap">';
print '...';
print '</td>';
print '<td class="nowrap right">';
print $othernb;
print '</td>';
print "</tr>\n";
}
$db->free($resql); $db->free($resql);
} }
@ -316,10 +335,10 @@ else
print "</table>"; print "</table>";
print '</div>'; print '</div>';
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. // This list can be very long, so we allow to hide it to prefer to use the list page.
// Add constant PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA to show this list // Add constant PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA to show this list
print '<br>'; print '<br>';
@ -329,7 +348,7 @@ if (!empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA))
print '</div></div></div>'; print '</div></div></div>';
$parameters = array('user' => $user); $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 // End of page
llxFooter(); llxFooter();