Debug v17

This commit is contained in:
Laurent Destailleur 2023-02-19 13:58:57 +01:00
parent b5ec68a1c3
commit 56add74e71
5 changed files with 65 additions and 39 deletions

View File

@ -163,7 +163,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) { if ($i >= $max) {
$othernb += 1; $othernb++;
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue; continue;

View File

@ -2192,13 +2192,16 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
* @param int $status -1=No filter on statut, 0 or 1 = Filter on status * @param int $status -1=No filter on statut, 0 or 1 = Filter on status
* @param array $listofoppstatus List of opportunity status * @param array $listofoppstatus List of opportunity status
* @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', ) * @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', )
* @param int $max Max nb of record to show in HTML list
* @return void * @return void
*/ */
function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array()) function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
global $theme_datacolor; global $theme_datacolor;
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$listofstatus = array_keys($listofoppstatus); $listofstatus = array_keys($listofoppstatus);
@ -2229,8 +2232,6 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]); $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
} }
$arrayidtypeofcontact = array();
print '<!-- print_projecttasks_array -->'; print '<!-- print_projecttasks_array -->';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -2309,11 +2310,15 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$resql = $db->query($sql2); $resql = $db->query($sql2);
if ($resql) { if ($resql) {
$othernb = 0;
$total_task = 0; $total_task = 0;
$total_opp_amount = 0; $total_opp_amount = 0;
$ponderated_opp_amount = 0; $ponderated_opp_amount = 0;
$total_plannedworkload = 0;
$total_declaredprogressworkload = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
$i = 0; $i = 0;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -2340,11 +2345,23 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
print "</tr>\n"; print "</tr>\n";
$total_plannedworkload = 0; while ($i < $nbofloop) {
$total_declaredprogressworkload = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
if ($max && $i >= $max) {
$othernb++;
$i++;
$total_task += $objp->nb;
$total_opp_amount += $objp->opp_amount;
$opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
$ponderated_opp_amount += price2num($opp_weighted_amount);
$plannedworkload = $objp->planned_workload;
$total_plannedworkload += $plannedworkload;
$declaredprogressworkload = $objp->declared_progess_workload;
$total_declaredprogressworkload += $declaredprogressworkload;
continue;
}
$projectstatic->id = $objp->projectid; $projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat; $projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public; $projectstatic->public = $objp->public;
@ -2451,13 +2468,21 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print "</tr>\n"; print "</tr>\n";
$total_task = $total_task + $objp->nb; $total_task += $objp->nb;
$total_opp_amount = $total_opp_amount + $objp->opp_amount; $total_opp_amount += $objp->opp_amount;
} }
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total")."</td><td></td>"; print '<td>'.$langs->trans("Total")."</td><td></td>";
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {

View File

@ -1487,7 +1487,7 @@ if ($num > 0) {
// Label // Label
if (!empty($arrayfields['f.label']['checked'])) { if (!empty($arrayfields['f.label']['checked'])) {
print '<td class="nowrap">'; print '<td class="nowrap">';
print $obj->label; print dol_escape_htmltag($obj->label);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1543,7 +1543,7 @@ if ($num > 0) {
// Alias // Alias
if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="tdoverflowmax150">'; print '<td class="tdoverflowmax150">';
print $thirdparty->name_alias; print dol_escape_htmltag($thirdparty->name_alias);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1551,8 +1551,8 @@ if ($num > 0) {
} }
// Town // Town
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).'">';
print $obj->town; print dol_escape_htmltag($obj->town);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1560,7 +1560,7 @@ if ($num > 0) {
} }
// Zip // Zip
if (!empty($arrayfields['s.zip']['checked'])) { if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd center tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).'">'; print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).'">';
print dol_escape_htmltag($obj->zip); print dol_escape_htmltag($obj->zip);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -1569,7 +1569,9 @@ if ($num > 0) {
} }
// State // State
if (!empty($arrayfields['state.nom']['checked'])) { if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n"; print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).'">';
print dol_escape_htmltag($obj->state_name);
print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -1102,7 +1102,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityStatus").'</td>'; print '<tr class="classuseopportunity'.$classfortr.'"><td>'.$langs->trans("OpportunityStatus").'</td>';
print '<td>'; print '<td>';
print '<div>'; print '<div>';
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle', 1, 1); print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'minwidth150 inline-block valignmiddle', 1, 1);
// Opportunity probability // Opportunity probability
print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ?vatrate($object->opp_percent) : '')).'"> %'; print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ?vatrate($object->opp_percent) : '')).'"> %';

View File

@ -193,9 +193,8 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
*/ */
include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; 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', 'prospectionstatus', 'projectstatus')); print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress', 'prospectionstatus', 'projectstatus'), $max);
print '</div><div class="fichetwothirdright">'; print '</div><div class="fichetwothirdright">';