36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43 $langs->loadLangs(array(
"companies",
"suppliers",
"categories"));
47 $action =
GETPOST(
'action',
'aZ09');
48 $massaction =
GETPOST(
'massaction',
'alpha');
49 $show_files =
GETPOST(
'show_files',
'int');
50 $confirm =
GETPOST(
'confirm',
'alpha');
51 $toselect =
GETPOST(
'toselect',
'array');
52 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contactlist';
56 $contactid =
GETPOST(
'id',
'int');
59 $socid = $user->socid;
63 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
64 $search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
65 $search_phone =
GETPOST(
"search_phone",
'alpha');
67 $search_id =
GETPOST(
"search_id",
"int");
68 $search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
69 $search_lastname =
GETPOST(
"search_lastname",
'alpha');
70 $search_firstname =
GETPOST(
"search_firstname",
'alpha');
71 $search_societe =
GETPOST(
"search_societe",
'alpha');
72 $search_poste =
GETPOST(
"search_poste",
'alpha');
73 $search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
74 $search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
75 $search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
76 $search_fax =
GETPOST(
"search_fax",
'alpha');
77 $search_email =
GETPOST(
"search_email",
'alpha');
78 if (!empty($conf->mailing->enabled)) {
79 $search_no_email =
GETPOSTISSET(
"search_no_email") ?
GETPOST(
"search_no_email",
'int') : -1;
81 $search_no_email = -1;
83 if (!empty($conf->socialnetworks->enabled)) {
84 foreach ($socialnetworks as $key => $value) {
85 if ($value[
'active']) {
86 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
90 $search_priv =
GETPOST(
"search_priv",
'alpha');
91 $search_categ =
GETPOST(
"search_categ",
'int');
92 $search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'int');
93 $search_categ_supplier =
GETPOST(
"search_categ_supplier",
'int');
94 $search_status =
GETPOST(
"search_status",
'int');
95 $search_type =
GETPOST(
'search_type',
'alpha');
96 $search_address =
GETPOST(
'search_address',
'alpha');
97 $search_zip =
GETPOST(
'search_zip',
'alpha');
98 $search_town =
GETPOST(
'search_town',
'alpha');
99 $search_import_key =
GETPOST(
"search_import_key",
"alpha");
100 $search_country =
GETPOST(
"search_country",
'intcomma');
101 $search_roles =
GETPOST(
"search_roles",
'array');
102 $search_level =
GETPOST(
"search_level",
"array");
103 $search_stcomm =
GETPOST(
'search_stcomm',
'int');
105 if ($search_status ===
'') {
108 if ($search_no_email ===
'') {
109 $search_no_email = -1;
112 $optioncss =
GETPOST(
'optioncss',
'alpha');
116 $view =
GETPOST(
"view",
'alpha');
118 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
119 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
120 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
122 $userid =
GETPOST(
'userid',
'int');
128 $sortfield =
"p.lastname";
130 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133 $offset = $limit * $page;
135 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
137 if (empty($contextpage) || $contextpage ==
'contactlist') {
138 $contextpage =
'contactprospectlist';
140 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
141 $urlfiche =
"card.php";
144 if (empty($contextpage) || $contextpage ==
'contactlist') {
145 $contextpage =
'contactcustomerlist';
147 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
148 $urlfiche =
"card.php";
149 } elseif ($type ==
"f") {
150 if (empty($contextpage) || $contextpage ==
'contactlist') {
151 $contextpage =
'contactsupplierlist';
153 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
154 $urlfiche =
"card.php";
155 } elseif ($type ==
"o") {
156 if (empty($contextpage) || $contextpage ==
'contactlist') {
157 $contextpage =
'contactotherlist';
159 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
165 $hookmanager->initHooks(array(
'contactlist'));
169 $extrafields->fetch_name_optionals_label($object->table_element);
171 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
174 $fieldstosearchall = array();
175 foreach ($object->fields as $key => $val) {
177 if (!empty($user->socid) && $key ==
"note_private") {
181 if (empty($val[
'searchall'])) {
185 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
189 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
190 $fieldstosearchall[
's.nom'] =
"ThirdParty";
194 $arrayfields = array();
195 foreach ($object->fields as $key => $val) {
197 if (empty($val[
'visible'])) {
201 $arrayfields[
'p.'.$key] = array(
202 'label'=>$val[
'label'],
203 'checked'=>(($val[
'visible'] < 0) ? 0 : 1),
204 'enabled'=>($val[
'enabled'] && ($val[
'visible'] != 3)),
205 'position'=>$val[
'position']);
209 $arrayfields[
'country.code_iso'] = array(
'label'=>
"Country",
'position'=>66,
'checked'=>0);
210 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
211 $arrayfields[
's.nom'] = array(
'label'=>
"ThirdParty",
'position'=>113,
'checked'=> 1);
214 $arrayfields[
'unsubscribed'] = array(
217 'enabled'=>(!empty($conf->mailing->enabled)),
220 if (!empty($conf->socialnetworks->enabled)) {
221 foreach ($socialnetworks as $key => $value) {
222 if ($value[
'active']) {
223 $arrayfields[
'p.'.$key] = array(
224 'label' => $value[
'label'],
233 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
239 if (($id > 0 || !empty($ref)) && $action !=
'add') {
240 $result = $object->fetch($id, $ref);
251 if (
GETPOST(
'cancel',
'alpha')) {
252 $action =
'list'; $massaction =
'';
254 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
258 $parameters = array();
259 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
264 if (empty($reshook)) {
266 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
269 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
272 $search_firstlast_only =
"";
273 $search_lastname =
"";
274 $search_firstname =
"";
275 $search_societe =
"";
277 $search_address =
"";
279 $search_country =
"";
282 $search_phone_perso =
"";
283 $search_phone_pro =
"";
284 $search_phone_mobile =
"";
287 $search_no_email = -1;
288 if (!empty($conf->socialnetworks->enabled)) {
289 foreach ($socialnetworks as $key => $value) {
290 if ($value[
'active']) {
300 $search_categ_thirdparty =
'';
301 $search_categ_supplier =
'';
302 $search_import_key =
'';
304 $search_array_options = array();
305 $search_roles = array();
309 $objectclass =
'Contact';
310 $objectlabel =
'Contact';
311 $permissiontoread = $user->rights->societe->lire;
312 $permissiontodelete = $user->rights->societe->supprimer;
313 $permissiontoadd = $user->rights->societe->creer;
314 $uploaddir = $conf->societe->dir_output;
315 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
317 if ($action ==
'setstcomm') {
319 $result = $object->fetch(
GETPOST(
'stcommcontactid'));
321 $result = $object->update($object->id, $user);
330 if ($search_priv < 0) {
342 $contactstatic =
new Contact($db);
347 if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
348 $contactstatic->loadCacheOfProspStatus();
351 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
354 $tab_level = array();
355 $sql =
"SELECT code, label, sortorder";
356 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
357 $sql .=
" WHERE active > 0";
358 $sql .=
" ORDER BY sortorder";
359 $resql = $db->query($sql);
361 while ($obj = $db->fetch_object(
$resql)) {
363 $level = $langs->trans($obj->code);
364 if ($level == $obj->code) {
365 $level = $langs->trans($obj->label);
367 $tab_level[$obj->code] = $level;
373 $sql =
"SELECT s.rowid as socid, s.nom as name,";
374 $sql .=
" p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,";
375 $sql .=
" p.socialnetworks, p.photo,";
376 $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,";
377 $sql .=
" p.import_key,";
378 $sql .=
" st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
379 $sql .=
" co.label as country, co.code as country_code";
381 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
382 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
383 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
386 if (!empty($conf->mailing->enabled)) {
387 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
390 $parameters = array();
391 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
392 $sql .= $hookmanager->resPrint;
393 $sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
394 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
395 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
397 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
398 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
399 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
400 if (!empty($search_categ) && $search_categ !=
'-1') {
401 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_contact as cc ON p.rowid = cc.fk_socpeople";
403 if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
404 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cs ON s.rowid = cs.fk_soc";
406 if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
407 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc";
409 if (empty($user->rights->societe->client->voir) && !$socid) {
410 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
412 $sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
413 if (empty($user->rights->societe->client->voir) && !$socid) {
414 $sql .=
" AND (sc.fk_user = ".((int) $user->id).
" OR p.fk_soc IS NULL)";
416 if (!empty($userid)) {
417 $sql .=
" AND p.fk_user_creat=".((int) $userid);
420 $sql .=
natural_search(
"p.fk_prospectcontactlevel", join(
',', $search_level), 3);
422 if ($search_stcomm !=
'' && $search_stcomm != -2) {
427 if ($search_priv !=
'0' && $search_priv !=
'1') {
428 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
430 if ($search_priv ==
'0') {
431 $sql .=
" AND p.priv='0'";
433 if ($search_priv ==
'1') {
434 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
438 if ($search_categ > 0) {
439 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ);
441 if ($search_categ == -2) {
442 $sql .=
" AND cc.fk_categorie IS NULL";
444 if ($search_categ_thirdparty > 0) {
445 $sql .=
" AND cs.fk_categorie = ".((int) $search_categ_thirdparty);
447 if ($search_categ_thirdparty == -2) {
448 $sql .=
" AND cs.fk_categorie IS NULL";
450 if ($search_categ_supplier > 0) {
451 $sql .=
" AND cs2.fk_categorie = ".((int) $search_categ_supplier);
453 if ($search_categ_supplier == -2) {
454 $sql .=
" AND cs2.fk_categorie IS NULL";
460 if (strlen($search_phone)) {
461 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
463 if (strlen($search_cti)) {
464 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
466 if (strlen($search_firstlast_only)) {
467 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
470 if ($search_id > 0) {
473 if ($search_lastname) {
476 if ($search_firstname) {
479 if ($search_societe) {
480 $sql .=
natural_search(empty($conf->global->SOCIETE_DISABLE_CONTACTS) ?
's.nom' :
'p.fk_soc', $search_societe);
482 if ($search_country) {
483 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
485 if (strlen($search_poste)) {
488 if (strlen($search_phone_perso)) {
491 if (strlen($search_phone_pro)) {
494 if (strlen($search_phone_mobile)) {
497 if (strlen($search_fax)) {
500 if (!empty($conf->socialnetworks->enabled)) {
501 foreach ($socialnetworks as $key => $value) {
502 if ($value[
'active'] && strlen($search_[$key])) {
503 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
504 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
505 $sql .=
" AND p.socialnetworks REGEXP '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
506 } elseif ($db->type ==
'pgsql') {
507 $sql .=
" AND p.socialnetworks ~ '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
510 $sql .=
" AND p.socialnetworks LIKE '%\"".$db->escape($db->escapeforlike($key)).
"\":\"".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"%'";
516 if (strlen($search_email)) {
519 if (strlen($search_address)) {
522 if (strlen($search_zip)) {
525 if (strlen($search_town)) {
528 if (count($search_roles) > 0) {
529 $sql .=
" AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX.
"societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(
',', $search_roles)).
"))";
531 if ($search_no_email != -1 && $search_no_email > 0) {
532 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
534 if ($search_no_email != -1 && $search_no_email == 0) {
535 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
537 if ($search_status !=
'' && $search_status >= 0) {
538 $sql .=
" AND p.statut = ".((int) $search_status);
540 if ($search_import_key) {
544 $sql .=
" AND p.fk_soc IS NULL";
545 } elseif ($type ==
"f") {
546 $sql .=
" AND s.fournisseur = 1";
547 } elseif ($type ==
"c") {
548 $sql .=
" AND s.client IN (1, 3)";
549 } elseif ($type ==
"p") {
550 $sql .=
" AND s.client IN (2, 3)";
552 if (!empty($socid)) {
553 $sql .=
" AND s.rowid = ".((int) $socid);
556 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
558 $parameters = array();
559 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
560 $sql .= $hookmanager->resPrint;
562 if ($view ==
"recent") {
563 $sql .= $db->order(
"p.datec",
"DESC");
565 $sql .= $db->order($sortfield, $sortorder);
570 $nbtotalofrecords =
'';
571 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
572 $resql = $db->query($sql);
573 $nbtotalofrecords = $db->num_rows(
$resql);
574 if (($page * $limit) > $nbtotalofrecords) {
580 $sql .= $db->plimit($limit + 1, $offset);
582 $resql = $db->query($sql);
588 $num = $db->num_rows(
$resql);
590 $arrayofselected = is_array($toselect) ? $toselect : array();
592 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall !=
'' || $search_cti !=
'')) {
593 $obj = $db->fetch_object(
$resql);
595 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.$id);
599 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
603 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
604 $param .=
'&contextpage='.urlencode($contextpage);
606 if ($limit > 0 && $limit != $conf->liste_limit) {
607 $param .=
'&limit='.((int) $limit);
609 $param .=
'&begin='.urlencode($begin).
'&userid='.urlencode($userid).
'&contactname='.urlencode($sall);
610 $param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
611 if (!empty($search_categ) && $search_categ !=
'-1') {
612 $param .=
'&search_categ='.urlencode($search_categ);
614 if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
615 $param .=
'&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
617 if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
618 $param .=
'&search_categ_supplier='.urlencode($search_categ_supplier);
621 $param .=
'&sall='.urlencode($sall);
623 if ($search_id > 0) {
624 $param .=
"&search_id=".urlencode($search_id);
626 if ($search_lastname !=
'') {
627 $param .=
'&search_lastname='.urlencode($search_lastname);
629 if ($search_firstname !=
'') {
630 $param .=
'&search_firstname='.urlencode($search_firstname);
632 if ($search_societe !=
'') {
633 $param .=
'&search_societe='.urlencode($search_societe);
635 if ($search_address !=
'') {
636 $param .=
'&search_address='.urlencode($search_address);
638 if ($search_zip !=
'') {
639 $param .=
'&search_zip='.urlencode($search_zip);
641 if ($search_town !=
'') {
642 $param .=
'&search_town='.urlencode($search_town);
644 if ($search_country !=
'') {
645 $param .=
"&search_country=".urlencode($search_country);
647 if ($search_poste !=
'') {
648 $param .=
'&search_poste='.urlencode($search_poste);
650 if ($search_phone_pro !=
'') {
651 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
653 if ($search_phone_perso !=
'') {
654 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
656 if ($search_phone_mobile !=
'') {
657 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
659 if ($search_fax !=
'') {
660 $param .=
'&search_fax='.urlencode($search_fax);
662 if ($search_email !=
'') {
663 $param .=
'&search_email='.urlencode($search_email);
665 if ($search_no_email !=
'') {
666 $param .=
'&search_no_email='.urlencode($search_no_email);
668 if ($search_status !=
'') {
669 $param .=
'&search_status='.urlencode($search_status);
671 if ($search_priv ==
'0' || $search_priv ==
'1') {
672 $param .=
"&search_priv=".urlencode($search_priv);
674 if ($search_stcomm !=
'') {
675 $param .=
'&search_stcomm='.urlencode($search_stcomm);
677 if (is_array($search_level) && count($search_level)) {
678 foreach ($search_level as $slevel) {
679 $param .=
'&search_level[]='.urlencode($slevel);
682 if ($search_import_key !=
'') {
683 $param .=
'&search_import_key='.urlencode($search_import_key);
685 if ($optioncss !=
'') {
686 $param .=
'&optioncss='.urlencode($optioncss);
688 if (count($search_roles) > 0) {
689 $param .= implode(
'&search_roles[]=', $search_roles);
693 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
696 $arrayofmassactions = array(
701 if ($user->rights->societe->supprimer) {
702 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
704 if (
isModEnabled(
'category') && $user->rights->societe->creer) {
705 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
707 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
708 $arrayofmassactions = array();
710 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
712 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $user->rights->societe->contact->creer);
714 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
715 if ($optioncss !=
'') {
716 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
718 print
'<input type="hidden" name="token" value="'.newToken().
'">';
719 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
720 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
721 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
723 print
'<input type="hidden" name="type" value="'.$type.
'">';
724 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
726 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
728 $topicmail =
"Information";
729 $modelmail =
"contact";
731 $trackid =
'ctc'.$object->id;
732 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
735 foreach ($fieldstosearchall as $key => $val) {
736 $fieldstosearchall[$key] = $langs->trans($val);
738 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
740 if ($search_firstlast_only) {
741 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
745 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
746 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
747 $moreforfilter .=
'<div class="divsearchfield">';
748 $tmptitle = $langs->trans(
'ContactCategoriesShort');
749 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
750 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ,
'search_categ', 1, $tmptitle);
751 $moreforfilter .=
'</div>';
752 if (empty($type) || $type ==
'c' || $type ==
'p') {
753 $moreforfilter .=
'<div class="divsearchfield">';
756 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
757 } elseif ($type ==
'p') {
758 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
760 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
762 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
763 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
764 $moreforfilter .=
'</div>';
767 if (!empty($conf->fournisseur->enabled) && (empty($type) || $type ==
'f')) {
768 $moreforfilter .=
'<div class="divsearchfield">';
769 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
770 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
771 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
772 $moreforfilter .=
'</div>';
776 $moreforfilter .=
'<div class="divsearchfield">';
777 $moreforfilter .= $langs->trans(
'Roles').
': ';
778 $moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles);
779 $moreforfilter .=
'</div>';
781 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
782 print $moreforfilter;
783 $parameters = array(
'type'=>$type);
784 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
785 print $hookmanager->resPrint;
788 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
789 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
790 if ($massactionbutton) {
791 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
794 print
'<div class="div-table-responsive">';
795 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
798 print
'<tr class="liste_titre_filter">';
799 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
800 print
'<td class="liste_titre">';
801 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
804 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
805 print
'<td class="liste_titre">';
806 print
'<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).
'">';
809 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
810 print
'<td class="liste_titre">';
811 print
'<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).
'">';
814 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
815 print
'<td class="liste_titre">';
816 print
'<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).
'">';
819 if (!empty($arrayfields[
'p.address'][
'checked'])) {
820 print
'<td class="liste_titre">';
821 print
'<input class="flat" type="text" name="search_address" size="6" value="'.dol_escape_htmltag($search_address).
'">';
824 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
825 print
'<td class="liste_titre">';
826 print
'<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).
'">';
829 if (!empty($arrayfields[
'p.town'][
'checked'])) {
830 print
'<td class="liste_titre">';
831 print
'<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).
'">';
849 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
850 print
'<td class="liste_titre center">';
851 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
854 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
855 print
'<td class="liste_titre">';
856 print
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
859 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
860 print
'<td class="liste_titre">';
861 print
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
864 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
865 print
'<td class="liste_titre">';
866 print
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
869 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
870 print
'<td class="liste_titre">';
871 print
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
874 if (!empty($arrayfields[
'p.email'][
'checked'])) {
875 print
'<td class="liste_titre">';
876 print
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
879 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
880 print
'<td class="liste_titre center">';
881 print
$form->selectarray(
'search_no_email', array(
'-1'=>
'',
'0'=>$langs->trans(
'No'),
'1'=>$langs->trans(
'Yes')), $search_no_email);
884 if (!empty($conf->socialnetworks->enabled)) {
885 foreach ($socialnetworks as $key => $value) {
886 if ($value[
'active']) {
887 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
888 print
'<td class="liste_titre">';
889 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
895 if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
896 print
'<td class="liste_titre">';
897 print
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
900 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
901 print
'<td class="liste_titre center">';
902 $selectarray = array(
'0'=>$langs->trans(
"ContactPublic"),
'1'=>$langs->trans(
"ContactPrivate"));
903 print
$form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
907 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
908 print
'<td class="liste_titre center">';
909 print
$form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
913 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
914 print
'<td class="liste_titre maxwidthonsmartphone center">';
915 $arraystcomm = array();
916 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
917 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
919 print
$form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
923 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
926 $parameters = array(
'arrayfields'=>$arrayfields);
927 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
928 print $hookmanager->resPrint;
930 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
931 print
'<td class="liste_titre">';
935 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
936 print
'<td class="liste_titre">';
940 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
941 print
'<td class="liste_titre center">';
942 print
$form->selectarray(
'search_status', array(
'-1'=>
'',
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $search_status);
945 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
946 print
'<td class="liste_titre center">';
947 print
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
951 print
'<td class="liste_titre maxwidthsearch">';
952 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
959 print
'<tr class="liste_titre">';
960 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
961 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
963 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
964 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
966 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
967 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
969 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
970 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
972 if (!empty($arrayfields[
'p.address'][
'checked'])) {
973 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
975 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
976 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
978 if (!empty($arrayfields[
'p.town'][
'checked'])) {
979 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
983 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
984 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
986 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
987 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
989 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
990 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
992 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
993 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
995 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
996 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
998 if (!empty($arrayfields[
'p.email'][
'checked'])) {
999 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1001 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1002 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1004 if (!empty($conf->socialnetworks->enabled)) {
1005 foreach ($socialnetworks as $key => $value) {
1006 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1007 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1011 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1012 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1014 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1015 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1017 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1018 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1020 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
1021 print_liste_field_titre($arrayfields[
'p.fk_prospectcontactlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectcontactlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1023 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1024 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1027 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1029 $parameters = array(
1030 'arrayfields'=>$arrayfields,
1032 'sortfield'=>$sortfield,
1033 'sortorder'=>$sortorder,
1035 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1036 print $hookmanager->resPrint;
1037 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1038 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1040 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1041 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1043 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1044 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1046 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1047 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1049 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1054 $totalarray = array();
1055 $totalarray[
'nbfield'] = 0;
1056 while ($i < min($num, $limit)) {
1057 $obj = $db->fetch_object(
$resql);
1059 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1060 $contactstatic->lastname = $obj->lastname;
1061 $contactstatic->firstname =
'';
1062 $contactstatic->id = $obj->rowid;
1063 $contactstatic->statut = $obj->statut;
1064 $contactstatic->poste = $obj->poste;
1065 $contactstatic->email = $obj->email;
1066 $contactstatic->phone_pro = $obj->phone_pro;
1067 $contactstatic->phone_perso = $obj->phone_perso;
1068 $contactstatic->phone_mobile = $obj->phone_mobile;
1069 $contactstatic->address = $obj->address;
1070 $contactstatic->zip = $obj->zip;
1071 $contactstatic->town = $obj->town;
1072 $contactstatic->socialnetworks = $arraysocialnetworks;
1073 $contactstatic->country = $obj->country;
1074 $contactstatic->country_code = $obj->country_code;
1075 $contactstatic->photo = $obj->photo;
1076 $contactstatic->import_key = $obj->import_key;
1078 $contactstatic->fk_prospectlevel = $obj->fk_prospectcontactlevel;
1080 print
'<tr class="oddeven">';
1083 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1084 print
'<td class="tdoverflowmax50">';
1088 $totalarray[
'nbfield']++;
1092 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1093 print
'<td class="middle tdoverflowmax150">';
1094 print $contactstatic->getNomUrl(1);
1097 $totalarray[
'nbfield']++;
1101 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1102 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1104 $totalarray[
'nbfield']++;
1108 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1109 print
'<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->poste).
'</td>';
1111 $totalarray[
'nbfield']++;
1115 if (!empty($arrayfields[
'p.address'][
'checked'])) {
1116 print
'<td>'.dol_escape_htmltag($obj->address).
'</td>';
1118 $totalarray[
'nbfield']++;
1122 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1123 print
'<td>'.dol_escape_htmltag($obj->zip).
'</td>';
1125 $totalarray[
'nbfield']++;
1129 if (!empty($arrayfields[
'p.town'][
'checked'])) {
1130 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">'.
dol_escape_htmltag($obj->town).
'</td>';
1132 $totalarray[
'nbfield']++;
1148 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1149 print
'<td class="center">';
1150 $tmparray =
getCountry($obj->fk_pays,
'all');
1154 $totalarray[
'nbfield']++;
1158 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1159 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'phone').
'</td>';
1161 $totalarray[
'nbfield']++;
1165 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1166 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'phone').
'</td>';
1168 $totalarray[
'nbfield']++;
1172 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1173 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'mobile').
'</td>';
1175 $totalarray[
'nbfield']++;
1179 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1180 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'fax').
'</td>';
1182 $totalarray[
'nbfield']++;
1186 if (!empty($arrayfields[
'p.email'][
'checked'])) {
1187 print
'<td class="nowraponall tdoverflowmax300">'.dol_print_email($obj->email, $obj->rowid, $obj->socid,
'AC_EMAIL', 18, 0, 1).
'</td>';
1189 $totalarray[
'nbfield']++;
1193 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1194 print
'<td class="center">';
1195 if (empty($obj->email)) {
1198 print
yn(($obj->unsubscribed > 0) ? 1 : 0);
1202 $totalarray[
'nbfield']++;
1205 if (!empty($conf->socialnetworks->enabled)) {
1206 foreach ($socialnetworks as $key => $value) {
1207 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1208 print
'<td class="tdoverflowmax100">'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).
'</td>';
1210 $totalarray[
'nbfield']++;
1216 if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1217 print
'<td class="tdoverflowmax200">';
1220 $objsoc->fetch($obj->socid);
1221 print $objsoc->getNomUrl(1);
1227 $totalarray[
'nbfield']++;
1232 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1233 print
'<td class="center">'.$contactstatic->LibPubPriv($obj->priv).
'</td>';
1235 $totalarray[
'nbfield']++;
1239 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
1241 print
'<td class="center">';
1242 print $contactstatic->getLibProspLevel();
1245 $totalarray[
'nbfield']++;
1249 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1251 print
'<td class="center nowrap"><div class="nowrap">';
1252 print
'<div class="inline-block">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id][
'label'], $obj->stcomm_picto);
1253 print
'</div> - <div class="inline-block">';
1254 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1255 $titlealt =
'default';
1256 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
1257 $titlealt = $val[
'label'];
1259 if ($obj->stcomm_id != $val[
'id']) {
1260 print
'<a class="pictosubstatus" href="'.$_SERVER[
"PHP_SELF"].
'?stcommcontactid='.$obj->rowid.
'&stcomm='.urlencode($val[
'code']).
'&action=setstcomm&token='.
newToken().$param.($page ?
'&page='.urlencode($page) :
'').
'">'.
img_action($titlealt, $val[
'code'], $val[
'picto']).
'</a>';
1263 print
'</div></div></td>';
1265 $totalarray[
'nbfield']++;
1270 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1272 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1273 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1274 print $hookmanager->resPrint;
1276 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1277 print
'<td class="center nowraponall">';
1278 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1281 $totalarray[
'nbfield']++;
1285 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1286 print
'<td class="center nowraponall">';
1287 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1290 $totalarray[
'nbfield']++;
1294 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1295 print
'<td class="center">'.$contactstatic->getLibStatut(5).
'</td>';
1297 $totalarray[
'nbfield']++;
1301 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1302 print
'<td class="tdoverflowmax100">';
1306 $totalarray[
'nbfield']++;
1311 print
'<td class="nowrap center">';
1312 if ($massactionbutton || $massaction) {
1314 if (in_array($obj->rowid, $arrayofselected)) {
1317 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1321 $totalarray[
'nbfield']++;
1329 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1334 foreach ($arrayfields as $key => $val) {
1335 if (!empty($val[
'checked'])) {
1339 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1344 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1345 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1346 print $hookmanager->resPrint;
1348 print
'</table>'.
"\n";
1349 print
'</div>'.
"\n";
1351 print
'</form>'.
"\n";