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

@ -1028,17 +1028,17 @@ if (!empty($arrayfields['f.ref_supplier']['checked'])) {
if (!empty($arrayfields['f.type']['checked'])) { if (!empty($arrayfields['f.type']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone">'; print '<td class="liste_titre maxwidthonsmartphone">';
$listtype = array( $listtype = array(
FactureFournisseur::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), FactureFournisseur::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
FactureFournisseur::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), FactureFournisseur::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
); );
/* /*
if (!empty($conf->global->INVOICE_USE_SITUATION)) if (!empty($conf->global->INVOICE_USE_SITUATION))
{ {
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
} }
*/ */
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order. //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100'); print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
print '</td>'; print '</td>';
@ -1065,11 +1065,11 @@ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
/* /*
print $langs->trans('From').' '; print $langs->trans('From').' ';
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to').' ';*/ print $langs->trans('to').' ';*/
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before")); print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before"));
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert"); print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
print '</div>'; print '</div>';
@ -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']++;
} }
@ -1620,14 +1622,14 @@ if ($num > 0) {
// Amount HT // Amount HT
if (!empty($arrayfields['f.total_ht']['checked'])) { if (!empty($arrayfields['f.total_ht']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->total_ht)."</span></td>\n"; print '<td class="right nowrap"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
} }
$totalarray['val']['f.total_ht'] += $obj->total_ht; $totalarray['val']['f.total_ht'] += $obj->total_ht;
} }
// Amount VAT // Amount VAT
if (!empty($arrayfields['f.total_vat']['checked'])) { if (!empty($arrayfields['f.total_vat']['checked'])) {
@ -1726,7 +1728,7 @@ if ($num > 0) {
// Currency // Currency
if (!empty($arrayfields['f.multicurrency_code']['checked'])) { if (!empty($arrayfields['f.multicurrency_code']['checked'])) {
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n"; print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@ -1734,16 +1736,16 @@ if ($num > 0) {
// Currency rate // Currency rate
if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
print '<td class="nowrap">'; print '<td class="nowrap">';
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print "</td>\n"; print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount HT // Amount HT
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n"; print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></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">';