list.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  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 <http://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.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
  121. 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
  122. );
  123. // Extra fields
  124. if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
  125. {
  126. foreach($extrafields->attribute_label as $key => $val)
  127. {
  128. if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
  129. }
  130. }
  131. /*
  132. * Actions
  133. */
  134. if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
  135. if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
  136. $parameters=array('socid'=>$socid);
  137. $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  138. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  139. if (empty($reshook))
  140. {
  141. // Selection of new fields
  142. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  143. // Purge search criteria
  144. 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
  145. {
  146. $search="";
  147. $search_ref="";
  148. $search_lastname="";
  149. $search_firstname="";
  150. $search_gender="";
  151. $search_civility="";
  152. $search_login="";
  153. $search_company="";
  154. $search_type="";
  155. $search_email="";
  156. $search_address="";
  157. $search_zip="";
  158. $search_town="";
  159. $search_state="";
  160. $search_country='';
  161. $search_phone='';
  162. $search_phone_perso='';
  163. $search_phone_mobile='';
  164. $search_morphy="";
  165. $search_categ="";
  166. $catid="";
  167. $sall="";
  168. $statut='';
  169. $toselect='';
  170. $search_array_options=array();
  171. }
  172. // Mass actions
  173. $objectclass='Adherent';
  174. $objectlabel='Members';
  175. $permtoread = $user->rights->adherent->lire;
  176. $permtodelete = $user->rights->adherent->supprimer;
  177. $uploaddir = $conf->adherent->dir_output;
  178. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  179. }
  180. /*
  181. * View
  182. */
  183. $form=new Form($db);
  184. $formother=new FormOther($db);
  185. $membertypestatic=new AdherentType($db);
  186. $memberstatic=new Adherent($db);
  187. $now=dol_now();
  188. $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
  189. $sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
  190. $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
  191. $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
  192. $sql.= " t.libelle as type, t.subscription,";
  193. $sql.= " state.code_departement as state_code, state.nom as state_name";
  194. // Add fields from extrafields
  195. foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
  196. // Add fields from hooks
  197. $parameters=array();
  198. $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
  199. $sql.=$hookmanager->resPrint;
  200. $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
  201. if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
  202. 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
  203. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
  204. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
  205. $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
  206. $sql.= " WHERE d.fk_adherent_type = t.rowid ";
  207. if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
  208. if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
  209. if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
  210. if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
  211. $sql.= " AND d.entity IN (".getEntity('adherent').")";
  212. if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
  213. if ($search_type > 0) $sql.=" AND t.rowid=".$db->escape($search_type);
  214. if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
  215. if ($search_ref)
  216. {
  217. if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
  218. else $sql.=" AND 1 = 2"; // Always wrong
  219. }
  220. if ($search_civility) $sql.= natural_search("d.civility", $search_civility);
  221. if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname);
  222. if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
  223. if ($search_gender != '' && $search_gender != '-1') $sql.= " AND d.gender = '".$search_gender."'";
  224. if ($search_login) $sql.= natural_search("d.login", $search_login);
  225. if ($search_email) $sql.= natural_search("d.email", $search_email);
  226. if ($search_town) $sql.= natural_search("d.town",$search_town);
  227. if ($search_zip) $sql.= natural_search("d.zip",$search_zip);
  228. if ($search_state) $sql.= natural_search("state.nom",$search_state);
  229. if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
  230. if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
  231. if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
  232. // Add where from extra fields
  233. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  234. // Add where from hooks
  235. $parameters=array();
  236. $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
  237. $sql.=$hookmanager->resPrint;
  238. $sql.= $db->order($sortfield,$sortorder);
  239. // Count total nb of records with no order and no limits
  240. $nbtotalofrecords = '';
  241. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
  242. {
  243. $resql = $db->query($sql);
  244. if ($resql) $nbtotalofrecords = $db->num_rows($resql);
  245. else dol_print_error($db);
  246. if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
  247. {
  248. $page = 0;
  249. $offset = 0;
  250. }
  251. }
  252. // Add limit
  253. $sql.= $db->plimit($limit+1, $offset);
  254. dol_syslog("get list", LOG_DEBUG);
  255. $resql = $db->query($sql);
  256. if (! $resql)
  257. {
  258. dol_print_error($db);
  259. exit;
  260. }
  261. $num = $db->num_rows($resql);
  262. $arrayofselected=is_array($toselect)?$toselect:array();
  263. if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
  264. {
  265. $obj = $db->fetch_object($resql);
  266. $id = $obj->rowid;
  267. header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
  268. exit;
  269. }
  270. llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
  271. $titre=$langs->trans("MembersList");
  272. if (GETPOSTISSET("statut"))
  273. {
  274. if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
  275. if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
  276. if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
  277. if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
  278. if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
  279. if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
  280. }
  281. elseif ($action == 'search')
  282. {
  283. $titre=$langs->trans("MembersListQualified");
  284. }
  285. if ($search_type > 0)
  286. {
  287. $membertype=new AdherentType($db);
  288. $result=$membertype->fetch(GETPOST("type",'int'));
  289. $titre.=" (".$membertype->label.")";
  290. }
  291. $param='';
  292. if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
  293. if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
  294. if ($sall != "") $param.="&sall=".urlencode($sall);
  295. if ($statut != "") $param.="&statut=".urlencode($statut);
  296. if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
  297. if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
  298. if ($search_civility) $param.="&search_civility=".urlencode($search_civility);
  299. if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
  300. if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
  301. if ($search_gender) $param.="&search_gender=".urlencode($search_gender);
  302. if ($search_login) $param.="&search_login=".urlencode($search_login);
  303. if ($search_email) $param.="&search_email=".urlencode($search_email);
  304. if ($search_company) $param.="&search_company=".urlencode($search_company);
  305. if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
  306. if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
  307. if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
  308. if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
  309. if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
  310. if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone);
  311. if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso);
  312. if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile);
  313. if ($filter) $param.="&filter=".urlencode($filter);
  314. if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
  315. if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
  316. // Add $param from extra fields
  317. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  318. // List of mass actions available
  319. $arrayofmassactions = array(
  320. //'presend'=>$langs->trans("SendByMail"),
  321. //'builddoc'=>$langs->trans("PDFMerge"),
  322. );
  323. if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
  324. if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
  325. $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
  326. $newcardbutton='';
  327. if ($user->rights->adherent->creer)
  328. {
  329. $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewMember').'</span>';
  330. $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
  331. $newcardbutton.= '</a>';
  332. }
  333. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  334. if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  335. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  336. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  337. print '<input type="hidden" name="action" value="list">';
  338. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  339. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  340. print '<input type="hidden" name="page" value="'.$page.'">';
  341. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  342. print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
  343. $topicmail="Information";
  344. $modelmail="member";
  345. $objecttmp=new Adherent($db);
  346. $trackid='mem'.$object->id;
  347. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  348. if ($sall)
  349. {
  350. foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
  351. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
  352. }
  353. // Filter on categories
  354. $moreforfilter='';
  355. if (! empty($conf->categorie->enabled))
  356. {
  357. require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
  358. $moreforfilter.='<div class="divsearchfield">';
  359. $moreforfilter.=$langs->trans('Categories'). ': ';
  360. $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
  361. $moreforfilter.='</div>';
  362. }
  363. $parameters=array();
  364. $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
  365. if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
  366. else $moreforfilter = $hookmanager->resPrint;
  367. if (! empty($moreforfilter))
  368. {
  369. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  370. print $moreforfilter;
  371. print '</div>';
  372. }
  373. $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
  374. $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  375. if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
  376. print '<div class="div-table-responsive">';
  377. print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
  378. // Line for filters fields
  379. print '<tr class="liste_titre_filter">';
  380. // Line numbering
  381. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
  382. {
  383. print '<td class="liste_titre">&nbsp;</td>';
  384. }
  385. // Ref
  386. if (! empty($arrayfields['d.ref']['checked']))
  387. {
  388. print '<td class="liste_titre">';
  389. print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
  390. print '</td>';
  391. }
  392. if (! empty($arrayfields['d.civility']['checked']))
  393. {
  394. print '<td class="liste_titre" align="left">';
  395. print '<input class="flat maxwidth25" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
  396. }
  397. if (! empty($arrayfields['d.firstname']['checked']))
  398. {
  399. print '<td class="liste_titre" align="left">';
  400. print '<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
  401. }
  402. if (! empty($arrayfields['d.lastname']['checked']))
  403. {
  404. print '<td class="liste_titre" align="left">';
  405. print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
  406. }
  407. if (! empty($arrayfields['d.gender']['checked']))
  408. {
  409. print '<td class="liste_titre">';
  410. $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
  411. print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
  412. print '</td>';
  413. }
  414. if (! empty($arrayfields['d.company']['checked']))
  415. {
  416. print '<td class="liste_titre" align="left">';
  417. print '<input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
  418. }
  419. if (! empty($arrayfields['d.login']['checked']))
  420. {
  421. print '<td class="liste_titre" align="left">';
  422. print '<input class="flat maxwidth50" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
  423. }
  424. if (! empty($arrayfields['d.morphy']['checked']))
  425. {
  426. print '<td class="liste_titre" align="left">';
  427. print '</td>';
  428. }
  429. if (! empty($arrayfields['t.libelle']['checked']))
  430. {
  431. print '<td class="liste_titre">';
  432. $listetype=$membertypestatic->liste_array();
  433. print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32);
  434. print '</td>';
  435. }
  436. if (! empty($arrayfields['d.address']['checked']))
  437. {
  438. print '<td class="liste_titre" align="left">';
  439. print '<input class="flat maxwidth50" type="text" name="search_address" value="'.$search_address.'"></td>';
  440. }
  441. if (! empty($arrayfields['d.zip']['checked']))
  442. {
  443. print '<td class="liste_titre" align="left">';
  444. print '<input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.'"></td>';
  445. }
  446. if (! empty($arrayfields['d.town']['checked']))
  447. {
  448. print '<td class="liste_titre" align="left">';
  449. print '<input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.'"></td>';
  450. }
  451. // State
  452. if (! empty($arrayfields['state.nom']['checked']))
  453. {
  454. print '<td class="liste_titre">';
  455. print '<input class="flat searchstring maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
  456. print '</td>';
  457. }
  458. // Country
  459. if (! empty($arrayfields['country.code_iso']['checked']))
  460. {
  461. print '<td class="liste_titre" align="center">';
  462. print $form->select_country($search_country,'search_country','',0,'maxwidth100');
  463. print '</td>';
  464. }
  465. // Phone pro
  466. if (! empty($arrayfields['d.phone']['checked']))
  467. {
  468. print '<td class="liste_titre" align="left">';
  469. print '<input class="flat maxwidth50" type="text" name="search_phone" value="'.$search_phone.'"></td>';
  470. }
  471. // Phone perso
  472. if (! empty($arrayfields['d.phone_perso']['checked']))
  473. {
  474. print '<td class="liste_titre" align="left">';
  475. print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>';
  476. }
  477. // Phone mobile
  478. if (! empty($arrayfields['d.phone_mobile']['checked']))
  479. {
  480. print '<td class="liste_titre" align="left">';
  481. print '<input class="flat maxwidth50" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>';
  482. }
  483. // Email
  484. if (! empty($arrayfields['d.email']['checked']))
  485. {
  486. print '<td class="liste_titre" align="left">';
  487. print '<input class="flat maxwidth50" type="text" name="search_email" value="'.$search_email.'"></td>';
  488. }
  489. if (! empty($arrayfields['d.datefin']['checked']))
  490. {
  491. print '<td class="liste_titre" align="left">';
  492. print '</td>';
  493. }
  494. // Extra fields
  495. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  496. // Fields from hook
  497. $parameters=array('arrayfields'=>$arrayfields);
  498. $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
  499. print $hookmanager->resPrint;
  500. // Date creation
  501. if (! empty($arrayfields['d.datec']['checked']))
  502. {
  503. print '<td class="liste_titre">';
  504. print '</td>';
  505. }
  506. // Date modification
  507. if (! empty($arrayfields['d.tms']['checked']))
  508. {
  509. print '<td class="liste_titre">';
  510. print '</td>';
  511. }
  512. // Status
  513. if (! empty($arrayfields['d.statut']['checked']))
  514. {
  515. print '<td class="liste_titre maxwidthonsmartphone" align="right">';
  516. $liststatus=array(
  517. '-1'=>$langs->trans("Draft"),
  518. '1'=>$langs->trans("Validated"),
  519. '0'=>$langs->trans("Resiliated")
  520. );
  521. print $form->selectarray('statut', $liststatus, $statut, -2);
  522. print '</td>';
  523. }
  524. // Action column
  525. print '<td class="liste_titre" align="middle">';
  526. $searchpicto=$form->showFilterButtons();
  527. print $searchpicto;
  528. print '</td>';
  529. print "</tr>\n";
  530. print '<tr class="liste_titre">';
  531. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID",$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
  532. if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
  533. if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder);
  534. if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
  535. if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
  536. if (! empty($arrayfields['d.gender']['checked'])) print_liste_field_titre($arrayfields['d.gender']['label'],$_SERVER['PHP_SELF'],'d.gender',$param,"","",$sortfield,$sortorder);
  537. if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
  538. if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
  539. if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
  540. if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder);
  541. if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
  542. if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
  543. if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
  544. if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
  545. 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);
  546. if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
  547. 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);
  548. 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);
  549. if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
  550. if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
  551. // Extra fields
  552. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  553. // Hook fields
  554. $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
  555. $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
  556. print $hookmanager->resPrint;
  557. 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);
  558. 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);
  559. if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder);
  560. print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
  561. print "</tr>\n";
  562. $i = 0;
  563. $totalarray=array();
  564. while ($i < min($num, $limit))
  565. {
  566. $obj = $db->fetch_object($resql);
  567. $datefin=$db->jdate($obj->datefin);
  568. $memberstatic->id=$obj->rowid;
  569. $memberstatic->ref=$obj->rowid;
  570. $memberstatic->civility_id=$obj->civility;
  571. $memberstatic->lastname=$obj->lastname;
  572. $memberstatic->firstname=$obj->firstname;
  573. $memberstatic->gender=$obj->gender;
  574. $memberstatic->statut=$obj->statut;
  575. $memberstatic->datefin= $datefin;
  576. $memberstatic->socid = $obj->fk_soc;
  577. $memberstatic->photo = $obj->photo;
  578. if (! empty($obj->fk_soc)) {
  579. $memberstatic->fetch_thirdparty();
  580. $companyname=$memberstatic->thirdparty->name;
  581. } else {
  582. $companyname=$obj->company;
  583. }
  584. $memberstatic->societe = $companyname;
  585. print '<tr class="oddeven">';
  586. if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
  587. {
  588. print '<td align="center">'.$obj->rowid.'</td>';
  589. if (! $i) $totalarray['nbfield']++;
  590. }
  591. // Ref
  592. if (! empty($arrayfields['d.ref']['checked']))
  593. {
  594. print "<td>";
  595. print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
  596. print "</td>\n";
  597. if (! $i) $totalarray['nbfield']++;
  598. }
  599. // Civility
  600. if (! empty($arrayfields['d.civility']['checked']))
  601. {
  602. print "<td>";
  603. print $obj->civility;
  604. print "</td>\n";
  605. if (! $i) $totalarray['nbfield']++;
  606. }
  607. // Firstname
  608. if (! empty($arrayfields['d.firstname']['checked']))
  609. {
  610. print "<td>";
  611. print $obj->firstname;
  612. print "</td>\n";
  613. if (! $i) $totalarray['nbfield']++;
  614. }
  615. // Lastname
  616. if (! empty($arrayfields['d.lastname']['checked']))
  617. {
  618. print "<td>";
  619. print $obj->lastname;
  620. print "</td>\n";
  621. if (! $i) $totalarray['nbfield']++;
  622. }
  623. // Gender
  624. if (! empty($arrayfields['d.gender']['checked']))
  625. {
  626. print '<td>';
  627. if ($obj->gender) print $langs->trans("Gender".$obj->gender);
  628. print '</td>';
  629. if (! $i) $totalarray['nbfield']++;
  630. }
  631. // Company
  632. if (! empty($arrayfields['d.company']['checked']))
  633. {
  634. print "<td>";
  635. print $companyname;
  636. print "</td>\n";
  637. }
  638. // Login
  639. if (! empty($arrayfields['d.login']['checked']))
  640. {
  641. print "<td>".$obj->login."</td>\n";
  642. if (! $i) $totalarray['nbfield']++;
  643. }
  644. // Moral/Physique
  645. if (! empty($arrayfields['d.morphy']['checked']))
  646. {
  647. print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
  648. if (! $i) $totalarray['nbfield']++;
  649. }
  650. // Type label
  651. if (! empty($arrayfields['t.libelle']['checked']))
  652. {
  653. $membertypestatic->id=$obj->type_id;
  654. $membertypestatic->label=$obj->type;
  655. print '<td class="nowrap">';
  656. print $membertypestatic->getNomUrl(1,32);
  657. print '</td>';
  658. if (! $i) $totalarray['nbfield']++;
  659. }
  660. // Address
  661. if (! empty($arrayfields['d.address']['checked']))
  662. {
  663. print '<td class="nocellnopadd">';
  664. print $obj->address;
  665. print '</td>';
  666. if (! $i) $totalarray['nbfield']++;
  667. }
  668. // Zip
  669. if (! empty($arrayfields['d.zip']['checked']))
  670. {
  671. print '<td class="nocellnopadd">';
  672. print $obj->zip;
  673. print '</td>';
  674. if (! $i) $totalarray['nbfield']++;
  675. }
  676. // Town
  677. if (! empty($arrayfields['d.town']['checked']))
  678. {
  679. print '<td class="nocellnopadd">';
  680. print $obj->town;
  681. print '</td>';
  682. if (! $i) $totalarray['nbfield']++;
  683. }
  684. // State
  685. if (! empty($arrayfields['state.nom']['checked']))
  686. {
  687. print "<td>".$obj->state_name."</td>\n";
  688. if (! $i) $totalarray['nbfield']++;
  689. }
  690. // Country
  691. if (! empty($arrayfields['country.code_iso']['checked']))
  692. {
  693. print '<td align="center">';
  694. $tmparray=getCountry($obj->country,'all');
  695. print $tmparray['label'];
  696. print '</td>';
  697. if (! $i) $totalarray['nbfield']++;
  698. }
  699. // Phone pro
  700. if (! empty($arrayfields['d.phone']['checked']))
  701. {
  702. print '<td class="nocellnopadd">';
  703. print $obj->phone;
  704. print '</td>';
  705. if (! $i) $totalarray['nbfield']++;
  706. }
  707. // Phone perso
  708. if (! empty($arrayfields['d.phone_perso']['checked']))
  709. {
  710. print '<td class="nocellnopadd">';
  711. print $obj->phone_perso;
  712. print '</td>';
  713. if (! $i) $totalarray['nbfield']++;
  714. }
  715. // Phone mobile
  716. if (! empty($arrayfields['d.phone_mobile']['checked']))
  717. {
  718. print '<td class="nocellnopadd">';
  719. print $obj->phone_mobile;
  720. print '</td>';
  721. if (! $i) $totalarray['nbfield']++;
  722. }
  723. // EMail
  724. if (! empty($arrayfields['d.email']['checked']))
  725. {
  726. print "<td>".dol_print_email($obj->email,0,0,1)."</td>\n";
  727. }
  728. // End of subscription date
  729. $datefin=$db->jdate($obj->datefin);
  730. if (! empty($arrayfields['d.datefin']['checked']))
  731. {
  732. if ($datefin)
  733. {
  734. print '<td align="center" class="nowrap">';
  735. print dol_print_date($datefin,'day');
  736. if ($memberstatic->hasDelay()) {
  737. $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").')';
  738. print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
  739. }
  740. print '</td>';
  741. }
  742. else
  743. {
  744. print '<td align="left" class="nowrap">';
  745. if ($obj->subscription == 'yes')
  746. {
  747. print $langs->trans("SubscriptionNotReceived");
  748. if ($obj->statut > 0) print " ".img_warning();
  749. }
  750. else
  751. {
  752. print '&nbsp;';
  753. }
  754. print '</td>';
  755. }
  756. }
  757. // Extra fields
  758. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  759. // Fields from hook
  760. $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
  761. $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
  762. print $hookmanager->resPrint;
  763. // Date creation
  764. if (! empty($arrayfields['d.datec']['checked']))
  765. {
  766. print '<td align="center" class="nowrap">';
  767. print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
  768. print '</td>';
  769. if (! $i) $totalarray['nbfield']++;
  770. }
  771. // Date modification
  772. if (! empty($arrayfields['d.tms']['checked']))
  773. {
  774. print '<td align="center" class="nowrap">';
  775. print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
  776. print '</td>';
  777. if (! $i) $totalarray['nbfield']++;
  778. }
  779. // Status
  780. if (! empty($arrayfields['d.statut']['checked']))
  781. {
  782. print '<td align="right" class="nowrap">';
  783. print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,5);
  784. print '</td>';
  785. if (! $i) $totalarray['nbfield']++;
  786. }
  787. // Action column
  788. print '<td align="center">';
  789. if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  790. {
  791. $selected=0;
  792. if (in_array($obj->rowid, $arrayofselected)) $selected=1;
  793. print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
  794. }
  795. print '</td>';
  796. if (! $i) $totalarray['nbfield']++;
  797. print "</tr>\n";
  798. $i++;
  799. }
  800. // Show total line
  801. if (isset($totalarray['pos']))
  802. {
  803. print '<tr class="liste_total">';
  804. $i=0;
  805. while ($i < $totalarray['nbfield'])
  806. {
  807. $i++;
  808. if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
  809. else
  810. {
  811. if ($i == 1)
  812. {
  813. if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
  814. else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
  815. }
  816. else print '<td></td>';
  817. }
  818. }
  819. print '</tr>';
  820. }
  821. // If no record found
  822. if ($num == 0)
  823. {
  824. $colspan=1;
  825. foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
  826. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  827. }
  828. $db->free($resql);
  829. $parameters=array('sql' => $sql);
  830. $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
  831. print $hookmanager->resPrint;
  832. print "</table>\n";
  833. print "</div>";
  834. print '</form>';
  835. if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
  836. // End of page
  837. llxFooter();
  838. $db->close();