--- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_19.0.3_byproperties.php
+++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_byproperties.php
@@ -24 +23,0 @@
-// Load Dolibarr environment
@@ -33 +32 @@
-$mode = GETPOST('mode') ? GETPOST('mode') : '';
+$mode = GETPOST('mode') ?GETPOST('mode') : '';
@@ -37,3 +36,4 @@
-if ($user->socid > 0) {
- $action = '';
- $socid = $user->socid;
+if ($user->socid > 0)
+{
+ $action = '';
+ $socid = $user->socid;
@@ -43,2 +43,2 @@
-$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
-$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
+$year = strftime("%Y", time());
+$startyear = $year - 2;
@@ -61 +61 @@
-print load_fiche_titre($title, '', $memberstatic->picto);
+print load_fiche_titre($title, '', 'object_group');
@@ -63 +63,3 @@
-//dol_mkdir($dir);
+dol_mkdir($dir);
+
+$tab = 'byproperties';
@@ -66,4 +68 @@
-
-$sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
-$sql .= " MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
-$sql .= " d.morphy as code";
+$sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
@@ -73 +72 @@
-$sql .= " AND d.statut <> ".Adherent::STATUS_DRAFT;
+$sql .= " AND d.statut = 1";
@@ -74,0 +74 @@
+
@@ -80 +80,2 @@
-if ($resql) {
+if ($resql)
+{
@@ -83 +84,2 @@
- while ($i < $num) {
+ while ($i < $num)
+ {
@@ -86,6 +88,2 @@
- if ($obj->code == 'phy') {
- $foundphy++;
- }
- if ($obj->code == 'mor') {
- $foundmor++;
- }
+ if ($obj->code == 'phy') $foundphy++;
+ if ($obj->code == 'mor') $foundmor++;
@@ -93 +91 @@
- $data[$obj->code] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'nbsubscriptions'=>$obj->nbsubscriptions, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
+ $data[] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
@@ -98,2 +95,0 @@
-} else {
- dol_print_error($db);
@@ -101,33 +97,2 @@
-
-$sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,";
-$sql .= " MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,";
-$sql .= " d.morphy as code";
-$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
-$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
-$sql .= " AND d.statut >= 1"; // Active (not excluded=-2, not draft=-1, not resiliated=0)
-$sql .= " GROUP BY d.morphy";
-$foundphy = $foundmor = 0;
-
-// Define $data array
-dol_syslog("Count member still active", LOG_DEBUG);
-$resql = $db->query($sql);
-if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
-
- if ($obj->code == 'phy') {
- $foundphy++;
- }
- if ($obj->code == 'mor') {
- $foundmor++;
- }
-
- $data[$obj->code]['nbactive'] = $obj->nb;
-
- $i++;
- }
- $db->free($resql);
-} else {
+else
+{
@@ -138 +103 @@
-$head = member_stats_prepare_head($memberstatic);
+$head = member_stats_prepare_head($adh);
@@ -140 +105 @@
-print dol_get_fiche_head($head, 'statsbyproperties', '', -1, '');
+dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
@@ -144,2 +109,3 @@
-if (!count($data)) {
- print ''.$langs->trans("NoValidatedMemberYet").'
';
+if (!count($data))
+{
+ print $langs->trans("NoValidatedMemberYet").'
';
@@ -147,2 +113,4 @@
-} else {
- print ''.$langs->trans("MembersByNature").'
';
+}
+else
+{
+ print $langs->trans("MembersByNature").'
';
@@ -153 +120,0 @@
-print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@@ -156,3 +123,2 @@
-print '
'.$langs->trans("MemberNature").' | ';
-print ''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").') | ';
-print ''.$langs->trans("NbOfActiveMembers").' | ';
+print ''.$langs->trans("Nature").' | ';
+print ''.$langs->trans("NbOfMembers").' | ';
@@ -160 +125,0 @@
-print ''.$langs->trans("NbOfSubscriptions").' | ';
@@ -164,6 +129,2 @@
-if (!$foundphy) {
- $data[] = array('label'=>'phy', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
-}
-if (!$foundmor) {
- $data[] = array('label'=>'mor', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
-}
+if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
+if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
@@ -171,5 +132,2 @@
-foreach ($data as $val) {
- $nb = $val['nb'];
- $nbsubscriptions = isset($val['nbsubscriptions']) ? $val['nbsubscriptions'] : 0;
- $nbactive = $val['nbactive'];
-
+foreach ($data as $val)
+{
@@ -178,2 +136 @@
- print ''.$nb.' | ';
- print ''.$nbactive.' | ';
+ print ''.$val['nb'].' | ';
@@ -181 +137,0 @@
- print ''.$nbsubscriptions.' | ';
@@ -187 +142,0 @@
-print '';
@@ -189 +144,2 @@
-print dol_get_fiche_end();
+
+dol_fiche_end();
--- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_19.0.3_geo.php
+++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_geo.php
@@ -24 +23,0 @@
-// Load Dolibarr environment
@@ -29 +27,0 @@
-require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -35 +33 @@
-$mode = GETPOST('mode') ? GETPOST('mode') : '';
+$mode = GETPOST('mode') ?GETPOST('mode') : '';
@@ -39,3 +37,4 @@
-if ($user->socid > 0) {
- $action = '';
- $socid = $user->socid;
+if ($user->socid > 0)
+{
+ $action = '';
+ $socid = $user->socid;
@@ -45,2 +44,2 @@
-$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
-$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
+$year = strftime("%Y", time());
+$startyear = $year - 2;
@@ -50 +49 @@
-$langs->loadLangs(array("companies", "members", "banks"));
+$langs->loadLangs(array("companies", "members"));
@@ -57,2 +55,0 @@
-$memberstatic = new Adherent($db);
-
@@ -60,3 +57 @@
-if (!empty($conf->dol_use_jmobile)) {
- $arrayjs = array();
-}
+if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
@@ -65,12 +60,4 @@
-if ($mode == 'memberbycountry') {
- $title = $langs->trans("MembersStatisticsByCountries");
-}
-if ($mode == 'memberbystate') {
- $title = $langs->trans("MembersStatisticsByState");
-}
-if ($mode == 'memberbytown') {
- $title = $langs->trans("MembersStatisticsByTown");
-}
-if ($mode == 'memberbyregion') {
- $title = $langs->trans("MembersStatisticsByRegion");
-}
+if ($mode == 'memberbycountry') $title = $langs->trans("MembersStatisticsByCountries");
+if ($mode == 'memberbystate') $title = $langs->trans("MembersStatisticsByState");
+if ($mode == 'memberbytown') $title = $langs->trans("MembersStatisticsByTown");
+if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion");
@@ -80,88 +67,107 @@
-print load_fiche_titre($title, '', $memberstatic->picto);
-
-//dol_mkdir($dir);
-
-if ($mode) {
- // Define sql
- if ($mode == 'memberbycountry') {
- $label = $langs->trans("Country");
- $tab = 'statscountry';
-
- $data = array();
- $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
- $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
- $sql .= " AND d.statut <> ".Adherent::STATUS_DRAFT;
- $sql .= " GROUP BY c.label, c.code";
- //print $sql;
- }
-
- if ($mode == 'memberbystate') {
- $label = $langs->trans("Country");
- $label2 = $langs->trans("State");
- $tab = 'statsstate';
-
- $data = array();
- $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
- $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
- $sql .= " AND d.statut <> ".Adherent::STATUS_DRAFT;
- $sql .= " GROUP BY co.label, co.code, c.nom";
- //print $sql;
- }
- if ($mode == 'memberbyregion') { //
- $label = $langs->trans("Country");
- $label2 = $langs->trans("Region"); //département
- $tab = 'statsregion'; //onglet
-
- $data = array(); //tableau de donnée
- $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
- $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
- $sql .= " AND d.statut <> ".Adherent::STATUS_DRAFT;
- $sql .= " GROUP BY co.label, co.code, r.nom"; //+
- //print $sql;
- }
- if ($mode == 'memberbytown') {
- $label = $langs->trans("Country");
- $label2 = $langs->trans("Town");
- $tab = 'statstown';
-
- $data = array();
- $sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
- $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
- $sql .= " AND d.statut <> ".Adherent::STATUS_DRAFT;
- $sql .= " GROUP BY c.label, c.code, d.town";
- //print $sql;
- }
-
- $langsen = new Translate('', $conf);
- $langsen->setDefaultLang('en_US');
- $langsen->load("dict");
- //print $langsen->trans("Country"."FI");exit;
-
- // Define $data array
- dol_syslog("Count member", LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- if ($mode == 'memberbycountry') {
- $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'code'=>$obj->code,
+print load_fiche_titre($title, '', 'object_group');
+
+dol_mkdir($dir);
+
+if ($mode)
+{
+ // Define sql
+ if ($mode == 'memberbycountry')
+ {
+ $label = $langs->trans("Country");
+ $tab = 'statscountry';
+
+ $data = array();
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY c.label, c.code";
+ //print $sql;
+ }
+
+ if ($mode == 'memberbystate')
+ {
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("State");
+ $tab = 'statsstate';
+
+ $data = array();
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY co.label, co.code, c.nom";
+ //print $sql;
+ }
+ if ($mode == 'memberbyregion') //
+ {
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("Region"); //département
+ $tab = 'statsregion'; //onglet
+
+ $data = array(); //tableau de donnée
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY co.label, co.code, r.nom"; //+
+ //print $sql;
+ }
+ if ($mode == 'memberbytown')
+ {
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("Town");
+ $tab = 'statstown';
+
+ $data = array();
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY c.label, c.code, d.town";
+ //print $sql;
+ }
+
+ $langsen = new Translate('', $conf);
+ $langsen->setDefaultLang('en_US');
+ $langsen->load("dict");
+ //print $langsen->trans("Country"."FI");exit;
+
+ // Define $data array
+ dol_syslog("Count member", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
+ if ($mode == 'memberbycountry')
+ {
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'code'=>$obj->code,
+ 'nb'=>$obj->nb,
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
+ );
+ }
+ if ($mode == 'memberbyregion') //+
+ {
+ $data[] = array(
+ 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
@@ -170,44 +176,38 @@
- 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
- );
- }
- if ($mode == 'memberbyregion') { //+
- $data[] = array(
- 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label2'=>($obj->label2 ? $obj->label2 : ''.$langs->trans("Unknown").''),
- 'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate),
- 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
- );
- }
- if ($mode == 'memberbystate') {
- $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label2'=>($obj->label2 ? $obj->label2 : ''.$langs->trans("Unknown").''),
- 'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate),
- 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
- );
- }
- if ($mode == 'memberbytown') {
- $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')),
- 'label2'=>($obj->label2 ? $obj->label2 : ''.$langs->trans("Unknown").''),
- 'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate),
- 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
- );
- }
-
- $i++;
- }
- $db->free($resql);
- } else {
- dol_print_error($db);
- }
-}
-
-
-$head = member_stats_prepare_head($memberstatic);
-
-print dol_get_fiche_head($head, $tab, '', -1, '');
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
+ );
+ }
+ if ($mode == 'memberbystate')
+ {
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
+ 'nb'=>$obj->nb,
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
+ );
+ }
+ if ($mode == 'memberbytown')
+ {
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
+ 'nb'=>$obj->nb,
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
+ );
+ }
+
+ $i++;
+ }
+ $db->free($resql);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
+
+$head = member_stats_prepare_head($adh);
+
+dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
@@ -217,21 +217,21 @@
-if ($mode && !count($data)) {
- print $langs->trans("NoValidatedMemberYet").'
';
- print '
';
-} else {
- if ($mode == 'memberbycountry') {
- print ''.$langs->trans("MembersByCountryDesc").'
';
- } elseif ($mode == 'memberbystate') {
- print ''.$langs->trans("MembersByStateDesc").'
';
- } elseif ($mode == 'memberbytown') {
- print ''.$langs->trans("MembersByTownDesc").'
';
- } elseif ($mode == 'memberbyregion') {
- print ''.$langs->trans("MembersByRegion").'
'; //+
- } else {
- print ''.$langs->trans("MembersStatisticsDesc").'
';
- print '
';
- print ''.$langs->trans("MembersStatisticsByCountries").'
';
- print '
';
- print ''.$langs->trans("MembersStatisticsByState").'
';
- print '
';
- print ''.$langs->trans("MembersStatisticsByTown").'
';
- print '
'; //+
+if ($mode && !count($data))
+{
+ print $langs->trans("NoValidatedMemberYet").'
';
+ print '
';
+}
+else
+{
+ if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'
';
+ elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'
';
+ elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'
';
+ elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'
'; //+
+ else
+ {
+ print $langs->trans("MembersStatisticsDesc").'
';
+ print '
';
+ print ''.$langs->trans("MembersStatisticsByCountries").'
';
+ print '
';
+ print ''.$langs->trans("MembersStatisticsByState").'
';
+ print '
';
+ print ''.$langs->trans("MembersStatisticsByTown").'
';
+ print '
'; //+
@@ -239,2 +239,2 @@
- }
- print '
';
+ }
+ print '
';
@@ -245,85 +245,78 @@
-if (count($arrayjs) && $mode == 'memberbycountry') {
- $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
- if (is_readable($color_file)) {
- include $color_file;
- }
-
- // Assume we've already included the proper headers so just call our script inline
- // More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR
- print "\n\n";
-
- // print the div tag that will contain the map
- print ''."\n";
-}
-
-if ($mode) {
- // Print array
- print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
- print '
';
- print '';
- print ''.$label.' | ';
- if (isset($label2)) {
- print ''.$label2.' | ';
- }
- print ''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").') | ';
- print ''.$langs->trans("LastMemberDate").' | ';
- print ''.$langs->trans("LatestSubscriptionDate").' | ';
- print '
';
-
- foreach ($data as $val) {
- $year = isset($val['year']) ? $val['year'] : '';
- print '';
- print ''.$val['label'].' | ';
- if (isset($label2)) {
- print ''.$val['label2'].' | ';
- }
- print ''.$val['nb'].' | ';
- print ''.dol_print_date($val['lastdate'], 'dayhour').' | ';
- print ''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').' | ';
- print '
';
- }
-
- print '
';
- print '
';
-}
-
-
-print dol_get_fiche_end();
+if (count($arrayjs) && $mode == 'memberbycountry')
+{
+ $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
+ if (is_readable($color_file)) include_once $color_file;
+
+ // Assume we've already included the proper headers so just call our script inline
+ // More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR
+ print "\n\n";
+
+ // print the div tag that will contain the map
+ print ''."\n";
+ print '
';
+}
+
+if ($mode)
+{
+ // Print array / Affiche le tableau
+ print '';
+ print '';
+ print ''.$label.' | ';
+ if ($label2) print ''.$label2.' | ';
+ print ''.$langs->trans("NbOfMembers").' | ';
+ print ''.$langs->trans("LastMemberDate").' | ';
+ print ''.$langs->trans("LatestSubscriptionDate").' | ';
+ print '
';
+
+ foreach ($data as $val)
+ {
+ $year = $val['year'];
+ print '';
+ print ''.$val['label'].' | ';
+ if ($label2) print ''.$val['label2'].' | ';
+ print ''.$val['nb'].' | ';
+ print ''.dol_print_date($val['lastdate'], 'dayhour').' | ';
+ print ''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').' | ';
+ print '
';
+ }
+
+ print '
';
+}
+
+
+dol_fiche_end();
--- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_19.0.3_index.php
+++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_index.php
@@ -26 +25,0 @@
-// Load Dolibarr environment
@@ -28 +26,0 @@
-require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -36,6 +34,2 @@
-$userid = GETPOST('userid', 'int'); if ($userid < 0) {
- $userid = 0;
-}
-$socid = GETPOST('socid', 'int'); if ($socid < 0) {
- $socid = 0;
-}
+$userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
+$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
@@ -44,3 +38,4 @@
-if ($user->socid > 0) {
- $action = '';
- $socid = $user->socid;
+if ($user->socid > 0)
+{
+ $action = '';
+ $socid = $user->socid;
@@ -50,2 +45,2 @@
-$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
-$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
+$year = strftime("%Y", time());
+$startyear = $year - 2;
@@ -53,3 +47,0 @@
-if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) {
- $endyear = dol_print_date(dol_time_plus_duree(dol_now('gmt'), (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)), "%Y", 'gmt');
-}
@@ -65 +56,0 @@
-$memberstatic = new Adherent($db);
@@ -71 +62 @@
-print load_fiche_titre($title, '', $memberstatic->picto);
+print load_fiche_titre($title, '', 'members');
@@ -91,19 +82,21 @@
-if (!$mesg) {
- $px1->SetData($data);
- $i = $startyear;
- while ($i <= $endyear) {
- $legend[] = $i;
- $i++;
- }
- $px1->SetLegend($legend);
- $px1->SetMaxValue($px1->GetCeilMaxValue());
- $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
- $px1->SetWidth($WIDTH);
- $px1->SetHeight($HEIGHT);
- $px1->SetYLabel($langs->trans("NbOfSubscriptions"));
- $px1->SetShading(3);
- $px1->SetHorizTickIncrement(1);
- $px1->mode = 'depth';
- $px1->SetTitle($langs->trans("NbOfSubscriptions"));
-
- $px1->draw($filenamenb, $fileurlnb);
+if (!$mesg)
+{
+ $px1->SetData($data);
+ $i = $startyear;
+ while ($i <= $endyear)
+ {
+ $legend[] = $i;
+ $i++;
+ }
+ $px1->SetLegend($legend);
+ $px1->SetMaxValue($px1->GetCeilMaxValue());
+ $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
+ $px1->SetWidth($WIDTH);
+ $px1->SetHeight($HEIGHT);
+ $px1->SetYLabel($langs->trans("NbOfSubscriptions"));
+ $px1->SetShading(3);
+ $px1->SetHorizTickIncrement(1);
+ $px1->mode = 'depth';
+ $px1->SetTitle($langs->trans("NbOfSubscriptions"));
+
+ $px1->draw($filenamenb, $fileurlnb);
@@ -122,25 +115,27 @@
-if (!$mesg) {
- $px2->SetData($data);
- $i = $startyear;
- while ($i <= $endyear) {
- $legend[] = $i;
- $i++;
- }
- $px2->SetLegend($legend);
- $px2->SetMaxValue($px2->GetCeilMaxValue());
- $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
- $px2->SetWidth($WIDTH);
- $px2->SetHeight($HEIGHT);
- $px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
- $px2->SetShading(3);
- $px2->SetHorizTickIncrement(1);
- $px2->mode = 'depth';
- $px2->SetTitle($langs->trans("AmountOfSubscriptions"));
-
- $px2->draw($filenameamount, $fileurlamount);
-}
-
-
-$head = member_stats_prepare_head($memberstatic);
-
-print dol_get_fiche_head($head, 'statssubscription', '', -1, '');
+if (!$mesg)
+{
+ $px2->SetData($data);
+ $i = $startyear;
+ while ($i <= $endyear)
+ {
+ $legend[] = $i;
+ $i++;
+ }
+ $px2->SetLegend($legend);
+ $px2->SetMaxValue($px2->GetCeilMaxValue());
+ $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
+ $px2->SetWidth($WIDTH);
+ $px2->SetHeight($HEIGHT);
+ $px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
+ $px2->SetShading(3);
+ $px2->SetHorizTickIncrement(1);
+ $px2->mode = 'depth';
+ $px2->SetTitle($langs->trans("AmountOfSubscriptions"));
+
+ $px2->draw($filenameamount, $fileurlamount);
+}
+
+
+$head = member_stats_prepare_head($adh);
+
+dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), -1, 'user');
@@ -158 +152,0 @@
-print img_picto('', 'company', 'class="pictofixedwidth"');
@@ -162,2 +156 @@
-print img_picto('', 'user', 'class="pictofixedwidth"');
-print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
+print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
@@ -165 +158 @@
-print ' |
';
+print ' |
';
@@ -185,24 +178,28 @@
-foreach ($data as $val) {
- $year = $val['year'];
- while ($oldyear > $year + 1) { // If we have empty year
- $oldyear--;
- print '';
- print '';
- //print '';
- print $oldyear;
- //print '';
- print ' | ';
- print '0 | ';
- print '0 | ';
- print '0 | ';
- print '
';
- }
- print '';
- print '';
- print ''.$year.'';
- print ' | ';
- print ''.$val['nb'].' | ';
- print ''.price(price2num($val['total'], 'MT'), 1).' | ';
- print ''.price(price2num($val['avg'], 'MT'), 1).' | ';
- print '
';
- $oldyear = $year;
+foreach ($data as $val)
+{
+ $year = $val['year'];
+ while ($oldyear > $year + 1)
+ { // If we have empty year
+ $oldyear--;
+ print '';
+ print '';
+ print '';
+ print $oldyear;
+ print '';
+ print ' | ';
+ print '0 | ';
+ print '0 | ';
+ print '0 | ';
+ print '
';
+ }
+ print '';
+ print '';
+ //print '';
+ print $year;
+ //print '';
+ print ' | ';
+ print ''.$val['nb'].' | ';
+ print ''.price(price2num($val['total'], 'MT'), 1).' | ';
+ print ''.price(price2num($val['avg'], 'MT'), 1).' | ';
+ print '
';
+ $oldyear = $year;
@@ -215 +212 @@
-print '';
+print '
';
@@ -220,6 +217,5 @@
-if ($mesg) {
- print $mesg;
-} else {
- print $px1->show();
- print "
\n";
- print $px2->show();
+if ($mesg) { print $mesg; }
+else {
+ print $px1->show();
+ print "
\n";
+ print $px2->show();
@@ -230,5 +226,5 @@
-print '
';
-print '';
-
-
-print dol_get_fiche_end();
+print '';
+print '';
+
+
+dol_fiche_end();