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 $sql .=
" AND p.socialnetworks LIKE '%\"".$key.
"\":\"".$search_[$key].
"%'";
507 if (strlen($search_email)) {
510 if (strlen($search_address)) {
513 if (strlen($search_zip)) {
516 if (strlen($search_town)) {
519 if (count($search_roles) > 0) {
520 $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)).
"))";
522 if ($search_no_email != -1 && $search_no_email > 0) {
523 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
525 if ($search_no_email != -1 && $search_no_email == 0) {
526 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
528 if ($search_status !=
'' && $search_status >= 0) {
529 $sql .=
" AND p.statut = ".((int) $search_status);
531 if ($search_import_key) {
535 $sql .=
" AND p.fk_soc IS NULL";
536 } elseif ($type ==
"f") {
537 $sql .=
" AND s.fournisseur = 1";
538 } elseif ($type ==
"c") {
539 $sql .=
" AND s.client IN (1, 3)";
540 } elseif ($type ==
"p") {
541 $sql .=
" AND s.client IN (2, 3)";
543 if (!empty($socid)) {
544 $sql .=
" AND s.rowid = ".((int) $socid);
547 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
549 $parameters = array();
550 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
551 $sql .= $hookmanager->resPrint;
553 if ($view ==
"recent") {
554 $sql .= $db->order(
"p.datec",
"DESC");
556 $sql .= $db->order($sortfield, $sortorder);
560 $nbtotalofrecords =
'';
561 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
562 $resql = $db->query($sql);
563 $nbtotalofrecords = $db->num_rows(
$resql);
564 if (($page * $limit) > $nbtotalofrecords) {
570 $sql .= $db->plimit($limit + 1, $offset);
572 $resql = $db->query($sql);
578 $num = $db->num_rows(
$resql);
580 $arrayofselected = is_array($toselect) ? $toselect : array();
582 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall !=
'' || $search_cti !=
'')) {
583 $obj = $db->fetch_object(
$resql);
585 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.$id);
589 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
593 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
594 $param .=
'&contextpage='.urlencode($contextpage);
596 if ($limit > 0 && $limit != $conf->liste_limit) {
597 $param .=
'&limit='.((int) $limit);
599 $param .=
'&begin='.urlencode($begin).
'&userid='.urlencode($userid).
'&contactname='.urlencode($sall);
600 $param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
601 if (!empty($search_categ) && $search_categ !=
'-1') {
602 $param .=
'&search_categ='.urlencode($search_categ);
604 if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
605 $param .=
'&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
607 if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
608 $param .=
'&search_categ_supplier='.urlencode($search_categ_supplier);
611 $param .=
'&sall='.urlencode($sall);
613 if ($search_id > 0) {
614 $param .=
"&search_id=".urlencode($search_id);
616 if ($search_lastname !=
'') {
617 $param .=
'&search_lastname='.urlencode($search_lastname);
619 if ($search_firstname !=
'') {
620 $param .=
'&search_firstname='.urlencode($search_firstname);
622 if ($search_societe !=
'') {
623 $param .=
'&search_societe='.urlencode($search_societe);
625 if ($search_address !=
'') {
626 $param .=
'&search_address='.urlencode($search_address);
628 if ($search_zip !=
'') {
629 $param .=
'&search_zip='.urlencode($search_zip);
631 if ($search_town !=
'') {
632 $param .=
'&search_town='.urlencode($search_town);
634 if ($search_country !=
'') {
635 $param .=
"&search_country=".urlencode($search_country);
637 if ($search_poste !=
'') {
638 $param .=
'&search_poste='.urlencode($search_poste);
640 if ($search_phone_pro !=
'') {
641 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
643 if ($search_phone_perso !=
'') {
644 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
646 if ($search_phone_mobile !=
'') {
647 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
649 if ($search_fax !=
'') {
650 $param .=
'&search_fax='.urlencode($search_fax);
652 if ($search_email !=
'') {
653 $param .=
'&search_email='.urlencode($search_email);
655 if ($search_no_email !=
'') {
656 $param .=
'&search_no_email='.urlencode($search_no_email);
658 if ($search_status !=
'') {
659 $param .=
'&search_status='.urlencode($search_status);
661 if ($search_priv ==
'0' || $search_priv ==
'1') {
662 $param .=
"&search_priv=".urlencode($search_priv);
664 if ($search_stcomm !=
'') {
665 $param .=
'&search_stcomm='.urlencode($search_stcomm);
667 if (is_array($search_level) && count($search_level)) {
668 foreach ($search_level as $slevel) {
669 $param .=
'&search_level[]='.urlencode($slevel);
672 if ($search_import_key !=
'') {
673 $param .=
'&search_import_key='.urlencode($search_import_key);
675 if ($optioncss !=
'') {
676 $param .=
'&optioncss='.urlencode($optioncss);
678 if (count($search_roles) > 0) {
679 $param .= implode(
'&search_roles[]=', $search_roles);
683 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
686 $arrayofmassactions = array(
691 if ($user->rights->societe->supprimer) {
692 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
694 if (
isModEnabled(
'category') && $user->rights->societe->creer) {
695 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
697 if (in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
698 $arrayofmassactions = array();
700 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
702 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $user->rights->societe->contact->creer);
704 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
705 if ($optioncss !=
'') {
706 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
708 print
'<input type="hidden" name="token" value="'.newToken().
'">';
709 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
710 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
711 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
713 print
'<input type="hidden" name="type" value="'.$type.
'">';
714 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
716 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
718 $topicmail =
"Information";
719 $modelmail =
"contact";
721 $trackid =
'ctc'.$object->id;
722 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
725 foreach ($fieldstosearchall as $key => $val) {
726 $fieldstosearchall[$key] = $langs->trans($val);
728 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
730 if ($search_firstlast_only) {
731 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
735 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
736 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
737 $moreforfilter .=
'<div class="divsearchfield">';
738 $tmptitle = $langs->trans(
'ContactCategoriesShort');
739 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
740 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ,
'search_categ', 1, $tmptitle);
741 $moreforfilter .=
'</div>';
742 if (empty($type) || $type ==
'c' || $type ==
'p') {
743 $moreforfilter .=
'<div class="divsearchfield">';
746 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
747 } elseif ($type ==
'p') {
748 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
750 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
752 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
753 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
754 $moreforfilter .=
'</div>';
757 if (!empty($conf->fournisseur->enabled) && (empty($type) || $type ==
'f')) {
758 $moreforfilter .=
'<div class="divsearchfield">';
759 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
760 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
761 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
762 $moreforfilter .=
'</div>';
766 $moreforfilter .=
'<div class="divsearchfield">';
767 $moreforfilter .= $langs->trans(
'Roles').
': ';
768 $moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles);
769 $moreforfilter .=
'</div>';
771 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
772 print $moreforfilter;
773 $parameters = array(
'type'=>$type);
774 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
775 print $hookmanager->resPrint;
778 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
779 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
780 if ($massactionbutton) {
781 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
784 print
'<div class="div-table-responsive">';
785 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
788 print
'<tr class="liste_titre_filter">';
789 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
790 print
'<td class="liste_titre">';
791 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
794 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
795 print
'<td class="liste_titre">';
796 print
'<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).
'">';
799 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
800 print
'<td class="liste_titre">';
801 print
'<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).
'">';
804 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
805 print
'<td class="liste_titre">';
806 print
'<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).
'">';
809 if (!empty($arrayfields[
'p.address'][
'checked'])) {
810 print
'<td class="liste_titre">';
811 print
'<input class="flat" type="text" name="search_address" size="6" value="'.dol_escape_htmltag($search_address).
'">';
814 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
815 print
'<td class="liste_titre">';
816 print
'<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).
'">';
819 if (!empty($arrayfields[
'p.town'][
'checked'])) {
820 print
'<td class="liste_titre">';
821 print
'<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).
'">';
839 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
840 print
'<td class="liste_titre center">';
841 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
844 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
845 print
'<td class="liste_titre">';
846 print
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
849 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
850 print
'<td class="liste_titre">';
851 print
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
854 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
855 print
'<td class="liste_titre">';
856 print
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
859 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
860 print
'<td class="liste_titre">';
861 print
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
864 if (!empty($arrayfields[
'p.email'][
'checked'])) {
865 print
'<td class="liste_titre">';
866 print
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
869 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
870 print
'<td class="liste_titre center">';
871 print
$form->selectarray(
'search_no_email', array(
'-1'=>
'',
'0'=>$langs->trans(
'No'),
'1'=>$langs->trans(
'Yes')), $search_no_email);
874 if (!empty($conf->socialnetworks->enabled)) {
875 foreach ($socialnetworks as $key => $value) {
876 if ($value[
'active']) {
877 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
878 print
'<td class="liste_titre">';
879 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
885 if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
886 print
'<td class="liste_titre">';
887 print
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
890 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
891 print
'<td class="liste_titre center">';
892 $selectarray = array(
'0'=>$langs->trans(
"ContactPublic"),
'1'=>$langs->trans(
"ContactPrivate"));
893 print
$form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
897 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
898 print
'<td class="liste_titre center">';
899 print
$form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
903 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
904 print
'<td class="liste_titre maxwidthonsmartphone center">';
905 $arraystcomm = array();
906 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
907 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
909 print
$form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
913 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
916 $parameters = array(
'arrayfields'=>$arrayfields);
917 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
918 print $hookmanager->resPrint;
920 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
921 print
'<td class="liste_titre">';
925 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
926 print
'<td class="liste_titre">';
930 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
931 print
'<td class="liste_titre center">';
932 print
$form->selectarray(
'search_status', array(
'-1'=>
'',
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $search_status);
935 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
936 print
'<td class="liste_titre center">';
937 print
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
941 print
'<td class="liste_titre maxwidthsearch">';
942 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
949 print
'<tr class="liste_titre">';
950 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
951 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
953 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
954 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
956 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
957 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
959 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
960 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
962 if (!empty($arrayfields[
'p.address'][
'checked'])) {
963 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
965 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
966 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
968 if (!empty($arrayfields[
'p.town'][
'checked'])) {
969 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
973 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
974 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
976 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
977 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
979 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
980 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
982 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
983 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
985 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
986 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
988 if (!empty($arrayfields[
'p.email'][
'checked'])) {
989 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
991 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
992 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
994 if (!empty($conf->socialnetworks->enabled)) {
995 foreach ($socialnetworks as $key => $value) {
996 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
997 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1001 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1002 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1004 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1005 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1007 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1008 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1010 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
1011 print_liste_field_titre($arrayfields[
'p.fk_prospectcontactlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectcontactlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1013 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1014 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1017 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1019 $parameters = array(
1020 'arrayfields'=>$arrayfields,
1022 'sortfield'=>$sortfield,
1023 'sortorder'=>$sortorder,
1025 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1026 print $hookmanager->resPrint;
1027 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1028 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1030 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1031 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1033 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1036 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1037 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1039 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1044 $totalarray = array();
1045 $totalarray[
'nbfield'] = 0;
1046 while ($i < min($num, $limit)) {
1047 $obj = $db->fetch_object(
$resql);
1049 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1050 $contactstatic->lastname = $obj->lastname;
1051 $contactstatic->firstname =
'';
1052 $contactstatic->id = $obj->rowid;
1053 $contactstatic->statut = $obj->statut;
1054 $contactstatic->poste = $obj->poste;
1055 $contactstatic->email = $obj->email;
1056 $contactstatic->phone_pro = $obj->phone_pro;
1057 $contactstatic->phone_perso = $obj->phone_perso;
1058 $contactstatic->phone_mobile = $obj->phone_mobile;
1059 $contactstatic->address = $obj->address;
1060 $contactstatic->zip = $obj->zip;
1061 $contactstatic->town = $obj->town;
1062 $contactstatic->socialnetworks = $arraysocialnetworks;
1063 $contactstatic->country = $obj->country;
1064 $contactstatic->country_code = $obj->country_code;
1065 $contactstatic->photo = $obj->photo;
1066 $contactstatic->import_key = $obj->import_key;
1068 $contactstatic->fk_prospectlevel = $obj->fk_prospectcontactlevel;
1070 print
'<tr class="oddeven">';
1073 if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1074 print
'<td class="tdoverflowmax50">';
1078 $totalarray[
'nbfield']++;
1082 if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1083 print
'<td class="middle tdoverflowmax150">';
1084 print $contactstatic->getNomUrl(1);
1087 $totalarray[
'nbfield']++;
1091 if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1092 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1094 $totalarray[
'nbfield']++;
1098 if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1099 print
'<td class="tdoverflowmax100">'.dol_escape_htmltag($obj->poste).
'</td>';
1101 $totalarray[
'nbfield']++;
1105 if (!empty($arrayfields[
'p.address'][
'checked'])) {
1106 print
'<td>'.dol_escape_htmltag($obj->address).
'</td>';
1108 $totalarray[
'nbfield']++;
1112 if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1113 print
'<td>'.dol_escape_htmltag($obj->zip).
'</td>';
1115 $totalarray[
'nbfield']++;
1119 if (!empty($arrayfields[
'p.town'][
'checked'])) {
1120 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">'.
dol_escape_htmltag($obj->town).
'</td>';
1122 $totalarray[
'nbfield']++;
1138 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1139 print
'<td class="center">';
1140 $tmparray =
getCountry($obj->fk_pays,
'all');
1144 $totalarray[
'nbfield']++;
1148 if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1149 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'phone').
'</td>';
1151 $totalarray[
'nbfield']++;
1155 if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1156 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'phone').
'</td>';
1158 $totalarray[
'nbfield']++;
1162 if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1163 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'mobile').
'</td>';
1165 $totalarray[
'nbfield']++;
1169 if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1170 print
'<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid,
'AC_TEL',
' ',
'fax').
'</td>';
1172 $totalarray[
'nbfield']++;
1176 if (!empty($arrayfields[
'p.email'][
'checked'])) {
1177 print
'<td class="nowraponall tdoverflowmax300">'.dol_print_email($obj->email, $obj->rowid, $obj->socid,
'AC_EMAIL', 18, 0, 1).
'</td>';
1179 $totalarray[
'nbfield']++;
1183 if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1184 print
'<td class="center">';
1185 if (empty($obj->email)) {
1188 print
yn(($obj->unsubscribed > 0) ? 1 : 0);
1192 $totalarray[
'nbfield']++;
1195 if (!empty($conf->socialnetworks->enabled)) {
1196 foreach ($socialnetworks as $key => $value) {
1197 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1198 print
'<td class="tdoverflowmax100">'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).
'</td>';
1200 $totalarray[
'nbfield']++;
1206 if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1207 print
'<td class="tdoverflowmax200">';
1210 $objsoc->fetch($obj->socid);
1211 print $objsoc->getNomUrl(1);
1217 $totalarray[
'nbfield']++;
1222 if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1223 print
'<td class="center">'.$contactstatic->LibPubPriv($obj->priv).
'</td>';
1225 $totalarray[
'nbfield']++;
1229 if (!empty($arrayfields[
'p.fk_prospectcontactlevel'][
'checked'])) {
1231 print
'<td class="center">';
1232 print $contactstatic->getLibProspLevel();
1235 $totalarray[
'nbfield']++;
1239 if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1241 print
'<td class="center nowrap"><div class="nowrap">';
1242 print
'<div class="inline-block">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id][
'label'], $obj->stcomm_picto);
1243 print
'</div> - <div class="inline-block">';
1244 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1245 $titlealt =
'default';
1246 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
1247 $titlealt = $val[
'label'];
1249 if ($obj->stcomm_id != $val[
'id']) {
1250 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>';
1253 print
'</div></div></td>';
1255 $totalarray[
'nbfield']++;
1260 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1262 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1263 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1264 print $hookmanager->resPrint;
1266 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1267 print
'<td class="center nowraponall">';
1268 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1271 $totalarray[
'nbfield']++;
1275 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1276 print
'<td class="center nowraponall">';
1277 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1280 $totalarray[
'nbfield']++;
1284 if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1285 print
'<td class="center">'.$contactstatic->getLibStatut(5).
'</td>';
1287 $totalarray[
'nbfield']++;
1291 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1292 print
'<td class="tdoverflowmax100">';
1296 $totalarray[
'nbfield']++;
1301 print
'<td class="nowrap center">';
1302 if ($massactionbutton || $massaction) {
1304 if (in_array($obj->rowid, $arrayofselected)) {
1307 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1311 $totalarray[
'nbfield']++;
1319 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1324 foreach ($arrayfields as $key => $val) {
1325 if (!empty($val[
'checked'])) {
1329 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1334 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1335 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1336 print $hookmanager->resPrint;
1338 print
'</table>'.
"\n";
1339 print
'</div>'.
"\n";
1341 print
'</form>'.
"\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
getArrayOfSocialNetworks()
Get array of social network dictionary.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0, $filters= '')
Return an id or code from a code or id.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
img_action($titlealt, $numaction, $picto= '')
Show logo action.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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...
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
isModEnabled($module)
Is Dolibarr module enabled.
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.