From ebfee045c379fbad95e2b43e28f7c2fb31912521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Mar 2011 10:08:02 +0000 Subject: [PATCH] New: Add region/country statistics for member module. --- htdocs/adherents/stats/index.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 2f03f6a6436..2a1c7c2d0a5 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -82,13 +82,16 @@ if ($mode) } if ($mode == 'memberbystate') { - $label=$langs->trans("State"); + $label=$langs->trans("Country"); + $label2=$langs->trans("State"); $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.nom as label"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, p.libelle as label, c.nom as label2"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.fk_departement = c.rowid"; - $sql.=" WHERE statut = 1"; - $sql.=" GROUP BY c.nom"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p on r.fk_pays = p.rowid"; + $sql.=" WHERE statut = 1"; + $sql.=" GROUP BY p.libelle, c.nom"; //print $sql; } @@ -113,6 +116,7 @@ if ($mode) if ($mode == 'memberbystate') { $data[]=array('label'=>($obj->label?$obj->label:$langs->trans("Unknown")), + 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, 'lastdate'=>$obj->lastdate ); @@ -198,6 +202,7 @@ if ($mode) print ''; print ''; print ''; + if ($label2) print ''; print ''; print ''; print ''; @@ -210,7 +215,8 @@ if ($mode) $var=!$var; print ''; print ''; - print ''; + if ($label2) print ''; + print ''; print ''; print ''; $oldyear=$year;
'.$label.''.$label2.''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").'
'.$val['label'].''.$val['nb'].''.$val['label2'].''.$val['nb'].''.dol_print_date($val['lastdate'],'dayhour').'