28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
36 $hookmanager->initHooks(array(
'membersindex'));
39 $langs->loadLangs(array(
"companies",
"members"));
49 llxHeader(
'', $langs->trans(
"Members"),
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
58 $AdherentsAValider = array();
59 $MemberUpToDate = array();
60 $AdherentsResilies = array();
62 $AdherentType = array();
65 $sql =
"SELECT t.rowid, t.libelle as label, t.subscription,";
66 $sql .=
" d.statut, count(d.rowid) as somme";
67 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as t";
68 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d";
69 $sql .=
" ON t.rowid = d.fk_adherent_type";
70 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
71 $sql .=
" WHERE t.entity IN (".getEntity(
'member_type').
")";
72 $sql .=
" GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
74 dol_syslog(
"index.php::select nb of members per type", LOG_DEBUG);
75 $result = $db->query($sql);
77 $num = $db->num_rows($result);
80 $objp = $db->fetch_object($result);
83 $adhtype->id = $objp->rowid;
84 $adhtype->subscription = $objp->subscription;
85 $adhtype->label = $objp->label;
86 $AdherentType[$objp->rowid] = $adhtype;
88 if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
89 if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
90 if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
102 $sql =
"SELECT count(*) as somme , d.fk_adherent_type";
103 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
104 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
105 $sql .=
" AND d.statut = 1 AND (d.datefin >= '".$db->idate($now).
"' OR t.subscription = 0)";
106 $sql .=
" AND t.rowid = d.fk_adherent_type";
107 $sql .=
" GROUP BY d.fk_adherent_type";
109 dol_syslog(
"index.php::select nb of uptodate members by type", LOG_DEBUG);
110 $result = $db->query($sql);
112 $num = $db->num_rows($result);
115 $objp = $db->fetch_object($result);
116 $MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
123 print '<div class="fichecenter"><div class="fichethirdleft">';
126 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
128 if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
129 $listofsearchfields[
'search_member'] = array(
'text'=>
'Member');
132 if (count($listofsearchfields)) {
133 print '<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
134 print '<input type="hidden" name="token" value="'.newToken().
'">';
135 print '<div class="div-table-responsive-no-min">';
136 print '<table class="noborder nohover centpercent">';
138 foreach ($listofsearchfields as $key => $value) {
139 if ($i == 0)
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
140 print '<tr class="oddeven">';
141 print '<td class="nowrap"><label for="'.$key.
'">'.$langs->trans($value[
"text"]).
'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.
'" id="'.$key.
'" size="18"></td>';
142 if ($i == 0)
print '<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
158 if ($conf->use_javascript_ajax) {
159 print '<div class="div-table-responsive-no-min">';
160 print '<table class="noborder nohover centpercent">';
161 print '<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
'</th></tr>';
162 print '<tr><td class="center" colspan="2">';
171 foreach ($AdherentType as $key => $adhtype) {
172 $dataval[
'draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
173 $dataval[
'notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
174 $dataval[
'uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
175 $dataval[
'resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
176 $SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
177 $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
178 $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
179 $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
182 $total = $SommeA + $SommeB + $SommeC + $SommeD;
183 $dataseries = array();
184 $dataseries[] = array($langs->transnoentitiesnoconv(
"OutOfDate"), round($SommeB));
185 $dataseries[] = array($langs->transnoentitiesnoconv(
"UpToDate"), round($SommeC));
186 $dataseries[] = array($langs->transnoentitiesnoconv(
"MembersStatusResiliated"), round($SommeD));
187 $dataseries[] = array($langs->transnoentitiesnoconv(
"MembersStatusToValid"), round($SommeA));
189 include_once DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
191 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
193 $dolgraph->SetData($dataseries);
194 $dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6,
'-'.$badgeStatus0));
195 $dolgraph->setShowLegend(2);
196 $dolgraph->setShowPercent(1);
197 $dolgraph->SetType(array(
'pie'));
198 $dolgraph->setHeight(
'200');
199 $dolgraph->draw(
'idgraphstatus');
200 print $dolgraph->show($total ? 0 : 1);
203 print '<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">';
204 print $SommeA + $SommeB + $SommeC + $SommeD;
218 $sql =
"SELECT c.subscription, c.dateadh as dateh";
219 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"subscription as c";
220 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
221 $sql .=
" AND d.rowid = c.fk_adherent";
224 $result = $db->query($sql);
226 $num = $db->num_rows($result);
229 $objp = $db->fetch_object($result);
231 $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
232 $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
233 $tot += $objp->subscription;
239 print '<div class="div-table-responsive-no-min">';
240 print '<table class="noborder centpercent">';
241 print '<tr class="liste_titre">';
242 print '<th>'.$langs->trans(
"Year").
'</th>';
243 print '<th class="right">'.$langs->trans(
"Subscriptions").
'</th>';
244 print '<th class="right">'.$langs->trans(
"AmountTotal").
'</th>';
245 print '<th class="right">'.$langs->trans(
"AmountAverage").
'</th>';
250 foreach ($Total as $key=>$value) {
252 print '<tr class="oddeven">';
253 print "<td>...</td>";
254 print "<td class=\"right\"></td>";
255 print "<td class=\"right\"></td>";
256 print "<td class=\"right\"></td>";
260 print '<tr class="oddeven">';
261 print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
262 print "<td class=\"right\">".$Number[$key].
"</td>";
263 print "<td class=\"right\">".price($value).
"</td>";
264 print "<td class=\"right\">".price(
price2num($value / $Number[$key],
'MT')).
"</td>";
270 print '<tr class="liste_total">';
271 print '<td>'.$langs->trans(
"Total").
'</td>';
272 print "<td class=\"right\">".$numb.
"</td>";
273 print '<td class="right">'.price($tot).
"</td>";
274 print "<td class=\"right\">".price(
price2num($numb > 0 ? ($tot / $numb) : 0,
'MT')).
"</td>";
276 print "</table></div>";
280 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
285 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
287 $sql =
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
288 $sql .=
" a.gender, a.email, a.photo, a.morphy,";
289 $sql .=
" a.tms as datem, a.datefin as date_end_subscription,";
290 $sql .=
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
291 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta";
292 $sql .=
" WHERE a.entity IN (".getEntity(
'adherent').
")";
293 $sql .=
" AND a.fk_adherent_type = ta.rowid";
294 $sql .= $db->order(
"a.tms",
"DESC");
295 $sql .= $db->plimit($max, 0);
297 $resql = $db->query($sql);
299 print '<div class="div-table-responsive-no-min">';
300 print '<table class="noborder centpercent">';
301 print '<tr class="liste_titre">';
302 print '<th colspan="4">'.$langs->trans(
"LastMembersModified", $max).
'</th></tr>';
304 $num = $db->num_rows(
$resql);
308 $obj = $db->fetch_object(
$resql);
310 $staticmember->id = $obj->rowid;
311 $staticmember->ref = $obj->rowid;
312 $staticmember->lastname = $obj->lastname;
313 $staticmember->firstname = $obj->firstname;
314 $staticmember->gender = $obj->gender;
315 $staticmember->email = $obj->email;
316 $staticmember->photo = $obj->photo;
317 $staticmember->morphy = $obj->morphy;
318 $staticmember->statut = $obj->status;
319 $staticmember->need_subscription = $obj->need_subscription;
320 $staticmember->datefin = $db->jdate($obj->date_end_subscription);
321 if (!empty($obj->fk_soc)) {
322 $staticmember->fk_soc = $obj->fk_soc;
323 $staticmember->fetch_thirdparty();
324 $staticmember->name = $staticmember->thirdparty->name;
326 $staticmember->name = $obj->company;
329 $statictype->id = $obj->typeid;
330 $statictype->label = $obj->label;
331 $statictype->subscription = $obj->need_subscription;
333 print '<tr class="oddeven">';
334 print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32).
'</td>';
335 print '<td>'.$statictype->getNomUrl(1, 32).
'</td>';
336 print '<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
337 print '<td class="right">'.$staticmember->getLibStatut(3).
'</td>';
342 print "</table></div>";
352 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
354 $sql =
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
355 $sql .=
" a.gender, a.email, a.photo, a.morphy,";
356 $sql .=
" a.datefin as date_end_subscription,";
357 $sql .=
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
358 $sql .=
" c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
359 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta, ".MAIN_DB_PREFIX.
"subscription as c";
360 $sql .=
" WHERE a.entity IN (".getEntity(
'adherent').
")";
361 $sql .=
" AND a.fk_adherent_type = ta.rowid";
362 $sql .=
" AND c.fk_adherent = a.rowid";
363 $sql .= $db->order(
"c.tms",
"DESC");
364 $sql .= $db->plimit($max, 0);
366 $resql = $db->query($sql);
368 print '<div class="div-table-responsive-no-min">';
369 print '<table class="noborder centpercent">';
370 print '<tr class="liste_titre">';
371 print '<th colspan="5">'.$langs->trans(
"LastSubscriptionsModified", $max).
'</th></tr>';
373 $num = $db->num_rows(
$resql);
377 $obj = $db->fetch_object(
$resql);
379 $staticmember->id = $obj->rowid;
380 $staticmember->ref = $obj->rowid;
381 $staticmember->lastname = $obj->lastname;
382 $staticmember->firstname = $obj->firstname;
383 $staticmember->gender = $obj->gender;
384 $staticmember->email = $obj->email;
385 $staticmember->photo = $obj->photo;
386 $staticmember->morphy = $obj->morphy;
387 $staticmember->statut = $obj->status;
388 $staticmember->need_subscription = $obj->need_subscription;
389 $staticmember->datefin = $db->jdate($obj->date_end_subscription);
390 if (!empty($obj->fk_soc)) {
391 $staticmember->fk_soc = $obj->fk_soc;
392 $staticmember->fetch_thirdparty();
393 $staticmember->name = $staticmember->thirdparty->name;
395 $staticmember->name = $obj->company;
398 $subscriptionstatic->id = $obj->cid;
399 $subscriptionstatic->ref = $obj->cid;
401 print '<tr class="oddeven">';
402 print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).
'</td>';
403 print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32,
'subscription').
'</td>';
404 print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).
'</td>';
405 print '<td class="right">'.price($obj->subscription).
'</td>';
407 print '<td class="right nowraponall">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec),
'dayhour').
'</td>';
412 print "</table></div>";
420 print '<div class="div-table-responsive-no-min">';
421 print '<table class="noborder centpercent">';
422 print '<tr class="liste_titre">';
423 print '<th>'.$langs->trans(
"MembersTypes").
'</th>';
424 print '<th class=right>'.$langs->trans(
"MembersStatusToValid").
'</th>';
425 print '<th class=right>'.$langs->trans(
"OutOfDate").
'</th>';
426 print '<th class=right>'.$langs->trans(
"UpToDate").
'</th>';
427 print '<th class=right>'.$langs->trans(
"MembersStatusResiliated").
'</th>';
430 foreach ($AdherentType as $key => $adhtype) {
431 print '<tr class="oddeven">';
433 print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] :
'').
' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).
'</td>';
434 print '<td class="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) :
'').
' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).
'</td>';
435 print '<td class="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] :
'').
' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).
'</td>';
436 print '<td class="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] :
'').
' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).
'</td>';
439 print '<tr class="liste_total">';
440 print '<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
441 print '<td class="liste_total right">'.$SommeA.
' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).
'</td>';
442 print '<td class="liste_total right">'.$SommeB.
' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).
'</td>';
443 print '<td class="liste_total right">'.$SommeC.
' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).
'</td>';
444 print '<td class="liste_total right">'.$SommeD.
' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).
'</td>';
450 print '</div></div></div>';
452 $parameters = array(
'user' => $user);
453 $reshook = $hookmanager->executeHooks(
'dashboardMembers', $parameters, $object);
dol_now($mode= 'auto')
Return date for now.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
dol_size($size, $type= '')
Optimize a size for some browsers (phone, smarphone, ...)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage members of a foundation.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage members type.
Class to manage subscriptions of foundation members.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...