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',
'alopha');
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);
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 = (boolean) 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();
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";
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')) {
283 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewMemberType'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/type.php?action=create');
286 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
287 if ($optioncss !=
'') {
288 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
290 print
'<input type="hidden" name="token" value="'.newToken().
'">';
291 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
292 print
'<input type="hidden" name="action" value="list">';
293 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
294 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
295 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
298 print_barre_liste($langs->trans(
"MembersTypes"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit, 0, 0, 1);
302 print
'<div class="div-table-responsive">';
303 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
305 print
'<tr class="liste_titre">';
307 print
'<th> </th>';
309 print
'<th>'.$langs->trans(
"Ref").
'</th>';
310 print
'<th>'.$langs->trans(
"Label").
'</th>';
311 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
312 print
'<th class="center">'.$langs->trans(
"SubscriptionRequired").
'</th>';
313 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
314 print
'<th class="center">'.$langs->trans(
"CanEditAmountShort").
'</th>';
315 print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
316 print
'<th class="center">'.$langs->trans(
"Status").
'</th>';
318 print
'<th> </th>';
330 $imaxinloop = ($limit ? min($num, $limit) : $num);
331 while ($i < $imaxinloop) {
332 $objp = $db->fetch_object($result);
334 $membertype->id = $objp->rowid;
335 $membertype->ref = $objp->rowid;
336 $membertype->label = $objp->rowid;
337 $membertype->status = $objp->status;
338 $membertype->subscription = $objp->subscription;
339 $membertype->amount = $objp->amount;
340 $membertype->caneditamount = $objp->caneditamount;
342 if ($mode ==
'kanban') {
344 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
345 print
'<div class="box-flex-container kanban">';
348 $membertype->label = $objp->label;
349 print $membertype->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
350 if ($i == ($imaxinloop - 1)) {
355 print
'<tr class="oddeven">';
357 if ($user->hasRight(
'adherent',
'configurer')) {
358 print
'<td class="center"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
361 print
'<td class="nowraponall">';
362 print $membertype->getNomUrl(1);
365 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
366 print
'<td class="center">';
367 if ($objp->morphy ==
'phy') {
368 print $langs->trans(
"Physical");
369 } elseif ($objp->morphy ==
'mor') {
370 print $langs->trans(
"Moral");
372 print $langs->trans(
"MorAndPhy");
375 print
'<td class="center">'.yn($objp->subscription).
'</td>';
376 print
'<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount ===
'' ?
'' :
price($objp->amount)).
'</span></td>';
377 print
'<td class="center">'.yn($objp->caneditamount).
'</td>';
378 print
'<td class="center">'.yn($objp->vote).
'</td>';
379 print
'<td class="center">'.$membertype->getLibStatut(5).
'</td>';
381 if ($user->hasRight(
'adherent',
'configurer')) {
382 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&rowid='.$objp->rowid.
'">'.
img_edit().
'</a></td>';
399 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
412if ($action ==
'create') {
417 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST">';
418 print
'<input type="hidden" name="token" value="'.newToken().
'">';
419 print
'<input type="hidden" name="action" value="add">';
423 print
'<table class="border centpercent">';
426 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
428 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
429 print $form->selectarray(
'status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
434 $morphys[
""] = $langs->trans(
"MorAndPhy");
435 $morphys[
"phy"] = $langs->trans(
"Physical");
436 $morphys[
"mor"] = $langs->trans(
"Moral");
437 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
438 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') :
'morphy');
441 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
442 print $form->selectyesno(
"subscription", 1, 1);
445 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
446 print
'<input name="amount" size="5" value="'.(GETPOSTISSET(
'amount') ?
GETPOST(
'amount') :
price($amount)).
'">';
449 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
450 print $form->selectyesno(
"caneditamount", GETPOSTISSET(
'caneditamount') ?
GETPOST(
'caneditamount') : 0, 1);
453 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
454 print $form->selectyesno(
"vote", GETPOSTISSET(
"vote") ?
GETPOST(
'vote',
'aZ09') : 1, 1);
457 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
458 print
'<input name="duration_value" size="5" value="'.GETPOST(
'duraction_unit',
'aZ09').
'"> ';
459 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", GETPOSTISSET(
"duration_unit") ?
GETPOST(
'duration_unit',
'aZ09') :
'y', 0, 1);
462 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
463 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
464 $doleditor =
new DolEditor(
'comment', (GETPOSTISSET(
'comment') ?
GETPOST(
'comment',
'restricthtml') : $object->note_public),
'', 200,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
465 $doleditor->Create();
467 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
468 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
469 $doleditor =
new DolEditor(
'mail_valid', GETPOSTISSET(
'mail_valid') ?
GETPOST(
'mail_valid') : $object->mail_valid,
'', 250,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor'), 15,
'90%');
470 $doleditor->Create();
474 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
481 print $form->buttonsSaveCancel();
488 if ($action !=
'edit') {
490 $object->fetch($rowid);
491 $object->fetch_optionals();
496 if ($action ==
'delete') {
497 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?rowid=".$object->id, $langs->trans(
"DeleteAMemberType"), $langs->trans(
"ConfirmDeleteMemberType", $object->label),
"confirm_delete",
'', 0, 1);
504 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
508 print
'<div class="fichecenter">';
509 print
'<div class="underbanner clearboth"></div>';
511 print
'<table class="tableforfield border centpercent">';
514 print
'<tr><td>'.$langs->trans(
"MembersNature").
'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).
'</td>';
517 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SubscriptionRequired"), $langs->trans(
"SubscriptionRequiredDesc")).
'</td><td>';
518 print
yn($object->subscription);
522 print
'<tr><td class="titlefield">'.$langs->trans(
"Amount").
'</td><td>';
523 print ((is_null($object->amount) || $object->amount ===
'') ?
'' :
'<span class="amount">'.
price($object->amount).
'</span>');
526 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmount")).
'</td><td>';
527 print
yn($object->caneditamount);
530 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
531 print
yn($object->vote);
534 print
'<tr><td class="titlefield">'.$langs->trans(
"Duration").
'</td><td colspan="2">'.$object->duration_value.
' ';
535 if ($object->duration_value > 1) {
536 $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"));
537 } elseif ($object->duration_value > 0) {
538 $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"));
540 print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) :
'').
" ";
543 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
547 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
552 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
564 print
'<div class="tabsAction">';
567 if ($user->hasRight(
'adherent',
'configurer')) {
568 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>';
572 if ($object->morphy ==
'phy') {
574 } elseif ($object->morphy ==
'mor') {
580 if ($user->hasRight(
'adherent',
'configurer')&& !empty($object->status)) {
581 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>';
583 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoAddMember")).
'">'.$langs->trans(
"AddMember").
'</a></div>';
587 if ($user->hasRight(
'adherent',
'configurer')) {
588 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>';
600 $sql =
"SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
601 $sql .=
" d.datefin,";
602 $sql .=
" d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
603 $sql .=
" t.libelle as type, t.subscription, t.amount";
607 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"adherent_type as t";
608 $sql .=
" WHERE d.fk_adherent_type = t.rowid ";
609 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
610 $sql .=
" AND t.rowid = ".((int) $object->id);
612 $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);
617 if ($action ==
'search') {
618 if (
GETPOST(
'search',
'alpha')) {
622 if (!empty($search_ref)) {
625 if (!empty($search_lastname)) {
626 $sql .=
natural_search(array(
"d.firstname",
"d.lastname"), $search_lastname);
628 if (!empty($search_login)) {
631 if (!empty($search_email)) {
634 if ($filter ==
'uptodate') {
635 $sql .=
" AND (datefin >= '".$db->idate($now).
"') OR t.subscription = 0)";
637 if ($filter ==
'outofdate') {
638 $sql .=
" AND (datefin < '".$db->idate($now).
"' AND t.subscription = 1)";
642 $nbtotalofrecords =
'';
645 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
646 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
647 $resql = $db->query($sqlforcount);
649 $objforcount = $db->fetch_object($resql);
650 $nbtotalofrecords = $objforcount->nbtotalofrecords;
655 if (($page * $limit) > $nbtotalofrecords) {
663 $sql .= $db->order($sortfield, $sortorder);
665 $sql .= $db->plimit($limit + 1, $offset);
668 $resql = $db->query($sql);
670 $num = $db->num_rows($resql);
673 $titre = $langs->trans(
"MembersList");
675 if ($status ==
'-1,1') {
676 $titre = $langs->trans(
"MembersListQualified");
677 } elseif ($status ==
'-1') {
678 $titre = $langs->trans(
"MembersListToValid");
679 } elseif ($status ==
'1' && !$filter) {
680 $titre = $langs->trans(
"MembersListValid");
681 } elseif ($status ==
'1' && $filter ==
'uptodate') {
682 $titre = $langs->trans(
"MembersListUpToDate");
683 } elseif ($status ==
'1' && $filter ==
'outofdate') {
684 $titre = $langs->trans(
"MembersListNotUpToDate");
685 } elseif ($status ==
'0') {
686 $titre = $langs->trans(
"MembersListResiliated");
687 } elseif ($status ==
'-2') {
688 $titre = $langs->trans(
"MembersListExcluded");
690 } elseif ($action ==
'search') {
691 $titre = $langs->trans(
"MembersListQualified");
696 $result = $membertype->fetch($type);
697 $titre .=
" (".$membertype->label.
")";
700 $param =
"&rowid=".urlencode($object->id);
702 $param .=
'&mode='.urlencode($mode);
704 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
705 $param .=
'&contextpage='.urlencode($contextpage);
707 if ($limit > 0 && $limit != $conf->liste_limit) {
708 $param .=
'&limit='.((int) $limit);
710 if (!empty($status)) {
711 $param .=
"&status=".urlencode($status);
713 if (!empty($search_ref)) {
714 $param .=
"&search_ref=".urlencode($search_ref);
716 if (!empty($search_lastname)) {
717 $param .=
"&search_lastname=".urlencode($search_lastname);
719 if (!empty($search_firstname)) {
720 $param .=
"&search_firstname=".urlencode($search_firstname);
722 if (!empty($search_login)) {
723 $param .=
"&search_login=".urlencode($search_login);
725 if (!empty($search_email)) {
726 $param .=
"&search_email=".urlencode($search_email);
728 if (!empty($filter)) {
729 $param .=
"&filter=".urlencode($filter);
733 print $langs->trans(
"Filter").
" (".$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
", ".$langs->trans(
"EMail").
", ".$langs->trans(
"Address").
" ".$langs->trans(
"or").
" ".$langs->trans(
"Town").
"): ".$sall;
736 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">';
737 print
'<input type="hidden" name="token" value="'.newToken().
'">';
738 print
'<input class="flat" type="hidden" name="rowid" value="'.$object->id.
'"></td>';
740 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
744 print
'<div class="div-table-responsive">';
745 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
748 print
'<tr class="liste_titre_filter">';
751 print
'<td class="liste_titre center maxwidthsearch">';
752 $searchpicto = $form->showFilterButtons(
'left');
757 print
'<td class="liste_titre left">';
758 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
760 print
'<td class="liste_titre left">';
761 print
'<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
763 print
'<td class="liste_titre left">';
764 print
'<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
766 print
'<td class="liste_titre"> </td>';
768 print
'<td class="liste_titre left">';
769 print
'<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'"></td>';
771 print
'<td class="liste_titre"> </td>';
773 print
'<td class="liste_titre"> </td>';
776 print
'<td class="liste_titre center nowraponall">';
777 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")).
'">';
779 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")).
'">';
785 print
'<tr class="liste_titre">';
787 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
790 print_liste_field_titre(
"NameSlashCompany", $_SERVER[
"PHP_SELF"],
"d.lastname", $param,
"",
"", $sortfield, $sortorder);
792 print_liste_field_titre(
"MemberNature", $_SERVER[
"PHP_SELF"],
"d.morphy", $param,
"",
"", $sortfield, $sortorder);
794 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"d.statut,d.datefin", $param,
"",
"", $sortfield, $sortorder);
795 print_liste_field_titre(
"EndSubscription", $_SERVER[
"PHP_SELF"],
"d.datefin", $param,
"",
'align="center"', $sortfield, $sortorder);
797 print_liste_field_titre(
"Action", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'width="60" align="center"', $sortfield, $sortorder);
803 $imaxinloop = ($limit ? min($num, $limit) : $num);
804 while ($i < $imaxinloop) {
805 $objp = $db->fetch_object($resql);
807 $datefin = $db->jdate($objp->datefin);
809 $adh->id = $objp->rowid;
810 $adh->ref = $objp->ref;
811 $adh->login = $objp->login;
812 $adh->lastname = $objp->lastname;
813 $adh->firstname = $objp->firstname;
814 $adh->datefin = $datefin;
815 $adh->need_subscription = $objp->subscription;
816 $adh->statut = $objp->status;
817 $adh->email = $objp->email;
818 $adh->photo = $objp->photo;
820 print
'<tr class="oddeven">';
824 print
'<td class="center">';
825 if ($user->hasRight(
'adherent',
'creer')) {
826 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>';
828 if ($user->hasRight(
'adherent',
'supprimer')) {
829 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
836 print $adh->getNomUrl(-1, 0,
'card',
'ref',
'', -1, 0, 1);
840 if ($objp->company !=
'') {
841 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";
843 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";
847 print
"<td>".dol_escape_htmltag($objp->login).
"</td>\n";
858 print
"<td>".$adh->getmorphylib($objp->morphy, 1).
"</td>\n";
861 print
"<td>".dol_print_email($objp->email, 0, 0, 1).
"</td>\n";
864 print
'<td class="nowrap">';
865 print $adh->getLibStatut(2);
870 print
'<td class="nowrap center">';
871 if ($datefin <
dol_now() && $objp->status > 0) {
878 print
'<td class="nowrap center">';
879 if (!empty($objp->subscription)) {
880 print
'<span class="opacitymedium">'.$langs->trans(
"SubscriptionNotReceived").
'</span>';
881 if ($objp->status > 0) {
882 print
" ".img_warning();
892 print
'<td class="center">';
893 if ($user->hasRight(
'adherent',
'creer')) {
894 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>';
896 if ($user->hasRight(
'adherent',
'supprimer')) {
897 print
'<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.
'&action=resiliate&token='.newToken().
'">'.
img_picto($langs->trans(
"Resiliate"),
'disable.png').
'</a>';
906 print
'<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
923 if ($action ==
'edit') {
925 $object->fetch($rowid);
926 $object->fetch_optionals();
930 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'">';
931 print
'<input type="hidden" name="token" value="'.newToken().
'">';
932 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
933 print
'<input type="hidden" name="action" value="update">';
937 print
'<table class="border centpercent">';
939 print
'<tr><td class="titlefield">'.$langs->trans(
"Ref").
'</td><td>'.$object->id.
'</td></tr>';
941 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>';
943 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
944 print $form->selectarray(
'status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
948 $morphys[
""] = $langs->trans(
"MorAndPhy");
949 $morphys[
"phy"] = $langs->trans(
"Physical");
950 $morphys[
"mor"] = $langs->trans(
"Moral");
951 print
'<tr><td><span>'.$langs->trans(
"MembersNature").
'</span></td><td>';
952 print $form->selectarray(
"morphy", $morphys, GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'aZ09') : $object->morphy);
955 print
'<tr><td>'.$langs->trans(
"SubscriptionRequired").
'</td><td>';
956 print $form->selectyesno(
"subscription", $object->subscription, 1);
959 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>';
960 print
'<input name="amount" size="5" value="';
961 print ((is_null($object->amount) || $object->amount ===
'') ?
'' :
price($object->amount));
965 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"CanEditAmountShort"), $langs->transnoentities(
"CanEditAmountDetail")).
'</td><td>';
966 print $form->selectyesno(
"caneditamount", $object->caneditamount, 1);
969 print
'<tr><td>'.$langs->trans(
"VoteAllowed").
'</td><td>';
970 print $form->selectyesno(
"vote", $object->vote, 1);
973 print
'<tr><td>'.$langs->trans(
"Duration").
'</td><td colspan="3">';
974 print
'<input name="duration_value" size="5" value="'.$object->duration_value.
'"> ';
975 print $formproduct->selectMeasuringUnits(
"duration_unit",
"time", ($object->duration_unit ===
'' ?
'y' : $object->duration_unit), 0, 1);
978 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
979 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
980 $doleditor =
new DolEditor(
'comment', $object->note_public,
'', 220,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
981 $doleditor->Create();
984 print
'<tr><td class="tdtop">'.$langs->trans(
"WelcomeEMail").
'</td><td>';
985 $doleditor =
new DolEditor(
'mail_valid', $object->mail_valid,
'', 280,
'dolibarr_notes',
'',
false,
true, isModEnabled(
'fckeditor'), 15,
'90%');
986 $doleditor->Create();
990 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
996 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 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.
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.