list.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. <?php
  2. /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  6. * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
  7. * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/adherents/list.php
  24. * \ingroup member
  25. * \brief Page to list all members of foundation
  26. */
  27. require '../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  32. $langs->loadLangs(array("members","companies"));
  33. $action=GETPOST('action', 'aZ09');
  34. $massaction=GETPOST('massaction', 'alpha');
  35. $show_files=GETPOST('show_files', 'int');
  36. $confirm=GETPOST('confirm', 'alpha');
  37. $toselect = GETPOST('toselect', 'array');
  38. // Security check
  39. $result=restrictedArea($user, 'adherent');
  40. $filter=GETPOST("filter", 'alpha');
  41. $statut=GETPOST("statut", 'intcomma');
  42. $search=GETPOST("search", 'alpha');
  43. $search_ref=GETPOST("search_ref", 'alpha');
  44. $search_lastname=GETPOST("search_lastname", 'alpha');
  45. $search_firstname=GETPOST("search_firstname", 'alpha');
  46. $search_gender=GETPOST("search_gender", 'alpha');
  47. $search_civility=GETPOST("search_civility", 'alpha');
  48. $search_login=GETPOST("search_login", 'alpha');
  49. $search_address=GETPOST("search_address", 'alpha');
  50. $search_zip=GETPOST("search_zip", 'alpha');
  51. $search_town=GETPOST("search_town", 'alpha');
  52. $search_state=GETPOST("search_state", 'alpha');
  53. $search_country=GETPOST("search_country", 'alpha');
  54. $search_phone=GETPOST("search_phone", 'alpha');
  55. $search_phone_perso=GETPOST("search_phone_perso", 'alpha');
  56. $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha');
  57. $search_type=GETPOST("search_type", 'alpha');
  58. $search_email=GETPOST("search_email", 'alpha');
  59. $search_categ = GETPOST("search_categ", 'int');
  60. $catid = GETPOST("catid", 'int');
  61. $optioncss = GETPOST('optioncss', 'alpha');
  62. $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
  63. if ($statut < -1) $statut = '';
  64. $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
  65. $sortfield = GETPOST("sortfield", 'alpha');
  66. $sortorder = GETPOST("sortorder", 'alpha');
  67. $page = GETPOST("page", 'int');
  68. if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
  69. $offset = $limit * $page ;
  70. $pageprev = $page - 1;
  71. $pagenext = $page + 1;
  72. if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
  73. if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
  74. $object = new Adherent($db);
  75. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  76. $hookmanager->initHooks(array('memberlist'));
  77. $extrafields = new ExtraFields($db);
  78. // fetch optionals attributes and labels
  79. $extralabels = $extrafields->fetch_name_optionals_label('adherent');
  80. $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  81. // List of fields to search into when doing a "search in all"
  82. $fieldstosearchall = array(
  83. 'd.rowid'=>'Ref',
  84. 'd.login'=>'Login',
  85. 'd.lastname'=>'Lastname',
  86. 'd.firstname'=>'Firstname',
  87. 'd.login'=>'Login',
  88. 'd.societe'=>"Company",
  89. 'd.email'=>'EMail',
  90. 'd.address'=>'Address',
  91. 'd.zip'=>'Zip',
  92. 'd.town'=>'Town',
  93. 'd.note_public'=>'NotePublic',
  94. 'd.note_private'=>'NotePrivate',
  95. );
  96. if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']);
  97. $arrayfields=array(
  98. 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
  99. 'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0),
  100. 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
  101. 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
  102. 'd.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0),
  103. 'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
  104. 'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
  105. 'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
  106. 't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
  107. 'd.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
  108. 'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
  109. 'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
  110. 'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
  111. 'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
  112. 'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
  113. 'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0),
  114. 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
  115. 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
  116. /*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
  117. 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
  118. 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
  119. 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
  120. 'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500),
  121. 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
  122. 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
  123. );
  124. // Extra fields
  125. if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
  126. {
  127. foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
  128. {
  129. if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
  130. $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
  131. }
  132. }
  133. /*
  134. * Actions
  135. */
  136. if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
  137. if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
  138. $parameters=array('socid'=>$socid);
  139. $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  140. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  141. if (empty($reshook))
  142. {
  143. // Selection of new fields
  144. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  145. // Purge search criteria
  146. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
  147. {
  148. $search="";
  149. $search_ref="";
  150. $search_lastname="";
  151. $search_firstname="";
  152. $search_gender="";
  153. $search_civility="";
  154. $search_login="";
  155. $search_company="";
  156. $search_type="";
  157. $search_email="";
  158. $search_address="";
  159. $search_zip="";
  160. $search_town="";
  161. $search_state="";
  162. $search_country='';
  163. $search_phone='';
  164. $search_phone_perso='';
  165. $search_phone_mobile='';
  166. $search_morphy="";
  167. $search_categ="";
  168. $catid="";
  169. $sall="";
  170. $statut='';
  171. $toselect='';
  172. $search_array_options=array();
  173. }
  174. // Close
  175. if ($massaction == 'close' && $user->rights->adherent->creer)
  176. {
  177. $tmpmember = new Adherent($db);
  178. $error=0;
  179. $nbclose=0;
  180. $db->begin();
  181. foreach($toselect as $idtoclose)
  182. {
  183. $tmpmember->fetch($idtoclose);
  184. $result=$tmpmember->resiliate($user);
  185. if ($result < 0 && ! count($tmpmember->errors))
  186. {
  187. setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
  188. }
  189. else
  190. {
  191. if ($result > 0) $nbclose++;
  192. }
  193. }
  194. if (! $error)
  195. {
  196. setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
  197. $db->commit();
  198. }
  199. else
  200. {
  201. $db->rollback();
  202. }
  203. }
  204. // Mass actions
  205. $objectclass='Adherent';
  206. $objectlabel='Members';
  207. $permtoread = $user->rights->adherent->lire;
  208. $permtodelete = $user->rights->adherent->supprimer;
  209. $uploaddir = $conf->adherent->dir_output;
  210. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  211. }
  212. /*
  213. * View
  214. */
  215. $form=new Form($db);
  216. $formother=new FormOther($db);
  217. $membertypestatic=new AdherentType($db);
  218. $memberstatic=new Adherent($db);
  219. $now=dol_now();
  220. $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
  221. $sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
  222. $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
  223. $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
  224. $sql.= " t.libelle as type, t.subscription,";
  225. $sql.= " state.code_departement as state_code, state.nom as state_name,";
  226. // Add fields from extrafields
  227. if (! empty($extrafields->attributes[$object->table_element]['label']))
  228. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
  229. // Add fields from hooks
  230. $parameters=array();
  231. $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
  232. $sql.=preg_replace('/^,/', '', $hookmanager->resPrint);
  233. $sql =preg_replace('/,\s*$/', '', $sql);
  234. $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
  235. 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)";
  236. if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
  237. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
  238. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
  239. $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
  240. $sql.= " WHERE d.fk_adherent_type = t.rowid ";
  241. if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
  242. if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
  243. if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
  244. if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
  245. $sql.= " AND d.entity IN (".getEntity('adherent').")";
  246. if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
  247. if ($search_type > 0) $sql.=" AND t.rowid=".$db->escape($search_type);
  248. if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
  249. if ($search_ref)
  250. {
  251. if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
  252. else $sql.=" AND 1 = 2"; // Always wrong
  253. }
  254. if ($search_civility) $sql.= natural_search("d.civility", $search_civility);
  255. if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname);
  256. if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
  257. if ($search_gender != '' && $search_gender != '-1') $sql.= " AND d.gender = '".$search_gender."'";
  258. if ($search_login) $sql.= natural_search("d.login", $search_login);
  259. if ($search_email) $sql.= natural_search("d.email", $search_email);
  260. if ($search_town) $sql.= natural_search("d.town", $search_town);
  261. if ($search_zip) $sql.= natural_search("d.zip", $search_zip);
  262. if ($search_state) $sql.= natural_search("state.nom", $search_state);
  263. if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
  264. if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
  265. if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
  266. // Add where from extra fields
  267. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  268. // Add where from hooks
  269. $parameters=array();
  270. $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
  271. $sql.=$hookmanager->resPrint;
  272. $sql.= $db->order($sortfield, $sortorder);
  273. // Count total nb of records with no order and no limits
  274. $nbtotalofrecords = '';
  275. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
  276. {
  277. $resql = $db->query($sql);
  278. if ($resql) $nbtotalofrecords = $db->num_rows($resql);
  279. else dol_print_error($db);
  280. if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
  281. {
  282. $page = 0;
  283. $offset = 0;
  284. }
  285. }
  286. // Add limit
  287. $sql.= $db->plimit($limit+1, $offset);
  288. dol_syslog("get list", LOG_DEBUG);
  289. $resql = $db->query($sql);
  290. if (! $resql)
  291. {
  292. dol_print_error($db);
  293. exit;
  294. }
  295. $num = $db->num_rows($resql);
  296. $arrayofselected=is_array($toselect)?$toselect:array();
  297. if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
  298. {
  299. $obj = $db->fetch_object($resql);
  300. $id = $obj->rowid;
  301. header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
  302. exit;
  303. }
  304. llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
  305. $titre=$langs->trans("MembersList");
  306. if (GETPOSTISSET("statut"))
  307. {
  308. if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
  309. if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
  310. if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
  311. if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
  312. if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
  313. if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
  314. }
  315. elseif ($action == 'search')
  316. {
  317. $titre=$langs->trans("MembersListQualified");
  318. }
  319. if ($search_type > 0)
  320. {
  321. $membertype=new AdherentType($db);
  322. $result=$membertype->fetch(GETPOST("type", 'int'));
  323. $titre.=" (".$membertype->label.")";
  324. }
  325. $param='';
  326. if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
  327. if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
  328. if ($sall != "") $param.="&sall=".urlencode($sall);
  329. if ($statut != "") $param.="&statut=".urlencode($statut);
  330. if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
  331. if ($search_civility) $param.="&search_civility=".urlencode($search_civility);
  332. if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
  333. if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
  334. if ($search_gender) $param.="&search_gender=".urlencode($search_gender);
  335. if ($search_login) $param.="&search_login=".urlencode($search_login);
  336. if ($search_email) $param.="&search_email=".urlencode($search_email);
  337. if ($search_company) $param.="&search_company=".urlencode($search_company);
  338. if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
  339. if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
  340. if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
  341. if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
  342. if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
  343. if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone);
  344. if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso);
  345. if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile);
  346. if ($filter) $param.="&filter=".urlencode($filter);
  347. if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
  348. if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
  349. // Add $param from extra fields
  350. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  351. // List of mass actions available
  352. $arrayofmassactions = array(
  353. //'presend'=>$langs->trans("SendByMail"),
  354. //'builddoc'=>$langs->trans("PDFMerge"),
  355. );
  356. if ($user->rights->adherent->creer) $arrayofmassactions['close']=$langs->trans("Resiliate");
  357. if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
  358. if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
  359. $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
  360. $newcardbutton='';
  361. if ($user->rights->adherent->creer)
  362. {
  363. $newcardbutton.= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
  364. }
  365. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  366. if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  367. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  368. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  369. print '<input type="hidden" name="action" value="list">';
  370. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  371. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  372. print '<input type="hidden" name="page" value="'.$page.'">';
  373. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  374. print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
  375. $topicmail="Information";
  376. $modelmail="member";
  377. $objecttmp=new Adherent($db);
  378. $trackid='mem'.$object->id;
  379. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  380. if ($sall)
  381. {
  382. foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
  383. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
  384. }
  385. // Filter on categories
  386. $moreforfilter='';
  387. if (! empty($conf->categorie->enabled))
  388. {
  389. require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
  390. $moreforfilter.='<div class="divsearchfield">';
  391. $moreforfilter.=$langs->trans('Categories'). ': ';
  392. $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);
  393. $moreforfilter.='</div>';
  394. }
  395. $parameters=array();
  396. $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
  397. if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
  398. else $moreforfilter = $hookmanager->resPrint;
  399. if (! empty($moreforfilter))
  400. {
  401. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  402. print $moreforfilter;
  403. print '</div>';
  404. }
  405. $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
  406. $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  407. if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
  408. print '<div class="div-table-responsive">';
  409. print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
  410. // Line for filters fields
  411. print '<tr class="liste_titre_filter">';
  412. // Line numbering
  413. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
  414. {
  415. print '<td class="liste_titre">&nbsp;</td>';
  416. }
  417. // Ref
  418. if (! empty($arrayfields['d.ref']['checked']))
  419. {
  420. print '<td class="liste_titre">';
  421. print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
  422. print '</td>';
  423. }
  424. if (! empty($arrayfields['d.civility']['checked']))
  425. {
  426. print '<td class="liste_titre left">';
  427. print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
  428. }
  429. if (! empty($arrayfields['d.firstname']['checked']))
  430. {
  431. print '<td class="liste_titre left">';
  432. print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
  433. }
  434. if (! empty($arrayfields['d.lastname']['checked']))
  435. {
  436. print '<td class="liste_titre left">';
  437. print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
  438. }
  439. if (! empty($arrayfields['d.gender']['checked']))
  440. {
  441. print '<td class="liste_titre">';
  442. $arraygender=array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
  443. print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
  444. print '</td>';
  445. }
  446. if (! empty($arrayfields['d.company']['checked']))
  447. {
  448. print '<td class="liste_titre left">';
  449. print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
  450. }
  451. if (! empty($arrayfields['d.login']['checked']))
  452. {
  453. print '<td class="liste_titre left">';
  454. print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
  455. }
  456. if (! empty($arrayfields['d.morphy']['checked']))
  457. {
  458. print '<td class="liste_titre left">';
  459. print '</td>';
  460. }
  461. if (! empty($arrayfields['t.libelle']['checked']))
  462. {
  463. print '<td class="liste_titre">';
  464. $listetype=$membertypestatic->liste_array();
  465. print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32);
  466. print '</td>';
  467. }
  468. if (! empty($arrayfields['d.address']['checked']))
  469. {
  470. print '<td class="liste_titre left">';
  471. print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.$search_address.'"></td>';
  472. }
  473. if (! empty($arrayfields['d.zip']['checked']))
  474. {
  475. print '<td class="liste_titre left">';
  476. print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.$search_zip.'"></td>';
  477. }
  478. if (! empty($arrayfields['d.town']['checked']))
  479. {
  480. print '<td class="liste_titre left">';
  481. print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.$search_town.'"></td>';
  482. }
  483. // State
  484. if (! empty($arrayfields['state.nom']['checked']))
  485. {
  486. print '<td class="liste_titre">';
  487. print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
  488. print '</td>';
  489. }
  490. // Country
  491. if (! empty($arrayfields['country.code_iso']['checked']))
  492. {
  493. print '<td class="liste_titre center">';
  494. print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
  495. print '</td>';
  496. }
  497. // Phone pro
  498. if (! empty($arrayfields['d.phone']['checked']))
  499. {
  500. print '<td class="liste_titre left">';
  501. print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.$search_phone.'"></td>';
  502. }
  503. // Phone perso
  504. if (! empty($arrayfields['d.phone_perso']['checked']))
  505. {
  506. print '<td class="liste_titre left">';
  507. print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>';
  508. }
  509. // Phone mobile
  510. if (! empty($arrayfields['d.phone_mobile']['checked']))
  511. {
  512. print '<td class="liste_titre left">';
  513. print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>';
  514. }
  515. // Email
  516. if (! empty($arrayfields['d.email']['checked']))
  517. {
  518. print '<td class="liste_titre left">';
  519. print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.$search_email.'"></td>';
  520. }
  521. if (! empty($arrayfields['d.datefin']['checked']))
  522. {
  523. print '<td class="liste_titre left">';
  524. print '</td>';
  525. }
  526. // Extra fields
  527. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  528. // Fields from hook
  529. $parameters=array('arrayfields'=>$arrayfields);
  530. $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
  531. print $hookmanager->resPrint;
  532. // Date creation
  533. if (! empty($arrayfields['d.datec']['checked']))
  534. {
  535. print '<td class="liste_titre">';
  536. print '</td>';
  537. }
  538. //Birthday
  539. if (! empty($arrayfields['d.birth']['checked']))
  540. {
  541. print '<td class="liste_titre">';
  542. print '</td>';
  543. }
  544. // Date modification
  545. if (! empty($arrayfields['d.tms']['checked']))
  546. {
  547. print '<td class="liste_titre">';
  548. print '</td>';
  549. }
  550. // Status
  551. if (! empty($arrayfields['d.statut']['checked']))
  552. {
  553. print '<td class="liste_titre right maxwidthonsmartphone">';
  554. $liststatus=array(
  555. '-1'=>$langs->trans("Draft"),
  556. '1'=>$langs->trans("Validated"),
  557. '0'=>$langs->trans("Resiliated")
  558. );
  559. print $form->selectarray('statut', $liststatus, $statut, -2);
  560. print '</td>';
  561. }
  562. // Action column
  563. print '<td class="liste_titre middle">';
  564. $searchpicto=$form->showFilterButtons();
  565. print $searchpicto;
  566. print '</td>';
  567. print "</tr>\n";
  568. print '<tr class="liste_titre">';
  569. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
  570. if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.rowid', '', $param, '', $sortfield, $sortorder);
  571. if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder);
  572. if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], 'd.firstname', '', $param, '', $sortfield, $sortorder);
  573. if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], 'd.lastname', '', $param, '', $sortfield, $sortorder);
  574. if (! empty($arrayfields['d.gender']['checked'])) print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
  575. if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder);
  576. if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
  577. if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'], $_SERVER["PHP_SELF"], 'd.morphy', '', $param, '', $sortfield, $sortorder);
  578. if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], 't.libelle', '', $param, '', $sortfield, $sortorder);
  579. if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'], $_SERVER["PHP_SELF"], 'd.address', '', $param, '', $sortfield, $sortorder);
  580. if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'], $_SERVER["PHP_SELF"], 'd.zip', '', $param, '', $sortfield, $sortorder);
  581. if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'], $_SERVER["PHP_SELF"], 'd.town', '', $param, '', $sortfield, $sortorder);
  582. if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
  583. 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);
  584. if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
  585. 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);
  586. 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);
  587. if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
  588. if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder);
  589. // Extra fields
  590. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  591. // Hook fields
  592. $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
  593. $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
  594. print $hookmanager->resPrint;
  595. 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);
  596. 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);
  597. 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);
  598. if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
  599. print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
  600. print "</tr>\n";
  601. $i = 0;
  602. $totalarray=array();
  603. while ($i < min($num, $limit))
  604. {
  605. $obj = $db->fetch_object($resql);
  606. $datefin=$db->jdate($obj->datefin);
  607. $memberstatic->id=$obj->rowid;
  608. $memberstatic->ref=$obj->rowid;
  609. $memberstatic->civility_id=$obj->civility;
  610. $memberstatic->lastname=$obj->lastname;
  611. $memberstatic->firstname=$obj->firstname;
  612. $memberstatic->gender=$obj->gender;
  613. $memberstatic->statut=$obj->statut;
  614. $memberstatic->datefin= $datefin;
  615. $memberstatic->socid = $obj->fk_soc;
  616. $memberstatic->photo = $obj->photo;
  617. if (! empty($obj->fk_soc)) {
  618. $memberstatic->fetch_thirdparty();
  619. $companyname=$memberstatic->thirdparty->name;
  620. } else {
  621. $companyname=$obj->company;
  622. }
  623. $memberstatic->company = $companyname;
  624. print '<tr class="oddeven">';
  625. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
  626. {
  627. print '<td class="center">'.$obj->rowid.'</td>';
  628. if (! $i) $totalarray['nbfield']++;
  629. }
  630. // Ref
  631. if (! empty($arrayfields['d.ref']['checked']))
  632. {
  633. print "<td>";
  634. print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
  635. print "</td>\n";
  636. if (! $i) $totalarray['nbfield']++;
  637. }
  638. // Civility
  639. if (! empty($arrayfields['d.civility']['checked']))
  640. {
  641. print "<td>";
  642. print $obj->civility;
  643. print "</td>\n";
  644. if (! $i) $totalarray['nbfield']++;
  645. }
  646. // Firstname
  647. if (! empty($arrayfields['d.firstname']['checked']))
  648. {
  649. print "<td>";
  650. print $obj->firstname;
  651. print "</td>\n";
  652. if (! $i) $totalarray['nbfield']++;
  653. }
  654. // Lastname
  655. if (! empty($arrayfields['d.lastname']['checked']))
  656. {
  657. print "<td>";
  658. print $obj->lastname;
  659. print "</td>\n";
  660. if (! $i) $totalarray['nbfield']++;
  661. }
  662. // Gender
  663. if (! empty($arrayfields['d.gender']['checked']))
  664. {
  665. print '<td>';
  666. if ($obj->gender) print $langs->trans("Gender".$obj->gender);
  667. print '</td>';
  668. if (! $i) $totalarray['nbfield']++;
  669. }
  670. // Company
  671. if (! empty($arrayfields['d.company']['checked']))
  672. {
  673. print "<td>";
  674. print $companyname;
  675. print "</td>\n";
  676. }
  677. // Login
  678. if (! empty($arrayfields['d.login']['checked']))
  679. {
  680. print "<td>".$obj->login."</td>\n";
  681. if (! $i) $totalarray['nbfield']++;
  682. }
  683. // Moral/Physique
  684. if (! empty($arrayfields['d.morphy']['checked']))
  685. {
  686. print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
  687. if (! $i) $totalarray['nbfield']++;
  688. }
  689. // Type label
  690. if (! empty($arrayfields['t.libelle']['checked']))
  691. {
  692. $membertypestatic->id=$obj->type_id;
  693. $membertypestatic->label=$obj->type;
  694. print '<td class="nowrap">';
  695. print $membertypestatic->getNomUrl(1, 32);
  696. print '</td>';
  697. if (! $i) $totalarray['nbfield']++;
  698. }
  699. // Address
  700. if (! empty($arrayfields['d.address']['checked']))
  701. {
  702. print '<td class="nocellnopadd">';
  703. print $obj->address;
  704. print '</td>';
  705. if (! $i) $totalarray['nbfield']++;
  706. }
  707. // Zip
  708. if (! empty($arrayfields['d.zip']['checked']))
  709. {
  710. print '<td class="nocellnopadd">';
  711. print $obj->zip;
  712. print '</td>';
  713. if (! $i) $totalarray['nbfield']++;
  714. }
  715. // Town
  716. if (! empty($arrayfields['d.town']['checked']))
  717. {
  718. print '<td class="nocellnopadd">';
  719. print $obj->town;
  720. print '</td>';
  721. if (! $i) $totalarray['nbfield']++;
  722. }
  723. // State
  724. if (! empty($arrayfields['state.nom']['checked']))
  725. {
  726. print "<td>".$obj->state_name."</td>\n";
  727. if (! $i) $totalarray['nbfield']++;
  728. }
  729. // Country
  730. if (! empty($arrayfields['country.code_iso']['checked']))
  731. {
  732. print '<td class="center">';
  733. $tmparray=getCountry($obj->country, 'all');
  734. print $tmparray['label'];
  735. print '</td>';
  736. if (! $i) $totalarray['nbfield']++;
  737. }
  738. // Phone pro
  739. if (! empty($arrayfields['d.phone']['checked']))
  740. {
  741. print '<td class="nocellnopadd">';
  742. print $obj->phone;
  743. print '</td>';
  744. if (! $i) $totalarray['nbfield']++;
  745. }
  746. // Phone perso
  747. if (! empty($arrayfields['d.phone_perso']['checked']))
  748. {
  749. print '<td class="nocellnopadd">';
  750. print $obj->phone_perso;
  751. print '</td>';
  752. if (! $i) $totalarray['nbfield']++;
  753. }
  754. // Phone mobile
  755. if (! empty($arrayfields['d.phone_mobile']['checked']))
  756. {
  757. print '<td class="nocellnopadd">';
  758. print $obj->phone_mobile;
  759. print '</td>';
  760. if (! $i) $totalarray['nbfield']++;
  761. }
  762. // EMail
  763. if (! empty($arrayfields['d.email']['checked']))
  764. {
  765. print "<td>".dol_print_email($obj->email, 0, 0, 1)."</td>\n";
  766. }
  767. // End of subscription date
  768. $datefin=$db->jdate($obj->datefin);
  769. if (! empty($arrayfields['d.datefin']['checked']))
  770. {
  771. if ($datefin)
  772. {
  773. print '<td class="nowrap center">';
  774. print dol_print_date($datefin, 'day');
  775. if ($memberstatic->hasDelay()) {
  776. $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").')';
  777. print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
  778. }
  779. print '</td>';
  780. }
  781. else
  782. {
  783. print '<td class="nowrap left">';
  784. if ($obj->subscription == 'yes')
  785. {
  786. print $langs->trans("SubscriptionNotReceived");
  787. if ($obj->statut > 0) print " ".img_warning();
  788. }
  789. else
  790. {
  791. print '&nbsp;';
  792. }
  793. print '</td>';
  794. }
  795. }
  796. // Extra fields
  797. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  798. // Fields from hook
  799. $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
  800. $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
  801. print $hookmanager->resPrint;
  802. // Date creation
  803. if (! empty($arrayfields['d.datec']['checked']))
  804. {
  805. print '<td class="nowrap center">';
  806. print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
  807. print '</td>';
  808. if (! $i) $totalarray['nbfield']++;
  809. }
  810. // Birth
  811. if (! empty($arrayfields['d.birth']['checked']))
  812. {
  813. print '<td class="nowrap center">';
  814. print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
  815. print '</td>';
  816. if (! $i) $totalarray['nbfield']++;
  817. }
  818. // Date modification
  819. if (! empty($arrayfields['d.tms']['checked']))
  820. {
  821. print '<td class="nowrap center">';
  822. print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
  823. print '</td>';
  824. if (! $i) $totalarray['nbfield']++;
  825. }
  826. // Status
  827. if (! empty($arrayfields['d.statut']['checked']))
  828. {
  829. print '<td class="nowrap right">';
  830. print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
  831. print '</td>';
  832. if (! $i) $totalarray['nbfield']++;
  833. }
  834. // Action column
  835. print '<td class="center">';
  836. if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  837. {
  838. $selected=0;
  839. if (in_array($obj->rowid, $arrayofselected)) $selected=1;
  840. print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
  841. }
  842. print '</td>';
  843. if (! $i) $totalarray['nbfield']++;
  844. print "</tr>\n";
  845. $i++;
  846. }
  847. // Show total line
  848. if (isset($totalarray['pos']))
  849. {
  850. print '<tr class="liste_total">';
  851. $i=0;
  852. while ($i < $totalarray['nbfield'])
  853. {
  854. $i++;
  855. if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
  856. else
  857. {
  858. if ($i == 1)
  859. {
  860. if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
  861. else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
  862. }
  863. else print '<td></td>';
  864. }
  865. }
  866. print '</tr>';
  867. }
  868. // If no record found
  869. if ($num == 0)
  870. {
  871. $colspan=1;
  872. foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
  873. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  874. }
  875. $db->free($resql);
  876. $parameters=array('sql' => $sql);
  877. $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
  878. print $hookmanager->resPrint;
  879. print "</table>\n";
  880. print "</div>";
  881. print '</form>';
  882. if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
  883. // End of page
  884. llxFooter();
  885. $db->close();