40require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
54$langs->loadLangs(array(
"companies",
"suppliers",
"categories"));
59$action =
GETPOST(
'action',
'aZ09');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$toselect =
GETPOST(
'toselect',
'array:int');
64$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contactlist';
65$optioncss =
GETPOST(
'optioncss',
'alpha');
66if ($contextpage ==
'poslist') {
68}$mode =
GETPOST(
'mode',
'alpha');
75$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
76$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
77$search_phone =
GETPOST(
"search_phone",
'alpha');
79$search_id =
GETPOST(
"search_id",
"intcomma");
80$search_ref_ext =
GETPOST(
"search_ref_ext",
"alpha");
81$search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
82$search_lastname =
GETPOST(
"search_lastname",
'alpha');
83$search_firstname =
GETPOST(
"search_firstname",
'alpha');
84$search_societe =
GETPOST(
"search_societe",
'alpha');
85$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
86$search_poste =
GETPOST(
"search_poste",
'alpha');
87$search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
88$search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
89$search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
90$search_fax =
GETPOST(
"search_fax",
'alpha');
91$search_email =
GETPOST(
"search_email",
'alpha');
93 $search_no_email = GETPOSTISSET(
"search_no_email") ?
GETPOSTINT(
"search_no_email") : -1;
95 $search_no_email = -1;
101 foreach ($socialnetworks as $key => $value) {
102 if ($value[
'active']) {
103 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
107$search_priv =
GETPOST(
"search_priv",
'alpha');
108$search_sale =
GETPOST(
'search_sale',
'intcomma');
109$search_categ =
GETPOST(
"search_categ",
'intcomma');
110$search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'intcomma');
111$search_categ_supplier =
GETPOST(
"search_categ_supplier",
'intcomma');
112$search_status =
GETPOST(
"search_status",
"intcomma");
113$search_type =
GETPOST(
'search_type',
'alpha');
114$search_address =
GETPOST(
'search_address',
'alpha');
115$search_zip =
GETPOST(
'search_zip',
'alpha');
116$search_town =
GETPOST(
'search_town',
'alpha');
117$search_import_key =
GETPOST(
"search_import_key",
'alpha');
118$search_country =
GETPOST(
"search_country",
'aZ09');
119$search_roles =
GETPOST(
"search_roles",
'array');
120$search_level =
GETPOST(
"search_level",
'array');
121$search_stcomm =
GETPOST(
'search_stcomm',
'intcomma');
124$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
125$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
127if ($search_status ===
'') {
130if ($search_no_email ===
'') {
131 $search_no_email = -1;
134$optioncss =
GETPOST(
'optioncss',
'alpha');
136$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
139$view =
GETPOST(
"view",
'alpha');
146$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
147$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
153 $sortfield =
"p.lastname";
155if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159$offset = $limit * $page;
160$pageprev = $page - 1;
161$pagenext = $page + 1;
164$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
166 if (empty($contextpage) || $contextpage ==
'contactlist') {
167 $contextpage =
'contactprospectlist';
169 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
172 if (empty($contextpage) || $contextpage ==
'contactlist') {
173 $contextpage =
'contactcustomerlist';
175 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
176} elseif ($type ==
"f") {
177 if (empty($contextpage) || $contextpage ==
'contactlist') {
178 $contextpage =
'contactsupplierlist';
180 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
181} elseif ($type ==
"o") {
182 if (empty($contextpage) || $contextpage ==
'contactlist') {
183 $contextpage =
'contactotherlist';
185 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
191$hookmanager->initHooks(array($contextpage));
193if ($user->socid > 0) {
194 $socid = $user->socid;
199$extrafields->fetch_name_optionals_label(
$object->table_element);
201$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
204$fieldstosearchall = array();
205foreach (
$object->fields as $key => $val) {
207 if (!empty($user->socid) && $key ==
"note_private") {
211 if (empty($val[
'searchall'])) {
215 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
220 $fieldstosearchall[
's.nom'] =
"ThirdParty";
221 $fieldstosearchall[
's.name_alias'] =
"AliasNames";
224$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
225$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
227 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
228} elseif ($reshook == 0) {
229 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
233$arrayfields = array();
234foreach (
$object->fields as $key => $val) {
236 if (!empty($val[
'visible'])) {
237 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
238 $arrayfields[
'p.'.$key] = array(
239 'label' => $val[
'label'],
240 'checked' => (($visible < 0) ?
'0' :
'1'),
241 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
242 'position' => $val[
'position'],
243 'help' => isset($val[
'help']) ? $val[
'help'] :
''
249$arrayfields[
'country.code_iso'] = array(
'label' =>
"Country",
'position' => 66,
'checked' =>
'0');
251 $arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'position' => 113,
'checked' =>
'1');
252 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'position' => 114,
'checked' =>
'1');
255$arrayfields[
'unsubscribed'] = array(
256 'label' =>
'No_Email',
262 foreach ($socialnetworks as $key => $value) {
263 if ($value[
'active']) {
264 $arrayfields[
'p.'.$key] = array(
265 'label' => $value[
'label'],
273$arrayfields[
'p.note_public'] = array(
'label' =>
'NotePublic',
'position' => 350,
'checked' =>
'-1');
274$arrayfields[
'p.note_private'] = array(
'label' =>
'NotePrivate',
'position' => 351,
'checked' =>
'-1');
278include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
285if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
292$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
293$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
294$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
296if (!$permissiontoread) {
305if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
310 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
311 $result = $db->query($sql);
312 $num_lines = $db->num_rows($result);
313 if ($num_lines == 0) {
314 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
316 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
319 $invoice->module_source =
'takepos';
320 $invoice->pos_source = $_SESSION[
"takeposterminal"];
321 $placeid = $invoice->create($user);
322 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
326 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
327 $resql = $db->query($sql);
330 if (!isset($invoice)) {
331 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
333 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
334 $invoice->delete_linked_contact(
'external',
'BILLING');
336 $invoice->add_contact($idcontact,
'BILLING'); ?>
338 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
339 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
341 <?php
if (!$resql) { ?>
342 alert(
'Error failed to update customer on draft invoice.');
344 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
345 parent.$.colorbox.close();
352if (
GETPOST(
'cancel',
'alpha')) {
356if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
360$parameters = array(
'arrayfields' => &$arrayfields);
361$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
366if (empty($reshook)) {
368 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
371 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
374 $search_ref_ext =
'';
375 $search_firstlast_only =
"";
376 $search_lastname =
"";
377 $search_firstname =
"";
378 $search_societe =
"";
379 $search_societe_alias =
"";
381 $search_address =
"";
383 $search_country =
"";
386 $search_phone_perso =
"";
387 $search_phone_pro =
"";
388 $search_phone_mobile =
"";
391 $search_no_email = -1;
393 foreach ($socialnetworks as $key => $value) {
394 if ($value[
'active']) {
405 $search_categ_thirdparty =
'';
406 $search_categ_supplier =
'';
407 $search_import_key =
'';
409 $search_array_options = array();
410 $search_roles = array();
411 $search_birthday_start =
'';
412 $search_birthday_end =
'';
413 $search_note_public =
"";
414 $search_note_private =
"";
418 $objectclass =
'Contact';
419 $objectlabel =
'Contact';
420 $uploaddir = $conf->societe->dir_output;
421 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
423 if ($action ==
'setstcomm' && $permissiontoadd) {
436if ($search_priv < 0) {
441if (!$user->hasRight(
'societe',
'client',
'voir')) {
442 $socid = $user->socid;
450$form =
new Form($db);
453$contactstatic =
new Contact($db);
455$title = $langs->trans(
"ContactsAddresses");
456$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
461 $contactstatic->loadCacheOfProspStatus();
464$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
465$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
469$sql =
"SELECT code, label, sortorder";
470$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
471$sql .=
" WHERE active > 0";
472$sql .=
" ORDER BY sortorder";
473$resql = $db->query($sql);
475 while ($obj = $db->fetch_object($resql)) {
477 $level = $langs->trans($obj->code);
478 if ($level == $obj->code) {
479 $level = $langs->trans($obj->label);
481 $tab_level[$obj->code] = $level;
489$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
490$sql .=
" p.rowid, p.ref_ext, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.birthday,";
491$sql .=
" p.socialnetworks, p.photo,";
492$sql .=
" p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.ip, p.datec as date_creation, p.tms as date_modification,";
493$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel, p.note_public, p.note_private,";
494$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
495$sql .=
" co.label as country, co.code as country_code";
497if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
498 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
499 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
503 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
507$parameters = array();
508$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
509$sql .= $hookmanager->resPrint;
510$sql = preg_replace(
'/,\s*$/',
'', $sql);
514$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
515if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
516 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
518$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
519$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
520$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
523$parameters = array();
524$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
525$sql .= $hookmanager->resPrint;
526$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
527if (!empty($userid)) {
528 $sql .=
" AND p.fk_user_creat=".((int) $userid);
531 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
533if ($search_stcomm !=
'' && $search_stcomm != -2) {
538if ($search_priv !=
'0' && $search_priv !=
'1') {
539 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
541 if ($search_priv ==
'0') {
542 $sql .=
" AND p.priv='0'";
544 if ($search_priv ==
'1') {
545 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
549if (!empty($search_sale) && $search_sale !=
'-1') {
550 if ($search_sale == -2) {
551 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
552 } elseif ($search_sale > 0) {
553 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
558$searchCategoryContactList = $search_categ ? array($search_categ) : array();
559$searchCategoryContactOperator = 0;
561if (!empty($searchCategoryContactList)) {
562 $searchCategoryContactSqlList = array();
563 $listofcategoryid =
'';
564 foreach ($searchCategoryContactList as $searchCategoryContact) {
565 if (intval($searchCategoryContact) == -2) {
566 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
567 } elseif (intval($searchCategoryContact) > 0) {
568 if ($searchCategoryContactOperator == 0) {
569 $searchCategoryContactSqlList[] =
" EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople AND ck.fk_categorie = ".((int) $searchCategoryContact).
")";
571 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
575 if ($listofcategoryid) {
576 $searchCategoryContactSqlList[] =
" EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
578 if ($searchCategoryContactOperator == 1) {
579 if (!empty($searchCategoryContactSqlList)) {
580 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
583 if (!empty($searchCategoryContactSqlList)) {
584 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
590$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
591$searchCategoryCustomerOperator = 0;
593if (!empty($searchCategoryCustomerList)) {
594 $searchCategoryCustomerSqlList = array();
595 $listofcategoryid =
'';
596 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
597 if (intval($searchCategoryCustomer) == -2) {
598 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
599 } elseif (intval($searchCategoryCustomer) > 0) {
600 if ($searchCategoryCustomerOperator == 0) {
601 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).
")";
603 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
607 if ($listofcategoryid) {
608 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
610 if ($searchCategoryCustomerOperator == 1) {
611 if (!empty($searchCategoryCustomerSqlList)) {
612 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
615 if (!empty($searchCategoryCustomerSqlList)) {
616 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
622$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
623$searchCategorySupplierOperator = 0;
625if (!empty($searchCategorySupplierList)) {
626 $searchCategorySupplierSqlList = array();
627 $listofcategoryid =
'';
628 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
629 if (intval($searchCategorySupplier) == -2) {
630 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
631 } elseif (intval($searchCategorySupplier) > 0) {
632 if ($searchCategorySupplierOperator == 0) {
633 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).
")";
635 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
639 if ($listofcategoryid) {
640 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
642 if ($searchCategorySupplierOperator == 1) {
643 if (!empty($searchCategorySupplierSqlList)) {
644 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
647 if (!empty($searchCategorySupplierSqlList)) {
648 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
654 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
656if (strlen($search_phone)) {
657 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
659if (strlen($search_cti)) {
660 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
662if (strlen($search_firstlast_only)) {
663 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
669if ($search_ref_ext) {
672if ($search_lastname) {
675if ($search_firstname) {
678if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
679 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
681 if ($search_societe) {
684 if ($search_societe_alias) {
688if ($search_country) {
689 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
691if (strlen($search_poste)) {
694if (strlen($search_phone_perso)) {
697if (strlen($search_phone_pro)) {
700if (strlen($search_phone_mobile)) {
703if (strlen($search_fax)) {
707 foreach ($socialnetworks as $key => $value) {
708 if ($value[
'active'] && strlen($search_[$key])) {
709 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
710 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
711 $sql .=
" AND p.socialnetworks REGEXP '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
712 } elseif ($db->type ==
'pgsql') {
713 $sql .=
" AND p.socialnetworks ~ '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
716 $sql .=
" AND p.socialnetworks LIKE '%\"".$db->escape($db->escapeforlike($key)).
"\":\"".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"%'";
723if (strlen($search_email)) {
726if (strlen($search_address)) {
729if (strlen($search_zip)) {
732if (strlen($search_town)) {
735if (count($search_roles) > 0) {
736 $sql .=
" AND EXISTS (SELECT sc.rowid FROM ".MAIN_DB_PREFIX.
"societe_contacts as sc WHERE p.rowid = sc.fk_socpeople AND sc.fk_c_type_contact IN (".$db->sanitize(implode(
',', $search_roles)).
"))";
738if ($search_no_email != -1 && $search_no_email > 0) {
739 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
741if ($search_no_email != -1 && $search_no_email == 0) {
742 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
744if ($search_note_public !=
'') {
747if ($search_note_private !=
'') {
750if ($search_status !=
'' && $search_status >= 0) {
751 $sql .=
" AND p.statut = ".((int) $search_status);
753if ($search_import_key) {
757 $sql .=
" AND p.fk_soc IS NULL";
758} elseif ($type ==
"f") {
759 $sql .=
" AND s.fournisseur = 1";
760} elseif ($type ==
"c") {
761 $sql .=
" AND s.client IN (1, 3)";
762} elseif ($type ==
"p") {
763 $sql .=
" AND s.client IN (2, 3)";
766 $sql .=
" AND s.rowid = ".((int) $socid);
768if ($search_birthday_start) {
769 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
771if ($search_birthday_end) {
772 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
776include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
779$parameters = array();
780$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
781$sql .= $hookmanager->resPrint;
785$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
786$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
787$sql .= $hookmanager->resPrint;
791$nbtotalofrecords =
'';
794 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
795 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
796 $resql = $db->query($sqlforcount);
798 $objforcount = $db->fetch_object($resql);
799 $nbtotalofrecords = $objforcount->nbtotalofrecords;
804 if (($page * $limit) > (
int) $nbtotalofrecords) {
812if ($view ==
"recent") {
813 $sql .= $db->order(
"p.datec",
"DESC");
815 $sql .= $db->order($sortfield, $sortorder);
818 $sql .= $db->plimit($limit + 1, $offset);
821$resql = $db->query($sql);
827$num = $db->num_rows($resql);
830if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
831 $obj = $db->fetch_object($resql);
833 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
841llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
843$arrayofselected = is_array($toselect) ? $toselect : array();
847 $param .=
'&mode='.urlencode($mode);
849if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
850 $param .=
'&contextpage='.urlencode($contextpage);
852if ($limit > 0 && $limit != $conf->liste_limit) {
853 $param .=
'&limit='.((int) $limit);
855if ($optioncss !=
'') {
856 $param .=
'&optioncss='.urlencode($optioncss);
858$param .=
'&userid='.urlencode((
string) $userid).
'&contactname='.urlencode((
string) $search_all);
859$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
860if (!empty($search_sale) && $search_sale !=
'-1') {
861 $param .=
'&search_sale='.urlencode($search_sale);
863if (!empty($search_categ) && $search_categ !=
'-1') {
864 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
866if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
867 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
869if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
870 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
872if ($search_all !=
'') {
873 $param .=
'&search_all='.urlencode($search_all);
876 $param .=
"&search_id=".((int) $search_id);
878if ($search_ref_ext) {
879 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
881if ($search_lastname !=
'') {
882 $param .=
'&search_lastname='.urlencode($search_lastname);
884if ($search_firstname !=
'') {
885 $param .=
'&search_firstname='.urlencode($search_firstname);
887if ($search_societe !=
'') {
888 $param .=
'&search_societe='.urlencode($search_societe);
890if ($search_societe_alias !=
'') {
891 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
893if ($search_address !=
'') {
894 $param .=
'&search_address='.urlencode($search_address);
896if ($search_zip !=
'') {
897 $param .=
'&search_zip='.urlencode($search_zip);
899if ($search_town !=
'') {
900 $param .=
'&search_town='.urlencode($search_town);
902if ($search_country !=
'') {
903 $param .=
"&search_country=".urlencode($search_country);
905if ($search_poste !=
'') {
906 $param .=
'&search_poste='.urlencode($search_poste);
908if ($search_phone_pro !=
'') {
909 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
911if ($search_phone_perso !=
'') {
912 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
914if ($search_phone_mobile !=
'') {
915 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
917if ($search_fax !=
'') {
918 $param .=
'&search_fax='.urlencode($search_fax);
920if ($search_email !=
'') {
921 $param .=
'&search_email='.urlencode($search_email);
923if ($search_no_email !=
'') {
924 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
926if ($search_note_private !=
'') {
927 $param .=
'&search_note_private='.urlencode((
string) ($search_note_private));
929if ($search_note_public !=
'') {
930 $param .=
'&search_note_public='.urlencode((
string) ($search_note_public));
932if ($search_stcomm !=
'') {
933 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
935if ($search_status !=
'') {
936 $param .=
'&search_status='.urlencode((
string) ($search_status));
938if ($search_priv ==
'0' || $search_priv ==
'1') {
939 $param .=
"&search_priv=".urlencode($search_priv);
941if ($search_stcomm !=
'') {
942 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
944if (is_array($search_level) && count($search_level)) {
945 foreach ($search_level as $slevel) {
946 $param .=
'&search_level[]='.urlencode($slevel);
949if ($search_import_key !=
'') {
950 $param .=
'&search_import_key='.urlencode($search_import_key);
952if (count($search_roles) > 0) {
953 $param .= implode(
'&search_roles[]=', $search_roles);
955if ($search_birthday_start) {
956 $param .=
'&search_birthday_start='.urlencode(
dol_print_date($search_birthday_start,
'%d')).
'&search_birthday_startmonth='.urlencode(
dol_print_date($search_birthday_start,
'%m')).
'&search_birthday_startyear='.urlencode(
dol_print_date($search_birthday_start,
'%Y'));
958if ($search_birthday_end) {
959 $param .=
'&search_birthday_end='.urlencode(
dol_print_date($search_birthday_end,
'%d')).
'&search_birthday_endmonth='.urlencode(
dol_print_date($search_birthday_end,
'%m')).
'&search_birthday_endyear='.urlencode(
dol_print_date($search_birthday_end,
'%Y'));
965include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
968$arrayofmassactions = array(
969 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
973if (!empty($permissiontodelete)) {
974 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
976if (
isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
977 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
979if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
980 $arrayofmassactions = array();
983$massactionbutton =
'';
984if ($contextpage !=
'poslist') {
985 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
988print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
989if ($optioncss !=
'') {
990 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
992print
'<input type="hidden" name="token" value="'.newToken().
'">';
993print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
994print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
995print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
996print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
998print
'<input type="hidden" name="type" value="'.$type.
'">';
999print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1000print
'<input type="hidden" name="page_y" value="">';
1001print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1005$parameters = array();
1006$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1007if (empty($reshook)) {
1008 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
1009 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
1011 if ($contextpage !=
'poslist') {
1012 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
1013 } elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
1014 $url = DOL_URL_ROOT .
'/contact/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage=' . urlencode($_SERVER[
"PHP_SELF"] .
'?token=' .
newToken() .
'type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
1015 $label =
'MenuNewCustomer';
1016 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1019 $newcardbutton = $hookmanager->resPrint;
1022print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1024$topicmail =
"Information";
1025$modelmail =
"contact";
1027$trackid =
'ctc'.$object->id;
1028include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1032 foreach ($fieldstosearchall as $key => $val) {
1033 $fieldstosearchall[$key] = $langs->trans($val);
1034 $setupstring .= $key.
"=".$val.
";";
1036 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1037 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1039if ($search_firstlast_only) {
1040 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1046if ($user->hasRight(
'societe',
'client',
'voir')) {
1047 $langs->load(
'commercial');
1048 $moreforfilter .=
'<div class="divsearchfield">';
1049 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1050 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1051 $moreforfilter .=
'</div>';
1054if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1055 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1056 $moreforfilter .=
'<div class="divsearchfield">';
1057 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1058 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1059 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (
int) $search_categ,
'search_categ', 1, $tmptitle);
1060 $moreforfilter .=
'</div>';
1061 if (empty($type) || $type ==
'c' || $type ==
'p') {
1062 $moreforfilter .=
'<div class="divsearchfield">';
1065 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1066 } elseif ($type ==
'p') {
1067 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1069 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1071 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1072 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (
int) $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1073 $moreforfilter .=
'</div>';
1076 if (
isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1077 $moreforfilter .=
'<div class="divsearchfield">';
1078 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1079 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1080 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (
int) $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1081 $moreforfilter .=
'</div>';
1085$moreforfilter .=
'<div class="divsearchfield">';
1086$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1087$moreforfilter .=
'</div>';
1089print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1090print $moreforfilter;
1091$parameters = array(
'type' => $type);
1092$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1093print $hookmanager->resPrint;
1096$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1097$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1098$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1100print
'<div class="div-table-responsive">';
1101print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1105print
'<tr class="liste_titre_filter">';
1108 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1109 $searchpicto = $form->showFilterButtons(
'left');
1113if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1114 print
'<td class="liste_titre">';
1115 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1118if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1119 print
'<td class="liste_titre">';
1120 print
'<input class="flat width75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
1123if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1124 print
'<td class="liste_titre">';
1125 print
'<input class="flat width75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
1128if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1129 print
'<td class="liste_titre">';
1130 print
'<input class="flat width50" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1133if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1134 print
'<td class="liste_titre">';
1135 print
'<input class="flat width50" type="text" name="search_poste" value="'.dol_escape_htmltag($search_poste).
'">';
1138if (!empty($arrayfields[
'p.address'][
'checked'])) {
1139 print
'<td class="liste_titre">';
1140 print
'<input class="flat width50" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1143if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1145 print
'<input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1148if (!empty($arrayfields[
'p.town'][
'checked'])) {
1149 print
'<td class="liste_titre">';
1150 print
'<input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1173if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1174 print
'<td class="liste_titre center">';
1175 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1178if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1179 print
'<td class="liste_titre">';
1180 print
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
1183if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1184 print
'<td class="liste_titre">';
1185 print
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
1188if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1189 print
'<td class="liste_titre">';
1190 print
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1193if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1194 print
'<td class="liste_titre">';
1195 print
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
1198if (!empty($arrayfields[
'p.email'][
'checked'])) {
1199 print
'<td class="liste_titre">';
1200 print
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
1203if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1204 print
'<td class="liste_titre center">';
1205 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1209 foreach ($socialnetworks as $key => $value) {
1210 if ($value[
'active']) {
1211 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1212 print
'<td class="liste_titre">';
1213 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
1219if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1220 print
'<td class="liste_titre">';
1221 print
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1225if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1226 print
'<td class="liste_titre" align="left">';
1227 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1230if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1231 print
'<td class="liste_titre center">';
1232 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1233 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1237if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1238 print
'<td class="liste_titre center">';
1239 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1243if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1244 print
'<td class="liste_titre maxwidthonsmartphone center">';
1245 $arraystcomm = array();
1246 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1247 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1249 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1252if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1253 print
'<td class="liste_titre center">';
1254 print
'<div class="nowrap">';
1255 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1257 print
'<div class="nowrap">';
1258 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1264include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1267$parameters = array(
'arrayfields' => $arrayfields);
1268$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1269print $hookmanager->resPrint;
1271if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1272 print
'<td class="liste_titre">';
1276if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1277 print
'<td class="liste_titre">';
1281if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1282 print
'<td class="liste_titre">';
1286if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1287 print
'<td class="liste_titre">';
1288 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1292if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1293 print
'<td class="liste_titre">';
1294 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1298if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1299 print
'<td class="liste_titre center parentonrightofpage">';
1300 print $form->selectarray(
'search_status', array(
'-1' =>
'',
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')), $search_status, 0, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
1303if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1304 print
'<td class="liste_titre center">';
1305 print
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
1310 print
'<td class="liste_titre center maxwidthsearch">';
1311 $searchpicto = $form->showFilterButtons();
1322print
'<tr class="liste_titre">';
1324 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1327if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1328 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1331if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1335if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1336 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1339if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1340 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1343if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1344 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1347if (!empty($arrayfields[
'p.address'][
'checked'])) {
1348 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1351if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1352 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1355if (!empty($arrayfields[
'p.town'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1361if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1365if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1366 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1369if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1370 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1373if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1374 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1377if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1378 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1381if (!empty($arrayfields[
'p.email'][
'checked'])) {
1382 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1385if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1386 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1390 foreach ($socialnetworks as $key => $value) {
1391 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1392 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1397if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1398 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1401if (!empty($arrayfields[
's.nom'][
'checked'])) {
1402 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1405if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1410if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1411 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1414if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1415 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1418if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1419 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1422if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1427include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1429$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1430$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1431print $hookmanager->resPrint;
1433if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1434 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1438if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1439 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1442if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1443 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1446if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1450if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1451 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1454if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1455 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1458if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1459 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1463 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1475$imaxinloop = ($limit ? min($num, $limit) : $num);
1476while ($i < $imaxinloop) {
1477 $obj = $db->fetch_object($resql);
1482 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1483 $contactstatic->id = $obj->rowid;
1484 $contactstatic->ref_ext = $obj->ref_ext;
1485 $contactstatic->lastname = $obj->lastname;
1486 $contactstatic->firstname = $obj->firstname;
1487 $contactstatic->status = $obj->statut;
1488 $contactstatic->statut = $obj->statut;
1489 $contactstatic->poste = $obj->poste;
1490 $contactstatic->email = $obj->email;
1491 $contactstatic->phone_pro = $obj->phone_pro;
1492 $contactstatic->phone_perso = $obj->phone_perso;
1493 $contactstatic->phone_mobile = $obj->phone_mobile;
1494 $contactstatic->address = $obj->address;
1495 $contactstatic->zip = $obj->zip;
1496 $contactstatic->town = $obj->town;
1497 $contactstatic->socialnetworks = $arraysocialnetworks;
1498 $contactstatic->country = $obj->country;
1499 $contactstatic->country_code = $obj->country_code;
1500 $contactstatic->photo = $obj->photo;
1501 $contactstatic->import_key = $obj->import_key;
1502 $contactstatic->photo = $obj->photo;
1503 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1507 if ($mode ==
'kanban') {
1509 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1510 print
'<div class="box-flex-container kanban">';
1513 if ($massactionbutton || $massaction) {
1515 if (in_array(
$object->id, $arrayofselected)) {
1519 if ($obj->socid > 0) {
1520 $contactstatic->fetch_thirdparty($obj->socid);
1522 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1523 if ($i == ($imaxinloop - 1)) {
1529 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select"';
1530 if ($contextpage ==
'poslist') {
1531 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1536 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1537 print '<td class="nowrap center
">';
1538 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1540 if (in_array($obj->rowid, $arrayofselected)) {
1543 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1547 $totalarray['nbfield']++;
1552 if (!empty($arrayfields['p.rowid']['checked'])) {
1553 print '<td class="tdoverflowmax50
">';
1554 print dol_escape_htmltag($obj->rowid);
1557 $totalarray['nbfield']++;
1562 if (!empty($arrayfields['p.lastname']['checked'])) {
1563 print '<td class="middle tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1564 if ($contextpage == 'poslist') {
1565 print $contactstatic->lastname;
1567 print $contactstatic->getNomUrl(1);
1571 $totalarray['nbfield']++;
1576 if (!empty($arrayfields['p.firstname']['checked'])) {
1577 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1578 print dolPrintHTML($obj->firstname);
1581 $totalarray['nbfield']++;
1586 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1587 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1588 print dolPrintHTML($contactstatic->ref_ext);
1591 $totalarray['nbfield']++;
1596 if (!empty($arrayfields['p.poste']['checked'])) {
1597 print '<td class="tdoverflowmax100
">'.dol_escape_htmltag($obj->poste).'</td>';
1599 $totalarray['nbfield']++;
1604 if (!empty($arrayfields['p.address']['checked'])) {
1605 print '<td>'.dol_escape_htmltag($obj->address).'</td>';
1607 $totalarray['nbfield']++;
1612 if (!empty($arrayfields['p.zip']['checked'])) {
1613 print '<td>'.dol_escape_htmltag($obj->zip).'</td>';
1615 $totalarray['nbfield']++;
1620 if (!empty($arrayfields['p.town']['checked'])) {
1621 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town).'</td>';
1623 $totalarray['nbfield']++;
1629 if (!empty($arrayfields['state.nom']['checked']))
1631 print "<td>
".$obj->state_name."</td>\n
";
1632 if (! $i) $totalarray['nbfield']++;
1636 if (!empty($arrayfields['region.nom']['checked']))
1638 print "<td>
".$obj->region_name."</td>\n
";
1639 if (! $i) $totalarray['nbfield']++;
1643 if (!empty($arrayfields['country.code_iso']['checked'])) {
1644 print '<td class="center
">';
1645 $tmparray = getCountry($obj->fk_pays, 'all');
1646 print dol_escape_htmltag($tmparray['label']);
1649 $totalarray['nbfield']++;
1654 if (!empty($arrayfields['p.phone']['checked'])) {
1655 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1657 $totalarray['nbfield']++;
1662 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1663 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1665 $totalarray['nbfield']++;
1670 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1671 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1673 $totalarray['nbfield']++;
1678 if (!empty($arrayfields['p.fax']['checked'])) {
1679 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1681 $totalarray['nbfield']++;
1686 if (!empty($arrayfields['p.email']['checked'])) {
1687 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTML($obj->email).'">';
1688 if ($contextpage == 'poslist') {
1691 print dol_print_email($obj->email, $obj->rowid, $obj->socid, 1, 18, 0, 1);
1695 $totalarray['nbfield']++;
1699 // No EMail Subscription
1700 if (!empty($arrayfields['unsubscribed']['checked'])) {
1701 print '<td class="center
">';
1702 if (empty($obj->email)) {
1703 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1705 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1709 $totalarray['nbfield']++;
1714 if (isModEnabled('socialnetworks')) {
1715 foreach ($socialnetworks as $key => $value) {
1716 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1717 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1719 $totalarray['nbfield']++;
1725 // Company / Third Party
1726 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1727 print '<td class="tdoverflowmax125
">';
1729 $objsoc = new Societe($db);
1730 $objsoc->fetch($obj->socid);
1731 $option_link = 'customer';
1732 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1733 $option_link = 'supplier';
1734 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1737 if ($contextpage == 'poslist') {
1738 print $objsoc->name;
1740 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1747 $totalarray['nbfield']++;
1752 if (!empty($arrayfields['s.name_alias']['checked'])) {
1753 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->alias).'">';
1754 print dol_escape_htmltag($obj->alias);
1757 $totalarray['nbfield']++;
1762 if (!empty($arrayfields['p.priv']['checked'])) {
1763 print '<td class="center
">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
1765 $totalarray['nbfield']++;
1770 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1771 print '<td class="center
">';
1772 print $contactstatic->getLibProspLevel();
1775 $totalarray['nbfield']++;
1780 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1781 print '<td class="center nowrap
"><div class="nowrap
">';
1782 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1783 print '</div> - <div class="inline-block
">';
1784 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1785 $titlealt = 'default';
1786 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1787 $titlealt = $val['label'];
1789 if ($obj->stcomm_id != $val['id']) {
1790 print '<a class="pictosubstatus
" href="'.$_SERVER["PHP_SELF"].'?stcommcontactid=
'.$obj->rowid.'&stcomm=
'.urlencode((string) ($val['code
'])).'&action=setstcomm&token=
'.newToken().$param.($page ? '&page=
'.urlencode((string) ($page)) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
1793 print '</div></div></td>';
1795 $totalarray['nbfield']++;
1800 if (!empty($arrayfields['p.birthday']['checked'])) {
1801 print '<td class="center nowraponall
">';
1802 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1805 $totalarray['nbfield']++;
1810 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1813 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1814 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1815 print $hookmanager->resPrint;
1818 if (!empty($arrayfields['p.ip']['checked'])) {
1819 print '<td class="center nowraponall
">';
1820 print dol_print_ip($obj->ip);
1823 $totalarray['nbfield']++;
1828 if (!empty($arrayfields['p.datec']['checked'])) {
1829 print '<td class="center nowraponall
">';
1830 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1833 $totalarray['nbfield']++;
1837 // Date modification
1838 if (!empty($arrayfields['p.tms']['checked'])) {
1839 print '<td class="center nowraponall
">';
1840 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1843 $totalarray['nbfield']++;
1848 if (!empty($arrayfields['p.note_public']['checked'])) {
1849 print '<td class="flat maxwidth250imp
">';
1850 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1853 $totalarray['nbfield']++;
1857 if (!empty($arrayfields['p.note_private']['checked'])) {
1858 print '<td class="flat maxwidth250imp
">';
1859 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1862 $totalarray['nbfield']++;
1867 if (!empty($arrayfields['p.statut']['checked'])) {
1868 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1870 $totalarray['nbfield']++;
1875 if (!empty($arrayfields['p.import_key']['checked'])) {
1876 print '<td class="tdoverflowmax100
">';
1877 print dol_escape_htmltag($obj->import_key);
1880 $totalarray['nbfield']++;
1885 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1886 print '<td class="nowrap center
">';
1887 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1889 if (in_array($obj->rowid, $arrayofselected)) {
1892 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1896 $totalarray['nbfield']++;
1906include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1908// If no record found
1911 foreach ($arrayfields as $key => $val) {
1912 if (!empty($val['checked'])) {
1916 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
1921$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1922$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1923print $hookmanager->resPrint;
1925print '</table>'."\n
";
1928print '</form>'."\n
";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
getArrayOfSocialNetworks()
Get array of social network dictionary.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.