Add option to be able to find behaviour before the fix of list of

invoice in direct debit order.
This commit is contained in:
Laurent Destailleur 2019-09-06 14:45:55 +02:00
parent bc0b8dfad0
commit cad9a59d2a
4 changed files with 17 additions and 5 deletions

View File

@ -739,8 +739,11 @@ class BonPrelevement extends CommonObject
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " WHERE f.entity IN (".getEntity('invoice').")";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND f.rowid = pfd.fk_facture";
$sql.= " AND pfd.traite = 0";
$sql.= " AND f.total_ttc > 0";

View File

@ -207,7 +207,10 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND f.total_ttc > 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND pfd.fk_facture = f.rowid";

View File

@ -93,7 +93,10 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$status) $sql.= " AND pfd.traite = 0";
if ($status) $sql.= " AND pfd.traite = ".$status;
$sql.= " AND f.total_ttc > 0";
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
{

View File

@ -102,7 +102,10 @@ $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.total_ttc > 0";
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;