mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code
This commit is contained in:
parent
c3d3b79315
commit
c9d6bc70e8
|
|
@ -66,6 +66,8 @@ if ($user->socid > 0) {
|
|||
}
|
||||
restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
|
||||
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -129,14 +131,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
|||
if ($resql) {
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
startSimpleTable("ProposalsDraft", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num);
|
||||
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $max) {
|
||||
|
|
@ -181,7 +183,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
|||
if ($othernb) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
|
@ -226,14 +228,14 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
|||
if ($resql) {
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
startSimpleTable("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=".SupplierProposal::STATUS_DRAFT, 2, $num);
|
||||
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $max) {
|
||||
|
|
@ -277,7 +279,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
|||
if ($othernb) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
|
@ -315,21 +317,21 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
|||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".$socid;
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
startSimpleTable("DraftOrders", "commande/list.php", "search_status=".Commande::STATUS_DRAFT, 2, $num);
|
||||
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $max) {
|
||||
|
|
@ -374,7 +376,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
|||
if ($othernb) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
|
@ -419,14 +421,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
|||
if ($resql) {
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
startSimpleTable("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=".CommandeFournisseur::STATUS_DRAFT, 2, $num);
|
||||
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $max) {
|
||||
|
|
@ -471,7 +473,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
|||
if ($othernb) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->globa
|
|||
$hookmanager->initHooks(array('invoiceindex'));
|
||||
|
||||
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -465,6 +465,8 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
|||
{
|
||||
global $conf, $db, $langs, $user, $hookmanager;
|
||||
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
$result = '';
|
||||
$tmpinvoice = new Facture($db);
|
||||
|
||||
|
|
@ -488,7 +490,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
|||
}
|
||||
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
|
|
@ -511,6 +513,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
|||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
|
|
@ -530,7 +533,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
|||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $num) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
|
|
@ -577,7 +580,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
|
|||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
|
@ -608,6 +611,8 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
|
|||
{
|
||||
global $conf, $db, $langs, $user, $hookmanager;
|
||||
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
$result = '';
|
||||
$facturesupplierstatic = new FactureFournisseur($db);
|
||||
|
||||
|
|
@ -637,6 +642,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
|
|||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
|
|
@ -656,7 +662,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
|
|||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $num) {
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
|
|
@ -702,7 +708,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
|
|||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user