diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index a5506fc6ebb..de160fe2b93 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -87,6 +87,13 @@ if (!$sortorder) {
}
}
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('accountancycustomerlist'));
+
+$formaccounting = new FormAccounting($db);
+
+$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
+
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
@@ -98,13 +105,6 @@ if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('accountancycustomerlist'));
-
-$formaccounting = new FormAccounting($db);
-
-$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
-
/*
* Actions
@@ -168,7 +168,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
$monCompte = GETPOST('codeventil'.$monId);
if ($monCompte <= 0) {
- $msg .= '
'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NoAccountSelected").'
';
+ $msg .= ''.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
@@ -215,7 +215,7 @@ if (empty($chartaccountcode)) {
}
// Customer Invoice lines
-$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
+$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@@ -239,7 +239,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
-if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) {
+if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
@@ -347,6 +347,7 @@ dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
if ($db->type == 'mysqli') {
$db->query("SET SQL_BIG_SELECTS=1");
}
+
$result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
@@ -654,6 +655,7 @@ if ($result) {
}
print '';
+ // Description
print '';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@@ -681,6 +683,7 @@ if ($result) {
print $labelcountry;
print ' | ';
+ // VAT Num
print ''.$objp->tva_intra.' | ';
// Found accounts
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 24ee3afe218..1dcd17ea074 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -53,8 +53,8 @@ $mesCasesCochees = GETPOST('toselect', 'array');
// Search Getpost
$search_societe = GETPOST('search_societe', 'alpha');
$search_lineid = GETPOST('search_lineid', 'int');
-$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
+$search_invoice = GETPOST('search_invoice', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
@@ -156,7 +156,7 @@ if (empty($reshook)) {
}
-if ($massaction == 'ventil') {
+if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
$msg = '';
//print '' . $langs->trans("Processing") . '...
';
@@ -183,7 +183,7 @@ if ($massaction == 'ventil') {
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '', 1);
- dol_syslog('accountancy/supplier/list.php:: sql='.$sql, LOG_DEBUG);
+ dol_syslog('accountancy/supplier/list.php sql='.$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= ''.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
';
$ok++;
@@ -249,6 +249,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
@@ -274,12 +275,12 @@ if ($search_lineid) {
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
}
-if (strlen(trim($search_label))) {
- $sql .= natural_search("f.libelle", $search_label);
-}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
+if (strlen(trim($search_label))) {
+ $sql .= natural_search("f.libelle", $search_label);
+}
if (strlen(trim($search_desc))) {
$sql .= natural_search("l.description", $search_desc);
}
@@ -344,9 +345,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$sql .= $db->plimit($limit + 1, $offset);
-dol_syslog('accountancy/supplier/list.php');
-$result = $db->query($sql);
+dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
+// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso)
+// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security
+if ($db->type == 'mysqli') {
+ $db->query("SET SQL_BIG_SELECTS=1");
+}
+$result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
@@ -447,8 +453,8 @@ if ($result) {
print '';
print ' | ';
print ' | ';
- print ' | ';
- print ' | ';
+ print ' | ';
+ print ' | ';
print ' | ';
print '';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1);
@@ -528,7 +534,7 @@ if ($result) {
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
- $facturefourn_static->type = $objp->type;
+ $facturefourn_static->type = $objp->ftype;
$facturefourn_static->label = $objp->invoice_label;
$code_buy_p_notset = '';
|