mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix permissions #yogosha13771
This commit is contained in:
parent
f32fdf3f29
commit
c0dc9d47e3
|
|
@ -111,7 +111,7 @@ if (isModEnabled('facture')) {
|
|||
}
|
||||
|
||||
if (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) {
|
||||
print getNumberInvoicesPieChart('fourn');
|
||||
print getNumberInvoicesPieChart('suppliers');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,13 +417,16 @@ class Utils
|
|||
}
|
||||
|
||||
|
||||
// TODO Replace with Utils->executeCLI() function but
|
||||
// we must first introduce the variant with $lowmemorydump into this method.
|
||||
if ($execmethod == 1) {
|
||||
$output_arr = array();
|
||||
$retval = null;
|
||||
|
||||
exec($fullcommandclear, $output_arr, $retval);
|
||||
// TODO Replace this exec with Utils->executeCLI() function.
|
||||
// We must check that the case for $lowmemorydump works too...
|
||||
//$utils = new Utils($db);
|
||||
//$outputfile = $conf->admin->dir_temp.'/dump.tmp';
|
||||
//$utils->executeCLI($fullcommandclear, $outputfile, 0);
|
||||
|
||||
if ($retval != 0) {
|
||||
$langs->load("errors");
|
||||
|
|
@ -438,6 +441,8 @@ class Utils
|
|||
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) {
|
||||
continue;
|
||||
}
|
||||
// Now check into the result file, that the file end with "-- Dump completed"
|
||||
// This is possible only if $output_arr is the clear dump file, so not possible with $lowmemorydump set because file is already compressed.
|
||||
if (!$lowmemorydump) {
|
||||
fwrite($handle, $read.($execmethod == 2 ? '' : "\n"));
|
||||
if (preg_match('/'.preg_quote('-- Dump completed', '/').'/i', $read)) {
|
||||
|
|
|
|||
|
|
@ -280,8 +280,9 @@ function supplier_invoice_rec_prepare_head($object)
|
|||
function getNumberInvoicesPieChart($mode)
|
||||
{
|
||||
global $conf, $db, $langs, $user;
|
||||
|
||||
if (($mode == 'customers' && isModEnabled('facture') && !empty($user->rights->facture->lire))
|
||||
|| ($mode = 'suppliers') && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)
|
||||
|| ($mode == 'suppliers' && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire))
|
||||
) {
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
|
|
@ -406,7 +407,9 @@ function getNumberInvoicesPieChart($mode)
|
|||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTML table that contains a list with customer invoice drafts
|
||||
*
|
||||
|
|
@ -418,137 +421,140 @@ 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);
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
|
||||
$sql .= ", f.type, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", cc.rowid as country_id, cc.code as country_code";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$tmpinvoice = new Facture($db);
|
||||
|
||||
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
|
||||
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
|
||||
$sql .= " cc.rowid, cc.code";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
$sql = "SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
|
||||
$sql .= ", f.type, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", cc.rowid as country_id, cc.code as country_code";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
// Add Group from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
|
||||
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
|
||||
$sql .= " cc.rowid, cc.code";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
// Add Group from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<th colspan="3">';
|
||||
$result .= $langs->trans("CustomersDraftInvoices").' ';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status='.Facture::STATUS_DRAFT.'">';
|
||||
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
|
||||
$result .= '</a>';
|
||||
$result .= '</th>';
|
||||
$result .= '</tr>';
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<th colspan="3">';
|
||||
$result .= $langs->trans("CustomersDraftInvoices").' ';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status='.Facture::STATUS_DRAFT.'">';
|
||||
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
|
||||
$result .= '</a>';
|
||||
$result .= '</th>';
|
||||
$result .= '</tr>';
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
$othernb += 1;
|
||||
$i++;
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
$othernb += 1;
|
||||
$i++;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
continue;
|
||||
}
|
||||
|
||||
$tmpinvoice->id = $obj->rowid;
|
||||
$tmpinvoice->ref = $obj->ref;
|
||||
$tmpinvoice->date = $db->jdate($obj->date);
|
||||
$tmpinvoice->type = $obj->type;
|
||||
$tmpinvoice->total_ht = $obj->total_ht;
|
||||
$tmpinvoice->total_tva = $obj->total_tva;
|
||||
$tmpinvoice->total_ttc = $obj->total_ttc;
|
||||
$tmpinvoice->ref_client = $obj->ref_client;
|
||||
$tmpinvoice->statut = $obj->status;
|
||||
$tmpinvoice->paye = $obj->paye;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->email = $obj->email;
|
||||
$companystatic->country_id = $obj->country_id;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
$companystatic->client = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $tmpinvoice->getNomUrl(1, '');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $companystatic->getNomUrl(1, 'customer');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
$result .= '</tr>';
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
continue;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$tmpinvoice->id = $obj->rowid;
|
||||
$tmpinvoice->ref = $obj->ref;
|
||||
$tmpinvoice->date = $db->jdate($obj->date);
|
||||
$tmpinvoice->type = $obj->type;
|
||||
$tmpinvoice->total_ht = $obj->total_ht;
|
||||
$tmpinvoice->total_tva = $obj->total_tva;
|
||||
$tmpinvoice->total_ttc = $obj->total_ttc;
|
||||
$tmpinvoice->ref_client = $obj->ref_client;
|
||||
$tmpinvoice->statut = $obj->status;
|
||||
$tmpinvoice->paye = $obj->paye;
|
||||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->email = $obj->email;
|
||||
$companystatic->country_id = $obj->country_id;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
$companystatic->client = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $tmpinvoice->getNomUrl(1, '');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $companystatic->getNomUrl(1, 'customer');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
|
||||
$result .= '</tr>';
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$i++;
|
||||
} else {
|
||||
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
|
||||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
||||
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
|
||||
$result .= '</tr>';
|
||||
$result .= "</table></div>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result .= "</table></div>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
@ -565,119 +571,122 @@ 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);
|
||||
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_client, s.code_compta";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", cc.rowid as country_id, cc.code as country_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').')';
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$resql = $db->query($sql);
|
||||
if ((isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)) {
|
||||
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
|
||||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
$facturesupplierstatic = new FactureFournisseur($db);
|
||||
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_client, s.code_compta";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", cc.rowid as country_id, cc.code as country_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').')';
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<th colspan="3">';
|
||||
$result .= $langs->trans("SuppliersDraftInvoices").' ';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?search_status='.FactureFournisseur::STATUS_DRAFT.'">';
|
||||
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
|
||||
$result .= '</a>';
|
||||
$result .= '</th>';
|
||||
$result .= '</tr>';
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$nbofloop = min($num, $maxofloop);
|
||||
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
$result .= '<div class="div-table-responsive-no-min">';
|
||||
$result .= '<table class="noborder centpercent">';
|
||||
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$result .= '<tr class="liste_titre">';
|
||||
$result .= '<th colspan="3">';
|
||||
$result .= $langs->trans("SuppliersDraftInvoices").' ';
|
||||
$result .= '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?search_status='.FactureFournisseur::STATUS_DRAFT.'">';
|
||||
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
|
||||
$result .= '</a>';
|
||||
$result .= '</th>';
|
||||
$result .= '</tr>';
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
$othernb += 1;
|
||||
$i++;
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
$othernb = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $nbofloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($i >= $maxCount) {
|
||||
$othernb += 1;
|
||||
$i++;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
continue;
|
||||
}
|
||||
|
||||
$facturesupplierstatic->ref = $obj->ref;
|
||||
$facturesupplierstatic->id = $obj->rowid;
|
||||
$facturesupplierstatic->total_ht = $obj->total_ht;
|
||||
$facturesupplierstatic->total_tva = $obj->total_tva;
|
||||
$facturesupplierstatic->total_ttc = $obj->total_ttc;
|
||||
$facturesupplierstatic->ref_supplier = $obj->ref_supplier;
|
||||
$facturesupplierstatic->type = $obj->type;
|
||||
$facturesupplierstatic->statut = $obj->status;
|
||||
$facturesupplierstatic->paye = $obj->paye;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->email = $obj->email;
|
||||
$companystatic->country_id = $obj->country_id;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $facturesupplierstatic->getNomUrl(1, '');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $companystatic->getNomUrl(1, 'supplier');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
$result .= '</tr>';
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
continue;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$facturesupplierstatic->ref = $obj->ref;
|
||||
$facturesupplierstatic->id = $obj->rowid;
|
||||
$facturesupplierstatic->total_ht = $obj->total_ht;
|
||||
$facturesupplierstatic->total_tva = $obj->total_tva;
|
||||
$facturesupplierstatic->total_ttc = $obj->total_ttc;
|
||||
$facturesupplierstatic->ref_supplier = $obj->ref_supplier;
|
||||
$facturesupplierstatic->type = $obj->type;
|
||||
$facturesupplierstatic->statut = $obj->status;
|
||||
$facturesupplierstatic->paye = $obj->paye;
|
||||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->email = $obj->email;
|
||||
$companystatic->country_id = $obj->country_id;
|
||||
$companystatic->country_code = $obj->country_code;
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $facturesupplierstatic->getNomUrl(1, '');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="nowrap tdoverflowmax100">';
|
||||
$result .= $companystatic->getNomUrl(1, 'supplier');
|
||||
$result .= '</td>';
|
||||
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
|
||||
$result .= '</tr>';
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$i++;
|
||||
} else {
|
||||
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
|
||||
if ($othernb) {
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap" colspan="3">';
|
||||
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
|
||||
$result .= '</td>';
|
||||
$result .= "</tr>\n";
|
||||
}
|
||||
|
||||
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
|
||||
$result .= '</tr>';
|
||||
$result .= "</table></div>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result .= "</table></div>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user