From 3875d26a2feb7f6fb39cc158101521f7b563b617 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Oct 2021 15:55:12 +0200 Subject: [PATCH] Fix filter for supplierinvoice stats --- htdocs/compta/facture/stats/index.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index fb47a3eb788..03fcf5b37d0 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -92,7 +92,7 @@ print load_fiche_titre($title, '', $picto); dol_mkdir($dir); $stats = new FactureStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); -if ($mode == 'customer' || $mode == 'supplier') { +if ($mode == 'customer') { if ($object_status != '' && $object_status >= 0) { $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')'; } @@ -101,6 +101,16 @@ if ($mode == 'customer' || $mode == 'supplier') { $stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')'; } } +if ($mode == 'supplier') { + if ($object_status != '' && $object_status >= 0) { + $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')'; + } + if (is_array($custcats) && !empty($custcats)) { + $stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)'; + $stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')'; + } + +} // Build graphic number of object // $data = array(array('Lib',val1,val2,val3),...)