Merge pull request #14040 from aspangaro/10.0_p40

FIX: Accountancy - Binding index - Add a filter on sql request for module Subtotal & Jalon
This commit is contained in:
Laurent Destailleur 2020-06-06 21:01:40 +02:00 committed by GitHub
commit 2140f05eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -252,6 +252,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -329,6 +330,7 @@ $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {
@ -406,6 +408,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {
@ -458,6 +461,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0";
$sql .= " AND fd.product_type <= 2";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {

View File

@ -250,6 +250,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -321,6 +322,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -392,6 +394,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/supplier/index.php');