From 371c75e76a1be84fc4ce497f2d7ccb70256d41f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Oct 2021 11:58:21 +0200 Subject: [PATCH 1/3] FIX list of categories in stats of supplier invoices --- htdocs/compta/facture/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 49f9be88ac6..7482faebad8 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -283,7 +283,7 @@ if (! empty($conf->category->enabled)) { $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier")); } print ''.$cat_label.''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); //print $formother->select_categories($cat_type, $categ_id, 'categ_id', true); print ''; From db3d16f080a1151ab581920553b6d4dd227aed42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Oct 2021 15:43:35 +0200 Subject: [PATCH 2/3] Fix filter tag for supplier invoice statistics --- htdocs/compta/facture/stats/index.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 7482faebad8..fb47a3eb788 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -92,18 +92,15 @@ 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') -{ - if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')'; +if ($mode == 'customer' || $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_societe as cat ON (f.fk_soc = cat.fk_soc)'; $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).')'; -} // Build graphic number of object // $data = array(array('Lib',val1,val2,val3),...) From 3875d26a2feb7f6fb39cc158101521f7b563b617 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Oct 2021 15:55:12 +0200 Subject: [PATCH 3/3] 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),...)