dolibarr  9.0.0
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
4  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
8  * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
9  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
10  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
11  * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array("companies", "suppliers", "categories"));
40 
41 $action=GETPOST('action','alpha');
42 $massaction=GETPOST('massaction','alpha');
43 $show_files=GETPOST('show_files','int');
44 $confirm=GETPOST('confirm','alpha');
45 $toselect = GETPOST('toselect', 'array');
46 $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contactlist';
47 
48 // Security check
49 $id = GETPOST('id','int');
50 $contactid = GETPOST('id','int');
51 $ref = ''; // There is no ref for contacts
52 if ($user->societe_id) $socid=$user->societe_id;
53 $result = restrictedArea($user, 'contact', $contactid,'');
54 
55 $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
56 $search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
57 $search_phone=GETPOST("search_phone",'alpha');
58 
59 $search_id=trim(GETPOST("search_id","int"));
60 $search_firstlast_only=GETPOST("search_firstlast_only",'alpha');
61 $search_lastname=GETPOST("search_lastname",'alpha');
62 $search_firstname=GETPOST("search_firstname",'alpha');
63 $search_societe=GETPOST("search_societe",'alpha');
64 $search_poste=GETPOST("search_poste",'alpha');
65 $search_phone_perso=GETPOST("search_phone_perso",'alpha');
66 $search_phone_pro=GETPOST("search_phone_pro",'alpha');
67 $search_phone_mobile=GETPOST("search_phone_mobile",'alpha');
68 $search_fax=GETPOST("search_fax",'alpha');
69 $search_email=GETPOST("search_email",'alpha');
70 $search_skype=GETPOST("search_skype",'alpha');
71 $search_twitter=GETPOST("search_twitter",'alpha');
72 $search_facebook=GETPOST("search_facebook",'alpha');
73 $search_priv=GETPOST("search_priv",'alpha');
74 $search_categ=GETPOST("search_categ",'int');
75 $search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
76 $search_categ_supplier=GETPOST("search_categ_supplier",'int');
77 $search_status=GETPOST("search_status",'int');
78 $search_type=GETPOST('search_type','alpha');
79 $search_zip=GETPOST('search_zip','alpha');
80 $search_town=GETPOST('search_town','alpha');
81 $search_import_key=GETPOST("search_import_key","alpha");
82 $search_country=GETPOST("search_country",'intcomma');
83 
84 if ($search_status=='') $search_status=1; // always display activ customer first
85 
86 $optioncss = GETPOST('optioncss','alpha');
87 
88 
89 $type=GETPOST("type",'aZ');
90 $view=GETPOST("view",'alpha');
91 
92 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
93 $sortfield = GETPOST('sortfield', 'alpha');
94 $sortorder = GETPOST('sortorder', 'alpha');
95 $page = GETPOST('page', 'int');
96 $userid=GETPOST('userid','int');
97 $begin=GETPOST('begin');
98 if (! $sortorder) $sortorder="ASC";
99 if (! $sortfield) $sortfield="p.lastname";
100 if (empty($page) || $page < 0) { $page = 0; }
101 $offset = $limit * $page;
102 
103 $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
104 if ($type == "p")
105 {
106  if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactprospectlist';
107  $titre.=' ('.$langs->trans("ThirdPartyProspects").')';
108  $urlfiche="card.php";
109 }
110 if ($type == "c")
111 {
112  if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactcustomerlist';
113  $titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
114  $urlfiche="card.php";
115 }
116 else if ($type == "f")
117 {
118  if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactsupplierlist';
119  $titre.=' ('.$langs->trans("ThirdPartySuppliers").')';
120  $urlfiche="card.php";
121 }
122 else if ($type == "o")
123 {
124  if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactotherlist';
125  $titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
126  $urlfiche="";
127 }
128 
129 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
130 $object = new Contact($db);
131 $hookmanager->initHooks(array('contactlist'));
132 $extrafields = new ExtraFields($db);
133 
134 // fetch optionals attributes and labels
135 $extralabels = $extrafields->fetch_name_optionals_label('contact');
136 $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
137 
138 // List of fields to search into when doing a "search in all"
139 $fieldstosearchall = array(
140  'p.lastname'=>'Lastname',
141  'p.firstname'=>'Firstname',
142  'p.email'=>'EMail',
143  's.nom'=>"ThirdParty",
144  'p.phone'=>"Phone",
145 );
146 
147 // Definition of fields for list
148 $arrayfields=array(
149  'p.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)),
150  'p.lastname'=>array('label'=>"Lastname", 'checked'=>1),
151  'p.firstname'=>array('label'=>"Firstname", 'checked'=>1),
152  'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1),
153  'p.town'=>array('label'=>"Town", 'checked'=>0),
154  'p.zip'=>array('label'=>"Zip", 'checked'=>0),
155  'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
156  'p.phone'=>array('label'=>"Phone", 'checked'=>1),
157  'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
158  'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
159  'p.fax'=>array('label'=>"Fax", 'checked'=>0),
160  'p.email'=>array('label'=>"EMail", 'checked'=>1),
161  'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
162  'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
163  'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
164  'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
165  'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
166  'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
167  'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
168  'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
169  'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
170 );
171 // Extra fields
172 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
173 {
174  foreach($extrafields->attribute_label as $key => $val)
175  {
176  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]));
177  }
178 }
179 
180 $object=new Contact($db);
181 if (($id > 0 || ! empty($ref)) && $action != 'add')
182 {
183  $result=$object->fetch($id,$ref);
184  if ($result < 0) dol_print_error($db);
185 }
186 
187 
188 /*
189  * Actions
190  */
191 
192 if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
193 if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
194 
195 $parameters=array();
196 $reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
197 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
198 
199 if (empty($reshook))
200 {
201  // Selection of new fields
202  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
203 
204  // Did we click on purge search criteria ?
205  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
206  {
207  $sall="";
208  $search_id='';
209  $search_firstlast_only="";
210  $search_lastname="";
211  $search_firstname="";
212  $search_societe="";
213  $search_town="";
214  $search_zip="";
215  $search_country="";
216  $search_poste="";
217  $search_phone="";
218  $search_phone_perso="";
219  $search_phone_pro="";
220  $search_phone_mobile="";
221  $search_fax="";
222  $search_email="";
223  $search_skype="";
224  $search_twitter="";
225  $search_facebook="";
226  $search_priv="";
227  $search_status=-1;
228  $search_categ='';
229  $search_categ_thirdparty='';
230  $search_categ_supplier='';
231  $search_import_key='';
232  $toselect='';
233  $search_array_options=array();
234  }
235 
236  // Mass actions
237  $objectclass='Contact';
238  $objectlabel='Contact';
239  $permtoread = $user->rights->societe->lire;
240  $permtodelete = $user->rights->societe->supprimer;
241  $uploaddir = $conf->societe->dir_output;
242  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
243 }
244 
245 if ($search_priv < 0) $search_priv='';
246 
247 
248 /*
249  * View
250  */
251 
252 $form=new Form($db);
253 $formother=new FormOther($db);
254 $contactstatic=new Contact($db);
255 
256 $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
257 
258 $sql = "SELECT s.rowid as socid, s.nom as name,";
259 $sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,";
260 $sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
261 $sql.= " co.code as country_code";
262 // Add fields from extrafields
263 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
264 // Add fields from hooks
265 $parameters=array();
266 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
267 $sql.=$hookmanager->resPrint;
268 $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
269 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)";
270 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
271 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
272 if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
273 if (! empty($search_categ_thirdparty)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
274 if (! empty($search_categ_supplier)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
275 if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
276 $sql.= ' WHERE p.entity IN ('.getEntity('socpeople').')';
277 if (!$user->rights->societe->client->voir && !$socid) //restriction
278 {
279  $sql .= " AND (sc.fk_user = " .$user->id." OR p.fk_soc IS NULL)";
280 }
281 if (! empty($userid)) // propre au commercial
282 {
283  $sql .= " AND p.fk_user_creat=".$db->escape($userid);
284 }
285 
286 // Filter to exclude not owned private contacts
287 if ($search_priv != '0' && $search_priv != '1')
288 {
289  $sql .= " AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".$user->id."))";
290 }
291 else
292 {
293  if ($search_priv == '0') $sql .= " AND p.priv='0'";
294  if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")";
295 }
296 
297 if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ);
298 if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
299 if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
300 if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
301 if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
302 if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
303 
304 if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
305 if (strlen($search_phone)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone);
306 if (strlen($search_cti)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_cti);
307 if (strlen($search_firstlast_only)) $sql.= natural_search(array('p.lastname', 'p.firstname'), $search_firstlast_only);
308 
309 if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1);
310 if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
311 if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
312 if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
313 if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')';
314 if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
315 if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
316 if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro);
317 if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
318 if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
319 if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
320 if (strlen($search_twitter)) $sql.= natural_search('p.twitter', $search_twitter);
321 if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_facebook);
322 if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
323 if (strlen($search_zip)) $sql.= natural_search("p.zip",$search_zip);
324 if (strlen($search_town)) $sql.= natural_search("p.town",$search_town);
325 
326 if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
327 if ($search_import_key) $sql.= natural_search("p.import_key",$search_import_key);
328 if ($type == "o") // filtre sur type
329 {
330  $sql .= " AND p.fk_soc IS NULL";
331 }
332 else if ($type == "f") // filtre sur type
333 {
334  $sql .= " AND s.fournisseur = 1";
335 }
336 else if ($type == "c") // filtre sur type
337 {
338  $sql .= " AND s.client IN (1, 3)";
339 }
340 else if ($type == "p") // filtre sur type
341 {
342  $sql .= " AND s.client IN (2, 3)";
343 }
344 if (! empty($socid))
345 {
346  $sql .= " AND s.rowid = ".$socid;
347 }
348 // Add where from extra fields
349 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
350 // Add where from hooks
351 $parameters=array();
352 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
353 $sql.=$hookmanager->resPrint;
354 // Add order
355 if ($view == "recent")
356 {
357  $sql.= $db->order("p.datec","DESC");
358 }
359 else
360 {
361  $sql.= $db->order($sortfield,$sortorder);
362 }
363 
364 // Count total nb of records
365 $nbtotalofrecords = '';
366 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
367 {
368  $result = $db->query($sql);
369  $nbtotalofrecords = $db->num_rows($result);
370  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
371  {
372  $page = 0;
373  $offset = 0;
374  }
375 }
376 
377 $sql.= $db->plimit($limit+1, $offset);
378 
379 $result = $db->query($sql);
380 if (! $result)
381 {
382  dol_print_error($db);
383  exit;
384 }
385 
386 $num = $db->num_rows($result);
387 
388 $arrayofselected=is_array($toselect)?$toselect:array();
389 
390 if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
391 {
392  $obj = $db->fetch_object($resql);
393  $id = $obj->rowid;
394  header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id);
395  exit;
396 }
397 
398 $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas';
399 llxHeader('',$title,$help_url);
400 
401 $param='';
402 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
403 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
404 $param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
405 $param.='&type='.urlencode($type).'&view='.urlencode($view);
406 if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
407 if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
408 if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
409 if ($sall != '') $param.='&amp;sall='.urlencode($sall);
410 if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
411 if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname);
412 if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname);
413 if ($search_societe != '') $param.='&amp;search_societe='.urlencode($search_societe);
414 if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip);
415 if ($search_town != '') $param.='&amp;search_town='.urlencode($search_town);
416 if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
417 if ($search_job != '') $param.='&amp;search_job='.urlencode($search_job);
418 if ($search_phone_pro != '') $param.='&amp;search_phone_pro='.urlencode($search_phone_pro);
419 if ($search_phone_perso != '') $param.='&amp;search_phone_perso='.urlencode($search_phone_perso);
420 if ($search_phone_mobile != '') $param.='&amp;search_phone_mobile='.urlencode($search_phone_mobile);
421 if ($search_fax != '') $param.='&amp;search_fax='.urlencode($search_fax);
422 if ($search_email != '') $param.='&amp;search_email='.urlencode($search_email);
423 if ($search_status != '') $param.='&amp;search_status='.urlencode($search_status);
424 if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
425 if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
426 if ($optioncss != '') $param.='&optioncss='.$optioncss;
427 
428 // Add $param from extra fields
429 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
430 
431 // List of mass actions available
432 $arrayofmassactions = array(
433 // 'presend'=>$langs->trans("SendByMail"),
434 // 'builddoc'=>$langs->trans("PDFMerge"),
435 );
436 //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
437 if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
438 if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
439 $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
440 
441 $newcardbutton='';
442 if ($user->rights->societe->contact->creer)
443 {
444  $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/contact/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewContactAddress').'</span>';
445  $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
446  $newcardbutton.= '</a>';
447 }
448 
449 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
450 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
451 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
452 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
453 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
454 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
455 print '<input type="hidden" name="page" value="'.$page.'">';
456 print '<input type="hidden" name="type" value="'.$type.'">';
457 print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
458 
459 print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit);
460 
461 $topicmail="Information";
462 $modelmail="contact";
463 $objecttmp=new Contact($db);
464 $trackid='ctc'.$object->id;
465 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
466 
467 if ($sall)
468 {
469  foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
470  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
471 }
472 if ($search_firstlast_only)
473 {
474  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname").'</div>';
475 }
476 
477 $moreforfilter='';
478 if (! empty($conf->categorie->enabled))
479 {
480  require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
481  $moreforfilter.='<div class="divsearchfield">';
482  $moreforfilter.=$langs->trans('Categories'). ': ';
483  $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1);
484  $moreforfilter.='</div>';
485  if (empty($type) || $type == 'c' || $type == 'p')
486  {
487  $moreforfilter.='<div class="divsearchfield">';
488  if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': ';
489  else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': ';
490  else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': ';
491  $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1);
492  $moreforfilter.='</div>';
493  }
494  if (empty($type) || $type == 'f')
495  {
496  $moreforfilter.='<div class="divsearchfield">';
497  $moreforfilter.=$langs->trans('SuppliersCategoriesShort'). ': ';
498  $moreforfilter.=$formother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ_supplier,'search_categ_supplier',1);
499  $moreforfilter.='</div>';
500  }
501 }
502 if ($moreforfilter)
503 {
504  print '<div class="liste_titre liste_titre_bydiv centpercent">';
505  print $moreforfilter;
506  $parameters=array('type'=>$type);
507  $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
508  print $hookmanager->resPrint;
509  print '</div>';
510 }
511 
512 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
513 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
514 if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
515 
516 print '<div class="div-table-responsive">';
517 print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
518 
519 // Lines for filter fields
520 print '<tr class="liste_titre_filter">';
521 if (! empty($arrayfields['p.rowid']['checked']))
522 {
523  print '<td class="liste_titre">';
524  print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
525  print '</td>';
526 }
527 if (! empty($arrayfields['p.lastname']['checked']))
528 {
529  print '<td class="liste_titre">';
530  print '<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).'">';
531  print '</td>';
532 }
533 if (! empty($arrayfields['p.firstname']['checked']))
534 {
535  print '<td class="liste_titre">';
536  print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
537  print '</td>';
538 }
539 if (! empty($arrayfields['p.poste']['checked']))
540 {
541  print '<td class="liste_titre">';
542  print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
543  print '</td>';
544 }
545 if (! empty($arrayfields['p.zip']['checked']))
546 {
547  print '<td class="liste_titre">';
548  print '<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).'">';
549  print '</td>';
550 }
551 if (! empty($arrayfields['p.town']['checked']))
552 {
553  print '<td class="liste_titre">';
554  print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
555  print '</td>';
556 }
557 // State
558 /*if (! empty($arrayfields['state.nom']['checked']))
559  {
560  print '<td class="liste_titre">';
561  print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
562  print '</td>';
563  }
564  // Region
565  if (! empty($arrayfields['region.nom']['checked']))
566  {
567  print '<td class="liste_titre">';
568  print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
569  print '</td>';
570  }*/
571 // Country
572 if (! empty($arrayfields['country.code_iso']['checked']))
573 {
574  print '<td class="liste_titre" align="center">';
575  print $form->select_country($search_country,'search_country','',0,'maxwidth100');
576  print '</td>';
577 }
578 if (! empty($arrayfields['p.phone']['checked']))
579 {
580  print '<td class="liste_titre">';
581  print '<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).'">';
582  print '</td>';
583 }
584 if (! empty($arrayfields['p.phone_perso']['checked']))
585 {
586  print '<td class="liste_titre">';
587  print '<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).'">';
588  print '</td>';
589 }
590 if (! empty($arrayfields['p.phone_mobile']['checked']))
591 {
592  print '<td class="liste_titre">';
593  print '<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).'">';
594  print '</td>';
595 }
596 if (! empty($arrayfields['p.fax']['checked']))
597 {
598  print '<td class="liste_titre">';
599  print '<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).'">';
600  print '</td>';
601 }
602 if (! empty($arrayfields['p.email']['checked']))
603 {
604  print '<td class="liste_titre">';
605  print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
606  print '</td>';
607 }
608 if (! empty($arrayfields['p.skype']['checked']))
609 {
610  print '<td class="liste_titre">';
611  print '<input class="flat" type="text" name="search_skype" size="6" value="'.dol_escape_htmltag($search_skype).'">';
612  print '</td>';
613 }
614 if (! empty($arrayfields['p.twitter']['checked']))
615 {
616  print '<td class="liste_titre">';
617  print '<input class="flat" type="text" name="search_twitter" size="6" value="'.dol_escape_htmltag($search_twitter).'">';
618  print '</td>';
619 }
620 if (! empty($arrayfields['p.facebook']['checked']))
621 {
622  print '<td class="liste_titre">';
623  print '<input class="flat" type="text" name="search_facebook" size="6" value="'.dol_escape_htmltag($search_facebook).'">';
624  print '</td>';
625 }
626 if (! empty($arrayfields['p.thirdparty']['checked']))
627 {
628  print '<td class="liste_titre">';
629  print '<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
630  print '</td>';
631 }
632 if (! empty($arrayfields['p.priv']['checked']))
633 {
634  print '<td class="liste_titre" align="center">';
635  $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
636  print $form->selectarray('search_priv',$selectarray,$search_priv,1);
637  print '</td>';
638 }
639 // Extra fields
640 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
641 
642 // Fields from hook
643 $parameters=array('arrayfields'=>$arrayfields);
644 $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
645 print $hookmanager->resPrint;
646 // Date creation
647 if (! empty($arrayfields['p.datec']['checked']))
648 {
649  print '<td class="liste_titre">';
650  print '</td>';
651 }
652 // Date modification
653 if (! empty($arrayfields['p.tms']['checked']))
654 {
655  print '<td class="liste_titre">';
656  print '</td>';
657 }
658 // Status
659 if (! empty($arrayfields['p.statut']['checked']))
660 {
661  print '<td class="liste_titre center">';
662  print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
663  print '</td>';
664 }
665 if (! empty($arrayfields['p.import_key']['checked']))
666 {
667  print '<td class="liste_titre center">';
668  print '<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).'">';
669  print '</td>';
670 }
671 // Action column
672 print '<td class="liste_titre" align="right">';
673 $searchpicto=$form->showFilterButtons();
674 print $searchpicto;
675 print '</td>';
676 
677 print '</tr>';
678 
679 // Ligne des titres
680 print '<tr class="liste_titre">';
681 if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
682 if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
683 if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
684 if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
685 if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
686 if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
687 //if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
688 //if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder);
689 if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"co.code_iso","",$param,'align="center"',$sortfield,$sortorder);
690 if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
691 if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
692 if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
693 if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'],$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
694 if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'],$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
695 if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'],$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
696 if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'],$_SERVER["PHP_SELF"],"p.twitter", $begin, $param, '', $sortfield,$sortorder);
697 if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'],$_SERVER["PHP_SELF"],"p.facebook", $begin, $param, '', $sortfield,$sortorder);
698 if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'],$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
699 if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'],$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
700 // Extra fields
701 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
702 // Hook fields
703 $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
704 $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
705 print $hookmanager->resPrint;
706 if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
707 if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
708 if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'],$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
709 if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'],$_SERVER["PHP_SELF"],"p.import_key","",$param,'align="center"',$sortfield,$sortorder);
710 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
711 print "</tr>\n";
712 
713 
714 $i = 0;
715 $totalarray=array();
716 while ($i < min($num,$limit))
717 {
718  $obj = $db->fetch_object($result);
719 
720  print '<tr class="oddeven">';
721 
722  $contactstatic->lastname=$obj->lastname;
723  $contactstatic->firstname='';
724  $contactstatic->id=$obj->rowid;
725  $contactstatic->statut=$obj->statut;
726  $contactstatic->poste=$obj->poste;
727  $contactstatic->email=$obj->email;
728  $contactstatic->phone_pro=$obj->phone_pro;
729  $contactstatic->phone_perso=$obj->phone_perso;
730  $contactstatic->phone_mobile=$obj->phone_mobile;
731  $contactstatic->zip=$obj->zip;
732  $contactstatic->town=$obj->town;
733 
734  // ID
735  if (! empty($arrayfields['p.rowid']['checked']))
736  {
737  print '<td class="tdoverflowmax50">';
738  print $obj->rowid;
739  print "</td>\n";
740  if (! $i) $totalarray['nbfield']++;
741  }
742  // Name
743  if (! empty($arrayfields['p.lastname']['checked']))
744  {
745  print '<td valign="middle">';
746  print $contactstatic->getNomUrl(1,'',0);
747  print '</td>';
748  if (! $i) $totalarray['nbfield']++;
749  }
750  // Firstname
751  if (! empty($arrayfields['p.firstname']['checked']))
752  {
753  print '<td>'.$obj->firstname.'</td>';
754  if (! $i) $totalarray['nbfield']++;
755  }
756  // Job position
757  if (! empty($arrayfields['p.poste']['checked']))
758  {
759  print '<td class="tdoverflowmax100">'.$obj->poste.'</td>';
760  if (! $i) $totalarray['nbfield']++;
761  }
762  // Zip
763  if (! empty($arrayfields['p.zip']['checked']))
764  {
765  print '<td>'.$obj->zip.'</td>';
766  if (! $i) $totalarray['nbfield']++;
767  }
768  // Town
769  if (! empty($arrayfields['p.town']['checked']))
770  {
771  print '<td>'.$obj->town.'</td>';
772  if (! $i) $totalarray['nbfield']++;
773  }
774  // State
775  /*if (! empty($arrayfields['state.nom']['checked']))
776  {
777  print "<td>".$obj->state_name."</td>\n";
778  if (! $i) $totalarray['nbfield']++;
779  }
780  // Region
781  if (! empty($arrayfields['region.nom']['checked']))
782  {
783  print "<td>".$obj->region_name."</td>\n";
784  if (! $i) $totalarray['nbfield']++;
785  }*/
786  // Country
787  if (! empty($arrayfields['country.code_iso']['checked']))
788  {
789  print '<td align="center">';
790  $tmparray=getCountry($obj->fk_pays,'all');
791  print $tmparray['label'];
792  print '</td>';
793  if (! $i) $totalarray['nbfield']++;
794  }
795  // Phone
796  if (! empty($arrayfields['p.phone']['checked']))
797  {
798  print '<td>'.dol_print_phone($obj->phone_pro,$obj->country_code,$obj->rowid,$obj->socid,'AC_TEL').'</td>';
799  if (! $i) $totalarray['nbfield']++;
800  }
801  // Phone perso
802  if (! empty($arrayfields['p.phone_perso']['checked']))
803  {
804  print '<td>'.dol_print_phone($obj->phone_perso,$obj->country_code,$obj->rowid,$obj->socid,'AC_TEL').'</td>';
805  if (! $i) $totalarray['nbfield']++;
806  }
807  // Phone mobile
808  if (! empty($arrayfields['p.phone_mobile']['checked']))
809  {
810  print '<td>'.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->rowid,$obj->socid,'AC_TEL').'</td>';
811  if (! $i) $totalarray['nbfield']++;
812  }
813  // Fax
814  if (! empty($arrayfields['p.fax']['checked']))
815  {
816  print '<td>'.dol_print_phone($obj->fax,$obj->country_code,$obj->rowid,$obj->socid,'AC_TEL').'</td>';
817  if (! $i) $totalarray['nbfield']++;
818  }
819  // EMail
820  if (! empty($arrayfields['p.email']['checked']))
821  {
822  print '<td>'.dol_print_email($obj->email,$obj->rowid,$obj->socid,'AC_EMAIL',18).'</td>';
823  if (! $i) $totalarray['nbfield']++;
824  }
825  // Skype
826  if (! empty($arrayfields['p.skype']['checked']))
827  {
828  if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->skype,$obj->rowid,$obj->socid,'skype').'</td>'; }
829  if (! $i) $totalarray['nbfield']++;
830  }
831  // Twitter
832  if (! empty($arrayfields['p.twitter']['checked']))
833  {
834  if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->twitter,$obj->rowid,$obj->socid,'twitter').'</td>'; }
835  if (! $i) $totalarray['nbfield']++;
836  }
837  // Facebook
838  if (! empty($arrayfields['p.facebook']['checked']))
839  {
840  if (! empty($conf->socialnetworks->enabled)) { print '<td>'.dol_print_socialnetworks($obj->facebook,$obj->rowid,$obj->socid,'facebook').'</td>'; }
841  if (! $i) $totalarray['nbfield']++;
842  }
843  // Company
844  if (! empty($arrayfields['p.thirdparty']['checked']))
845  {
846  print '<td>';
847  if ($obj->socid)
848  {
849  $objsoc = new Societe($db);
850  $objsoc->fetch($obj->socid);
851  print $objsoc->getNomUrl(1);
852  }
853  else
854  print '&nbsp;';
855  print '</td>';
856  if (! $i) $totalarray['nbfield']++;
857  }
858 
859  // Private/Public
860  if (! empty($arrayfields['p.priv']['checked']))
861  {
862  print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
863  if (! $i) $totalarray['nbfield']++;
864  }
865 
866  // Extra fields
867  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
868  // Fields from hook
869  $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
870  $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
871  print $hookmanager->resPrint;
872  // Date creation
873  if (! empty($arrayfields['p.datec']['checked']))
874  {
875  print '<td align="center">';
876  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
877  print '</td>';
878  if (! $i) $totalarray['nbfield']++;
879  }
880  // Date modification
881  if (! empty($arrayfields['p.tms']['checked']))
882  {
883  print '<td align="center">';
884  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
885  print '</td>';
886  if (! $i) $totalarray['nbfield']++;
887  }
888  // Status
889  if (! empty($arrayfields['p.statut']['checked']))
890  {
891  print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
892  if (! $i) $totalarray['nbfield']++;
893  }
894  if (! empty($arrayfields['p.import_key']['checked']))
895  {
896  print '<td class="tdoverflowmax100">';
897  print $obj->import_key;
898  print "</td>\n";
899  if (! $i) $totalarray['nbfield']++;
900  }
901 
902  // Action column
903  print '<td class="nowrap" align="center">';
904  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
905  {
906  $selected=0;
907  if (in_array($obj->rowid, $arrayofselected)) $selected=1;
908  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
909  }
910  print '</td>';
911  if (! $i) $totalarray['nbfield']++;
912 
913  print "</tr>\n";
914  $i++;
915 }
916 
917 $db->free($result);
918 
919 $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
920 $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
921 print $hookmanager->resPrint;
922 
923 print "</table>";
924 print "</div>";
925 
926 //if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1);
927 
928 print '</form>';
929 
930 
931 llxFooter();
932 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->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) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
Class to manage contact/addresses.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
Class to manage third parties objects (customers, suppliers, prospects...)
Classe permettant la generation de composants html autre Only common components are here...
llxHeader()
Empty header.
Definition: wrapper.php:44
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...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.