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",
"categories",
"suppliers",
"other"));
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') {
69$mode =
GETPOST(
'mode',
'alpha');
77$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
78$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
79$search_phone =
GETPOST(
"search_phone",
'alpha');
81$search_id =
GETPOST(
"search_id",
"intcomma");
82$search_ref_ext =
GETPOST(
"search_ref_ext",
"alpha");
83$search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
84$search_lastname =
GETPOST(
"search_lastname",
'alpha');
85$search_firstname =
GETPOST(
"search_firstname",
'alpha');
86$search_societe =
GETPOST(
"search_societe",
'alpha');
87$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
88$search_poste =
GETPOST(
"search_poste",
'alpha');
89$search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
90$search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
91$search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
92$search_fax =
GETPOST(
"search_fax",
'alpha');
93$search_email =
GETPOST(
"search_email",
'alpha');
95 $search_no_email = GETPOSTISSET(
"search_no_email") ?
GETPOSTINT(
"search_no_email") : -1;
97 $search_no_email = -1;
103 foreach ($socialnetworks as $key => $value) {
104 if ($value[
'active']) {
105 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
109$search_priv =
GETPOST(
"search_priv",
'alpha');
110$search_sale =
GETPOST(
'search_sale',
'intcomma');
111$search_categ =
GETPOST(
"search_categ",
'intcomma');
112$search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'intcomma');
113$search_categ_supplier =
GETPOST(
"search_categ_supplier",
'intcomma');
114$search_status =
GETPOST(
"search_status",
"intcomma");
115$search_type =
GETPOST(
'search_type',
'alpha');
116$search_address =
GETPOST(
'search_address',
'alpha');
117$search_zip =
GETPOST(
'search_zip',
'alpha');
118$search_town =
GETPOST(
'search_town',
'alpha');
119$search_state = trim(
GETPOST(
"search_state",
'alpha'));
120$search_region = trim(
GETPOST(
"search_region",
'alpha'));
121$search_import_key =
GETPOST(
"search_import_key",
'alpha');
122$search_country =
GETPOST(
"search_country",
'aZ09');
123$search_roles =
GETPOST(
"search_roles",
'array');
124$search_level =
GETPOST(
"search_level",
'array');
125$search_stcomm =
GETPOST(
'search_stcomm',
'intcomma');
127$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
128$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
129$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
130$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
131$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
132$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
133$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
134$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
136$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
137$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
138$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
139$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
140$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
141$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
142$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
143$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
147$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
148$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
150if ($search_status ===
'') {
153if ($search_no_email ===
'') {
154 $search_no_email = -1;
157$optioncss =
GETPOST(
'optioncss',
'alpha');
159$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
162$view =
GETPOST(
"view",
'alpha');
169$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
170$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
176 $sortfield =
"p.lastname";
178if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
182$offset = $limit * $page;
183$pageprev = $page - 1;
184$pagenext = $page + 1;
187$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
189 if (empty($contextpage) || $contextpage ==
'contactlist') {
190 $contextpage =
'contactprospectlist';
192 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
195 if (empty($contextpage) || $contextpage ==
'contactlist') {
196 $contextpage =
'contactcustomerlist';
198 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
199} elseif ($type ==
"f") {
200 if (empty($contextpage) || $contextpage ==
'contactlist') {
201 $contextpage =
'contactsupplierlist';
203 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
204} elseif ($type ==
"o") {
205 if (empty($contextpage) || $contextpage ==
'contactlist') {
206 $contextpage =
'contactotherlist';
208 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
214$hookmanager->initHooks(array($contextpage));
216if ($user->socid > 0) {
217 $socid = $user->socid;
222$extrafields->fetch_name_optionals_label(
$object->table_element);
224$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
227$fieldstosearchall = array();
228foreach (
$object->fields as $key => $val) {
230 if (!empty($user->socid) && $key ==
"note_private") {
234 if (empty($val[
'searchall'])) {
238 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
243 $fieldstosearchall[
's.nom'] =
"ThirdParty";
244 $fieldstosearchall[
's.name_alias'] =
"AliasNames";
247$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
248$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
250 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
251} elseif ($reshook == 0) {
252 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
256$arrayfields = array();
257foreach (
$object->fields as $key => $val) {
259 if (!empty($val[
'visible'])) {
260 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
261 $arrayfields[
'p.'.$key] = array(
262 'label' => $val[
'label'],
263 'checked' => (($visible < 0) ?
'0' :
'1'),
264 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
265 'position' => $val[
'position'],
266 'help' => isset($val[
'help']) ? $val[
'help'] :
''
272$arrayfields[
'state.nom'] = array(
'label' =>
"State",
'position' => 66,
'checked' =>
'0');
273$arrayfields[
'region.nom'] = array(
'label' =>
"Region",
'position' => 67,
'checked' =>
'0');
274$arrayfields[
'country.code_iso'] = array(
'label' =>
"Country",
'position' => 68,
'checked' =>
'0');
276 $arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'position' => 113,
'checked' =>
'1');
277 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'position' => 114,
'checked' =>
'1');
280$arrayfields[
'unsubscribed'] = array(
281 'label' =>
'No_Email',
287 foreach ($socialnetworks as $key => $value) {
288 if ($value[
'active']) {
289 $arrayfields[
'p.'.$key] = array(
290 'label' => $value[
'label'],
298$arrayfields[
'p.note_public'] = array(
'label' =>
'NotePublic',
'position' => 350,
'checked' =>
'-1');
299$arrayfields[
'p.note_private'] = array(
'label' =>
'NotePrivate',
'position' => 351,
'checked' =>
'-1');
303include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
306$parameters = array(
'arrayfields' => &$arrayfields);
307$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
314if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
321$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
322$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
323$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
325if (!$permissiontoread) {
334if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
339 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
340 $result =
$db->query($sql);
341 $num_lines =
$db->num_rows($result);
342 if ($num_lines == 0) {
343 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
345 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
348 $invoice->module_source =
'takepos';
349 $invoice->pos_source = $_SESSION[
"takeposterminal"];
350 $placeid = $invoice->create($user);
351 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
355 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
356 $resql =
$db->query($sql);
359 if (!isset($invoice)) {
360 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
362 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
363 $invoice->delete_linked_contact(
'external',
'BILLING');
365 $invoice->add_contact($idcontact,
'BILLING'); ?>
367 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
368 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
370 <?php
if (!$resql) { ?>
371 alert(
'Error failed to update customer on draft invoice.');
373 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
374 parent.$.colorbox.close();
381if (
GETPOST(
'cancel',
'alpha')) {
385if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
389$parameters = array(
'arrayfields' => &$arrayfields);
390$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
395if (empty($reshook)) {
397 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
400 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
403 $search_ref_ext =
'';
404 $search_firstlast_only =
"";
405 $search_lastname =
"";
406 $search_firstname =
"";
407 $search_societe =
"";
408 $search_societe_alias =
"";
410 $search_address =
"";
414 $search_country =
"";
417 $search_phone_perso =
"";
418 $search_phone_pro =
"";
419 $search_phone_mobile =
"";
422 $search_no_email = -1;
424 foreach ($socialnetworks as $key => $value) {
425 if ($value[
'active']) {
433 $search_date_creation_startmonth =
"";
434 $search_date_creation_startyear =
"";
435 $search_date_creation_startday =
"";
436 $search_date_creation_start =
"";
437 $search_date_creation_endmonth =
"";
438 $search_date_creation_endyear =
"";
439 $search_date_creation_endday =
"";
440 $search_date_creation_end =
"";
441 $search_date_modif_startmonth =
"";
442 $search_date_modif_startyear =
"";
443 $search_date_modif_startday =
"";
444 $search_date_modif_start =
"";
445 $search_date_modif_endmonth =
"";
446 $search_date_modif_endyear =
"";
447 $search_date_modif_endday =
"";
448 $search_date_modif_end =
"";
452 $search_categ_thirdparty =
'';
453 $search_categ_supplier =
'';
454 $search_import_key =
'';
456 $search_array_options = array();
457 $search_roles = array();
458 $search_birthday_start =
'';
459 $search_birthday_end =
'';
460 $search_note_public =
"";
461 $search_note_private =
"";
465 $objectclass =
'Contact';
466 $objectlabel =
'Contact';
467 $uploaddir =
$conf->societe->dir_output;
468 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
470 if ($action ==
'setstcomm' && $permissiontoadd) {
483if ($search_priv < 0) {
488if (!$user->hasRight(
'societe',
'client',
'voir')) {
489 $socid = $user->socid;
502$title = $langs->trans(
"ContactsAddresses");
503$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
508 $contactstatic->loadCacheOfProspStatus();
511$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
512$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
516$sql =
"SELECT code, label, sortorder";
517$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
518$sql .=
" WHERE active > 0";
519$sql .=
" ORDER BY sortorder";
520$resql =
$db->query($sql);
522 while ($obj =
$db->fetch_object($resql)) {
524 $level = $langs->trans($obj->code);
525 if ($level == $obj->code) {
526 $level = $langs->trans($obj->label);
528 $tab_level[$obj->code] = $level;
536$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
537$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,";
538$sql .=
" p.socialnetworks, p.photo,";
539$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,";
540$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel, p.note_public, p.note_private,";
541$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
542$sql .=
" co.label as country, co.code as country_code,";
543$sql .=
" state.code_departement as state_code, state.nom as state_name,";
544$sql .=
" region.code_region as region_code, region.nom as region_name";
546if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
547 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
548 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
552 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
556$parameters = array();
557$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
558$sql .= $hookmanager->resPrint;
559$sql = preg_replace(
'/,\s*$/',
'', $sql);
563$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
564if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
565 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
567$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
568$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
569$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = p.fk_departement)";
570$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
571$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
574$parameters = array();
575$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
576$sql .= $hookmanager->resPrint;
577$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
578if (!empty($userid)) {
579 $sql .=
" AND p.fk_user_creat=".((int) $userid);
582 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
584if ($search_stcomm !=
'' && $search_stcomm != -2) {
589if ($search_priv !=
'0' && $search_priv !=
'1') {
590 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
592 if ($search_priv ==
'0') {
593 $sql .=
" AND p.priv='0'";
595 if ($search_priv ==
'1') {
596 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
600if (!empty($search_sale) && $search_sale !=
'-1') {
601 if ($search_sale == -2) {
602 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
603 } elseif ($search_sale > 0) {
604 $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).
")";
609$searchCategoryContactList = $search_categ ? array($search_categ) : array();
610$searchCategoryContactOperator = 0;
612if (!empty($searchCategoryContactList)) {
613 $searchCategoryContactSqlList = array();
614 $listofcategoryid =
'';
615 foreach ($searchCategoryContactList as $searchCategoryContact) {
616 if (intval($searchCategoryContact) == -2) {
617 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
618 } elseif (intval($searchCategoryContact) > 0) {
619 if ($searchCategoryContactOperator == 0) {
620 $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).
")";
622 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
626 if ($listofcategoryid) {
627 $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).
"))";
629 if ($searchCategoryContactOperator == 1) {
630 if (!empty($searchCategoryContactSqlList)) {
631 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
634 if (!empty($searchCategoryContactSqlList)) {
635 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
641$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
642$searchCategoryCustomerOperator = 0;
644if (!empty($searchCategoryCustomerList)) {
645 $searchCategoryCustomerSqlList = array();
646 $listofcategoryid =
'';
647 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
648 if (intval($searchCategoryCustomer) == -2) {
649 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
650 } elseif (intval($searchCategoryCustomer) > 0) {
651 if ($searchCategoryCustomerOperator == 0) {
652 $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).
")";
654 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
658 if ($listofcategoryid) {
659 $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).
"))";
661 if ($searchCategoryCustomerOperator == 1) {
662 if (!empty($searchCategoryCustomerSqlList)) {
663 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
666 if (!empty($searchCategoryCustomerSqlList)) {
667 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
673$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
674$searchCategorySupplierOperator = 0;
676if (!empty($searchCategorySupplierList)) {
677 $searchCategorySupplierSqlList = array();
678 $listofcategoryid =
'';
679 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
680 if (intval($searchCategorySupplier) == -2) {
681 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
682 } elseif (intval($searchCategorySupplier) > 0) {
683 if ($searchCategorySupplierOperator == 0) {
684 $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).
")";
686 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
690 if ($listofcategoryid) {
691 $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).
"))";
693 if ($searchCategorySupplierOperator == 1) {
694 if (!empty($searchCategorySupplierSqlList)) {
695 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
698 if (!empty($searchCategorySupplierSqlList)) {
699 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
705 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
707if (strlen($search_phone)) {
708 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
710if (strlen($search_cti)) {
711 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
713if (strlen($search_firstlast_only)) {
714 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
720if ($search_ref_ext) {
723if ($search_lastname) {
726if ($search_firstname) {
729if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
730 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
732 if ($search_societe) {
735 if ($search_societe_alias) {
739if ($search_country) {
740 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
742if (strlen($search_poste)) {
745if (strlen($search_phone_perso)) {
748if (strlen($search_phone_pro)) {
751if (strlen($search_phone_mobile)) {
754if (strlen($search_fax)) {
758 foreach ($socialnetworks as $key => $value) {
759 if ($value[
'active'] && strlen($search_[$key])) {
760 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
761 if (in_array(
$db->type, array(
'mysql',
'mysqli'))) {
762 $sql .=
" AND p.socialnetworks REGEXP '".$db->escape(
"\"".
$db->escapeforlike($key).
"\":\"[^\"]*".
$db->escapeforlike($searchkeyinjsonformat)).
"'";
763 } elseif (
$db->type ==
'pgsql') {
764 $sql .=
" AND p.socialnetworks ~ '".$db->escape(
"\"".
$db->escapeforlike($key).
"\":\"[^\"]*".
$db->escapeforlike($searchkeyinjsonformat)).
"'";
767 $sql .=
" AND p.socialnetworks LIKE '".$db->escape(
"%\"".
$db->escapeforlike($key.
"\":\"".$searchkeyinjsonformat).
"%").
"'";
774if (strlen($search_email)) {
777if (strlen($search_address)) {
780if (strlen($search_zip)) {
783if (strlen($search_town)) {
792if (count($search_roles) > 0) {
793 $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)).
"))";
795if ($search_no_email != -1 && $search_no_email > 0) {
796 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
798if ($search_no_email != -1 && $search_no_email == 0) {
799 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
801if ($search_note_public !=
'') {
804if ($search_note_private !=
'') {
807if ($search_date_creation_start) {
808 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
810if ($search_date_creation_end) {
811 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
814if ($search_date_modif_start) {
815 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
817if ($search_date_modif_end) {
818 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
820if ($search_status !=
'' && $search_status >= 0) {
821 $sql .=
" AND p.statut = ".((int) $search_status);
823if ($search_import_key) {
827 $sql .=
" AND p.fk_soc IS NULL";
828} elseif ($type ==
"f") {
829 $sql .=
" AND s.fournisseur = 1";
830} elseif ($type ==
"c") {
831 $sql .=
" AND s.client IN (1, 3)";
832} elseif ($type ==
"p") {
833 $sql .=
" AND s.client IN (2, 3)";
836 $sql .=
" AND s.rowid = ".((int) $socid);
838if ($search_birthday_start) {
839 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
841if ($search_birthday_end) {
842 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
846include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
849$parameters = array();
850$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
851$sql .= $hookmanager->resPrint;
855$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
856$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
857$sql .= $hookmanager->resPrint;
861$nbtotalofrecords =
'';
864 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
865 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
866 $resql =
$db->query($sqlforcount);
868 $objforcount =
$db->fetch_object($resql);
869 $nbtotalofrecords = $objforcount->nbtotalofrecords;
874 if (($page * $limit) > (
int) $nbtotalofrecords) {
882if ($view ==
"recent") {
883 $sql .=
$db->order(
"p.datec",
"DESC");
885 $sql .=
$db->order($sortfield, $sortorder);
888 $sql .=
$db->plimit($limit + 1, $offset);
891$resql =
$db->query($sql);
897$num =
$db->num_rows($resql);
900if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
901 $obj =
$db->fetch_object($resql);
903 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
911llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
913$arrayofselected = is_array($toselect) ? $toselect : array();
917 $param .=
'&mode='.urlencode($mode);
919if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
920 $param .=
'&contextpage='.urlencode($contextpage);
922if ($limit > 0 && $limit !=
$conf->liste_limit) {
923 $param .=
'&limit='.((int) $limit);
925if ($optioncss !=
'') {
926 $param .=
'&optioncss='.urlencode($optioncss);
928$param .=
'&userid='.urlencode((
string) $userid).
'&contactname='.urlencode((
string) $search_all);
929$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
930if (!empty($search_sale) && $search_sale !=
'-1') {
931 $param .=
'&search_sale='.urlencode($search_sale);
933if (!empty($search_categ) && $search_categ !=
'-1') {
934 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
936if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
937 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
939if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
940 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
942if ($search_all !=
'') {
943 $param .=
'&search_all='.urlencode($search_all);
946 $param .=
"&search_id=".((int) $search_id);
948if ($search_ref_ext) {
949 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
951if ($search_lastname !=
'') {
952 $param .=
'&search_lastname='.urlencode($search_lastname);
954if ($search_firstname !=
'') {
955 $param .=
'&search_firstname='.urlencode($search_firstname);
957if ($search_societe !=
'') {
958 $param .=
'&search_societe='.urlencode($search_societe);
960if ($search_societe_alias !=
'') {
961 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
963if ($search_address !=
'') {
964 $param .=
'&search_address='.urlencode($search_address);
966if ($search_zip !=
'') {
967 $param .=
'&search_zip='.urlencode($search_zip);
969if ($search_town !=
'') {
970 $param .=
'&search_town='.urlencode($search_town);
972if ($search_state !=
'') {
973 $param .=
"&search_state=".urlencode($search_state);
975if ($search_region !=
'') {
976 $param .=
"&search_region=".urlencode($search_region);
978if ($search_country !=
'') {
979 $param .=
"&search_country=".urlencode($search_country);
981if ($search_poste !=
'') {
982 $param .=
'&search_poste='.urlencode($search_poste);
984if ($search_phone_pro !=
'') {
985 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
987if ($search_phone_perso !=
'') {
988 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
990if ($search_phone_mobile !=
'') {
991 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
993if ($search_fax !=
'') {
994 $param .=
'&search_fax='.urlencode($search_fax);
996if ($search_email !=
'') {
997 $param .=
'&search_email='.urlencode($search_email);
999if ($search_no_email !=
'') {
1000 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
1002if ($search_note_private !=
'') {
1003 $param .=
'&search_note_private='.urlencode((
string) ($search_note_private));
1005if ($search_note_public !=
'') {
1006 $param .=
'&search_note_public='.urlencode((
string) ($search_note_public));
1008if ($search_date_creation_startmonth) {
1009 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1011if ($search_date_creation_startyear) {
1012 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1014if ($search_date_creation_startday) {
1015 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1017if ($search_date_creation_start) {
1018 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1020if ($search_date_creation_endmonth) {
1021 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1023if ($search_date_creation_endyear) {
1024 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1026if ($search_date_creation_endday) {
1027 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1029if ($search_date_creation_end) {
1030 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1032if ($search_date_modif_startmonth) {
1033 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1035if ($search_date_modif_startyear) {
1036 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1038if ($search_date_modif_startday) {
1039 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1041if ($search_date_modif_start) {
1042 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1044if ($search_date_modif_endmonth) {
1045 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1047if ($search_date_modif_endyear) {
1048 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1050if ($search_date_modif_endday) {
1051 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1053if ($search_date_modif_end) {
1054 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1056if ($search_stcomm !=
'') {
1057 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1059if ($search_status !=
'') {
1060 $param .=
'&search_status='.urlencode((
string) ($search_status));
1062if ($search_priv ==
'0' || $search_priv ==
'1') {
1063 $param .=
"&search_priv=".urlencode($search_priv);
1065if ($search_stcomm !=
'') {
1066 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1068if (is_array($search_level) && count($search_level)) {
1069 foreach ($search_level as $slevel) {
1070 $param .=
'&search_level[]='.urlencode($slevel);
1073if ($search_import_key !=
'') {
1074 $param .=
'&search_import_key='.urlencode($search_import_key);
1076if (count($search_roles) > 0) {
1077 $param .= implode(
'&search_roles[]=', $search_roles);
1079if ($search_birthday_start) {
1080 $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'));
1082if ($search_birthday_end) {
1083 $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'));
1086include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1089$arrayofmassactions = array(
1090 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1094if (!empty($permissiontodelete)) {
1095 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1097if (
isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
1098 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1100if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
1101 $arrayofmassactions = array();
1104$massactionbutton =
'';
1105if ($contextpage !=
'poslist') {
1106 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1109print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
1110if ($optioncss !=
'') {
1111 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1113print
'<input type="hidden" name="token" value="'.newToken().
'">';
1114print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1115print
'<input type="hidden" name="view" value="'.dolPrintHTMLForAttribute($view).
'">';
1116print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1117print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1119print
'<input type="hidden" name="type" value="'.$type.
'">';
1120print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1121print
'<input type="hidden" name="page_y" value="">';
1122print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1126$parameters = array();
1127$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1128if (empty($reshook)) {
1129 $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'));
1130 $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'));
1132 if ($contextpage !=
'poslist') {
1133 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
1134 } elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
1135 $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);
1136 $label =
'MenuNewCustomer';
1137 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1140 $newcardbutton = $hookmanager->resPrint;
1143print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1145$topicmail =
"Information";
1146$modelmail =
"contact";
1148$trackid =
'ctc'.$object->id;
1149include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1153 foreach ($fieldstosearchall as $key => $val) {
1154 $fieldstosearchall[$key] = $langs->trans($val);
1155 $setupstring .= $key.
"=".$val.
";";
1157 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1158 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1160if ($search_firstlast_only) {
1161 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1167if ($user->hasRight(
'societe',
'client',
'voir')) {
1168 $langs->load(
'commercial');
1169 $moreforfilter .=
'<div class="divsearchfield">';
1170 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1171 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1172 $moreforfilter .=
'</div>';
1175if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1176 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1177 $moreforfilter .=
'<div class="divsearchfield">';
1178 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1179 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1180 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (
int) $search_categ,
'search_categ', 1, $tmptitle);
1181 $moreforfilter .=
'</div>';
1182 if (empty($type) || $type ==
'c' || $type ==
'p') {
1183 $moreforfilter .=
'<div class="divsearchfield">';
1186 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1187 } elseif ($type ==
'p') {
1188 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1190 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1192 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1193 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (
int) $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1194 $moreforfilter .=
'</div>';
1197 if (
isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1198 $moreforfilter .=
'<div class="divsearchfield">';
1199 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1200 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1201 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (
int) $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1202 $moreforfilter .=
'</div>';
1206$moreforfilter .=
'<div class="divsearchfield">';
1207$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1208$moreforfilter .=
'</div>';
1210print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1211print $moreforfilter;
1212$parameters = array(
'type' => $type);
1213$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1214print $hookmanager->resPrint;
1217$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1218$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1219$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1221print
'<div class="div-table-responsive">';
1222print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1226print
'<tr class="liste_titre_filter">';
1228if (
$conf->main_checkbox_left_column) {
1229 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1230 $searchpicto = $form->showFilterButtons(
'left');
1234if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1235 print
'<td class="liste_titre">';
1236 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dolPrintHTMLForAttribute($search_id).
'">';
1239if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1240 print
'<td class="liste_titre">';
1241 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_lastname" value="'.dolPrintHTMLForAttribute($search_lastname).
'">';
1244if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1246 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_firstname" value="'.dolPrintHTMLForAttribute($search_firstname).
'">';
1249if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1250 print
'<td class="liste_titre">';
1251 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_ref_ext" value="'.dolPrintHTMLForAttribute($search_ref_ext).
'">';
1254if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1255 print
'<td class="liste_titre">';
1256 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_poste" value="'.dolPrintHTMLForAttribute($search_poste).
'">';
1259if (!empty($arrayfields[
'p.address'][
'checked'])) {
1260 print
'<td class="liste_titre">';
1261 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dolPrintHTMLForAttribute($search_address).
'">';
1264if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1265 print
'<td class="liste_titre">';
1266 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dolPrintHTMLForAttribute($search_zip).
'">';
1269if (!empty($arrayfields[
'p.town'][
'checked'])) {
1270 print
'<td class="liste_titre">';
1271 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dolPrintHTMLForAttribute($search_town).
'">';
1275if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1276 print
'<td class="liste_titre">';
1277 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dolPrintHTMLForAttribute($search_state).
'">';
1281if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1282 print
'<td class="liste_titre">';
1283 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dolPrintHTMLForAttribute($search_region).
'">';
1287if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1288 print
'<td class="liste_titre center">';
1289 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1292if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1293 print
'<td class="liste_titre">';
1294 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_pro" size="6" value="'.dolPrintHTMLForAttribute($search_phone_pro).
'">';
1297if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1298 print
'<td class="liste_titre">';
1299 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_perso" size="6" value="'.dolPrintHTMLForAttribute($search_phone_perso).
'">';
1302if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1303 print
'<td class="liste_titre">';
1304 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" size="6" value="'.dolPrintHTMLForAttribute($search_phone_mobile).
'">';
1307if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1308 print
'<td class="liste_titre">';
1309 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" size="6" value="'.dolPrintHTMLForAttribute($search_fax).
'">';
1312if (!empty($arrayfields[
'p.email'][
'checked'])) {
1313 print
'<td class="liste_titre">';
1314 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" size="6" value="'.dolPrintHTMLForAttribute($search_email).
'">';
1317if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1318 print
'<td class="liste_titre center">';
1319 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1323 foreach ($socialnetworks as $key => $value) {
1324 if ($value[
'active']) {
1325 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1326 print
'<td class="liste_titre">';
1327 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dolPrintHTMLForAttribute($search_[$key]).
'">';
1333if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1334 print
'<td class="liste_titre">';
1335 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe" size="8" value="'.dolPrintHTMLForAttribute($search_societe).
'">';
1339if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1340 print
'<td class="liste_titre left">';
1341 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe_alias" value="'.dolPrintHTMLForAttribute($search_societe_alias).
'">';
1344if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1345 print
'<td class="liste_titre center">';
1346 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1347 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1351if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1352 print
'<td class="liste_titre center">';
1353 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1357if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1358 print
'<td class="liste_titre maxwidthonsmartphone center">';
1359 $arraystcomm = array();
1360 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1361 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1363 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1366if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1367 print
'<td class="liste_titre center">';
1368 print
'<div class="nowrap">';
1369 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1371 print
'<div class="nowrap">';
1372 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1378include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1381$parameters = array(
'arrayfields' => $arrayfields);
1382$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1383print $hookmanager->resPrint;
1385if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1386 print
'<td class="liste_titre center nowraponall">';
1390if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1391 print
'<td class="liste_titre center nowraponall">';
1392 print
'<div class="nowrapfordate">';
1393 print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1395 print
'<div class="nowrapfordate">';
1396 print $form->selectDate($search_date_creation_end ? $search_date_creation_end : -1,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1401if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1402 print
'<td class="liste_titre center nowraponall">';
1403 print
'<div class="nowrapfordate">';
1404 print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1,
'search_date_modif_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1406 print
'<div class="nowrapfordate">';
1407 print $form->selectDate($search_date_modif_end ? $search_date_modif_end : -1,
'search_date_modif_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1412if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1413 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1414 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');
1417if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1418 print
'<td class="liste_titre center">';
1419 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" size="3" value="'.dolPrintHTMLForAttribute($search_import_key).
'">';
1423if (!
$conf->main_checkbox_left_column) {
1424 print
'<td class="liste_titre center maxwidthsearch">';
1425 $searchpicto = $form->showFilterButtons();
1436print
'<tr class="liste_titre">';
1437if (
$conf->main_checkbox_left_column) {
1438 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1441if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1442 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1445if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1446 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1449if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1453if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1454 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1457if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1458 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1461if (!empty($arrayfields[
'p.address'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1465if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1466 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1469if (!empty($arrayfields[
'p.town'][
'checked'])) {
1470 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1473if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1477if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1478 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1481if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1482 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1485if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1486 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1489if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1490 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1493if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1494 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1497if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1498 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1501if (!empty($arrayfields[
'p.email'][
'checked'])) {
1502 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1505if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1506 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1510 foreach ($socialnetworks as $key => $value) {
1511 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1512 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1517if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1521if (!empty($arrayfields[
's.nom'][
'checked'])) {
1522 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1525if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1530if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1531 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1534if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1535 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1538if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1539 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1542if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1543 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1547include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1549$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
1550$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1551print $hookmanager->resPrint;
1553if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1554 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1558if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1559 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1562if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1563 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1566if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1567 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1570if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1571 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1574if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1575 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1578if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1579 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1582if (!
$conf->main_checkbox_left_column) {
1583 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1595$imaxinloop = ($limit ? min($num, $limit) : $num);
1596while ($i < $imaxinloop) {
1597 $obj =
$db->fetch_object($resql);
1602 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1603 $contactstatic->id = $obj->rowid;
1604 $contactstatic->ref_ext = $obj->ref_ext;
1605 $contactstatic->lastname = $obj->lastname;
1606 $contactstatic->firstname = $obj->firstname;
1607 $contactstatic->status = $obj->statut;
1608 $contactstatic->statut = $obj->statut;
1609 $contactstatic->poste = $obj->poste;
1610 $contactstatic->email = $obj->email;
1611 $contactstatic->phone_pro = $obj->phone_pro;
1612 $contactstatic->phone_perso = $obj->phone_perso;
1613 $contactstatic->phone_mobile = $obj->phone_mobile;
1614 $contactstatic->address = $obj->address;
1615 $contactstatic->zip = $obj->zip;
1616 $contactstatic->town = $obj->town;
1617 $contactstatic->state = $obj->state_name;
1618 $contactstatic->region = $obj->region_name;
1619 $contactstatic->socialnetworks = $arraysocialnetworks;
1620 $contactstatic->country = $obj->country;
1621 $contactstatic->country_code = $obj->country_code;
1622 $contactstatic->photo = $obj->photo;
1623 $contactstatic->import_key = $obj->import_key;
1624 $contactstatic->photo = $obj->photo;
1625 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1629 if ($mode ==
'kanban') {
1631 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1632 print
'<div class="box-flex-container kanban">';
1635 if ($massactionbutton || $massaction) {
1637 if (in_array(
$object->id, $arrayofselected)) {
1641 if ($obj->socid > 0) {
1642 $contactstatic->fetch_thirdparty($obj->socid);
1644 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1645 if ($i == ($imaxinloop - 1)) {
1651 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select"';
1652 if ($contextpage ==
'poslist') {
1653 print
' onclick="location.href=\'list.php?action=change&token='.newToken().
'&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1658 if ($conf->main_checkbox_left_column) {
1659 print '<td class="nowrap center
">';
1660 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1662 if (in_array($obj->rowid, $arrayofselected)) {
1665 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1669 $totalarray['nbfield']++;
1674 if (!empty($arrayfields['p.rowid']['checked'])) {
1675 print '<td class="tdoverflowmax50
">';
1676 print dolPrintHTML($obj->rowid);
1679 $totalarray['nbfield']++;
1684 if (!empty($arrayfields['p.lastname']['checked'])) {
1685 print '<td class="middle tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1686 if ($contextpage == 'poslist') {
1687 print $contactstatic->lastname;
1689 print $contactstatic->getNomUrl(1);
1693 $totalarray['nbfield']++;
1698 if (!empty($arrayfields['p.firstname']['checked'])) {
1699 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1700 print dolPrintHTML($obj->firstname);
1703 $totalarray['nbfield']++;
1708 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1709 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1710 print dolPrintHTML($contactstatic->ref_ext);
1713 $totalarray['nbfield']++;
1718 if (!empty($arrayfields['p.poste']['checked'])) {
1719 print '<td class="tdoverflowmax100
">'.dolPrintHTML($obj->poste).'</td>';
1721 $totalarray['nbfield']++;
1726 if (!empty($arrayfields['p.address']['checked'])) {
1727 print '<td>'.dolPrintHTML($obj->address).'</td>';
1729 $totalarray['nbfield']++;
1734 if (!empty($arrayfields['p.zip']['checked'])) {
1735 print '<td>'.dolPrintHTML($obj->zip).'</td>';
1737 $totalarray['nbfield']++;
1742 if (!empty($arrayfields['p.town']['checked'])) {
1743 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->town).'">'.dolPrintHTML($obj->town).'</td>';
1745 $totalarray['nbfield']++;
1749 if (!empty($arrayfields['state.nom']['checked'])) {
1750 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
1752 $totalarray['nbfield']++;
1756 if (!empty($arrayfields['region.nom']['checked'])) {
1757 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
1759 $totalarray['nbfield']++;
1763 if (!empty($arrayfields['country.code_iso']['checked'])) {
1764 print '<td class="center
">';
1765 $tmparray = getCountry($obj->fk_pays, 'all');
1766 print dolPrintHTML($tmparray['label']);
1769 $totalarray['nbfield']++;
1774 if (!empty($arrayfields['p.phone']['checked'])) {
1775 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1777 $totalarray['nbfield']++;
1782 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1783 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1785 $totalarray['nbfield']++;
1790 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1791 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1793 $totalarray['nbfield']++;
1798 if (!empty($arrayfields['p.fax']['checked'])) {
1799 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1801 $totalarray['nbfield']++;
1806 if (!empty($arrayfields['p.email']['checked'])) {
1807 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTMLForAttribute($obj->email).'">';
1808 if ($contextpage == 'poslist') {
1811 $showinvalidemail = getDolGlobalInt('MAIN_SHOW_INVALID_EMAIL_IN_LIST', 1); // in list, we check only syntax of emails
1812 print dol_print_email($obj->email, $obj->rowid, $obj->socid, 1, 18, $showinvalidemail, 1);
1816 $totalarray['nbfield']++;
1820 // No EMail Subscription
1821 if (!empty($arrayfields['unsubscribed']['checked'])) {
1822 print '<td class="center
">';
1823 if (empty($obj->email)) {
1824 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1826 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1830 $totalarray['nbfield']++;
1835 if (isModEnabled('socialnetworks')) {
1836 foreach ($socialnetworks as $key => $value) {
1837 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1838 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1840 $totalarray['nbfield']++;
1846 // Company / Third Party
1847 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1848 print '<td class="tdoverflowmax125
">';
1850 $objsoc = new Societe($db);
1851 $objsoc->fetch($obj->socid);
1852 $option_link = 'customer';
1853 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1854 $option_link = 'supplier';
1855 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1858 if ($contextpage == 'poslist') {
1859 print $objsoc->name;
1861 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1868 $totalarray['nbfield']++;
1873 if (!empty($arrayfields['s.name_alias']['checked'])) {
1874 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->alias).'">';
1875 print dolPrintHTML($obj->alias);
1878 $totalarray['nbfield']++;
1883 if (!empty($arrayfields['p.priv']['checked'])) {
1884 print '<td class="center
">';
1885 print $contactstatic->LibPubPriv($obj->priv, 2);
1888 $totalarray['nbfield']++;
1893 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1894 print '<td class="center
">';
1895 print $contactstatic->getLibProspLevel();
1898 $totalarray['nbfield']++;
1903 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1904 print '<td class="center nowrap
"><div class="nowrap
">';
1905 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1906 print '</div> - <div class="inline-block
">';
1907 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1908 $titlealt = 'default';
1909 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1910 $titlealt = $val['label'];
1912 if ($obj->stcomm_id != $val['id']) {
1913 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>';
1916 print '</div></div></td>';
1918 $totalarray['nbfield']++;
1923 if (!empty($arrayfields['p.birthday']['checked'])) {
1924 print '<td class="center nowraponall
">';
1925 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1928 $totalarray['nbfield']++;
1933 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1936 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1937 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1938 print $hookmanager->resPrint;
1941 if (!empty($arrayfields['p.ip']['checked'])) {
1942 print '<td class="center nowraponall
">';
1943 print dol_print_ip($obj->ip);
1946 $totalarray['nbfield']++;
1951 if (!empty($arrayfields['p.datec']['checked'])) {
1952 print '<td class="center nowraponall
">';
1953 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1956 $totalarray['nbfield']++;
1960 // Date modification
1961 if (!empty($arrayfields['p.tms']['checked'])) {
1962 print '<td class="center nowraponall
">';
1963 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1966 $totalarray['nbfield']++;
1971 if (!empty($arrayfields['p.note_public']['checked'])) {
1972 print '<td class="flat maxwidth250imp
">';
1973 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1976 $totalarray['nbfield']++;
1980 if (!empty($arrayfields['p.note_private']['checked'])) {
1981 print '<td class="flat maxwidth250imp
">';
1982 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1985 $totalarray['nbfield']++;
1990 if (!empty($arrayfields['p.statut']['checked'])) {
1991 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1993 $totalarray['nbfield']++;
1998 if (!empty($arrayfields['p.import_key']['checked'])) {
1999 print '<td class="tdoverflowmax100
">';
2000 print dolPrintHTML($obj->import_key);
2003 $totalarray['nbfield']++;
2008 if (!$conf->main_checkbox_left_column) {
2009 print '<td class="nowrap center
">';
2010 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2012 if (in_array($obj->rowid, $arrayofselected)) {
2015 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2019 $totalarray['nbfield']++;
2029include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2031// If no record found
2034 foreach ($arrayfields as $key => $val) {
2035 if (!empty($val['checked'])) {
2039 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2044$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2045$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2046print $hookmanager->resPrint;
2048print '</table>'."\n
";
2051print '</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.
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
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.
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)
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.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.