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';
310if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
317$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
318$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
319$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
321if (!$permissiontoread) {
330if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
335 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
336 $result =
$db->query($sql);
337 $num_lines =
$db->num_rows($result);
338 if ($num_lines == 0) {
339 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
341 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
344 $invoice->module_source =
'takepos';
345 $invoice->pos_source = $_SESSION[
"takeposterminal"];
346 $placeid = $invoice->create($user);
347 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
351 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
352 $resql =
$db->query($sql);
355 if (!isset($invoice)) {
356 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
358 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
359 $invoice->delete_linked_contact(
'external',
'BILLING');
361 $invoice->add_contact($idcontact,
'BILLING'); ?>
363 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
364 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
366 <?php
if (!$resql) { ?>
367 alert(
'Error failed to update customer on draft invoice.');
369 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
370 parent.$.colorbox.close();
377if (
GETPOST(
'cancel',
'alpha')) {
381if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
385$parameters = array(
'arrayfields' => &$arrayfields);
386$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
391if (empty($reshook)) {
393 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
396 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
399 $search_ref_ext =
'';
400 $search_firstlast_only =
"";
401 $search_lastname =
"";
402 $search_firstname =
"";
403 $search_societe =
"";
404 $search_societe_alias =
"";
406 $search_address =
"";
410 $search_country =
"";
413 $search_phone_perso =
"";
414 $search_phone_pro =
"";
415 $search_phone_mobile =
"";
418 $search_no_email = -1;
420 foreach ($socialnetworks as $key => $value) {
421 if ($value[
'active']) {
429 $search_date_creation_startmonth =
"";
430 $search_date_creation_startyear =
"";
431 $search_date_creation_startday =
"";
432 $search_date_creation_start =
"";
433 $search_date_creation_endmonth =
"";
434 $search_date_creation_endyear =
"";
435 $search_date_creation_endday =
"";
436 $search_date_creation_end =
"";
437 $search_date_modif_startmonth =
"";
438 $search_date_modif_startyear =
"";
439 $search_date_modif_startday =
"";
440 $search_date_modif_start =
"";
441 $search_date_modif_endmonth =
"";
442 $search_date_modif_endyear =
"";
443 $search_date_modif_endday =
"";
444 $search_date_modif_end =
"";
448 $search_categ_thirdparty =
'';
449 $search_categ_supplier =
'';
450 $search_import_key =
'';
452 $search_array_options = array();
453 $search_roles = array();
454 $search_birthday_start =
'';
455 $search_birthday_end =
'';
456 $search_note_public =
"";
457 $search_note_private =
"";
461 $objectclass =
'Contact';
462 $objectlabel =
'Contact';
463 $uploaddir =
$conf->societe->dir_output;
464 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
466 if ($action ==
'setstcomm' && $permissiontoadd) {
479if ($search_priv < 0) {
484if (!$user->hasRight(
'societe',
'client',
'voir')) {
485 $socid = $user->socid;
498$title = $langs->trans(
"ContactsAddresses");
499$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
504 $contactstatic->loadCacheOfProspStatus();
507$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
508$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
512$sql =
"SELECT code, label, sortorder";
513$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
514$sql .=
" WHERE active > 0";
515$sql .=
" ORDER BY sortorder";
516$resql =
$db->query($sql);
518 while ($obj =
$db->fetch_object($resql)) {
520 $level = $langs->trans($obj->code);
521 if ($level == $obj->code) {
522 $level = $langs->trans($obj->label);
524 $tab_level[$obj->code] = $level;
532$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
533$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,";
534$sql .=
" p.socialnetworks, p.photo,";
535$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,";
536$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel, p.note_public, p.note_private,";
537$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
538$sql .=
" co.label as country, co.code as country_code,";
539$sql .=
" state.code_departement as state_code, state.nom as state_name,";
540$sql .=
" region.code_region as region_code, region.nom as region_name";
542if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
543 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
544 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
548 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
552$parameters = array();
553$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
554$sql .= $hookmanager->resPrint;
555$sql = preg_replace(
'/,\s*$/',
'', $sql);
559$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
560if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
561 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
563$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
564$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
565$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = p.fk_departement)";
566$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
567$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
570$parameters = array();
571$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
572$sql .= $hookmanager->resPrint;
573$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
574if (!empty($userid)) {
575 $sql .=
" AND p.fk_user_creat=".((int) $userid);
578 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
580if ($search_stcomm !=
'' && $search_stcomm != -2) {
585if ($search_priv !=
'0' && $search_priv !=
'1') {
586 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
588 if ($search_priv ==
'0') {
589 $sql .=
" AND p.priv='0'";
591 if ($search_priv ==
'1') {
592 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
596if (!empty($search_sale) && $search_sale !=
'-1') {
597 if ($search_sale == -2) {
598 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
599 } elseif ($search_sale > 0) {
600 $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).
")";
605$searchCategoryContactList = $search_categ ? array($search_categ) : array();
606$searchCategoryContactOperator = 0;
608if (!empty($searchCategoryContactList)) {
609 $searchCategoryContactSqlList = array();
610 $listofcategoryid =
'';
611 foreach ($searchCategoryContactList as $searchCategoryContact) {
612 if (intval($searchCategoryContact) == -2) {
613 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
614 } elseif (intval($searchCategoryContact) > 0) {
615 if ($searchCategoryContactOperator == 0) {
616 $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).
")";
618 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
622 if ($listofcategoryid) {
623 $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).
"))";
625 if ($searchCategoryContactOperator == 1) {
626 if (!empty($searchCategoryContactSqlList)) {
627 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
630 if (!empty($searchCategoryContactSqlList)) {
631 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
637$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
638$searchCategoryCustomerOperator = 0;
640if (!empty($searchCategoryCustomerList)) {
641 $searchCategoryCustomerSqlList = array();
642 $listofcategoryid =
'';
643 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
644 if (intval($searchCategoryCustomer) == -2) {
645 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
646 } elseif (intval($searchCategoryCustomer) > 0) {
647 if ($searchCategoryCustomerOperator == 0) {
648 $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).
")";
650 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
654 if ($listofcategoryid) {
655 $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).
"))";
657 if ($searchCategoryCustomerOperator == 1) {
658 if (!empty($searchCategoryCustomerSqlList)) {
659 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
662 if (!empty($searchCategoryCustomerSqlList)) {
663 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
669$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
670$searchCategorySupplierOperator = 0;
672if (!empty($searchCategorySupplierList)) {
673 $searchCategorySupplierSqlList = array();
674 $listofcategoryid =
'';
675 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
676 if (intval($searchCategorySupplier) == -2) {
677 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
678 } elseif (intval($searchCategorySupplier) > 0) {
679 if ($searchCategorySupplierOperator == 0) {
680 $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).
")";
682 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
686 if ($listofcategoryid) {
687 $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).
"))";
689 if ($searchCategorySupplierOperator == 1) {
690 if (!empty($searchCategorySupplierSqlList)) {
691 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
694 if (!empty($searchCategorySupplierSqlList)) {
695 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
701 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
703if (strlen($search_phone)) {
704 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
706if (strlen($search_cti)) {
707 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
709if (strlen($search_firstlast_only)) {
710 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
716if ($search_ref_ext) {
719if ($search_lastname) {
722if ($search_firstname) {
725if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
726 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
728 if ($search_societe) {
731 if ($search_societe_alias) {
735if ($search_country) {
736 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
738if (strlen($search_poste)) {
741if (strlen($search_phone_perso)) {
744if (strlen($search_phone_pro)) {
747if (strlen($search_phone_mobile)) {
750if (strlen($search_fax)) {
754 foreach ($socialnetworks as $key => $value) {
755 if ($value[
'active'] && strlen($search_[$key])) {
756 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
757 if (in_array(
$db->type, array(
'mysql',
'mysqli'))) {
758 $sql .=
" AND p.socialnetworks REGEXP '\"".$db->escape(
$db->escapeforlike($key)).
"\":\"[^\"]*".
$db->escape(
$db->escapeforlike($searchkeyinjsonformat)).
"'";
759 } elseif (
$db->type ==
'pgsql') {
760 $sql .=
" AND p.socialnetworks ~ '\"".$db->escape(
$db->escapeforlike($key)).
"\":\"[^\"]*".
$db->escape(
$db->escapeforlike($searchkeyinjsonformat)).
"'";
763 $sql .=
" AND p.socialnetworks LIKE '%\"".$db->escape(
$db->escapeforlike($key)).
"\":\"".
$db->escape(
$db->escapeforlike($searchkeyinjsonformat)).
"%'";
770if (strlen($search_email)) {
773if (strlen($search_address)) {
776if (strlen($search_zip)) {
779if (strlen($search_town)) {
788if (count($search_roles) > 0) {
789 $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)).
"))";
791if ($search_no_email != -1 && $search_no_email > 0) {
792 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
794if ($search_no_email != -1 && $search_no_email == 0) {
795 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
797if ($search_note_public !=
'') {
800if ($search_note_private !=
'') {
803if ($search_date_creation_start) {
804 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
806if ($search_date_creation_end) {
807 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
810if ($search_date_modif_start) {
811 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
813if ($search_date_modif_end) {
814 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
816if ($search_status !=
'' && $search_status >= 0) {
817 $sql .=
" AND p.statut = ".((int) $search_status);
819if ($search_import_key) {
823 $sql .=
" AND p.fk_soc IS NULL";
824} elseif ($type ==
"f") {
825 $sql .=
" AND s.fournisseur = 1";
826} elseif ($type ==
"c") {
827 $sql .=
" AND s.client IN (1, 3)";
828} elseif ($type ==
"p") {
829 $sql .=
" AND s.client IN (2, 3)";
832 $sql .=
" AND s.rowid = ".((int) $socid);
834if ($search_birthday_start) {
835 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
837if ($search_birthday_end) {
838 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
842include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
845$parameters = array();
846$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
847$sql .= $hookmanager->resPrint;
851$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
852$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
853$sql .= $hookmanager->resPrint;
857$nbtotalofrecords =
'';
860 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
861 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
862 $resql =
$db->query($sqlforcount);
864 $objforcount =
$db->fetch_object($resql);
865 $nbtotalofrecords = $objforcount->nbtotalofrecords;
870 if (($page * $limit) > (
int) $nbtotalofrecords) {
878if ($view ==
"recent") {
879 $sql .=
$db->order(
"p.datec",
"DESC");
881 $sql .=
$db->order($sortfield, $sortorder);
884 $sql .=
$db->plimit($limit + 1, $offset);
887$resql =
$db->query($sql);
893$num =
$db->num_rows($resql);
896if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
897 $obj =
$db->fetch_object($resql);
899 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
907llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
909$arrayofselected = is_array($toselect) ? $toselect : array();
913 $param .=
'&mode='.urlencode($mode);
915if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
916 $param .=
'&contextpage='.urlencode($contextpage);
918if ($limit > 0 && $limit !=
$conf->liste_limit) {
919 $param .=
'&limit='.((int) $limit);
921if ($optioncss !=
'') {
922 $param .=
'&optioncss='.urlencode($optioncss);
924$param .=
'&userid='.urlencode((
string) $userid).
'&contactname='.urlencode((
string) $search_all);
925$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
926if (!empty($search_sale) && $search_sale !=
'-1') {
927 $param .=
'&search_sale='.urlencode($search_sale);
929if (!empty($search_categ) && $search_categ !=
'-1') {
930 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
932if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
933 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
935if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
936 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
938if ($search_all !=
'') {
939 $param .=
'&search_all='.urlencode($search_all);
942 $param .=
"&search_id=".((int) $search_id);
944if ($search_ref_ext) {
945 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
947if ($search_lastname !=
'') {
948 $param .=
'&search_lastname='.urlencode($search_lastname);
950if ($search_firstname !=
'') {
951 $param .=
'&search_firstname='.urlencode($search_firstname);
953if ($search_societe !=
'') {
954 $param .=
'&search_societe='.urlencode($search_societe);
956if ($search_societe_alias !=
'') {
957 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
959if ($search_address !=
'') {
960 $param .=
'&search_address='.urlencode($search_address);
962if ($search_zip !=
'') {
963 $param .=
'&search_zip='.urlencode($search_zip);
965if ($search_town !=
'') {
966 $param .=
'&search_town='.urlencode($search_town);
968if ($search_state !=
'') {
969 $param .=
"&search_state=".urlencode($search_state);
971if ($search_region !=
'') {
972 $param .=
"&search_region=".urlencode($search_region);
974if ($search_country !=
'') {
975 $param .=
"&search_country=".urlencode($search_country);
977if ($search_poste !=
'') {
978 $param .=
'&search_poste='.urlencode($search_poste);
980if ($search_phone_pro !=
'') {
981 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
983if ($search_phone_perso !=
'') {
984 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
986if ($search_phone_mobile !=
'') {
987 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
989if ($search_fax !=
'') {
990 $param .=
'&search_fax='.urlencode($search_fax);
992if ($search_email !=
'') {
993 $param .=
'&search_email='.urlencode($search_email);
995if ($search_no_email !=
'') {
996 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
998if ($search_note_private !=
'') {
999 $param .=
'&search_note_private='.urlencode((
string) ($search_note_private));
1001if ($search_note_public !=
'') {
1002 $param .=
'&search_note_public='.urlencode((
string) ($search_note_public));
1004if ($search_date_creation_startmonth) {
1005 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1007if ($search_date_creation_startyear) {
1008 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1010if ($search_date_creation_startday) {
1011 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1013if ($search_date_creation_start) {
1014 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1016if ($search_date_creation_endmonth) {
1017 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1019if ($search_date_creation_endyear) {
1020 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1022if ($search_date_creation_endday) {
1023 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1025if ($search_date_creation_end) {
1026 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1028if ($search_date_modif_startmonth) {
1029 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1031if ($search_date_modif_startyear) {
1032 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1034if ($search_date_modif_startday) {
1035 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1037if ($search_date_modif_start) {
1038 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1040if ($search_date_modif_endmonth) {
1041 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1043if ($search_date_modif_endyear) {
1044 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1046if ($search_date_modif_endday) {
1047 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1049if ($search_date_modif_end) {
1050 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1052if ($search_stcomm !=
'') {
1053 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1055if ($search_status !=
'') {
1056 $param .=
'&search_status='.urlencode((
string) ($search_status));
1058if ($search_priv ==
'0' || $search_priv ==
'1') {
1059 $param .=
"&search_priv=".urlencode($search_priv);
1061if ($search_stcomm !=
'') {
1062 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1064if (is_array($search_level) && count($search_level)) {
1065 foreach ($search_level as $slevel) {
1066 $param .=
'&search_level[]='.urlencode($slevel);
1069if ($search_import_key !=
'') {
1070 $param .=
'&search_import_key='.urlencode($search_import_key);
1072if (count($search_roles) > 0) {
1073 $param .= implode(
'&search_roles[]=', $search_roles);
1075if ($search_birthday_start) {
1076 $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'));
1078if ($search_birthday_end) {
1079 $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'));
1082include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1085$arrayofmassactions = array(
1086 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1090if (!empty($permissiontodelete)) {
1091 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1093if (
isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
1094 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1096if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
1097 $arrayofmassactions = array();
1100$massactionbutton =
'';
1101if ($contextpage !=
'poslist') {
1102 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1105print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
1106if ($optioncss !=
'') {
1107 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1109print
'<input type="hidden" name="token" value="'.newToken().
'">';
1110print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1111print
'<input type="hidden" name="view" value="'.dolPrintHTMLForAttribute($view).
'">';
1112print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1113print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1115print
'<input type="hidden" name="type" value="'.$type.
'">';
1116print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1117print
'<input type="hidden" name="page_y" value="">';
1118print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1122$parameters = array();
1123$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1124if (empty($reshook)) {
1125 $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'));
1126 $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'));
1127 $newcardbutton .= dolGetButtonTitleSeparator();
1128 if ($contextpage !=
'poslist') {
1129 $newcardbutton .= dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
1130 } elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
1131 $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);
1132 $label =
'MenuNewCustomer';
1133 $newcardbutton .= dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1136 $newcardbutton = $hookmanager->resPrint;
1139print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1141$topicmail =
"Information";
1142$modelmail =
"contact";
1144$trackid =
'ctc'.$object->id;
1145include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1149 foreach ($fieldstosearchall as $key => $val) {
1150 $fieldstosearchall[$key] = $langs->trans($val);
1151 $setupstring .= $key.
"=".$val.
";";
1153 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1154 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1156if ($search_firstlast_only) {
1157 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1163if ($user->hasRight(
'societe',
'client',
'voir')) {
1164 $langs->load(
'commercial');
1165 $moreforfilter .=
'<div class="divsearchfield">';
1166 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1167 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1168 $moreforfilter .=
'</div>';
1171if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1172 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1173 $moreforfilter .=
'<div class="divsearchfield">';
1174 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1175 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1176 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (
int) $search_categ,
'search_categ', 1, $tmptitle);
1177 $moreforfilter .=
'</div>';
1178 if (empty($type) || $type ==
'c' || $type ==
'p') {
1179 $moreforfilter .=
'<div class="divsearchfield">';
1182 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1183 } elseif ($type ==
'p') {
1184 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1186 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1188 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1189 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (
int) $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1190 $moreforfilter .=
'</div>';
1193 if (
isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1194 $moreforfilter .=
'<div class="divsearchfield">';
1195 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1196 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1197 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (
int) $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1198 $moreforfilter .=
'</div>';
1202$moreforfilter .=
'<div class="divsearchfield">';
1203$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1204$moreforfilter .=
'</div>';
1206print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1207print $moreforfilter;
1208$parameters = array(
'type' => $type);
1209$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1210print $hookmanager->resPrint;
1213$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1214$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1215$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1217print
'<div class="div-table-responsive">';
1218print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1222print
'<tr class="liste_titre_filter">';
1224if (
$conf->main_checkbox_left_column) {
1225 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1226 $searchpicto = $form->showFilterButtons(
'left');
1230if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1231 print
'<td class="liste_titre">';
1232 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dolPrintHTMLForAttribute($search_id).
'">';
1235if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1236 print
'<td class="liste_titre">';
1237 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_lastname" value="'.dolPrintHTMLForAttribute($search_lastname).
'">';
1240if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1241 print
'<td class="liste_titre">';
1242 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_firstname" value="'.dolPrintHTMLForAttribute($search_firstname).
'">';
1245if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1247 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_ref_ext" value="'.dolPrintHTMLForAttribute($search_ref_ext).
'">';
1250if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1251 print
'<td class="liste_titre">';
1252 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_poste" value="'.dolPrintHTMLForAttribute($search_poste).
'">';
1255if (!empty($arrayfields[
'p.address'][
'checked'])) {
1256 print
'<td class="liste_titre">';
1257 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dolPrintHTMLForAttribute($search_address).
'">';
1260if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1261 print
'<td class="liste_titre">';
1262 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dolPrintHTMLForAttribute($search_zip).
'">';
1265if (!empty($arrayfields[
'p.town'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1267 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dolPrintHTMLForAttribute($search_town).
'">';
1271if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1272 print
'<td class="liste_titre">';
1273 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dolPrintHTMLForAttribute($search_state).
'">';
1277if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1278 print
'<td class="liste_titre">';
1279 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dolPrintHTMLForAttribute($search_region).
'">';
1283if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1284 print
'<td class="liste_titre center">';
1285 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1288if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1289 print
'<td class="liste_titre">';
1290 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_pro" size="6" value="'.dolPrintHTMLForAttribute($search_phone_pro).
'">';
1293if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1294 print
'<td class="liste_titre">';
1295 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_perso" size="6" value="'.dolPrintHTMLForAttribute($search_phone_perso).
'">';
1298if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1299 print
'<td class="liste_titre">';
1300 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" size="6" value="'.dolPrintHTMLForAttribute($search_phone_mobile).
'">';
1303if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1304 print
'<td class="liste_titre">';
1305 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" size="6" value="'.dolPrintHTMLForAttribute($search_fax).
'">';
1308if (!empty($arrayfields[
'p.email'][
'checked'])) {
1309 print
'<td class="liste_titre">';
1310 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" size="6" value="'.dolPrintHTMLForAttribute($search_email).
'">';
1313if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1314 print
'<td class="liste_titre center">';
1315 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1319 foreach ($socialnetworks as $key => $value) {
1320 if ($value[
'active']) {
1321 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1322 print
'<td class="liste_titre">';
1323 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dolPrintHTMLForAttribute($search_[$key]).
'">';
1329if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1330 print
'<td class="liste_titre">';
1331 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe" size="8" value="'.dolPrintHTMLForAttribute($search_societe).
'">';
1335if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1336 print
'<td class="liste_titre left">';
1337 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe_alias" value="'.dolPrintHTMLForAttribute($search_societe_alias).
'">';
1340if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1341 print
'<td class="liste_titre center">';
1342 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1343 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1347if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1348 print
'<td class="liste_titre center">';
1349 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1353if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1354 print
'<td class="liste_titre maxwidthonsmartphone center">';
1355 $arraystcomm = array();
1356 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1357 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1359 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1362if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1363 print
'<td class="liste_titre center">';
1364 print
'<div class="nowrap">';
1365 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1367 print
'<div class="nowrap">';
1368 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1374include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1377$parameters = array(
'arrayfields' => $arrayfields);
1378$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1379print $hookmanager->resPrint;
1381if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1382 print
'<td class="liste_titre center nowraponall">';
1386if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1387 print
'<td class="liste_titre center nowraponall">';
1388 print
'<div class="nowrapfordate">';
1389 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'));
1391 print
'<div class="nowrapfordate">';
1392 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'));
1397if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1398 print
'<td class="liste_titre center nowraponall">';
1399 print
'<div class="nowrapfordate">';
1400 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'));
1402 print
'<div class="nowrapfordate">';
1403 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'));
1408if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1409 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1410 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');
1413if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1414 print
'<td class="liste_titre center">';
1415 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" size="3" value="'.dolPrintHTMLForAttribute($search_import_key).
'">';
1419if (!
$conf->main_checkbox_left_column) {
1420 print
'<td class="liste_titre center maxwidthsearch">';
1421 $searchpicto = $form->showFilterButtons();
1432print
'<tr class="liste_titre">';
1433if (
$conf->main_checkbox_left_column) {
1434 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1437if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1438 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1441if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1442 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1445if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1446 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1449if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1453if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1454 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1457if (!empty($arrayfields[
'p.address'][
'checked'])) {
1458 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1461if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1465if (!empty($arrayfields[
'p.town'][
'checked'])) {
1466 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1469if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1470 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1473if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1477if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1478 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1481if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1482 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1485if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1486 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1489if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1490 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1493if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1494 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1497if (!empty($arrayfields[
'p.email'][
'checked'])) {
1498 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1501if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1502 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1506 foreach ($socialnetworks as $key => $value) {
1507 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1508 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1513if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1514 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1517if (!empty($arrayfields[
's.nom'][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1521if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1523 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1526if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1530if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1531 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1534if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1535 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1538if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1539 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1543include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1545$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
1546$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1547print $hookmanager->resPrint;
1549if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1550 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1554if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1555 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1558if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1559 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1562if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1563 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1566if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1567 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1570if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1571 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1574if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1575 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1578if (!
$conf->main_checkbox_left_column) {
1579 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1591$imaxinloop = ($limit ? min($num, $limit) : $num);
1592while ($i < $imaxinloop) {
1593 $obj =
$db->fetch_object($resql);
1598 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1599 $contactstatic->id = $obj->rowid;
1600 $contactstatic->ref_ext = $obj->ref_ext;
1601 $contactstatic->lastname = $obj->lastname;
1602 $contactstatic->firstname = $obj->firstname;
1603 $contactstatic->status = $obj->statut;
1604 $contactstatic->statut = $obj->statut;
1605 $contactstatic->poste = $obj->poste;
1606 $contactstatic->email = $obj->email;
1607 $contactstatic->phone_pro = $obj->phone_pro;
1608 $contactstatic->phone_perso = $obj->phone_perso;
1609 $contactstatic->phone_mobile = $obj->phone_mobile;
1610 $contactstatic->address = $obj->address;
1611 $contactstatic->zip = $obj->zip;
1612 $contactstatic->town = $obj->town;
1613 $contactstatic->state = $obj->state_name;
1614 $contactstatic->region = $obj->region_name;
1615 $contactstatic->socialnetworks = $arraysocialnetworks;
1616 $contactstatic->country = $obj->country;
1617 $contactstatic->country_code = $obj->country_code;
1618 $contactstatic->photo = $obj->photo;
1619 $contactstatic->import_key = $obj->import_key;
1620 $contactstatic->photo = $obj->photo;
1621 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1625 if ($mode ==
'kanban') {
1627 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1628 print
'<div class="box-flex-container kanban">';
1631 if ($massactionbutton || $massaction) {
1633 if (in_array(
$object->id, $arrayofselected)) {
1637 if ($obj->socid > 0) {
1638 $contactstatic->fetch_thirdparty($obj->socid);
1640 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1641 if ($i == ($imaxinloop - 1)) {
1647 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select"';
1648 if ($contextpage ==
'poslist') {
1649 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1654 if ($conf->main_checkbox_left_column) {
1655 print '<td class="nowrap center
">';
1656 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1658 if (in_array($obj->rowid, $arrayofselected)) {
1661 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1665 $totalarray['nbfield']++;
1670 if (!empty($arrayfields['p.rowid']['checked'])) {
1671 print '<td class="tdoverflowmax50
">';
1672 print dolPrintHTML($obj->rowid);
1675 $totalarray['nbfield']++;
1680 if (!empty($arrayfields['p.lastname']['checked'])) {
1681 print '<td class="middle tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1682 if ($contextpage == 'poslist') {
1683 print $contactstatic->lastname;
1685 print $contactstatic->getNomUrl(1);
1689 $totalarray['nbfield']++;
1694 if (!empty($arrayfields['p.firstname']['checked'])) {
1695 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1696 print dolPrintHTML($obj->firstname);
1699 $totalarray['nbfield']++;
1704 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1705 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1706 print dolPrintHTML($contactstatic->ref_ext);
1709 $totalarray['nbfield']++;
1714 if (!empty($arrayfields['p.poste']['checked'])) {
1715 print '<td class="tdoverflowmax100
">'.dolPrintHTML($obj->poste).'</td>';
1717 $totalarray['nbfield']++;
1722 if (!empty($arrayfields['p.address']['checked'])) {
1723 print '<td>'.dolPrintHTML($obj->address).'</td>';
1725 $totalarray['nbfield']++;
1730 if (!empty($arrayfields['p.zip']['checked'])) {
1731 print '<td>'.dolPrintHTML($obj->zip).'</td>';
1733 $totalarray['nbfield']++;
1738 if (!empty($arrayfields['p.town']['checked'])) {
1739 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->town).'">'.dolPrintHTML($obj->town).'</td>';
1741 $totalarray['nbfield']++;
1745 if (!empty($arrayfields['state.nom']['checked'])) {
1746 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
1748 $totalarray['nbfield']++;
1752 if (!empty($arrayfields['region.nom']['checked'])) {
1753 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
1755 $totalarray['nbfield']++;
1759 if (!empty($arrayfields['country.code_iso']['checked'])) {
1760 print '<td class="center
">';
1761 $tmparray = getCountry($obj->fk_pays, 'all');
1762 print dolPrintHTML($tmparray['label']);
1765 $totalarray['nbfield']++;
1770 if (!empty($arrayfields['p.phone']['checked'])) {
1771 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1773 $totalarray['nbfield']++;
1778 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1779 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1781 $totalarray['nbfield']++;
1786 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1787 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1789 $totalarray['nbfield']++;
1794 if (!empty($arrayfields['p.fax']['checked'])) {
1795 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1797 $totalarray['nbfield']++;
1802 if (!empty($arrayfields['p.email']['checked'])) {
1803 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTML($obj->email).'">';
1804 if ($contextpage == 'poslist') {
1807 print dol_print_email($obj->email, $obj->rowid, $obj->socid, 1, 18, 0, 1);
1811 $totalarray['nbfield']++;
1815 // No EMail Subscription
1816 if (!empty($arrayfields['unsubscribed']['checked'])) {
1817 print '<td class="center
">';
1818 if (empty($obj->email)) {
1819 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1821 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1825 $totalarray['nbfield']++;
1830 if (isModEnabled('socialnetworks')) {
1831 foreach ($socialnetworks as $key => $value) {
1832 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1833 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1835 $totalarray['nbfield']++;
1841 // Company / Third Party
1842 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1843 print '<td class="tdoverflowmax125
">';
1845 $objsoc = new Societe($db);
1846 $objsoc->fetch($obj->socid);
1847 $option_link = 'customer';
1848 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1849 $option_link = 'supplier';
1850 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1853 if ($contextpage == 'poslist') {
1854 print $objsoc->name;
1856 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1863 $totalarray['nbfield']++;
1868 if (!empty($arrayfields['s.name_alias']['checked'])) {
1869 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->alias).'">';
1870 print dolPrintHTML($obj->alias);
1873 $totalarray['nbfield']++;
1878 if (!empty($arrayfields['p.priv']['checked'])) {
1879 print '<td class="center
">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
1881 $totalarray['nbfield']++;
1886 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1887 print '<td class="center
">';
1888 print $contactstatic->getLibProspLevel();
1891 $totalarray['nbfield']++;
1896 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1897 print '<td class="center nowrap
"><div class="nowrap
">';
1898 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1899 print '</div> - <div class="inline-block
">';
1900 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1901 $titlealt = 'default';
1902 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1903 $titlealt = $val['label'];
1905 if ($obj->stcomm_id != $val['id']) {
1906 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>';
1909 print '</div></div></td>';
1911 $totalarray['nbfield']++;
1916 if (!empty($arrayfields['p.birthday']['checked'])) {
1917 print '<td class="center nowraponall
">';
1918 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1921 $totalarray['nbfield']++;
1926 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1929 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1930 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1931 print $hookmanager->resPrint;
1934 if (!empty($arrayfields['p.ip']['checked'])) {
1935 print '<td class="center nowraponall
">';
1936 print dol_print_ip($obj->ip);
1939 $totalarray['nbfield']++;
1944 if (!empty($arrayfields['p.datec']['checked'])) {
1945 print '<td class="center nowraponall
">';
1946 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1949 $totalarray['nbfield']++;
1953 // Date modification
1954 if (!empty($arrayfields['p.tms']['checked'])) {
1955 print '<td class="center nowraponall
">';
1956 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1959 $totalarray['nbfield']++;
1964 if (!empty($arrayfields['p.note_public']['checked'])) {
1965 print '<td class="flat maxwidth250imp
">';
1966 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1969 $totalarray['nbfield']++;
1973 if (!empty($arrayfields['p.note_private']['checked'])) {
1974 print '<td class="flat maxwidth250imp
">';
1975 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1978 $totalarray['nbfield']++;
1983 if (!empty($arrayfields['p.statut']['checked'])) {
1984 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1986 $totalarray['nbfield']++;
1991 if (!empty($arrayfields['p.import_key']['checked'])) {
1992 print '<td class="tdoverflowmax100
">';
1993 print dolPrintHTML($obj->import_key);
1996 $totalarray['nbfield']++;
2001 if (!$conf->main_checkbox_left_column) {
2002 print '<td class="nowrap center
">';
2003 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2005 if (in_array($obj->rowid, $arrayofselected)) {
2008 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2012 $totalarray['nbfield']++;
2022include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2024// If no record found
2027 foreach ($arrayfields as $key => $val) {
2028 if (!empty($val['checked'])) {
2032 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2037$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2038$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2039print $hookmanager->resPrint;
2041print '</table>'."\n
";
2044print '</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.
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...
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.
getArrayOfSocialNetworks()
Get array of social network dictionary.
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.
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
buildzip.php
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.