30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 $langs->loadLangs(array(
"members",
"companies"));
38 $action =
GETPOST(
'action',
'aZ09');
39 $massaction =
GETPOST(
'massaction',
'alpha');
40 $show_files =
GETPOST(
'show_files',
'int');
41 $confirm =
GETPOST(
'confirm',
'alpha');
42 $toselect =
GETPOST(
'toselect',
'array');
43 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'memberslist';
45 $search =
GETPOST(
"search",
'alpha');
46 $search_ref =
GETPOST(
"search_ref",
'alpha');
47 $search_lastname =
GETPOST(
"search_lastname",
'alpha');
48 $search_firstname =
GETPOST(
"search_firstname",
'alpha');
49 $search_gender =
GETPOST(
"search_gender",
'alpha');
50 $search_civility =
GETPOST(
"search_civility",
'alpha');
51 $search_company =
GETPOST(
'search_company',
'alphanohtml');
52 $search_login =
GETPOST(
"search_login",
'alpha');
53 $search_address =
GETPOST(
"search_address",
'alpha');
54 $search_zip =
GETPOST(
"search_zip",
'alpha');
55 $search_town =
GETPOST(
"search_town",
'alpha');
56 $search_state =
GETPOST(
"search_state",
'alpha');
57 $search_country =
GETPOST(
"search_country",
'alpha');
58 $search_phone =
GETPOST(
"search_phone",
'alpha');
59 $search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
60 $search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
61 $search_type =
GETPOST(
"search_type",
'alpha');
62 $search_email =
GETPOST(
"search_email",
'alpha');
63 $search_categ =
GETPOST(
"search_categ",
'int');
64 $search_filter =
GETPOST(
"search_filter",
'alpha');
65 $search_status =
GETPOST(
"search_status",
'intcomma');
66 $search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
67 $catid =
GETPOST(
"catid",
'int');
68 $optioncss =
GETPOST(
'optioncss',
'alpha');
69 $socid =
GETPOST(
'socid',
'int');
71 $filter =
GETPOST(
"filter",
'alpha');
73 $search_filter = $filter;
75 $statut =
GETPOST(
"statut",
'alpha');
77 $search_status = $statut;
80 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
82 if ($search_status < -2) {
86 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
87 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
88 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
90 if (empty($page) || $page == -1) {
93 $offset = $limit * $page;
94 $pageprev = $page - 1;
95 $pagenext = $page + 1;
97 $sortorder = ($filter ==
'outofdate' ?
"DESC" :
"ASC");
100 $sortfield = ($filter ==
'outofdate' ?
"d.datefin" :
"d.lastname");
106 $hookmanager->initHooks(array(
'memberlist'));
110 $extrafields->fetch_name_optionals_label($object->table_element);
112 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
115 $fieldstosearchall = array(
118 'd.lastname'=>
'Lastname',
119 'd.firstname'=>
'Firstname',
121 'd.societe'=>
"Company",
123 'd.address'=>
'Address',
127 'd.phone_perso'=>
"PhonePerso",
128 'd.phone_mobile'=>
"PhoneMobile",
129 'd.note_public'=>
'NotePublic',
130 'd.note_private'=>
'NotePrivate',
132 if ($db->type ==
'pgsql') {
133 unset($fieldstosearchall[
'd.rowid']);
135 $arrayfields = array(
136 'd.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
137 'd.civility'=>array(
'label'=>$langs->trans(
"Civility"),
'checked'=>0),
138 'd.lastname'=>array(
'label'=>$langs->trans(
"Lastname"),
'checked'=>1),
139 'd.firstname'=>array(
'label'=>$langs->trans(
"Firstname"),
'checked'=>1),
140 'd.gender'=>array(
'label'=>$langs->trans(
"Gender"),
'checked'=>0),
141 'd.company'=>array(
'label'=>$langs->trans(
"Company"),
'checked'=>1),
142 'd.login'=>array(
'label'=>$langs->trans(
"Login"),
'checked'=>1),
143 'd.morphy'=>array(
'label'=>$langs->trans(
"MemberNature"),
'checked'=>1),
144 't.libelle'=>array(
'label'=>$langs->trans(
"Type"),
'checked'=>1),
145 'd.email'=>array(
'label'=>$langs->trans(
"Email"),
'checked'=>1),
146 'd.address'=>array(
'label'=>$langs->trans(
"Address"),
'checked'=>0),
147 'd.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>0),
148 'd.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>0),
149 'd.phone'=>array(
'label'=>$langs->trans(
"Phone"),
'checked'=>0),
150 'd.phone_perso'=>array(
'label'=>$langs->trans(
"PhonePerso"),
'checked'=>0),
151 'd.phone_mobile'=>array(
'label'=>$langs->trans(
"PhoneMobile"),
'checked'=>0),
152 'state.nom'=>array(
'label'=>$langs->trans(
"State"),
'checked'=>0),
153 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
156 'd.datefin'=>array(
'label'=>$langs->trans(
"EndSubscription"),
'checked'=>1,
'position'=>500),
157 'd.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
158 'd.birth'=>array(
'label'=>$langs->trans(
"Birthday"),
'checked'=>0,
'position'=>500),
159 'd.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
160 'd.statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
161 'd.import_key'=>array(
'label'=>
"ImportId",
'checked'=>0,
'position'=>1100),
164 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
174 if (
GETPOST(
'cancel',
'alpha')) {
175 $action =
'list'; $massaction =
'';
177 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
181 $parameters = array(
'socid'=>isset($socid) ? $socid :
null);
182 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
187 if (empty($reshook)) {
189 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
198 $search_lastname =
"";
199 $search_firstname =
"";
201 $search_civility =
"";
203 $search_company =
"";
206 $search_address =
"";
210 $search_country =
'';
212 $search_phone_perso =
'';
213 $search_phone_mobile =
'';
218 $search_import_key =
'';
222 $search_array_options = array();
226 if ($massaction ==
'close' && $user->rights->adherent->creer) {
233 foreach ($toselect as $idtoclose) {
234 $tmpmember->fetch($idtoclose);
235 $result = $tmpmember->resiliate($user);
237 if ($result < 0 && !count($tmpmember->errors)) {
256 if ($massaction ==
'createexternaluser' && $user->rights->adherent->creer && $user->rights->user->user->creer) {
263 foreach ($toselect as $idtoclose) {
264 $tmpmember->fetch($idtoclose);
266 if (!empty($tmpmember->fk_soc)) {
267 $nuser =
new User($db);
270 $result = $nuser->create_from_member($tmpuser, $tmpmember->login);
272 if ($result < 0 && !count($tmpmember->errors)) {
283 setEventMessages($langs->trans(
"XExternalUserCreated", $nbcreated),
null,
'mesgs');
292 $objectclass =
'Adherent';
293 $objectlabel =
'Members';
294 $permissiontoread = $user->rights->adherent->lire;
295 $permissiontodelete = $user->rights->adherent->supprimer;
296 $permissiontoadd = $user->rights->adherent->creer;
297 $uploaddir = $conf->adherent->dir_output;
298 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
311 $title = $langs->trans(
"Members");
315 if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
316 $sql =
"SELECT DISTINCT";
320 $sql .=
" d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
321 $sql .=
" d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
322 $sql .=
" d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
323 $sql .=
" d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
324 $sql .=
" d.note_private, d.note_public, d.import_key,";
326 $sql .=
" ".$db->ifsql(
"d.societe IS NULL",
"s.nom",
"d.societe").
" as companyname,";
327 $sql .=
" t.libelle as type, t.subscription,";
328 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
330 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
331 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
332 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
" as options_".$key.
', ' :
'');
336 $parameters = array();
337 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
338 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
339 $sql = preg_replace(
'/,\s*$/',
'', $sql);
340 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
341 if (!empty($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
342 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (d.rowid = ef.fk_object)";
344 if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
346 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_member as cm ON d.rowid = cm.fk_member";
348 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = d.country)";
349 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = d.state_id)";
350 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on (s.rowid = d.fk_soc)";
351 $sql .=
", ".MAIN_DB_PREFIX.
"adherent_type as t";
352 $sql .=
" WHERE d.fk_adherent_type = t.rowid";
354 $sql .=
" AND cm.fk_categorie = ".((int) $catid);
357 $sql .=
" AND cm.fk_categorie IS NULL";
359 if ($search_categ > 0) {
360 $sql .=
" AND cm.fk_categorie = ".((int) $search_categ);
362 if ($search_categ == -2) {
363 $sql .=
" AND cm.fk_categorie IS NULL";
365 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
369 if ($search_type > 0) {
370 $sql .=
" AND t.rowid=".((int) $search_type);
372 if ($search_filter ==
'withoutsubscription') {
373 $sql .=
" AND (datefin IS NULL)";
375 if ($search_filter ==
'uptodate') {
376 $sql .=
" AND (datefin >= '".$db->idate($now).
"' OR t.subscription = '0')";
378 if ($search_filter ==
'outofdate') {
379 $sql .=
" AND (datefin < '".$db->idate($now).
"' AND t.subscription = '1')";
381 if ($search_status !=
'') {
383 $sql .=
" AND d.statut in (".$db->sanitize($db->escape($search_status)).
")";
388 if ($search_civility) {
391 if ($search_firstname) {
394 if ($search_lastname) {
395 $sql .=
natural_search(array(
"d.firstname",
"d.lastname",
"d.societe"), $search_lastname);
397 if ($search_gender !=
'' && $search_gender !=
'-1') {
403 if ($search_company) {
409 if ($search_address) {
424 if ($search_phone_perso) {
427 if ($search_phone_mobile) {
430 if ($search_country) {
431 $sql .=
" AND d.country IN (".$db->sanitize($search_country).
')';
433 if ($search_import_key) {
438 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
441 $parameters = array();
442 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
443 $sql .= $hookmanager->resPrint;
446 $nbtotalofrecords =
'';
447 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
448 $resql = $db->query($sql);
450 $nbtotalofrecords = $db->num_rows(
$resql);
455 if (($page * $limit) > $nbtotalofrecords) {
463 $sql .= $db->order($sortfield, $sortorder);
465 $sql .= $db->plimit($limit + 1, $offset);
468 $resql = $db->query($sql);
474 $num = $db->num_rows(
$resql);
477 $arrayofselected = is_array($toselect) ? $toselect : array();
479 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
480 $obj = $db->fetch_object(
$resql);
482 header(
"Location: ".DOL_URL_ROOT.
'/adherents/card.php?id='.$id);
486 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
490 if ($search_status ==
'-1,1') {
491 $title = $langs->trans(
"MembersListQualified");
494 $title = $langs->trans(
"MembersListToValid");
497 $title = $langs->trans(
"MenuMembersValidated");
500 $title = $langs->trans(
"MembersWithSubscriptionToReceive");
503 $title = $langs->trans(
"MembersListUpToDate");
506 $title = $langs->trans(
"MembersListNotUpToDate");
509 $title = $langs->trans(
"MembersListResiliated");
512 $title = $langs->trans(
"MembersListExcluded");
514 } elseif ($action ==
'search') {
515 $title = $langs->trans(
"MembersListQualified");
518 if ($search_type > 0) {
520 $result = $membertype->fetch($search_type);
521 $title .=
" (".$membertype->label.
")";
525 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
526 $param .=
'&contextpage='.urlencode($contextpage);
528 if ($limit > 0 && $limit != $conf->liste_limit) {
529 $param .=
'&limit='.urlencode($limit);
532 $param .=
"&sall=".urlencode($sall);
535 $param .=
"&search_ref=".urlencode($search_ref);
537 if ($search_civility) {
538 $param .=
"&search_civility=".urlencode($search_civility);
540 if ($search_firstname) {
541 $param .=
"&search_firstname=".urlencode($search_firstname);
543 if ($search_lastname) {
544 $param .=
"&search_lastname=".urlencode($search_lastname);
546 if ($search_gender) {
547 $param .=
"&search_gender=".urlencode($search_gender);
550 $param .=
"&search_login=".urlencode($search_login);
553 $param .=
"&search_email=".urlencode($search_email);
555 if ($search_categ > 0 || $search_categ == -2) {
556 $param .=
"&search_categ=".urlencode($search_categ);
558 if ($search_company) {
559 $param .=
"&search_company=".urlencode($search_company);
561 if ($search_address !=
'') {
562 $param .=
"&search_address=".urlencode($search_address);
564 if ($search_town !=
'') {
565 $param .=
"&search_town=".urlencode($search_town);
567 if ($search_zip !=
'') {
568 $param .=
"&search_zip=".urlencode($search_zip);
570 if ($search_state !=
'') {
571 $param .=
"&search_state=".urlencode($search_state);
573 if ($search_country !=
'') {
574 $param .=
"&search_country=".urlencode($search_country);
576 if ($search_phone !=
'') {
577 $param .=
"&search_phone=".urlencode($search_phone);
579 if ($search_phone_perso !=
'') {
580 $param .=
"&search_phone_perso=".urlencode($search_phone_perso);
582 if ($search_phone_mobile !=
'') {
583 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
585 if ($search_filter && $search_filter !=
'-1') {
586 $param .=
"&search_filter=".urlencode($search_filter);
588 if ($search_status !=
"" && $search_status != -3) {
589 $param .=
"&search_status=".urlencode($search_status);
591 if ($search_import_key !=
'') {
592 $param .=
'&search_import_key='.urlencode($search_import_key);
594 if ($search_type > 0) {
595 $param .=
"&search_type=".urlencode($search_type);
597 if ($optioncss !=
'') {
598 $param .=
'&optioncss='.urlencode($optioncss);
601 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
604 $arrayofmassactions = array(
608 if ($user->rights->adherent->creer) {
609 $arrayofmassactions[
'close'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Resiliate");
611 if ($user->rights->adherent->supprimer) {
612 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
614 if (
isModEnabled(
'category') && $user->rights->adherent->creer) {
615 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
617 if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
618 $arrayofmassactions[
'createexternaluser'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"CreateExternalUser");
620 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
621 $arrayofmassactions = array();
623 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
626 if ($user->rights->adherent->creer) {
627 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewMember'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/card.php?action=create');
630 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
631 if ($optioncss !=
'') {
632 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
634 print
'<input type="hidden" name="token" value="'.newToken().
'">';
635 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
636 print
'<input type="hidden" name="action" value="list">';
637 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
638 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
639 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
641 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
643 $topicmail =
"Information";
644 $modelmail =
"member";
646 $trackid =
'mem'.$object->id;
647 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
650 foreach ($fieldstosearchall as $key => $val) {
651 $fieldstosearchall[$key] = $langs->trans($val);
653 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
658 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
659 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
660 $moreforfilter .=
'<div class="divsearchfield">';
661 $moreforfilter .=
img_picto($langs->trans(
'Categories'),
'category',
'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ,
'search_categ', 1);
662 $moreforfilter .=
'</div>';
664 $parameters = array();
665 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
666 if (empty($reshook)) {
667 $moreforfilter .= $hookmanager->resPrint;
669 $moreforfilter = $hookmanager->resPrint;
671 if (!empty($moreforfilter)) {
672 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
673 print $moreforfilter;
677 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
678 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
679 if ($massactionbutton) {
680 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
683 print
'<div class="div-table-responsive">';
684 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
687 print
'<tr class="liste_titre_filter">';
690 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
691 print
'<td class="liste_titre"> </td>';
695 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
696 print
'<td class="liste_titre">';
697 print
'<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
700 if (!empty($arrayfields[
'd.civility'][
'checked'])) {
701 print
'<td class="liste_titre left">';
702 print
'<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).
'"></td>';
704 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
705 print
'<td class="liste_titre left">';
706 print
'<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'"></td>';
708 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
709 print
'<td class="liste_titre left">';
710 print
'<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
712 if (!empty($arrayfields[
'd.gender'][
'checked'])) {
713 print
'<td class="liste_titre">';
714 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
715 print
$form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
718 if (!empty($arrayfields[
'd.company'][
'checked'])) {
719 print
'<td class="liste_titre left">';
720 print
'<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"></td>';
722 if (!empty($arrayfields[
'd.login'][
'checked'])) {
723 print
'<td class="liste_titre left">';
724 print
'<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
726 if (!empty($arrayfields[
'd.morphy'][
'checked'])) {
727 print
'<td class="liste_titre left">';
730 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
731 print
'<td class="liste_titre">';
732 $listetype = $membertypestatic->liste_array();
733 print
$form->selectarray(
"search_type", $listetype, $search_type, 1, 0, 0,
'', 0, 32);
737 if (!empty($arrayfields[
'd.address'][
'checked'])) {
738 print
'<td class="liste_titre left">';
739 print
'<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'"></td>';
742 if (!empty($arrayfields[
'd.zip'][
'checked'])) {
743 print
'<td class="liste_titre left">';
744 print
'<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
746 if (!empty($arrayfields[
'd.town'][
'checked'])) {
747 print
'<td class="liste_titre left">';
748 print
'<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
751 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
752 print
'<td class="liste_titre">';
753 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
757 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
758 print
'<td class="liste_titre center">';
759 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
763 if (!empty($arrayfields[
'd.phone'][
'checked'])) {
764 print
'<td class="liste_titre left">';
765 print
'<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'"></td>';
768 if (!empty($arrayfields[
'd.phone_perso'][
'checked'])) {
769 print
'<td class="liste_titre left">';
770 print
'<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).
'"></td>';
773 if (!empty($arrayfields[
'd.phone_mobile'][
'checked'])) {
774 print
'<td class="liste_titre left">';
775 print
'<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'"></td>';
778 if (!empty($arrayfields[
'd.email'][
'checked'])) {
779 print
'<td class="liste_titre left">';
780 print
'<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'"></td>';
783 if (!empty($arrayfields[
'd.datefin'][
'checked'])) {
784 print
'<td class="liste_titre center">';
785 $selectarray = array(
'-1'=>
'',
'withoutsubscription'=>$langs->trans(
"WithoutSubscription"),
'uptodate'=>$langs->trans(
"UpToDate"),
'outofdate'=>$langs->trans(
"OutOfDate"));
786 print
$form->selectarray(
'search_filter', $selectarray, $search_filter);
790 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
793 $parameters = array(
'arrayfields'=>$arrayfields);
794 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
795 print $hookmanager->resPrint;
797 if (!empty($arrayfields[
'd.datec'][
'checked'])) {
798 print
'<td class="liste_titre">';
802 if (!empty($arrayfields[
'd.birth'][
'checked'])) {
803 print
'<td class="liste_titre">';
807 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
808 print
'<td class="liste_titre">';
812 if (!empty($arrayfields[
'd.statut'][
'checked'])) {
813 print
'<td class="liste_titre right maxwidthonsmartphone">';
820 print
$form->selectarray(
'search_status', $liststatus, $search_status, -3);
823 if (!empty($arrayfields[
'd.import_key'][
'checked'])) {
824 print
'<td class="liste_titre center">';
825 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
828 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
830 print
'<td class="liste_titre middle">';
831 $searchpicto =
$form->showFilterButtons();
837 print
'<tr class="liste_titre">';
838 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
839 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
841 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
844 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
845 print_liste_field_titre($arrayfields[
'd.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'd.ref',
'', $param,
'', $sortfield, $sortorder);
847 if (!empty($arrayfields[
'd.civility'][
'checked'])) {
848 print_liste_field_titre($arrayfields[
'd.civility'][
'label'], $_SERVER[
"PHP_SELF"],
'd.civility',
'', $param,
'', $sortfield, $sortorder);
850 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
851 print_liste_field_titre($arrayfields[
'd.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
'd.firstname',
'', $param,
'', $sortfield, $sortorder);
853 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
854 print_liste_field_titre($arrayfields[
'd.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
'd.lastname',
'', $param,
'', $sortfield, $sortorder);
856 if (!empty($arrayfields[
'd.gender'][
'checked'])) {
857 print_liste_field_titre($arrayfields[
'd.gender'][
'label'], $_SERVER[
'PHP_SELF'],
'd.gender', $param,
"",
"", $sortfield, $sortorder);
859 if (!empty($arrayfields[
'd.company'][
'checked'])) {
860 print_liste_field_titre($arrayfields[
'd.company'][
'label'], $_SERVER[
"PHP_SELF"],
'companyname',
'', $param,
'', $sortfield, $sortorder);
862 if (!empty($arrayfields[
'd.login'][
'checked'])) {
863 print_liste_field_titre($arrayfields[
'd.login'][
'label'], $_SERVER[
"PHP_SELF"],
'd.login',
'', $param,
'', $sortfield, $sortorder);
865 if (!empty($arrayfields[
'd.morphy'][
'checked'])) {
866 print_liste_field_titre($arrayfields[
'd.morphy'][
'label'], $_SERVER[
"PHP_SELF"],
'd.morphy',
'', $param,
'', $sortfield, $sortorder);
868 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
869 print_liste_field_titre($arrayfields[
't.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
't.libelle',
'', $param,
'', $sortfield, $sortorder);
871 if (!empty($arrayfields[
'd.address'][
'checked'])) {
872 print_liste_field_titre($arrayfields[
'd.address'][
'label'], $_SERVER[
"PHP_SELF"],
'd.address',
'', $param,
'', $sortfield, $sortorder);
874 if (!empty($arrayfields[
'd.zip'][
'checked'])) {
875 print_liste_field_titre($arrayfields[
'd.zip'][
'label'], $_SERVER[
"PHP_SELF"],
'd.zip',
'', $param,
'', $sortfield, $sortorder);
877 if (!empty($arrayfields[
'd.town'][
'checked'])) {
878 print_liste_field_titre($arrayfields[
'd.town'][
'label'], $_SERVER[
"PHP_SELF"],
'd.town',
'', $param,
'', $sortfield, $sortorder);
880 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
881 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
883 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
884 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
886 if (!empty($arrayfields[
'd.phone'][
'checked'])) {
887 print_liste_field_titre($arrayfields[
'd.phone'][
'label'], $_SERVER[
"PHP_SELF"],
'd.phone',
'', $param,
'', $sortfield, $sortorder);
889 if (!empty($arrayfields[
'd.phone_perso'][
'checked'])) {
890 print_liste_field_titre($arrayfields[
'd.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
'd.phone_perso',
'', $param,
'', $sortfield, $sortorder);
892 if (!empty($arrayfields[
'd.phone_mobile'][
'checked'])) {
893 print_liste_field_titre($arrayfields[
'd.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
'd.phone_mobile',
'', $param,
'', $sortfield, $sortorder);
895 if (!empty($arrayfields[
'd.email'][
'checked'])) {
896 print_liste_field_titre($arrayfields[
'd.email'][
'label'], $_SERVER[
"PHP_SELF"],
'd.email',
'', $param,
'', $sortfield, $sortorder);
898 if (!empty($arrayfields[
'd.datefin'][
'checked'])) {
899 print_liste_field_titre($arrayfields[
'd.datefin'][
'label'], $_SERVER[
"PHP_SELF"],
'd.datefin',
'', $param,
'', $sortfield, $sortorder,
'center ');
902 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
905 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
906 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
907 print $hookmanager->resPrint;
908 if (!empty($arrayfields[
'd.datec'][
'checked'])) {
909 print_liste_field_titre($arrayfields[
'd.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"d.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
911 if (!empty($arrayfields[
'd.birth'][
'checked'])) {
912 print_liste_field_titre($arrayfields[
'd.birth'][
'label'], $_SERVER[
"PHP_SELF"],
"d.birth",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
914 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
915 print_liste_field_titre($arrayfields[
'd.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"d.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
917 if (!empty($arrayfields[
'd.statut'][
'checked'])) {
918 print_liste_field_titre($arrayfields[
'd.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"d.statut",
"", $param,
'class="right"', $sortfield, $sortorder);
920 if (!empty($arrayfields[
'd.import_key'][
'checked'])) {
921 print_liste_field_titre($arrayfields[
'd.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"d.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
923 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
924 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
929 $totalarray = array();
930 $totalarray[
'nbfield'] = 0;
931 while ($i < min($num, $limit)) {
932 $obj = $db->fetch_object(
$resql);
934 $datefin = $db->jdate($obj->datefin);
935 $memberstatic->id = $obj->rowid;
936 $memberstatic->ref = $obj->ref;
937 $memberstatic->civility_id = $obj->civility;
938 $memberstatic->login = $obj->login;
939 $memberstatic->lastname = $obj->lastname;
940 $memberstatic->firstname = $obj->firstname;
941 $memberstatic->gender = $obj->gender;
942 $memberstatic->statut = $obj->statut;
943 $memberstatic->datefin = $datefin;
944 $memberstatic->socid = $obj->fk_soc;
945 $memberstatic->photo = $obj->photo;
946 $memberstatic->email = $obj->email;
947 $memberstatic->morphy = $obj->morphy;
948 $memberstatic->note_public = $obj->note_public;
949 $memberstatic->note_private = $obj->note_private;
951 if (!empty($obj->fk_soc)) {
952 $memberstatic->fetch_thirdparty();
953 if ($memberstatic->thirdparty->id > 0) {
954 $companyname = $memberstatic->thirdparty->name;
955 $companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
958 $companyname = $obj->company;
959 $companynametoshow = $obj->company;
961 $memberstatic->company = $companyname;
963 print
'<tr class="oddeven">';
965 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
966 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
968 $totalarray[
'nbfield']++;
973 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
975 print $memberstatic->getNomUrl(-1, 0,
'card',
'ref',
'', -1, 0, 1);
978 $totalarray[
'nbfield']++;
982 if (!empty($arrayfields[
'd.civility'][
'checked'])) {
984 print $obj->civility;
987 $totalarray[
'nbfield']++;
991 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
992 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">';
993 print $memberstatic->getNomUrl(0, 0,
'card',
'firstname');
997 $totalarray[
'nbfield']++;
1001 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
1002 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">';
1003 print $memberstatic->getNomUrl(0, 0,
'card',
'lastname');
1007 $totalarray[
'nbfield']++;
1011 if (!empty($arrayfields[
'd.gender'][
'checked'])) {
1014 print $langs->trans(
"Gender".$obj->gender);
1018 $totalarray[
'nbfield']++;
1022 if (!empty($arrayfields[
'd.company'][
'checked'])) {
1023 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companyname).
'">';
1024 print $companynametoshow;
1028 if (!empty($arrayfields[
'd.login'][
'checked'])) {
1029 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).
'">'.$obj->login.
"</td>\n";
1031 $totalarray[
'nbfield']++;
1035 if (!empty($arrayfields[
'd.morphy'][
'checked'])) {
1036 print
'<td class="center">';
1038 if ($obj->morphy ==
'phy') {
1039 $s .=
'<span class="customer-back" title="'.$langs->trans(
"Physical").
'">'.
dol_substr($langs->trans(
"Physical"), 0, 1).
'</span>';
1041 if ($obj->morphy ==
'mor') {
1042 $s .=
'<span class="vendor-back" title="'.$langs->trans(
"Moral").
'">'.
dol_substr($langs->trans(
"Moral"), 0, 1).
'</span>';
1047 $totalarray[
'nbfield']++;
1051 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
1052 $membertypestatic->id = $obj->type_id;
1053 $membertypestatic->label = $obj->type;
1054 print
'<td class="nowraponall">';
1055 print $membertypestatic->getNomUrl(1, 32);
1058 $totalarray[
'nbfield']++;
1062 if (!empty($arrayfields[
'd.address'][
'checked'])) {
1063 print
'<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).
'">';
1064 print $obj->address;
1067 $totalarray[
'nbfield']++;
1071 if (!empty($arrayfields[
'd.zip'][
'checked'])) {
1072 print
'<td class="nocellnopadd">';
1076 $totalarray[
'nbfield']++;
1080 if (!empty($arrayfields[
'd.town'][
'checked'])) {
1081 print
'<td class="nocellnopadd">';
1085 $totalarray[
'nbfield']++;
1089 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1090 print
"<td>".$obj->state_name.
"</td>\n";
1092 $totalarray[
'nbfield']++;
1096 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1097 $tmparray =
getCountry($obj->country,
'all');
1098 print
'<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray[
'label']).
'">';
1102 $totalarray[
'nbfield']++;
1106 if (!empty($arrayfields[
'd.phone'][
'checked'])) {
1107 print
'<td class="nocellnopadd">';
1111 $totalarray[
'nbfield']++;
1115 if (!empty($arrayfields[
'd.phone_perso'][
'checked'])) {
1116 print
'<td class="nocellnopadd">';
1117 print $obj->phone_perso;
1120 $totalarray[
'nbfield']++;
1124 if (!empty($arrayfields[
'd.phone_mobile'][
'checked'])) {
1125 print
'<td class="nocellnopadd">';
1126 print $obj->phone_mobile;
1129 $totalarray[
'nbfield']++;
1133 if (!empty($arrayfields[
'd.email'][
'checked'])) {
1134 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->email).
'">';
1139 $datefin = $db->jdate($obj->datefin);
1140 if (!empty($arrayfields[
'd.datefin'][
'checked'])) {
1141 print
'<td class="nowrap center">';
1144 if ($memberstatic->hasDelay()) {
1145 $textlate =
' ('.$langs->trans(
"DateReference").
' > '.$langs->trans(
"DateToday").
' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ?
'+' :
'').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).
' '.$langs->trans(
"days").
')';
1146 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1149 if (!empty($obj->subscription)) {
1150 print $langs->trans(
"SubscriptionNotReceived");
1151 if ($obj->statut > 0) {
1152 print
" ".img_warning();
1161 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1163 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1164 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1165 print $hookmanager->resPrint;
1167 if (!empty($arrayfields[
'd.datec'][
'checked'])) {
1168 print
'<td class="nowrap center">';
1169 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1172 $totalarray[
'nbfield']++;
1176 if (!empty($arrayfields[
'd.birth'][
'checked'])) {
1177 print
'<td class="nowrap center">';
1181 $totalarray[
'nbfield']++;
1185 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
1186 print
'<td class="nowrap center">';
1187 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1190 $totalarray[
'nbfield']++;
1194 if (!empty($arrayfields[
'd.statut'][
'checked'])) {
1195 print
'<td class="nowrap right">';
1196 print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
1199 $totalarray[
'nbfield']++;
1202 if (!empty($arrayfields[
'd.import_key'][
'checked'])) {
1203 print
'<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).
'">';
1207 $totalarray[
'nbfield']++;
1211 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1212 print
'<td class="center">';
1213 if ($massactionbutton || $massaction) {
1215 if (in_array($obj->rowid, $arrayofselected)) {
1218 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1223 $totalarray[
'nbfield']++;
1231 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1237 foreach ($arrayfields as $key => $val) {
1238 if (!empty($val[
'checked'])) {
1242 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
1247 $parameters = array(
'sql' => $sql);
1248 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1249 print $hookmanager->resPrint;