MAIN_DASHBOARD_USE_TOTAL_HT + more clean

This commit is contained in:
Sekan, Tobias 2020-09-16 14:03:41 +02:00
parent be27617e68
commit 91641e593f
3 changed files with 52 additions and 55 deletions

View File

@ -84,7 +84,8 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo // This is useless due to the global search combo
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
// Search proposal // Search proposal
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$listofsearchfields['search_proposal'] = array('text'=>'Proposal'); $listofsearchfields['search_proposal'] = array('text'=>'Proposal');
@ -152,7 +153,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("ProposalsDraft", "comm/propal/list.php", "search_status=0", 2, $num); startSimpleTable("ProposalsDraft", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -180,11 +181,11 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td>'; print '<td class="nowrap right">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ht; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -217,7 +218,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=0", 2, $num); startSimpleTable("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=".SupplierProposal::STATUS_DRAFT, 2, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -243,11 +244,11 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$supplierproposalstatic->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$supplierproposalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td>'; print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ht; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -280,7 +281,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("DraftOrders", "commande/list.php", "search_status=0", 2, $num); startSimpleTable("DraftOrders", "commande/list.php", "search_status=".Commande::STATUS_DRAFT, 2, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -311,7 +312,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ttc; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -344,7 +345,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=0", 2, $num); startSimpleTable("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=".CommandeFournisseur::STATUS_DRAFT, 2, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -375,7 +376,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ttc; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -387,7 +388,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
} }
} }
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
/* /*
* Last modified customers or prospects * Last modified customers or prospects
@ -622,24 +624,21 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding nowrap">';
if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename = dol_sanitizeFileName($obj->ref); $filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); $warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : '';
print '</td></tr></table>';
print "</td>"; print '<tr class="oddeven">';
print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'.$propalstatic->getNomUrl(1).'</td>';
print '<td width="18" class="nobordernopadding nowrap">'.$warning.'</td>';
print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).'</td>';
print '</tr>';
print '</table>';
print '</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
@ -649,7 +648,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ttc; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -683,7 +682,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("OrdersOpened", "commande/list.php", "search_status=1", 4, $num); startSimpleTable("OrdersOpened", "commande/list.php", "search_status=".Commande::STATUS_VALIDATED, 4, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -710,22 +709,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$filename = dol_sanitizeFileName($obj->ref); $filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); $filedir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
//$warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : '';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref
print '<td class="nowrap" width="140">'; print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">'.$orderstatic->getNomUrl(1).'</td>';
print $orderstatic->getNomUrl(1); print '<td width="18" class="nobordernopadding nowrap"></td>';
print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).'</td>';
print '</tr>';
print '</table>';
print '</td>'; print '</td>';
print '<td width="18" class="nobordernopadding nowrap">';
//if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
print '</td></tr></table>';
print "</td>";
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
@ -735,7 +730,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ttc; $total +=(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -747,7 +742,9 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
} }
} }
print '</div></div></div>'; print '</div>';
print '</div>';
print '</div>';
$parameters = array('user' => $user); $parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardCommercials', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('dashboardCommercials', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -213,7 +213,7 @@ if (!empty($conf->propal->enabled)) {
if ($resql) { if ($resql) {
$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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=0", 2, $num); startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num);
if ($num) { if ($num) {
$total = 0; $total = 0;
@ -242,11 +242,11 @@ if (!empty($conf->propal->enabled)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td>'; print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ht; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }
@ -352,7 +352,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
$total = 0; $total = 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)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("ProposalsOpened", "comm/propal/list.php", "search_status=1", 4, $num); startSimpleTable("ProposalsOpened", "comm/propal/list.php", "search_status=".Propal::STATUS_VALIDATED, 4, $num);
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
@ -388,13 +388,13 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
print '<td class="left">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>'; print '<td class="left">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
print '<td class="right">'.price($obj->total_ttc).'</td>'; print '<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>'; print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
$total += $obj->total_ttc; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
} }