32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40 $langs->loadLangs(array(
"companies",
"members"));
46 $hookmanager->initHooks(array(
'membersindex'));
59 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
60 $zone =
GETPOST(
'areacode',
'int');
61 $userid =
GETPOST(
'userid',
'int');
62 $boxorder =
GETPOST(
'boxorder',
'aZ09');
63 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
80 llxHeader(
'', $langs->trans(
"Members"),
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
86 print
load_fiche_titre($langs->trans(
"MembersArea"), $resultboxes[
'selectboxlist'],
'members');
88 $MembersValidated = array();
89 $MembersToValidate = array();
90 $MembersWaitingSubscription = array();
91 $MembersUpToDate = array();
92 $MembersExpired = array();
93 $MembersExcluded = array();
94 $MembersResiliated = array();
96 $AdherentType = array();
99 $sql =
"SELECT t.rowid, t.libelle as label, t.subscription,";
100 $sql .=
" d.statut, count(d.rowid) as somme";
101 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as t";
102 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d";
103 $sql .=
" ON t.rowid = d.fk_adherent_type";
104 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
105 $sql .=
" WHERE t.entity IN (".getEntity(
'member_type').
")";
106 $sql .=
" GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
108 dol_syslog(
"index.php::select nb of members per type", LOG_DEBUG);
109 $resql = $db->query($sql);
111 $num = $db->num_rows(
$resql);
114 $objp = $db->fetch_object(
$resql);
117 $adhtype->id = $objp->rowid;
118 $adhtype->subscription = $objp->subscription;
119 $adhtype->label = $objp->label;
120 $AdherentType[$objp->rowid] = $adhtype;
122 if ($objp->statut == -1) {
123 $MembersToValidate[$objp->rowid] = $objp->somme;
125 if ($objp->statut == 1) {
126 $MembersValidated[$objp->rowid] = $objp->somme;
128 if ($objp->statut == -2) {
129 $MembersExcluded[$objp->rowid] = $objp->somme;
131 if ($objp->statut == 0) {
132 $MembersResiliated[$objp->rowid] = $objp->somme;
143 $sql =
"SELECT count(*) as somme , d.fk_adherent_type";
144 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
145 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
146 $sql .=
" AND d.statut = 1";
147 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
148 $sql .=
" AND t.rowid = d.fk_adherent_type";
149 $sql .=
" GROUP BY d.fk_adherent_type";
151 dol_syslog(
"index.php::select nb of uptodate members by type", LOG_DEBUG);
152 $resql = $db->query($sql);
154 $num = $db->num_rows(
$resql);
157 $objp = $db->fetch_object(
$resql);
158 $MembersWaitingSubscription[$objp->fk_adherent_type] = $objp->somme;
167 $sql =
"SELECT count(*) as somme , d.fk_adherent_type";
168 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
169 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
170 $sql .=
" AND d.statut = 1";
171 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR t.subscription = '0')";
172 $sql .=
" AND t.rowid = d.fk_adherent_type";
173 $sql .=
" GROUP BY d.fk_adherent_type";
175 dol_syslog(
"index.php::select nb of uptodate members by type", LOG_DEBUG);
176 $resql = $db->query($sql);
178 $num = $db->num_rows(
$resql);
181 $objp = $db->fetch_object(
$resql);
182 $MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
189 $sql =
"SELECT count(*) as somme , d.fk_adherent_type";
190 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
191 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
192 $sql .=
" AND d.statut = 1";
193 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND t.subscription = '1')";
194 $sql .=
" AND t.rowid = d.fk_adherent_type";
195 $sql .=
" GROUP BY d.fk_adherent_type";
197 dol_syslog(
"index.php::select nb of uptodate members by type", LOG_DEBUG);
198 $resql = $db->query($sql);
200 $num = $db->num_rows(
$resql);
203 $objp = $db->fetch_object(
$resql);
204 $MembersExpired[$objp->fk_adherent_type] = $objp->somme;
215 if ($conf->use_javascript_ajax) {
216 $boxgraph .=
'<div class="div-table-responsive-no-min">';
217 $boxgraph .=
'<table class="noborder nohover centpercent">';
218 $boxgraph .=
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
'</th></tr>';
219 $boxgraph .=
'<tr><td class="center" colspan="2">';
222 $SumWaitingSubscription = 0;
231 foreach ($AdherentType as $key => $adhtype) {
232 $dataval[
'draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
233 $dataval[
'waitingsubscription'][] = array($i, isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0);
234 $dataval[
'uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
235 $dataval[
'expired'][] = array($i, isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0);
236 $dataval[
'excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
237 $dataval[
'resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
239 $SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
240 $SumWaitingSubscription += isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0;
241 $SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
242 $SumExpired += isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0;
243 $SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
244 $SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
247 $total = $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
248 $dataseries = array();
249 $dataseries[] = array($langs->transnoentitiesnoconv(
"MembersStatusToValid"), round($SumToValidate));
250 $dataseries[] = array($langs->transnoentitiesnoconv(
"WaitingSubscription"), round($SumWaitingSubscription));
251 $dataseries[] = array($langs->transnoentitiesnoconv(
"UpToDate"), round($SumUpToDate));
252 $dataseries[] = array($langs->transnoentitiesnoconv(
"OutOfDate"), round($SumExpired));
253 $dataseries[] = array($langs->transnoentitiesnoconv(
"MembersStatusExcluded"), round($SumExcluded));
254 $dataseries[] = array($langs->transnoentitiesnoconv(
"MembersStatusResiliated"), round($SumResiliated));
256 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
258 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
260 $dolgraph->SetData($dataseries);
261 $dolgraph->SetDataColor(array(
'-'.$badgeStatus0, $badgeStatus1, $badgeStatus4, $badgeStatus8,
'-'.$badgeStatus8, $badgeStatus6));
262 $dolgraph->setShowLegend(2);
263 $dolgraph->setShowPercent(1);
264 $dolgraph->SetType(array(
'pie'));
265 $dolgraph->setHeight(
'200');
266 $dolgraph->draw(
'idgraphstatus');
267 $boxgraph .=$dolgraph->show($total ? 0 : 1);
269 $boxgraph .=
'</td></tr>';
270 $boxgraph .=
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">';
271 $boxgraph .= $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
272 $boxgraph .=
'</td></tr>';
273 $boxgraph .=
'</table>';
274 $boxgraph .=
'</div>';
279 print
'<div class="clearboth"></div>';
280 print
'<div class="fichecenter fichecenterbis">';
282 print
'<div class="twocolumns">';
284 print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
288 print $resultboxes[
'boxlista'];
292 print
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
294 print $resultboxes[
'boxlistb'];
301 $parameters = array(
'user' => $user);
302 $reshook = $hookmanager->executeHooks(
'dashboardMembers', $parameters, $object);
Class to manage members of a foundation.
Class to manage members type.
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
Class to manage subscriptions of foundation members.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.