mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 22:11:36 +01:00
finished helper method and usage of it
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -168,7 +169,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
StartSimpleTableHeader(["ProposalsDraft"], 2, $num, "comm/propal/list.php","search_status=0");
|
||||
StartSimpleTableHeader("ProposalsDraft", "comm/propal/list.php", "search_status=0", 2, $num);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@@ -250,7 +251,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
StartSimpleTableHeader(["SupplierProposalsDraft"], 2, $num, "supplier_proposal/list.php","search_status=0");
|
||||
StartSimpleTableHeader("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=0", 2, $num);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@@ -329,7 +330,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
StartSimpleTableHeader(["DraftOrders"], 2, $num, "commande/list.php","search_status=0");
|
||||
StartSimpleTableHeader("DraftOrders", "commande/list.php", "search_status=0", 2, $num);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@@ -413,7 +414,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
StartSimpleTableHeader(["DraftSuppliersOrders"], 2, $num, "fourn/commande/list.php","search_status=0");
|
||||
StartSimpleTableHeader("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=0", 2, $num);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@@ -503,16 +504,19 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects", $max);
|
||||
elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects", $max);
|
||||
else print $langs->trans("BoxTitleLastModifiedCustomers", $max);
|
||||
print '</th>';
|
||||
print '<th class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
{
|
||||
StartSimpleTableHeader($langs->trans("BoxTitleLastCustomersOrProspects", min($max, $num)), "societe/list.php", "type=p,c", 1);
|
||||
}
|
||||
elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
{
|
||||
StartSimpleTableHeader($langs->trans("BoxTitleLastModifiedProspects", min($max, $num)), "societe/list.php", "type=p,c", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSimpleTableHeader($langs->trans("BoxTitleLastModifiedCustomers", min($max, $num)), "societe/list.php", "type=p,c", 1);
|
||||
}
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
@@ -570,12 +574,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)).'</th>';
|
||||
print '<th class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>';
|
||||
print '</tr>';
|
||||
StartSimpleTableHeader($langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)), "societe/list.php", "type=f");
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num && $i < $max)
|
||||
@@ -653,9 +653,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("LastContracts", 5).'</th></tr>';
|
||||
StartSimpleTableHeader($langs->trans("LastContracts", 5), "", "", 2);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$staticcontrat = new Contrat($db);
|
||||
@@ -715,7 +714,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
StartSimpleTableHeader(["ProposalsOpened"], 4, $num, "comm/propal/list.php","search_status=1");
|
||||
StartSimpleTableHeader("ProposalsOpened", "comm/propal/list.php", "search_status=1", 4, $num);
|
||||
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
while ($i < $nbofloop)
|
||||
@@ -817,7 +816,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
StartSimpleTableHeader(["OrdersOpened"], 4, $num, "commande/list.php","search_status=1");
|
||||
StartSimpleTableHeader("OrdersOpened", "commande/list.php", "search_status=1", 4, $num);
|
||||
|
||||
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
while ($i < $nbofloop)
|
||||
|
||||
@@ -8675,14 +8675,14 @@ function currentToken()
|
||||
* Start a table with headers and a optinal clickable number
|
||||
* (don't forget to close the table with a HTML TABLE and a HTML DIV element)
|
||||
*
|
||||
* @param string|array $headers The header(s) of the table (headers inside a array are automatic translated)
|
||||
* @param integer $emptyRows (optional) The count of empty rows after the first header (use this instead of empty headers)
|
||||
* @param integer $number (optional) The number that is shown right after the first header
|
||||
* @param string $internalLink (optional) The link to a internal dolibarr page, when click on the number (without the first "/")
|
||||
* @param string $header The first left header of the table (automatic translated)
|
||||
* @param string $link (optional) The link to a internal dolibarr page, when click on the number (without the first "/")
|
||||
* @param string $arguments (optional) Additional arguments for the link (e.g. "search_status=0")
|
||||
* @param integer $emptyRows (optional) The count of empty rows after the first header
|
||||
* @param integer $number (optional) The number that is shown right after the first header, when not set the link is shown on the right side of the header as "FullList"
|
||||
* @return void
|
||||
*/
|
||||
function StartSimpleTableHeader($headers, $emptyRows = 0, $number = -1, $internalLink = "", $arguments = "")
|
||||
function StartSimpleTableHeader($header, $link = "", $arguments = "", $emptyRows = 0, $number = -1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -8692,41 +8692,53 @@ function StartSimpleTableHeader($headers, $emptyRows = 0, $number = -1, $interna
|
||||
|
||||
print $emptyRows < 1 ? '<th>' : '<th colspan="'.($emptyRows + 1).'">';
|
||||
|
||||
print is_array($headers) ? $langs->trans($headers[0]) : $headers;
|
||||
print $langs->trans($header);
|
||||
|
||||
if($number > -1)
|
||||
if ($number > -1)
|
||||
{
|
||||
// extra space between the first header and the number
|
||||
print ' ';
|
||||
}
|
||||
|
||||
if(!empty($internalLink))
|
||||
if (!empty($link))
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/'.$internalLink.'?'.$arguments.'">';
|
||||
if (!empty($arguments))
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/'.$link.'?'.$arguments.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/'.$link.'">';
|
||||
}
|
||||
}
|
||||
|
||||
if($number > -1)
|
||||
if ($number > -1)
|
||||
{
|
||||
print '<span class="badge">'.$number.'</span>';
|
||||
}
|
||||
|
||||
if(!empty($internalLink))
|
||||
if (!empty($link))
|
||||
{
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '</th>';
|
||||
|
||||
if(!is_array($headers) || count($headers) < 2)
|
||||
if ($number < 0 && !empty($link))
|
||||
{
|
||||
print '</tr>';
|
||||
return;
|
||||
print '<th class="right">';
|
||||
|
||||
if (!empty($arguments))
|
||||
{
|
||||
print '<a class="commonlink" href="'.DOL_URL_ROOT.'/'.$link.'?'.$arguments.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="commonlink" href="'.DOL_URL_ROOT.'/'.$link.'">';
|
||||
}
|
||||
|
||||
foreach(array_slice($headers, 1) as $header)
|
||||
{
|
||||
print '<th>';
|
||||
print print $langs->trans($header);
|
||||
print $langs->trans("FullList");
|
||||
print '</a>';
|
||||
print '</th>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user