29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35 $langs->loadLangs(array(
"members",
"companies"));
37 $action =
GETPOST(
'action',
'aZ09');
38 $massaction =
GETPOST(
'massaction',
'alpha');
39 $show_files =
GETPOST(
'show_files',
'int');
40 $confirm =
GETPOST(
'confirm',
'alpha');
41 $toselect =
GETPOST(
'toselect',
'array');
42 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'memberslist';
47 $search =
GETPOST(
"search",
'alpha');
48 $search_ref =
GETPOST(
"search_ref",
'alpha');
49 $search_lastname =
GETPOST(
"search_lastname",
'alpha');
50 $search_firstname =
GETPOST(
"search_firstname",
'alpha');
51 $search_gender =
GETPOST(
"search_gender",
'alpha');
52 $search_civility =
GETPOST(
"search_civility",
'alpha');
53 $search_company =
GETPOST(
'search_company',
'alphanohtml');
54 $search_login =
GETPOST(
"search_login",
'alpha');
55 $search_address =
GETPOST(
"search_address",
'alpha');
56 $search_zip =
GETPOST(
"search_zip",
'alpha');
57 $search_town =
GETPOST(
"search_town",
'alpha');
58 $search_state =
GETPOST(
"search_state",
'alpha');
59 $search_country =
GETPOST(
"search_country",
'alpha');
60 $search_phone =
GETPOST(
"search_phone",
'alpha');
61 $search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
62 $search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
63 $search_type =
GETPOST(
"search_type",
'alpha');
64 $search_email =
GETPOST(
"search_email",
'alpha');
65 $search_categ =
GETPOST(
"search_categ",
'int');
66 $search_filter =
GETPOST(
"search_filter",
'alpha');
67 $search_status =
GETPOST(
"search_status",
'intcomma');
68 $catid =
GETPOST(
"catid",
'int');
69 $optioncss =
GETPOST(
'optioncss',
'alpha');
71 $filter =
GETPOST(
"filter",
'alpha');
72 if ($filter) $search_filter = $filter;
73 $statut =
GETPOST(
"statut",
'alpha');
74 if ($statut !=
'') $search_status = $statut;
76 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
78 if ($search_status < -1) $search_status =
'';
80 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
81 $sortfield =
GETPOST(
"sortfield",
'alpha');
82 $sortorder =
GETPOST(
"sortorder",
'alpha');
84 if (empty($page) || $page == -1) { $page = 0; }
85 $offset = $limit * $page;
86 $pageprev = $page - 1;
87 $pagenext = $page + 1;
88 if (!$sortorder) { $sortorder = ($filter ==
'outofdate' ?
"DESC" :
"ASC"); }
89 if (!$sortfield) { $sortfield = ($filter ==
'outofdate' ?
"d.datefin" :
"d.lastname"); }
94 $hookmanager->initHooks(array(
'memberlist'));
98 $extrafields->fetch_name_optionals_label($object->table_element);
100 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
103 $fieldstosearchall = array(
106 'd.lastname'=>
'Lastname',
107 'd.firstname'=>
'Firstname',
109 'd.societe'=>
"Company",
111 'd.address'=>
'Address',
115 'd.phone_perso'=>
"PhonePerso",
116 'd.phone_mobile'=>
"PhoneMobile",
117 'd.note_public'=>
'NotePublic',
118 'd.note_private'=>
'NotePrivate',
120 if ($db->type ==
'pgsql') unset($fieldstosearchall[
'd.rowid']);
121 $arrayfields = array(
122 'd.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
123 'd.civility'=>array(
'label'=>$langs->trans(
"Civility"),
'checked'=>0),
124 'd.lastname'=>array(
'label'=>$langs->trans(
"Lastname"),
'checked'=>1),
125 'd.firstname'=>array(
'label'=>$langs->trans(
"Firstname"),
'checked'=>1),
126 'd.gender'=>array(
'label'=>$langs->trans(
"Gender"),
'checked'=>0),
127 'd.company'=>array(
'label'=>$langs->trans(
"Company"),
'checked'=>1),
128 'd.login'=>array(
'label'=>$langs->trans(
"Login"),
'checked'=>1),
129 'd.morphy'=>array(
'label'=>$langs->trans(
"MemberNature"),
'checked'=>1),
130 't.libelle'=>array(
'label'=>$langs->trans(
"Type"),
'checked'=>1),
131 'd.email'=>array(
'label'=>$langs->trans(
"Email"),
'checked'=>1),
132 'd.address'=>array(
'label'=>$langs->trans(
"Address"),
'checked'=>0),
133 'd.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>0),
134 'd.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>0),
135 'd.phone'=>array(
'label'=>$langs->trans(
"Phone"),
'checked'=>0),
136 'd.phone_perso'=>array(
'label'=>$langs->trans(
"PhonePerso"),
'checked'=>0),
137 'd.phone_mobile'=>array(
'label'=>$langs->trans(
"PhoneMobile"),
'checked'=>0),
138 'state.nom'=>array(
'label'=>$langs->trans(
"State"),
'checked'=>0),
139 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
142 'd.datefin'=>array(
'label'=>$langs->trans(
"EndSubscription"),
'checked'=>1,
'position'=>500),
143 'd.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
144 'd.birth'=>array(
'label'=>$langs->trans(
"Birthday"),
'checked'=>0,
'position'=>500),
145 'd.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
146 'd.statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000)
149 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
156 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
157 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') { $massaction =
''; }
159 $parameters = array(
'socid'=>$socid);
160 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
161 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
163 if (empty($reshook)) {
165 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
168 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
174 $search_lastname =
"";
175 $search_firstname =
"";
177 $search_civility =
"";
179 $search_company =
"";
182 $search_address =
"";
186 $search_country =
'';
188 $search_phone_perso =
'';
189 $search_phone_mobile =
'';
197 $search_array_options = array();
201 if ($massaction ==
'close' && $user->rights->adherent->creer) {
208 foreach ($toselect as $idtoclose) {
209 $tmpmember->fetch($idtoclose);
210 $result = $tmpmember->resiliate($user);
212 if ($result < 0 && !count($tmpmember->errors)) {
215 if ($result > 0) $nbclose++;
229 $objectclass =
'Adherent';
230 $objectlabel =
'Members';
231 $permissiontoread = $user->rights->adherent->lire;
232 $permissiontodelete = $user->rights->adherent->supprimer;
233 $uploaddir = $conf->adherent->dir_output;
234 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
242 $form =
new Form($db);
249 $sql =
"SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
250 $sql .=
" d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
251 $sql .=
" d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
252 $sql .=
" d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
253 $sql .=
" d.note_private, d.note_public,";
255 $sql .=
" t.libelle as type, t.subscription,";
256 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
258 if (!empty($extrafields->attributes[$object->table_element][
'label']))
259 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
' as options_'.$key.
', ' :
'');
261 $parameters = array();
262 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
263 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
264 $sql = preg_replace(
'/,\s*$/',
'', $sql);
265 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
266 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (d.rowid = ef.fk_object)";
267 if (!empty($search_categ) || !empty($catid)) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_member as cm ON d.rowid = cm.fk_member";
268 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = d.country)";
269 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = d.state_id)";
270 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on (s.rowid = d.fk_soc)";
271 $sql .=
", ".MAIN_DB_PREFIX.
"adherent_type as t";
272 $sql .=
" WHERE d.fk_adherent_type = t.rowid ";
273 if ($catid > 0) $sql .=
" AND cm.fk_categorie = ".$db->escape($catid);
274 if ($catid == -2) $sql .=
" AND cm.fk_categorie IS NULL";
275 if ($search_categ > 0) $sql .=
" AND cm.fk_categorie = ".$db->escape($search_categ);
276 if ($search_categ == -2) $sql .=
" AND cm.fk_categorie IS NULL";
277 $sql .=
" AND d.entity IN (".getEntity(
'adherent').
")";
278 if ($sall) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
279 if ($search_type > 0) $sql .=
" AND t.rowid=".$db->escape($search_type);
280 if ($search_filter ==
'withoutsubscription') $sql .=
" AND (datefin IS NULL OR t.subscription = 0)";
281 if ($search_filter ==
'uptodate') $sql .=
" AND (datefin >= '".$db->idate($now).
"' OR t.subscription = 0)";
282 if ($search_filter ==
'outofdate') $sql .=
" AND (datefin < '".$db->idate($now).
"' AND t.subscription = 1)";
283 if ($search_status !=
'') $sql .=
" AND d.statut in (".$db->sanitize($db->escape($search_status)).
")";
285 if (is_numeric($search_ref)) $sql .=
" AND (d.rowid = ".$db->escape($search_ref).
")";
286 else $sql .=
" AND 1 = 2";
288 if ($search_civility) $sql .=
natural_search(
"d.civility", $search_civility);
289 if ($search_firstname) $sql .=
natural_search(
"d.firstname", $search_firstname);
290 if ($search_lastname) $sql .=
natural_search(array(
"d.firstname",
"d.lastname",
"d.societe"), $search_lastname);
291 if ($search_gender !=
'' && $search_gender !=
'-1') $sql .=
natural_search(
"d.gender", $search_gender);
292 if ($search_login) $sql .=
natural_search(
"d.login", $search_login);
293 if ($search_company) $sql .=
natural_search(
"s.nom", $search_company);
294 if ($search_email) $sql .=
natural_search(
"d.email", $search_email);
295 if ($search_address) $sql .=
natural_search(
"d.address", $search_address);
298 if ($search_state) $sql .=
natural_search(
"state.nom", $search_state);
299 if ($search_phone) $sql .=
natural_search(
"d.phone", $search_phone);
300 if ($search_phone_perso) $sql .=
natural_search(
"d.phone_perso", $search_phone_perso);
301 if ($search_phone_mobile) $sql .=
natural_search(
"d.phone_mobile", $search_phone_mobile);
302 if ($search_country) $sql .=
" AND d.country IN (".$search_country.
')';
305 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
308 $parameters = array();
309 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
310 $sql .= $hookmanager->resPrint;
312 $sql .= $db->order($sortfield, $sortorder);
315 $nbtotalofrecords =
'';
316 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
317 $resql = $db->query($sql);
320 if (($page * $limit) > $nbtotalofrecords) {
326 $sql .= $db->plimit($limit + 1, $offset);
329 $resql = $db->query($sql);
335 $num = $db->num_rows(
$resql);
337 $arrayofselected = is_array($toselect) ? $toselect : array();
339 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
340 $obj = $db->fetch_object(
$resql);
342 header(
"Location: ".DOL_URL_ROOT.
'/adherents/card.php?id='.$id);
346 llxHeader(
'', $langs->trans(
"Member"),
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
348 $titre = $langs->trans(
"MembersList");
350 if ($search_status ==
'-1,1') { $titre = $langs->trans(
"MembersListQualified"); }
351 if ($search_status ==
'-1') { $titre = $langs->trans(
"MembersListToValid"); }
352 if ($search_status ==
'1' && $filter ==
'') { $titre = $langs->trans(
"MembersValidated"); }
353 if ($search_status ==
'1' && $filter ==
'withoutsubscription') { $titre = $langs->trans(
"MembersWithSubscriptionToReceive"); }
354 if ($search_status ==
'1' && $filter ==
'uptodate') { $titre = $langs->trans(
"MembersListUpToDate"); }
355 if ($search_status ==
'1' && $filter ==
'outofdate') { $titre = $langs->trans(
"MembersListNotUpToDate"); }
356 if ($search_status ==
'0') { $titre = $langs->trans(
"MembersListResiliated"); }
357 } elseif ($action ==
'search') {
358 $titre = $langs->trans(
"MembersListQualified");
361 if ($search_type > 0) {
363 $result = $membertype->fetch(
GETPOST(
"type",
'int'));
364 $titre .=
" (".$membertype->label.
")";
368 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
369 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
370 if ($sall !=
"") $param .=
"&sall=".urlencode($sall);
371 if ($search_ref) $param .=
"&search_ref=".urlencode($search_ref);
372 if ($search_civility) $param .=
"&search_civility=".urlencode($search_civility);
373 if ($search_firstname) $param .=
"&search_firstname=".urlencode($search_firstname);
374 if ($search_lastname) $param .=
"&search_lastname=".urlencode($search_lastname);
375 if ($search_gender) $param .=
"&search_gender=".urlencode($search_gender);
376 if ($search_login) $param .=
"&search_login=".urlencode($search_login);
377 if ($search_email) $param .=
"&search_email=".urlencode($search_email);
378 if ($search_categ) $param .=
"&search_categ=".urlencode($search_categ);
379 if ($search_company) $param .=
"&search_company=".urlencode($search_company);
380 if ($search_address !=
'') $param .=
"&search_address=".urlencode($search_address);
381 if ($search_town !=
'') $param .=
"&search_town=".urlencode($search_town);
382 if ($search_zip !=
'') $param .=
"&search_zip=".urlencode($search_zip);
383 if ($search_state !=
'') $param .=
"&search_state=".urlencode($search_state);
384 if ($search_country !=
'') $param .=
"&search_country=".urlencode($search_country);
385 if ($search_phone !=
'') $param .=
"&search_phone=".urlencode($search_phone);
386 if ($search_phone_perso !=
'') $param .=
"&search_phone_perso=".urlencode($search_phone_perso);
387 if ($search_phone_mobile !=
'') $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
388 if ($search_filter && $search_filter !=
'-1') $param .=
"&search_filter=".urlencode($search_filter);
389 if ($search_status !=
"" && $search_status !=
'-1') $param .=
"&search_status=".urlencode($search_status);
390 if ($search_type > 0) $param .=
"&search_type=".urlencode($search_type);
391 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
393 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
396 $arrayofmassactions = array(
400 if ($user->rights->adherent->creer) $arrayofmassactions[
'close'] = $langs->trans(
"Resiliate");
401 if ($user->rights->adherent->supprimer) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
402 if (in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
403 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
406 if ($user->rights->adherent->creer) {
407 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewMember'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/card.php?action=create');
410 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
411 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
412 print '<input type="hidden" name="token" value="'.newToken().
'">';
413 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
414 print '<input type="hidden" name="action" value="list">';
415 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
416 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
417 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
419 print_barre_liste($titre, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'members', 0, $newcardbutton,
'', $limit, 0, 0, 1);
421 $topicmail =
"Information";
422 $modelmail =
"member";
424 $trackid =
'mem'.$object->id;
425 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
428 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
429 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
434 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
435 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
436 $moreforfilter .=
'<div class="divsearchfield">';
437 $moreforfilter .= $langs->trans(
'Categories').
': ';
438 $moreforfilter .= $formother->select_categories(Categorie::TYPE_MEMBER, $search_categ,
'search_categ', 1);
439 $moreforfilter .=
'</div>';
441 $parameters = array();
442 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
443 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
444 else $moreforfilter = $hookmanager->resPrint;
445 if (!empty($moreforfilter)) {
446 print '<div class="liste_titre liste_titre_bydiv centpercent">';
447 print $moreforfilter;
451 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
452 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
453 if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
455 print '<div class="div-table-responsive">';
456 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
460 print '<tr class="liste_titre_filter">';
463 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
464 print
'<td class="liste_titre"> </td>';
468 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
469 print
'<td class="liste_titre">';
470 print
'<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
473 if (!empty($arrayfields[
'd.civility'][
'checked'])) {
474 print
'<td class="liste_titre left">';
475 print
'<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).
'"></td>';
477 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
478 print
'<td class="liste_titre left">';
479 print
'<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'"></td>';
481 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
482 print
'<td class="liste_titre left">';
483 print
'<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
485 if (!empty($arrayfields[
'd.gender'][
'checked'])) {
486 print
'<td class="liste_titre">';
487 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
488 print $form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
491 if (!empty($arrayfields[
'd.company'][
'checked'])) {
492 print
'<td class="liste_titre left">';
493 print
'<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"></td>';
495 if (!empty($arrayfields[
'd.login'][
'checked'])) {
496 print
'<td class="liste_titre left">';
497 print
'<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
499 if (!empty($arrayfields[
'd.morphy'][
'checked'])) {
500 print
'<td class="liste_titre left">';
503 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
504 print
'<td class="liste_titre">';
505 $listetype = $membertypestatic->liste_array();
506 print $form->selectarray(
"search_type", $listetype, $type, 1, 0, 0,
'', 0, 32);
510 if (!empty($arrayfields[
'd.address'][
'checked'])) {
511 print
'<td class="liste_titre left">';
512 print
'<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'"></td>';
515 if (!empty($arrayfields[
'd.zip'][
'checked'])) {
516 print
'<td class="liste_titre left">';
517 print
'<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
519 if (!empty($arrayfields[
'd.town'][
'checked'])) {
520 print
'<td class="liste_titre left">';
521 print
'<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
524 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
525 print
'<td class="liste_titre">';
526 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
530 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
531 print
'<td class="liste_titre center">';
532 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
536 if (!empty($arrayfields[
'd.phone'][
'checked'])) {
537 print
'<td class="liste_titre left">';
538 print
'<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'"></td>';
541 if (!empty($arrayfields[
'd.phone_perso'][
'checked'])) {
542 print
'<td class="liste_titre left">';
543 print
'<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).
'"></td>';
546 if (!empty($arrayfields[
'd.phone_mobile'][
'checked'])) {
547 print
'<td class="liste_titre left">';
548 print
'<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'"></td>';
551 if (!empty($arrayfields[
'd.email'][
'checked'])) {
552 print
'<td class="liste_titre left">';
553 print
'<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'"></td>';
556 if (!empty($arrayfields[
'd.datefin'][
'checked'])) {
557 print
'<td class="liste_titre left">';
558 $selectarray = array(
'-1'=>
'',
'withoutsubscription'=>$langs->trans(
"WithoutSubscription"),
'uptodate'=>$langs->trans(
"UpToDate"),
'outofdate'=>$langs->trans(
"OutOfDate"));
559 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
563 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
566 $parameters = array(
'arrayfields'=>$arrayfields);
567 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
568 print $hookmanager->resPrint;
570 if (!empty($arrayfields[
'd.datec'][
'checked'])) {
571 print
'<td class="liste_titre">';
575 if (!empty($arrayfields[
'd.birth'][
'checked'])) {
576 print
'<td class="liste_titre">';
580 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
581 print
'<td class="liste_titre">';
585 if (!empty($arrayfields[
'd.statut'][
'checked'])) {
586 print
'<td class="liste_titre right maxwidthonsmartphone">';
588 '-1'=>$langs->trans(
"Draft"),
589 '1'=>$langs->trans(
"Validated"),
590 '0'=>$langs->trans(
"Resiliated")
592 print $form->selectarray(
'search_status', $liststatus, $search_status, -2);
596 print
'<td class="liste_titre middle">';
597 $searchpicto = $form->showFilterButtons();
603 print
'<tr class="liste_titre">';
604 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
print_liste_field_titre(
"ID",
$_SERVER[
"PHP_SELF"],
'',
'', $param,
'align="center"', $sortfield, $sortorder);
605 if (!empty($arrayfields[
'd.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'd.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.rowid',
'', $param,
'', $sortfield, $sortorder);
606 if (!empty($arrayfields[
'd.civility'][
'checked']))
print_liste_field_titre($arrayfields[
'd.civility'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.civility',
'', $param,
'', $sortfield, $sortorder);
607 if (!empty($arrayfields[
'd.firstname'][
'checked']))
print_liste_field_titre($arrayfields[
'd.firstname'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.firstname',
'', $param,
'', $sortfield, $sortorder);
608 if (!empty($arrayfields[
'd.lastname'][
'checked']))
print_liste_field_titre($arrayfields[
'd.lastname'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.lastname',
'', $param,
'', $sortfield, $sortorder);
609 if (!empty($arrayfields[
'd.gender'][
'checked']))
print_liste_field_titre($arrayfields[
'd.gender'][
'label'],
$_SERVER[
'PHP_SELF'],
'd.gender', $param,
"",
"", $sortfield, $sortorder);
610 if (!empty($arrayfields[
'd.company'][
'checked']))
print_liste_field_titre($arrayfields[
'd.company'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.societe',
'', $param,
'', $sortfield, $sortorder);
611 if (!empty($arrayfields[
'd.login'][
'checked']))
print_liste_field_titre($arrayfields[
'd.login'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.login',
'', $param,
'', $sortfield, $sortorder);
612 if (!empty($arrayfields[
'd.morphy'][
'checked']))
print_liste_field_titre($arrayfields[
'd.morphy'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.morphy',
'', $param,
'', $sortfield, $sortorder);
613 if (!empty($arrayfields[
't.libelle'][
'checked']))
print_liste_field_titre($arrayfields[
't.libelle'][
'label'],
$_SERVER[
"PHP_SELF"],
't.libelle',
'', $param,
'', $sortfield, $sortorder);
614 if (!empty($arrayfields[
'd.address'][
'checked']))
print_liste_field_titre($arrayfields[
'd.address'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.address',
'', $param,
'', $sortfield, $sortorder);
615 if (!empty($arrayfields[
'd.zip'][
'checked']))
print_liste_field_titre($arrayfields[
'd.zip'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.zip',
'', $param,
'', $sortfield, $sortorder);
616 if (!empty($arrayfields[
'd.town'][
'checked']))
print_liste_field_titre($arrayfields[
'd.town'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.town',
'', $param,
'', $sortfield, $sortorder);
617 if (!empty($arrayfields[
'state.nom'][
'checked']))
print_liste_field_titre($arrayfields[
'state.nom'][
'label'],
$_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
618 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'],
$_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'align="center"', $sortfield, $sortorder);
619 if (!empty($arrayfields[
'd.phone'][
'checked']))
print_liste_field_titre($arrayfields[
'd.phone'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.phone',
'', $param,
'', $sortfield, $sortorder);
620 if (!empty($arrayfields[
'd.phone_perso'][
'checked']))
print_liste_field_titre($arrayfields[
'd.phone_perso'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.phone_perso',
'', $param,
'', $sortfield, $sortorder);
621 if (!empty($arrayfields[
'd.phone_mobile'][
'checked']))
print_liste_field_titre($arrayfields[
'd.phone_mobile'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.phone_mobile',
'', $param,
'', $sortfield, $sortorder);
622 if (!empty($arrayfields[
'd.email'][
'checked']))
print_liste_field_titre($arrayfields[
'd.email'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.email',
'', $param,
'', $sortfield, $sortorder);
623 if (!empty($arrayfields[
'd.datefin'][
'checked']))
print_liste_field_titre($arrayfields[
'd.datefin'][
'label'],
$_SERVER[
"PHP_SELF"],
'd.datefin',
'', $param,
'align="center"', $sortfield, $sortorder);
625 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
628 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
629 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
630 print $hookmanager->resPrint;
631 if (!empty($arrayfields[
'd.datec'][
'checked']))
print_liste_field_titre($arrayfields[
'd.datec'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
632 if (!empty($arrayfields[
'd.birth'][
'checked']))
print_liste_field_titre($arrayfields[
'd.birth'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.birth",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
633 if (!empty($arrayfields[
'd.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'd.tms'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
634 if (!empty($arrayfields[
'd.statut'][
'checked']))
print_liste_field_titre($arrayfields[
'd.statut'][
'label'],
$_SERVER[
"PHP_SELF"],
"d.statut",
"", $param,
'class="right"', $sortfield, $sortorder);
639 $totalarray = array();
640 while ($i < min($num, $limit)) {
641 $obj = $db->fetch_object(
$resql);
643 $datefin = $db->jdate($obj->datefin);
644 $memberstatic->id = $obj->rowid;
645 $memberstatic->ref = $obj->rowid;
646 $memberstatic->civility_id = $obj->civility;
647 $memberstatic->lastname = $obj->lastname;
648 $memberstatic->firstname = $obj->firstname;
649 $memberstatic->gender = $obj->gender;
650 $memberstatic->statut = $obj->statut;
651 $memberstatic->datefin = $datefin;
652 $memberstatic->socid = $obj->fk_soc;
653 $memberstatic->photo = $obj->photo;
654 $memberstatic->email = $obj->email;
655 $memberstatic->morphy = $obj->morphy;
656 $memberstatic->note_public = $obj->note_public;
657 $memberstatic->note_private = $obj->note_private;
659 if (!empty($obj->fk_soc)) {
660 $memberstatic->fetch_thirdparty();
661 $companyname = $memberstatic->thirdparty->name;
663 $companyname = $obj->company;
665 $memberstatic->company = $companyname;
667 print
'<tr class="oddeven">';
669 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
670 print
'<td class="center">'.$obj->rowid.
'</td>';
671 if (!$i) $totalarray[
'nbfield']++;
675 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
677 print $memberstatic->getNomUrl(-1, 0,
'card',
'ref',
'', -1, 0, 1);
679 if (!$i) $totalarray[
'nbfield']++;
682 if (!empty($arrayfields[
'd.civility'][
'checked'])) {
684 print $obj->civility;
686 if (!$i) $totalarray[
'nbfield']++;
689 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
691 print $obj->firstname;
693 if (!$i) $totalarray[
'nbfield']++;
696 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
698 print $obj->lastname;
700 if (!$i) $totalarray[
'nbfield']++;
703 if (!empty($arrayfields[
'd.gender'][
'checked'])) {
705 if ($obj->gender) print $langs->trans(
"Gender".$obj->gender);
707 if (!$i) $totalarray[
'nbfield']++;
710 if (!empty($arrayfields[
'd.company'][
'checked'])) {
716 if (!empty($arrayfields[
'd.login'][
'checked'])) {
717 print
"<td>".$obj->login.
"</td>\n";
718 if (!$i) $totalarray[
'nbfield']++;
721 if (!empty($arrayfields[
'd.morphy'][
'checked'])) {
722 print
'<td class="center">';
724 if ($obj->morphy ==
'phy') {
725 $s .=
'<span class="customer-back" title="'.$langs->trans(
"Physical").
'">'.
dol_substr($langs->trans(
"Physical"), 0, 1).
'</span>';
727 if ($obj->morphy ==
'mor') {
728 $s .=
'<span class="vendor-back" title="'.$langs->trans(
"Moral").
'">'.
dol_substr($langs->trans(
"Moral"), 0, 1).
'</span>';
732 if (!$i) $totalarray[
'nbfield']++;
735 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
736 $membertypestatic->id = $obj->type_id;
737 $membertypestatic->label = $obj->type;
738 print
'<td class="nowrap">';
739 print $membertypestatic->getNomUrl(1, 32);
741 if (!$i) $totalarray[
'nbfield']++;
744 if (!empty($arrayfields[
'd.address'][
'checked'])) {
745 print
'<td class="nocellnopadd">';
748 if (!$i) $totalarray[
'nbfield']++;
751 if (!empty($arrayfields[
'd.zip'][
'checked'])) {
752 print
'<td class="nocellnopadd">';
755 if (!$i) $totalarray[
'nbfield']++;
758 if (!empty($arrayfields[
'd.town'][
'checked'])) {
759 print
'<td class="nocellnopadd">';
762 if (!$i) $totalarray[
'nbfield']++;
765 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
766 print
"<td>".$obj->state_name.
"</td>\n";
767 if (!$i) $totalarray[
'nbfield']++;
770 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
771 print
'<td class="center">';
773 print $tmparray[
'label'];
775 if (!$i) $totalarray[
'nbfield']++;
778 if (!empty($arrayfields[
'd.phone'][
'checked'])) {
779 print
'<td class="nocellnopadd">';
782 if (!$i) $totalarray[
'nbfield']++;
785 if (!empty($arrayfields[
'd.phone_perso'][
'checked'])) {
786 print
'<td class="nocellnopadd">';
787 print $obj->phone_perso;
789 if (!$i) $totalarray[
'nbfield']++;
792 if (!empty($arrayfields[
'd.phone_mobile'][
'checked'])) {
793 print
'<td class="nocellnopadd">';
794 print $obj->phone_mobile;
796 if (!$i) $totalarray[
'nbfield']++;
799 if (!empty($arrayfields[
'd.email'][
'checked'])) {
800 print
"<td>".dol_print_email($obj->email, 0, 0, 1).
"</td>\n";
803 $datefin = $db->jdate($obj->datefin);
804 if (!empty($arrayfields[
'd.datefin'][
'checked'])) {
806 print
'<td class="nowrap center">';
808 if ($memberstatic->hasDelay()) {
809 $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").
')';
810 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
814 print
'<td class="nowrap left">';
815 if ($obj->subscription ==
'yes') {
816 print $langs->trans(
"SubscriptionNotReceived");
817 if ($obj->statut > 0) print
" ".img_warning();
825 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
827 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
828 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
829 print $hookmanager->resPrint;
831 if (!empty($arrayfields[
'd.datec'][
'checked'])) {
832 print
'<td class="nowrap center">';
833 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
835 if (!$i) $totalarray[
'nbfield']++;
838 if (!empty($arrayfields[
'd.birth'][
'checked'])) {
839 print
'<td class="nowrap center">';
842 if (!$i) $totalarray[
'nbfield']++;
845 if (!empty($arrayfields[
'd.tms'][
'checked'])) {
846 print
'<td class="nowrap center">';
847 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
849 if (!$i) $totalarray[
'nbfield']++;
852 if (!empty($arrayfields[
'd.statut'][
'checked'])) {
853 print
'<td class="nowrap right">';
854 print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
856 if (!$i) $totalarray[
'nbfield']++;
859 print
'<td class="center">';
860 if ($massactionbutton || $massaction) {
862 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
863 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
866 if (!$i) $totalarray[
'nbfield']++;
873 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
879 foreach ($arrayfields as $key => $val) {
if (!empty($val[
'checked'])) $colspan++; }
880 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
885 $parameters = array(
'sql' => $sql);
886 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
887 print $hookmanager->resPrint;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length, $stringencoding= '', $trunconbytes=0)
Make a substring.
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_now($mode= 'auto')
Return date for now.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage members of a foundation.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
Class to manage members type.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.