35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
43$langs->load(
"members");
46$action =
GETPOST(
'action',
'aZ09');
47$massaction =
GETPOST(
'massaction',
'alpha');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$toselect =
GETPOST(
'toselect',
'array');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
51$backtopage =
GETPOST(
'backtopage',
'alpha');
52$mode =
GETPOST(
'mode',
'alpha');
54$sall =
GETPOST(
"sall",
"alpha");
55$filter =
GETPOST(
"filter",
'alpha');
56$search_ref =
GETPOST(
'search_ref',
'alpha');
57$search_lastname =
GETPOST(
'search_lastname',
'alpha');
58$search_login =
GETPOST(
'search_login',
'alpha');
59$search_email =
GETPOST(
'search_email',
'alpha');
60$type =
GETPOST(
'type',
'intcomma');
61$status =
GETPOST(
'status',
'alpha');
62$optioncss =
GETPOST(
'optioncss',
'alpha');
66$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
67$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
69if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
73$offset = $limit * $page;
80 $sortfield =
"d.lastname";
83$label =
GETPOST(
"label",
"alpha");
84$morphy =
GETPOST(
"morphy",
"alpha");
85$status =
GETPOST(
"status",
"intcomma");
87$amount =
GETPOST(
'amount',
'alpha');
89$duration_unit =
GETPOST(
'duration_unit',
'alpha');
91$comment =
GETPOST(
"comment",
'restricthtml');
92$mail_valid =
GETPOST(
"mail_valid",
'restricthtml');
98$hookmanager->initHooks(array(
'membertypecard',
'globalcard'));
101$extrafields->fetch_name_optionals_label(
$object->table_element);
104$result =
restrictedArea($user,
'adherent', $rowid,
'adherent_type');
111if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113 $search_lastname =
"";
120if (
GETPOST(
'cancel',
'alpha')) {
124if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
131 if (!empty($backtopage)) {
132 header(
"Location: ".$backtopage);
137if ($action ==
'add' && $user->hasRight(
'adherent',
'configurer')) {
139 $object->morphy = trim($morphy);
140 $object->status = (int) $status;
141 $object->subscription = (int) $subscription;
143 $object->caneditamount = $caneditamount;
144 $object->duration_value = $duration_value;
145 $object->duration_unit = $duration_unit;
146 $object->note_public = trim($comment);
148 $object->mail_valid = trim($mail_valid);
152 $ret = $extrafields->setOptionalsFromPost(
null, $object);
159 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
161 $sql =
"SELECT libelle FROM ".MAIN_DB_PREFIX.
"adherent_type WHERE libelle = '".$db->escape(
$object->label).
"'";
162 $sql .=
" WHERE entity IN (".getEntity(
'member_type').
")";
163 $result = $db->query($sql);
166 $num = $db->num_rows($result);
170 $langs->load(
"errors");
171 setEventMessages($langs->trans(
"ErrorLabelAlreadyExists", $login),
null,
'errors');
178 $backurlforlist = $_SERVER[
"PHP_SELF"];
180 $urltogo = $backtopage ? str_replace(
'__ID__', (
string) $id, $backtopage) : $backurlforlist;
181 $urltogo = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $urltogo);
183 header(
"Location: " . $urltogo);
194if ($action ==
'update' && $user->hasRight(
'adherent',
'configurer')) {
200 $object->morphy = trim($morphy);
201 $object->status = (int) $status;
202 $object->subscription = (int) $subscription;
204 $object->caneditamount = $caneditamount;
205 $object->duration_value = $duration_value;
206 $object->duration_unit = $duration_unit;
207 $object->note_public = trim($comment);
209 $object->mail_valid = trim($mail_valid);
213 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
220 if ($ret >= 0 && !count(
$object->errors)) {
226 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id);
230if ($action ==
'confirm_delete' && $user->hasRight(
'adherent',
'configurer')) {
236 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
239 setEventMessages($langs->trans(
"MemberTypeCanNotBeDeleted"),
null,
'errors');
249$form =
new Form($db);
252$title = $langs->trans(
"MembersTypeSetup");
253$help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
255llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-type');
257$arrayofselected = is_array($toselect) ? $toselect : array();
260if (!$rowid && $action !=
'create' && $action !=
'edit') {
263 $sql =
"SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration";
264 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as d";
265 $sql .=
" WHERE d.entity IN (".getEntity(
'member_type').
")";
267 $result = $db->query($sql);
269 $num = $db->num_rows($result);
270 $nbtotalofrecords = $num;
276 $param .=
'&mode='.urlencode($mode);
278 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
279 $param .=
'&contextpage='.$contextpage;
281 if ($limit > 0 && $limit != $conf->liste_limit) {
282 $param .=
'&limit='.$limit;
287 $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'));
288 $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'));
290 if ($user->hasRight(
'adherent',
'configurer')) {
292 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewMemberType'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/type.php?action=create');
295 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
296 if ($optioncss !=
'') {
297 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
299 print
'<input type="hidden" name="token" value="'.newToken().
'">';
300 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
301 print
'<input type="hidden" name="action" value="list">';
302 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
303 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
304 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
307 print_barre_liste($langs->trans(
"MembersTypes"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit, 0, 0, 1);
311 print
'<div class="div-table-responsive">';
312 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
314 print
'<tr class="liste_titre">';
316 print
'<th> </th>';
318 print
'<th>'.$langs->trans(
"Ref").
'</th>';
319 print
'<th>'.$langs->trans(
"Label").
'</th>';
320 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
321 print
'<th class="center">'.$langs->trans(
"MembershipDuration").
'</th>';
322 print
'<th class="center">'.$langs->trans(
"SubscriptionRequired").
'</th>';
323 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
324 print
'<th class="center">'.$langs->trans(
"CanEditAmountShort").
'</th>';
325 print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
326 print
'<th class="center">'.$langs->trans(
"Status").
'</th>';
328 print
'<th> </th>';
340 $imaxinloop = ($limit ? min($num, $limit) : $num);
341 while ($i < $imaxinloop) {
342 $objp = $db->fetch_object($result);
344 $membertype->id = $objp->rowid;
345 $membertype->ref = $objp->rowid;
346 $membertype->label = $objp->rowid;
347 $membertype->status = $objp->status;
348 $membertype->subscription = $objp->subscription;
349 $membertype->amount = $objp->amount;
350 $membertype->caneditamount = $objp->caneditamount;
352 if ($mode ==
'kanban') {
354 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
355 print
'<div class="box-flex-container kanban">';
358 $membertype->label = $objp->label;
359 print $membertype->getKanbanView(
'', array(
'selected' => in_array(
$object->id, $arrayofselected)));
360 if ($i == ($imaxinloop - 1)) {
365 print
'<tr class="oddeven">';
368 if ($user->hasRight(
'adherent',
'configurer')) {
369 print
'<td class="center"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
373 print
'<td class="nowraponall">';
374 print $membertype->getNomUrl(1);
378 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
380 print
'<td class="center">';
381 if ($objp->morphy ==
'phy') {
382 print $langs->trans(
"Physical");
383 } elseif ($objp->morphy ==
'mor') {
384 print $langs->trans(
"Moral");
386 print $langs->trans(
"MorAndPhy");
390 print
'<td class="center nowrap">';
391 if ($objp->duration) {
392 $duration_value = intval($objp->duration);
393 if ($duration_value > 1) {
394 $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"));
396 $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"));
398 $unit = preg_replace(
"/[^a-zA-Z]+/",
"", $objp->duration);
399 print max(1, $duration_value).
' '.$dur[$unit];
403 print
'<td class="center">'.yn($objp->subscription).
'</td>';
405 print
'<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount ===
'' ?
'' :
price($objp->amount)).
'</span></td>';
407 print
'<td class="center">'.yn($objp->caneditamount).
'</td>';
409 print
'<td class="center">'.yn($objp->vote).
'</td>';
411 print
'<td class="center">'.$membertype->getLibStatut(5).
'</td>';
414 if ($user->hasRight(
'adherent',
'configurer')) {
415 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
432 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
445if ($action ==
'create') {
450 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
451 print
'<input type="hidden" name="token" value="'.newToken().
'">';
452 print
'<input type="hidden" name="action" value="add">';
453 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
457 print
'<table class="border centpercent">';
460 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
462 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
463 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
468 $morphys[
""] = $langs->trans(
"MorAndPhy");
469 $morphys[
"phy"] = $langs->trans(
"Physical");
470 $morphys[
"mor"] = $langs->trans(
"Moral");
471 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
472 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') :
'morphy');
475 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
476 print $form->selectyesno(
"subscription", 1, 1);
479 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
480 print
'<input name="amount" size="5" value="'.(GETPOSTISSET(
'amount') ?
GETPOST(
'amount') :
price($amount)).
'">';
483 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
484 print $form->selectyesno(
"caneditamount", GETPOSTISSET(
'caneditamount') ?
GETPOST(
'caneditamount') : 0, 1);
487 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
488 print $form->selectyesno(
"vote", GETPOSTISSET(
"vote") ?
GETPOST(
'vote',
'aZ09') : 1, 1);
491 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
492 print
'<input name="duration_value" size="5" value="'.GETPOST(
'duraction_unit',
'aZ09').
'"> ';
493 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", GETPOSTISSET(
"duration_unit") ?
GETPOST(
'duration_unit',
'aZ09') :
'y', 0, 1);
496 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
497 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
498 $doleditor =
new DolEditor(
'comment', (GETPOSTISSET(
'comment') ?
GETPOST(
'comment',
'restricthtml') :
$object->note_public),
'', 200,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
499 $doleditor->Create();
501 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
502 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
503 $doleditor =
new DolEditor(
'mail_valid', GETPOSTISSET(
'mail_valid') ?
GETPOST(
'mail_valid') :
$object->mail_valid,
'', 250,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
504 $doleditor->Create();
508 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
515 print $form->buttonsSaveCancel();
522 if ($action !=
'edit') {
530 if ($action ==
'delete') {
531 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?rowid=".
$object->id, $langs->trans(
"DeleteAMemberType"), $langs->trans(
"ConfirmDeleteMemberType",
$object->label),
"confirm_delete",
'', 0, 1);
538 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
540 dol_banner_tab($object,
'rowid', $linkback);
542 print
'<div class="fichecenter">';
543 print
'<div class="underbanner clearboth"></div>';
545 print
'<table class="tableforfield border centpercent">';
548 print
'<tr><td>'.$langs->trans(
"MembersNature").
'</td><td class="valeur" >'.
$object->getmorphylib(
$object->morphy).
'</td>';
551 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
556 print
'<tr><td class="titlefield">'.$langs->trans(
"Amount").
'</td><td>';
560 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
564 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
568 print
'<tr><td class="titlefield">'.$langs->trans(
"Duration").
'</td><td colspan="2">'.
$object->duration_value.
' ';
569 if (
$object->duration_value > 1) {
570 $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"));
571 } elseif (
$object->duration_value > 0) {
572 $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"));
574 print(!empty(
$object->duration_unit) && isset($dur[
$object->duration_unit]) ? $langs->trans($dur[
$object->duration_unit]) :
'').
" ";
577 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
581 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
586 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
598 print
'<div class="tabsAction">';
601 if ($user->hasRight(
'adherent',
'configurer')) {
602 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>';
606 if (
$object->morphy ==
'phy') {
608 } elseif (
$object->morphy ==
'mor') {
614 if ($user->hasRight(
'adherent',
'configurer') && !empty(
$object->status)) {
615 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>';
617 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoAddMember")).
'">'.$langs->trans(
"AddMember").
'</a></div>';
621 if ($user->hasRight(
'adherent',
'configurer')) {
622 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>';
634 $sql =
"SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
635 $sql .=
" d.datefin,";
636 $sql .=
" d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
637 $sql .=
" t.libelle as type, t.subscription, t.amount";
641 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
642 $sql .=
" WHERE d.fk_adherent_type = t.rowid ";
643 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
644 $sql .=
" AND t.rowid = ".((int)
$object->id);
646 $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);
651 if ($action ==
'search') {
652 if (
GETPOST(
'search',
'alpha')) {
656 if (!empty($search_ref)) {
659 if (!empty($search_lastname)) {
660 $sql .=
natural_search(array(
"d.firstname",
"d.lastname"), $search_lastname);
662 if (!empty($search_login)) {
665 if (!empty($search_email)) {
668 if ($filter ==
'uptodate') {
669 $sql .=
" AND (datefin >= '".$db->idate($now).
"') OR t.subscription = 0)";
671 if ($filter ==
'outofdate') {
672 $sql .=
" AND (datefin < '".$db->idate($now).
"' AND t.subscription = 1)";
676 $nbtotalofrecords =
'';
679 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
680 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
681 $resql = $db->query($sqlforcount);
683 $objforcount = $db->fetch_object($resql);
684 $nbtotalofrecords = $objforcount->nbtotalofrecords;
689 if (($page * $limit) > $nbtotalofrecords) {
697 $sql .= $db->order($sortfield, $sortorder);
699 $sql .= $db->plimit($limit + 1, $offset);
702 $resql = $db->query($sql);
704 $num = $db->num_rows($resql);
707 $titre = $langs->trans(
"MembersList");
709 if ($status ==
'-1,1') {
710 $titre = $langs->trans(
"MembersListQualified");
711 } elseif ($status ==
'-1') {
712 $titre = $langs->trans(
"MembersListToValid");
713 } elseif ($status ==
'1' && !$filter) {
714 $titre = $langs->trans(
"MembersListValid");
715 } elseif ($status ==
'1' && $filter ==
'uptodate') {
716 $titre = $langs->trans(
"MembersListUpToDate");
717 } elseif ($status ==
'1' && $filter ==
'outofdate') {
718 $titre = $langs->trans(
"MembersListNotUpToDate");
719 } elseif ($status ==
'0') {
720 $titre = $langs->trans(
"MembersListResiliated");
721 } elseif ($status ==
'-2') {
722 $titre = $langs->trans(
"MembersListExcluded");
724 } elseif ($action ==
'search') {
725 $titre = $langs->trans(
"MembersListQualified");
730 $result = $membertype->fetch($type);
731 $titre .=
" (".$membertype->label.
")";
734 $param =
"&rowid=".urlencode((
string) (
$object->id));
736 $param .=
'&mode='.urlencode($mode);
738 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
739 $param .=
'&contextpage='.urlencode($contextpage);
741 if ($limit > 0 && $limit != $conf->liste_limit) {
742 $param .=
'&limit='.((int) $limit);
744 if (!empty($status)) {
745 $param .=
"&status=".urlencode($status);
747 if (!empty($search_ref)) {
748 $param .=
"&search_ref=".urlencode($search_ref);
750 if (!empty($search_lastname)) {
751 $param .=
"&search_lastname=".urlencode($search_lastname);
753 if (!empty($search_firstname)) {
754 $param .=
"&search_firstname=".urlencode($search_firstname);
756 if (!empty($search_login)) {
757 $param .=
"&search_login=".urlencode($search_login);
759 if (!empty($search_email)) {
760 $param .=
"&search_email=".urlencode($search_email);
762 if (!empty($filter)) {
763 $param .=
"&filter=".urlencode($filter);
767 print $langs->trans(
"Filter").
" (".$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
", ".$langs->trans(
"EMail").
", ".$langs->trans(
"Address").
" ".$langs->trans(
"or").
" ".$langs->trans(
"Town").
"): ".$sall;
770 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">';
771 print
'<input type="hidden" name="token" value="'.newToken().
'">';
772 print
'<input class="flat" type="hidden" name="rowid" value="'.$object->id.
'"></td>';
774 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
778 print
'<div class="div-table-responsive">';
779 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
782 print
'<tr class="liste_titre_filter">';
785 print
'<td class="liste_titre center maxwidthsearch">';
786 $searchpicto = $form->showFilterButtons(
'left');
791 print
'<td class="liste_titre left">';
792 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
794 print
'<td class="liste_titre left">';
795 print
'<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
797 print
'<td class="liste_titre left">';
798 print
'<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
800 print
'<td class="liste_titre"> </td>';
802 print
'<td class="liste_titre left">';
803 print
'<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'"></td>';
805 print
'<td class="liste_titre"> </td>';
807 print
'<td class="liste_titre"> </td>';
810 print
'<td class="liste_titre center nowraponall">';
811 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")).
'">';
813 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")).
'">';
819 print
'<tr class="liste_titre">';
821 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
824 print_liste_field_titre(
"NameSlashCompany", $_SERVER[
"PHP_SELF"],
"d.lastname", $param,
"",
"", $sortfield, $sortorder);
826 print_liste_field_titre(
"MemberNature", $_SERVER[
"PHP_SELF"],
"d.morphy", $param,
"",
"", $sortfield, $sortorder);
828 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"d.statut,d.datefin", $param,
"",
"", $sortfield, $sortorder);
829 print_liste_field_titre(
"EndSubscription", $_SERVER[
"PHP_SELF"],
"d.datefin", $param,
"",
'align="center"', $sortfield, $sortorder);
831 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
837 $imaxinloop = ($limit ? min($num, $limit) : $num);
838 while ($i < $imaxinloop) {
839 $objp = $db->fetch_object($resql);
841 $datefin = $db->jdate($objp->datefin);
843 $adh->id = $objp->rowid;
844 $adh->ref = $objp->ref;
845 $adh->login = $objp->login;
846 $adh->lastname = $objp->lastname;
847 $adh->firstname = $objp->firstname;
848 $adh->datefin = $datefin;
849 $adh->need_subscription = $objp->subscription;
850 $adh->statut = $objp->status;
851 $adh->email = $objp->email;
852 $adh->photo = $objp->photo;
854 print
'<tr class="oddeven">';
858 print
'<td class="center">';
859 if ($user->hasRight(
'adherent',
'creer')) {
860 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>';
862 if ($user->hasRight(
'adherent',
'supprimer')) {
863 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
870 print $adh->getNomUrl(-1, 0,
'card',
'ref',
'', -1, 0, 1);
874 if ($objp->company !=
'') {
875 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";
877 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";
881 print
"<td>".dol_escape_htmltag($objp->login).
"</td>\n";
892 print
"<td>".$adh->getmorphylib($objp->morphy, 1).
"</td>\n";
895 print
"<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
898 print
'<td class="nowrap">';
899 print $adh->getLibStatut(2);
904 print
'<td class="nowrap center">';
905 if ($datefin <
dol_now() && $objp->status > 0) {
912 print
'<td class="nowrap center">';
913 if (!empty($objp->subscription)) {
914 print
'<span class="opacitymedium">'.$langs->trans(
"SubscriptionNotReceived").
'</span>';
915 if ($objp->status > 0) {
916 print
" ".img_warning();
926 print
'<td class="center">';
927 if ($user->hasRight(
'adherent',
'creer')) {
928 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>';
930 if ($user->hasRight(
'adherent',
'supprimer')) {
931 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
940 print
'<tr><td colspan="9"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
957 if ($action ==
'edit') {
964 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?rowid='.
$object->id.
'">';
965 print
'<input type="hidden" name="token" value="'.newToken().
'">';
966 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
967 print
'<input type="hidden" name="action" value="update">';
971 print
'<table class="border centpercent">';
973 print
'<tr><td class="titlefield">'.$langs->trans(
"Ref").
'</td><td>'.
$object->id.
'</td></tr>';
975 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>';
977 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
978 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
982 $morphys[
""] = $langs->trans(
"MorAndPhy");
983 $morphys[
"phy"] = $langs->trans(
"Physical");
984 $morphys[
"mor"] = $langs->trans(
"Moral");
985 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
986 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') :
$object->morphy);
989 print
'<tr><td>'.$langs->trans(
"SubscriptionRequired").
'</td><td>';
990 print $form->selectyesno(
"subscription",
$object->subscription, 1);
993 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
994 print
'<input name="amount" size="5" value="';
999 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmountDetail")).
'</td><td>';
1000 print $form->selectyesno(
"caneditamount",
$object->caneditamount, 1);
1003 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
1004 print $form->selectyesno(
"vote",
$object->vote, 1);
1007 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
1008 print
'<input name="duration_value" size="5" value="'.$object->duration_value.
'"> ';
1009 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", (
$object->duration_unit ===
'' ?
'y' :
$object->duration_unit), 0, 1);
1012 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
1013 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1014 $doleditor =
new DolEditor(
'comment',
$object->note_public,
'', 220,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
1015 $doleditor->Create();
1018 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
1019 $doleditor =
new DolEditor(
'mail_valid',
$object->mail_valid,
'', 280,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
1020 $doleditor->Create();
1024 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1030 print $form->buttonsSaveCancel();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to manage a WYSIWYG editor.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 '.
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.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
print_barre_liste($title, $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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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 edit/modify 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 information.
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.