33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
41$langs->load(
"members");
43$rowid =
GETPOST(
'rowid',
'int');
44$action =
GETPOST(
'action',
'aZ09');
45$massaction =
GETPOST(
'massaction',
'alpha');
46$cancel =
GETPOST(
'cancel',
'alpha');
47$toselect =
GETPOST(
'toselect',
'array');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
49$backtopage =
GETPOST(
'backtopage',
'alpha');
50$mode =
GETPOST(
'mode',
'alpha');
52$sall =
GETPOST(
"sall",
"alpha");
53$filter =
GETPOST(
"filter",
'alpha');
54$search_ref =
GETPOST(
'search_ref',
'alpha');
55$search_lastname =
GETPOST(
'search_lastname',
'alpha');
56$search_login =
GETPOST(
'search_login',
'alpha');
57$search_email =
GETPOST(
'search_email',
'alpha');
58$type =
GETPOST(
'type',
'intcomma');
59$status =
GETPOST(
'status',
'alpha');
60$optioncss =
GETPOST(
'optioncss',
'alpha');
63$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
64$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
67if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
71$offset = $limit * $page;
78 $sortfield =
"d.lastname";
81$label =
GETPOST(
"label",
"alpha");
82$morphy =
GETPOST(
"morphy",
"alpha");
83$status =
GETPOST(
"status",
"int");
84$subscription =
GETPOST(
"subscription",
"int");
85$amount =
GETPOST(
'amount',
'alpha');
86$duration_value =
GETPOST(
'duration_value',
'int');
87$duration_unit =
GETPOST(
'duration_unit',
'alpha');
89$comment =
GETPOST(
"comment",
'restricthtml');
90$mail_valid =
GETPOST(
"mail_valid",
'restricthtml');
96$hookmanager->initHooks(array(
'membertypecard',
'globalcard'));
99$extrafields->fetch_name_optionals_label($object->table_element);
102$result =
restrictedArea($user,
'adherent', $rowid,
'adherent_type');
109if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
111 $search_lastname =
"";
118if (
GETPOST(
'cancel',
'alpha')) {
122if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
129 if (!empty($backtopage)) {
130 header(
"Location: ".$backtopage);
135if ($action ==
'add' && $user->hasRight(
'adherent',
'configurer')) {
136 $object->label = trim($label);
137 $object->morphy = trim($morphy);
138 $object->status = (int) $status;
139 $object->subscription = (int) $subscription;
140 $object->amount = ($amount ==
'' ?
'' :
price2num($amount,
'MT'));
141 $object->caneditamount = $caneditamount;
142 $object->duration_value = $duration_value;
143 $object->duration_unit = $duration_unit;
144 $object->note_public = trim($comment);
145 $object->note_private =
'';
146 $object->mail_valid = trim($mail_valid);
147 $object->vote = (int) $vote;
150 $ret = $extrafields->setOptionalsFromPost(
null, $object);
155 if (empty($object->label)) {
157 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
159 $sql =
"SELECT libelle FROM ".MAIN_DB_PREFIX.
"adherent_type WHERE libelle = '".$db->escape($object->label).
"'";
160 $sql .=
" WHERE entity IN (".getEntity(
'member_type').
")";
161 $result = $db->query($sql);
164 $num = $db->num_rows($result);
168 $langs->load(
"errors");
169 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
174 $id = $object->create($user);
176 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
187if ($action ==
'update' && $user->hasRight(
'adherent',
'configurer')) {
188 $object->fetch($rowid);
190 $object->oldcopy =
dol_clone($object, 2);
192 $object->label= trim($label);
193 $object->morphy = trim($morphy);
194 $object->status = (int) $status;
195 $object->subscription = (int) $subscription;
196 $object->amount = ($amount ==
'' ?
'' :
price2num($amount,
'MT'));
197 $object->caneditamount = $caneditamount;
198 $object->duration_value = $duration_value;
199 $object->duration_unit = $duration_unit;
200 $object->note_public = trim($comment);
201 $object->note_private =
'';
202 $object->mail_valid = trim($mail_valid);
203 $object->vote = (bool) trim($vote);
206 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
211 $ret = $object->update($user);
213 if ($ret >= 0 && !count($object->errors)) {
219 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id);
223if ($action ==
'confirm_delete' && $user->hasRight(
'adherent',
'configurer')) {
224 $object->fetch($rowid);
225 $res = $object->delete($user);
229 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
232 setEventMessages($langs->trans(
"MemberTypeCanNotBeDeleted"),
null,
'errors');
242$form =
new Form($db);
245$help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
247llxHeader(
'', $langs->trans(
"MembersTypeSetup"), $help_url);
249$arrayofselected = is_array($toselect) ? $toselect : array();
252if (!$rowid && $action !=
'create' && $action !=
'edit') {
255 $sql =
"SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration";
256 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as d";
257 $sql .=
" WHERE d.entity IN (".getEntity(
'member_type').
")";
259 $result = $db->query($sql);
261 $num = $db->num_rows($result);
262 $nbtotalofrecords = $num;
268 $param .=
'&mode'.urlencode($mode);
270 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
271 $param .=
'&contextpage='.$contextpage;
273 if ($limit > 0 && $limit != $conf->liste_limit) {
274 $param .=
'&limit='.$limit;
279 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
280 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
282 if ($user->hasRight(
'adherent',
'configurer')) {
284 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewMemberType'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/type.php?action=create');
287 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
288 if ($optioncss !=
'') {
289 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
291 print
'<input type="hidden" name="token" value="'.newToken().
'">';
292 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
293 print
'<input type="hidden" name="action" value="list">';
294 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
295 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
296 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
299 print_barre_liste($langs->trans(
"MembersTypes"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit, 0, 0, 1);
303 print
'<div class="div-table-responsive">';
304 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
306 print
'<tr class="liste_titre">';
308 print
'<th> </th>';
310 print
'<th>'.$langs->trans(
"Ref").
'</th>';
311 print
'<th>'.$langs->trans(
"Label").
'</th>';
312 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
313 print
'<th class="center">'.$langs->trans(
"MembershipDuration").
'</th>';
314 print
'<th class="center">'.$langs->trans(
"SubscriptionRequired").
'</th>';
315 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
316 print
'<th class="center">'.$langs->trans(
"CanEditAmountShort").
'</th>';
317 print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
318 print
'<th class="center">'.$langs->trans(
"Status").
'</th>';
320 print
'<th> </th>';
332 $imaxinloop = ($limit ? min($num, $limit) : $num);
333 while ($i < $imaxinloop) {
334 $objp = $db->fetch_object($result);
336 $membertype->id = $objp->rowid;
337 $membertype->ref = $objp->rowid;
338 $membertype->label = $objp->rowid;
339 $membertype->status = $objp->status;
340 $membertype->subscription = $objp->subscription;
341 $membertype->amount = $objp->amount;
342 $membertype->caneditamount = $objp->caneditamount;
344 if ($mode ==
'kanban') {
346 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
347 print
'<div class="box-flex-container kanban">';
350 $membertype->label = $objp->label;
351 print $membertype->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
352 if ($i == ($imaxinloop - 1)) {
357 print
'<tr class="oddeven">';
359 if ($user->hasRight(
'adherent',
'configurer')) {
360 print
'<td class="center"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
363 print
'<td class="nowraponall">';
364 print $membertype->getNomUrl(1);
367 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
368 print
'<td class="center">';
369 if ($objp->morphy ==
'phy') {
370 print $langs->trans(
"Physical");
371 } elseif ($objp->morphy ==
'mor') {
372 print $langs->trans(
"Moral");
374 print $langs->trans(
"MorAndPhy");
377 print
'<td class="center nowrap">';
378 if ($objp->duration) {
379 $duration_value = intval($objp->duration);
380 if ($duration_value > 1) {
381 $dur = array(
"i"=>$langs->trans(
"Minutes"),
"h"=>$langs->trans(
"Hours"),
"d"=>$langs->trans(
"Days"),
"w"=>$langs->trans(
"Weeks"),
"m"=>$langs->trans(
"Months"),
"y"=>$langs->trans(
"Years"));
383 $dur = array(
"i"=>$langs->trans(
"Minute"),
"h"=>$langs->trans(
"Hour"),
"d"=>$langs->trans(
"Day"),
"w"=>$langs->trans(
"Week"),
"m"=>$langs->trans(
"Month"),
"y"=>$langs->trans(
"Year"));
385 $unit = preg_replace(
"/[^a-zA-Z]+/",
"", $objp->duration);
386 print max(1, $duration_value).
' '.$dur[$unit];
389 print
'<td class="center">'.yn($objp->subscription).
'</td>';
390 print
'<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount ===
'' ?
'' :
price($objp->amount)).
'</span></td>';
391 print
'<td class="center">'.yn($objp->caneditamount).
'</td>';
392 print
'<td class="center">'.yn($objp->vote).
'</td>';
393 print
'<td class="center">'.$membertype->getLibStatut(5).
'</td>';
395 if ($user->hasRight(
'adherent',
'configurer')) {
396 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
413 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
426if ($action ==
'create') {
431 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
432 print
'<input type="hidden" name="token" value="'.newToken().
'">';
433 print
'<input type="hidden" name="action" value="add">';
437 print
'<table class="border centpercent">';
440 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
442 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
443 print $form->selectarray(
'status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
448 $morphys[
""] = $langs->trans(
"MorAndPhy");
449 $morphys[
"phy"] = $langs->trans(
"Physical");
450 $morphys[
"mor"] = $langs->trans(
"Moral");
451 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
452 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') :
'morphy');
455 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
456 print $form->selectyesno(
"subscription", 1, 1);
459 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
460 print
'<input name="amount" size="5" value="'.(GETPOSTISSET(
'amount') ?
GETPOST(
'amount') :
price($amount)).
'">';
463 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
464 print $form->selectyesno(
"caneditamount", GETPOSTISSET(
'caneditamount') ?
GETPOST(
'caneditamount') : 0, 1);
467 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
468 print $form->selectyesno(
"vote", GETPOSTISSET(
"vote") ?
GETPOST(
'vote',
'aZ09') : 1, 1);
471 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
472 print
'<input name="duration_value" size="5" value="'.GETPOST(
'duraction_unit',
'aZ09').
'"> ';
473 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", GETPOSTISSET(
"duration_unit") ?
GETPOST(
'duration_unit',
'aZ09') :
'y', 0, 1);
476 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
477 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
478 $doleditor =
new DolEditor(
'comment', (GETPOSTISSET(
'comment') ?
GETPOST(
'comment',
'restricthtml') : $object->note_public),
'', 200,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
479 $doleditor->Create();
481 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
482 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
483 $doleditor =
new DolEditor(
'mail_valid', GETPOSTISSET(
'mail_valid') ?
GETPOST(
'mail_valid') : $object->mail_valid,
'', 250,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
484 $doleditor->Create();
488 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
495 print $form->buttonsSaveCancel();
502 if ($action !=
'edit') {
504 $object->fetch($rowid);
505 $object->fetch_optionals();
510 if ($action ==
'delete') {
511 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?rowid=".$object->id, $langs->trans(
"DeleteAMemberType"), $langs->trans(
"ConfirmDeleteMemberType", $object->label),
"confirm_delete",
'', 0, 1);
518 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
522 print
'<div class="fichecenter">';
523 print
'<div class="underbanner clearboth"></div>';
525 print
'<table class="tableforfield border centpercent">';
528 print
'<tr><td>'.$langs->trans(
"MembersNature").
'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).
'</td>';
531 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
532 print
yn($object->subscription);
536 print
'<tr><td class="titlefield">'.$langs->trans(
"Amount").
'</td><td>';
537 print((is_null($object->amount) || $object->amount ===
'') ?
'' :
'<span class="amount">'.
price($object->amount).
'</span>');
540 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
541 print
yn($object->caneditamount);
544 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
545 print
yn($object->vote);
548 print
'<tr><td class="titlefield">'.$langs->trans(
"Duration").
'</td><td colspan="2">'.$object->duration_value.
' ';
549 if ($object->duration_value > 1) {
550 $dur = array(
"i"=>$langs->trans(
"Minutes"),
"h"=>$langs->trans(
"Hours"),
"d"=>$langs->trans(
"Days"),
"w"=>$langs->trans(
"Weeks"),
"m"=>$langs->trans(
"Months"),
"y"=>$langs->trans(
"Years"));
551 } elseif ($object->duration_value > 0) {
552 $dur = array(
"i"=>$langs->trans(
"Minute"),
"h"=>$langs->trans(
"Hour"),
"d"=>$langs->trans(
"Day"),
"w"=>$langs->trans(
"Week"),
"m"=>$langs->trans(
"Month"),
"y"=>$langs->trans(
"Year"));
554 print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) :
'').
" ";
557 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
561 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
566 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
578 print
'<div class="tabsAction">';
581 if ($user->hasRight(
'adherent',
'configurer')) {
582 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit&token='.newToken().
'&rowid='.$object->id.
'">'.$langs->trans(
"Modify").
'</a></div>';
586 if ($object->morphy ==
'phy') {
588 } elseif ($object->morphy ==
'mor') {
594 if ($user->hasRight(
'adherent',
'configurer')&& !empty($object->status)) {
595 print
'<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().
'&typeid='.$object->id.($morphy ?
'&morphy='.urlencode($morphy) :
'').
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?rowid='.$object->id).
'">'.$langs->trans(
"AddMember").
'</a></div>';
597 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoAddMember")).
'">'.$langs->trans(
"AddMember").
'</a></div>';
601 if ($user->hasRight(
'adherent',
'configurer')) {
602 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.newToken().
'&rowid='.$object->id.
'">'.$langs->trans(
"DeleteType").
'</a></div>';
614 $sql =
"SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
615 $sql .=
" d.datefin,";
616 $sql .=
" d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
617 $sql .=
" t.libelle as type, t.subscription, t.amount";
621 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
622 $sql .=
" WHERE d.fk_adherent_type = t.rowid ";
623 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
624 $sql .=
" AND t.rowid = ".((int) $object->id);
626 $sql .=
natural_search(array(
"d.firstname",
"d.lastname",
"d.societe",
"d.email",
"d.login",
"d.address",
"d.town",
"d.note_public",
"d.note_private"), $sall);
631 if ($action ==
'search') {
632 if (
GETPOST(
'search',
'alpha')) {
636 if (!empty($search_ref)) {
639 if (!empty($search_lastname)) {
640 $sql .=
natural_search(array(
"d.firstname",
"d.lastname"), $search_lastname);
642 if (!empty($search_login)) {
645 if (!empty($search_email)) {
648 if ($filter ==
'uptodate') {
649 $sql .=
" AND (datefin >= '".$db->idate($now).
"') OR t.subscription = 0)";
651 if ($filter ==
'outofdate') {
652 $sql .=
" AND (datefin < '".$db->idate($now).
"' AND t.subscription = 1)";
656 $nbtotalofrecords =
'';
659 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
660 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
661 $resql = $db->query($sqlforcount);
663 $objforcount = $db->fetch_object($resql);
664 $nbtotalofrecords = $objforcount->nbtotalofrecords;
669 if (($page * $limit) > $nbtotalofrecords) {
677 $sql .= $db->order($sortfield, $sortorder);
679 $sql .= $db->plimit($limit + 1, $offset);
682 $resql = $db->query($sql);
684 $num = $db->num_rows($resql);
687 $titre = $langs->trans(
"MembersList");
689 if ($status ==
'-1,1') {
690 $titre = $langs->trans(
"MembersListQualified");
691 } elseif ($status ==
'-1') {
692 $titre = $langs->trans(
"MembersListToValid");
693 } elseif ($status ==
'1' && !$filter) {
694 $titre = $langs->trans(
"MembersListValid");
695 } elseif ($status ==
'1' && $filter ==
'uptodate') {
696 $titre = $langs->trans(
"MembersListUpToDate");
697 } elseif ($status ==
'1' && $filter ==
'outofdate') {
698 $titre = $langs->trans(
"MembersListNotUpToDate");
699 } elseif ($status ==
'0') {
700 $titre = $langs->trans(
"MembersListResiliated");
701 } elseif ($status ==
'-2') {
702 $titre = $langs->trans(
"MembersListExcluded");
704 } elseif ($action ==
'search') {
705 $titre = $langs->trans(
"MembersListQualified");
710 $result = $membertype->fetch($type);
711 $titre .=
" (".$membertype->label.
")";
714 $param =
"&rowid=".urlencode($object->id);
716 $param .=
'&mode='.urlencode($mode);
718 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
719 $param .=
'&contextpage='.urlencode($contextpage);
721 if ($limit > 0 && $limit != $conf->liste_limit) {
722 $param .=
'&limit='.((int) $limit);
724 if (!empty($status)) {
725 $param .=
"&status=".urlencode($status);
727 if (!empty($search_ref)) {
728 $param .=
"&search_ref=".urlencode($search_ref);
730 if (!empty($search_lastname)) {
731 $param .=
"&search_lastname=".urlencode($search_lastname);
733 if (!empty($search_firstname)) {
734 $param .=
"&search_firstname=".urlencode($search_firstname);
736 if (!empty($search_login)) {
737 $param .=
"&search_login=".urlencode($search_login);
739 if (!empty($search_email)) {
740 $param .=
"&search_email=".urlencode($search_email);
742 if (!empty($filter)) {
743 $param .=
"&filter=".urlencode($filter);
747 print $langs->trans(
"Filter").
" (".$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
", ".$langs->trans(
"EMail").
", ".$langs->trans(
"Address").
" ".$langs->trans(
"or").
" ".$langs->trans(
"Town").
"): ".$sall;
750 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">';
751 print
'<input type="hidden" name="token" value="'.newToken().
'">';
752 print
'<input class="flat" type="hidden" name="rowid" value="'.$object->id.
'"></td>';
754 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
758 print
'<div class="div-table-responsive">';
759 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
762 print
'<tr class="liste_titre_filter">';
765 print
'<td class="liste_titre center maxwidthsearch">';
766 $searchpicto = $form->showFilterButtons(
'left');
771 print
'<td class="liste_titre left">';
772 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
774 print
'<td class="liste_titre left">';
775 print
'<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
777 print
'<td class="liste_titre left">';
778 print
'<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
780 print
'<td class="liste_titre"> </td>';
782 print
'<td class="liste_titre left">';
783 print
'<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'"></td>';
785 print
'<td class="liste_titre"> </td>';
787 print
'<td class="liste_titre"> </td>';
790 print
'<td class="liste_titre center nowraponall">';
791 print
'<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/img/search.png" name="button_search" value="'.
dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
793 print
'<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.
'/theme/'.$conf->theme.
'/img/searchclear.png" name="button_removefilter" value="'.
dol_escape_htmltag($langs->trans(
"RemoveFilter")).
'" title="'.
dol_escape_htmltag($langs->trans(
"RemoveFilter")).
'">';
799 print
'<tr class="liste_titre">';
801 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
804 print_liste_field_titre(
"NameSlashCompany", $_SERVER[
"PHP_SELF"],
"d.lastname", $param,
"",
"", $sortfield, $sortorder);
806 print_liste_field_titre(
"MemberNature", $_SERVER[
"PHP_SELF"],
"d.morphy", $param,
"",
"", $sortfield, $sortorder);
808 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"d.statut,d.datefin", $param,
"",
"", $sortfield, $sortorder);
809 print_liste_field_titre(
"EndSubscription", $_SERVER[
"PHP_SELF"],
"d.datefin", $param,
"",
'align="center"', $sortfield, $sortorder);
811 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
817 $imaxinloop = ($limit ? min($num, $limit) : $num);
818 while ($i < $imaxinloop) {
819 $objp = $db->fetch_object($resql);
821 $datefin = $db->jdate($objp->datefin);
823 $adh->id = $objp->rowid;
824 $adh->ref = $objp->ref;
825 $adh->login = $objp->login;
826 $adh->lastname = $objp->lastname;
827 $adh->firstname = $objp->firstname;
828 $adh->datefin = $datefin;
829 $adh->need_subscription = $objp->subscription;
830 $adh->statut = $objp->status;
831 $adh->email = $objp->email;
832 $adh->photo = $objp->photo;
834 print
'<tr class="oddeven">';
838 print
'<td class="center">';
839 if ($user->hasRight(
'adherent',
'creer')) {
840 print
'<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=edit&token='.newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?rowid='.$object->id).
'">'.
img_edit().
'</a>';
842 if ($user->hasRight(
'adherent',
'supprimer')) {
843 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
850 print $adh->getNomUrl(-1, 0,
'card',
'ref',
'', -1, 0, 1);
854 if ($objp->company !=
'') {
855 print
'<td><a href="card.php?rowid='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowMember"),
"user",
'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).
' / '.
dol_trunc($objp->company, 12).
'</a></td>'.
"\n";
857 print
'<td><a href="card.php?rowid='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowMember"),
"user",
'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).
'</a></td>'.
"\n";
861 print
"<td>".dol_escape_htmltag($objp->login).
"</td>\n";
872 print
"<td>".$adh->getmorphylib($objp->morphy, 1).
"</td>\n";
875 print
"<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
878 print
'<td class="nowrap">';
879 print $adh->getLibStatut(2);
884 print
'<td class="nowrap center">';
885 if ($datefin <
dol_now() && $objp->status > 0) {
892 print
'<td class="nowrap center">';
893 if (!empty($objp->subscription)) {
894 print
'<span class="opacitymedium">'.$langs->trans(
"SubscriptionNotReceived").
'</span>';
895 if ($objp->status > 0) {
896 print
" ".img_warning();
906 print
'<td class="center">';
907 if ($user->hasRight(
'adherent',
'creer')) {
908 print
'<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=edit&token='.newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?rowid='.$object->id).
'">'.
img_edit().
'</a>';
910 if ($user->hasRight(
'adherent',
'supprimer')) {
911 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
920 print
'<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
937 if ($action ==
'edit') {
939 $object->fetch($rowid);
940 $object->fetch_optionals();
944 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'">';
945 print
'<input type="hidden" name="token" value="'.newToken().
'">';
946 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
947 print
'<input type="hidden" name="action" value="update">';
951 print
'<table class="border centpercent">';
953 print
'<tr><td class="titlefield">'.$langs->trans(
"Ref").
'</td><td>'.$object->id.
'</td></tr>';
955 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth300" name="label" value="'.
dol_escape_htmltag($object->label).
'"></td></tr>';
957 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
958 print $form->selectarray(
'status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
962 $morphys[
""] = $langs->trans(
"MorAndPhy");
963 $morphys[
"phy"] = $langs->trans(
"Physical");
964 $morphys[
"mor"] = $langs->trans(
"Moral");
965 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
966 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') : $object->morphy);
969 print
'<tr><td>'.$langs->trans(
"SubscriptionRequired").
'</td><td>';
970 print $form->selectyesno(
"subscription", $object->subscription, 1);
973 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
974 print
'<input name="amount" size="5" value="';
975 print((is_null($object->amount) || $object->amount ===
'') ?
'' :
price($object->amount));
979 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmountDetail")).
'</td><td>';
980 print $form->selectyesno(
"caneditamount", $object->caneditamount, 1);
983 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
984 print $form->selectyesno(
"vote", $object->vote, 1);
987 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
988 print
'<input name="duration_value" size="5" value="'.$object->duration_value.
'"> ';
989 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", ($object->duration_unit ===
'' ?
'y' : $object->duration_unit), 0, 1);
992 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
993 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
994 $doleditor =
new DolEditor(
'comment', $object->note_public,
'', 220,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
995 $doleditor->Create();
998 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
999 $doleditor =
new DolEditor(
'mail_valid', $object->mail_valid,
'', 280,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
1000 $doleditor->Create();
1004 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1010 print $form->buttonsSaveCancel();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to manage a WYSIWYG editor.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0)
Clean a string to keep only desirable HTML tags.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
member_type_prepare_head(AdherentType $object)
Return array head with list of tabs to view object informations.
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.