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/lib/phone.lib.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
55$langs->loadLangs(array(
"companies",
"categories",
"suppliers",
"other"));
60$action =
GETPOST(
'action',
'aZ09');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contactlist';
66$optioncss =
GETPOST(
'optioncss',
'alpha');
67if ($contextpage ==
'poslist') {
70$mode =
GETPOST(
'mode',
'alpha');
78$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
79$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
80$search_phone =
GETPOST(
"search_phone",
'alpha');
82$search_id =
GETPOST(
"search_id",
"intcomma");
83$search_ref_ext =
GETPOST(
"search_ref_ext",
"alpha");
84$search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
85$search_lastname =
GETPOST(
"search_lastname",
'alpha');
86$search_firstname =
GETPOST(
"search_firstname",
'alpha');
87$search_societe =
GETPOST(
"search_societe",
'alpha');
88$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
89$search_poste =
GETPOST(
"search_poste",
'alpha');
90$search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
91$search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
92$search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
93$search_fax =
GETPOST(
"search_fax",
'alpha');
94$search_email =
GETPOST(
"search_email",
'alpha');
98 $search_no_email = -1;
104 foreach ($socialnetworks as $key => $value) {
105 if ($value[
'active']) {
106 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
110$search_priv =
GETPOST(
"search_priv",
'alpha');
111$search_sale =
GETPOST(
'search_sale',
'intcomma');
112$search_categ =
GETPOST(
"search_categ",
'intcomma');
113$search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'intcomma');
114$search_categ_supplier =
GETPOST(
"search_categ_supplier",
'intcomma');
115$search_status =
GETPOST(
"search_status",
"intcomma");
116$search_type =
GETPOST(
'search_type',
'alpha');
117$search_address =
GETPOST(
'search_address',
'alpha');
118$search_zip =
GETPOST(
'search_zip',
'alpha');
119$search_town =
GETPOST(
'search_town',
'alpha');
120$search_state = trim(
GETPOST(
"search_state",
'alpha'));
121$search_region = trim(
GETPOST(
"search_region",
'alpha'));
122$search_import_key =
GETPOST(
"search_import_key",
'alpha');
123$search_country =
GETPOST(
"search_country",
'aZ09');
124$search_roles =
GETPOST(
"search_roles",
'array');
125$search_level =
GETPOST(
"search_level",
'array');
126$search_stcomm =
GETPOST(
'search_stcomm',
'intcomma');
128$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
129$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
130$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
131$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
132$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
133$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
134$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
135$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
137$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
138$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
139$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
140$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
141$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
142$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
143$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
144$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
148$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
149$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
151if ($search_status ===
'') {
154if ($search_no_email ===
'') {
155 $search_no_email = -1;
158$optioncss =
GETPOST(
'optioncss',
'alpha');
160$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
163$view =
GETPOST(
"view",
'alpha');
170$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
171$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
177 $sortfield =
"p.lastname";
179if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
183$offset = $limit * $page;
184$pageprev = $page - 1;
185$pagenext = $page + 1;
188$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
190 if (empty($contextpage) || $contextpage ==
'contactlist') {
191 $contextpage =
'contactprospectlist';
193 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
196 if (empty($contextpage) || $contextpage ==
'contactlist') {
197 $contextpage =
'contactcustomerlist';
199 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
200} elseif ($type ==
"f") {
201 if (empty($contextpage) || $contextpage ==
'contactlist') {
202 $contextpage =
'contactsupplierlist';
204 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
205} elseif ($type ==
"o") {
206 if (empty($contextpage) || $contextpage ==
'contactlist') {
207 $contextpage =
'contactotherlist';
209 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
215$hookmanager->initHooks(array($contextpage));
217if ($user->socid > 0) {
218 $socid = $user->socid;
223$extrafields->fetch_name_optionals_label(
$object->table_element);
225$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
228$fieldstosearchall = array();
229foreach (
$object->fields as $key => $val) {
231 if (!empty($user->socid) && $key ==
"note_private") {
235 if (empty($val[
'searchall'])) {
239 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
244 $fieldstosearchall[
's.nom'] =
"ThirdParty";
245 $fieldstosearchall[
's.name_alias'] =
"AliasNames";
248$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
249$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
251 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
252} elseif ($reshook == 0) {
253 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
257$arrayfields = array();
258foreach (
$object->fields as $key => $val) {
260 if (!empty($val[
'visible'])) {
261 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
262 $arrayfields[
'p.'.$key] = array(
263 'label' => $val[
'label'],
264 'checked' => (($visible < 0) ?
'0' :
'1'),
265 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
266 'position' => $val[
'position'],
267 'help' => isset($val[
'help']) ? $val[
'help'] :
''
273$arrayfields[
'state.nom'] = array(
'label' =>
"State",
'position' => 66,
'checked' =>
'0');
274$arrayfields[
'region.nom'] = array(
'label' =>
"Region",
'position' => 67,
'checked' =>
'0');
275$arrayfields[
'country.code_iso'] = array(
'label' =>
"Country",
'position' => 68,
'checked' =>
'0');
277 $arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'position' => 113,
'checked' =>
'1');
278 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'position' => 114,
'checked' =>
'1');
281$arrayfields[
'unsubscribed'] = array(
282 'label' =>
'No_Email',
288 foreach ($socialnetworks as $key => $value) {
289 if ($value[
'active']) {
290 $arrayfields[
'p.'.$key] = array(
291 'label' => $value[
'label'],
299$arrayfields[
'p.note_public'] = array(
'label' =>
'NotePublic',
'position' => 350,
'checked' =>
'-1');
300$arrayfields[
'p.note_private'] = array(
'label' =>
'NotePrivate',
'position' => 351,
'checked' =>
'-1');
304include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
307$parameters = array(
'arrayfields' => &$arrayfields);
308$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
315if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
318 dol_print_error($db);
322$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
323$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
324$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
326if (!$permissiontoread) {
335if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
340 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
341 $result = $db->query($sql);
342 $num_lines = $db->num_rows($result);
343 if ($num_lines == 0) {
344 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
346 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
349 $invoice->module_source =
'takepos';
350 $invoice->pos_source = $_SESSION[
"takeposterminal"];
351 $placeid = $invoice->create($user);
352 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
356 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
357 $resql = $db->query($sql);
360 if (!isset($invoice)) {
361 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
363 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
364 $invoice->delete_linked_contact(
'external',
'BILLING');
366 $invoice->add_contact($idcontact,
'BILLING'); ?>
368 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
369 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
371 <?php
if (!$resql) { ?>
372 alert(
'Error failed to update customer on draft invoice.');
374 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
375 parent.$.colorbox.close();
382if (
GETPOST(
'cancel',
'alpha')) {
386if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
390$parameters = array(
'arrayfields' => &$arrayfields);
391$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
393 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
396if (empty($reshook)) {
398 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
401 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
404 $search_ref_ext =
'';
405 $search_firstlast_only =
"";
406 $search_lastname =
"";
407 $search_firstname =
"";
408 $search_societe =
"";
409 $search_societe_alias =
"";
411 $search_address =
"";
415 $search_country =
"";
418 $search_phone_perso =
"";
419 $search_phone_pro =
"";
420 $search_phone_mobile =
"";
423 $search_no_email = -1;
425 foreach ($socialnetworks as $key => $value) {
426 if ($value[
'active']) {
434 $search_date_creation_startmonth =
"";
435 $search_date_creation_startyear =
"";
436 $search_date_creation_startday =
"";
437 $search_date_creation_start =
"";
438 $search_date_creation_endmonth =
"";
439 $search_date_creation_endyear =
"";
440 $search_date_creation_endday =
"";
441 $search_date_creation_end =
"";
442 $search_date_modif_startmonth =
"";
443 $search_date_modif_startyear =
"";
444 $search_date_modif_startday =
"";
445 $search_date_modif_start =
"";
446 $search_date_modif_endmonth =
"";
447 $search_date_modif_endyear =
"";
448 $search_date_modif_endday =
"";
449 $search_date_modif_end =
"";
453 $search_categ_thirdparty =
'';
454 $search_categ_supplier =
'';
455 $search_import_key =
'';
457 $search_array_options = array();
458 $search_roles = array();
459 $search_birthday_start =
'';
460 $search_birthday_end =
'';
461 $search_note_public =
"";
462 $search_note_private =
"";
466 $objectclass =
'Contact';
467 $objectlabel =
'Contact';
468 $uploaddir =
$conf->societe->dir_output;
469 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
471 if ($action ==
'setstcomm' && $permissiontoadd) {
484if ($search_priv < 0) {
489if (!$user->hasRight(
'societe',
'client',
'voir')) {
490 $socid = $user->socid;
498$form =
new Form($db);
501$contactstatic =
new Contact($db);
503$title = $langs->trans(
"ContactsAddresses");
504$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
509 $contactstatic->loadCacheOfProspStatus();
512$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
513$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
517$sql =
"SELECT code, label, sortorder";
518$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
519$sql .=
" WHERE active > 0";
520$sql .=
" ORDER BY sortorder";
521$resql = $db->query($sql);
523 while ($obj = $db->fetch_object($resql)) {
525 $level = $langs->trans($obj->code);
526 if ($level == $obj->code) {
527 $level = $langs->trans($obj->label);
529 $tab_level[$obj->code] = $level;
532 dol_print_error($db);
537$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
538$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,";
539$sql .=
" p.socialnetworks, p.photo,";
540$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,";
541$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel, p.note_public, p.note_private,";
542$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
543$sql .=
" co.label as country, co.code as country_code,";
544$sql .=
" state.code_departement as state_code, state.nom as state_name,";
545$sql .=
" region.code_region as region_code, region.nom as region_name";
547if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
548 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
549 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
553 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
557$parameters = array();
558$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
559$sql .= $hookmanager->resPrint;
560$sql = preg_replace(
'/,\s*$/',
'', $sql);
564$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
565if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
566 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
568$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
569$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
570$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = p.fk_departement)";
571$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
572$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
575$parameters = array();
576$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
577$sql .= $hookmanager->resPrint;
578$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
579if (!empty($userid)) {
580 $sql .=
" AND p.fk_user_creat=".((int) $userid);
583 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
585if ($search_stcomm !=
'' && $search_stcomm != -2) {
590if ($search_priv !=
'0' && $search_priv !=
'1') {
591 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
593 if ($search_priv ==
'0') {
594 $sql .=
" AND p.priv='0'";
596 if ($search_priv ==
'1') {
597 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
601if (!empty($search_sale) && $search_sale !=
'-1') {
602 if ($search_sale == -2) {
603 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
604 } elseif ($search_sale > 0) {
605 $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).
")";
610$searchCategoryContactList = $search_categ ? array($search_categ) : array();
611$searchCategoryContactOperator = 0;
613if (!empty($searchCategoryContactList)) {
614 $searchCategoryContactSqlList = array();
615 $listofcategoryid =
'';
616 foreach ($searchCategoryContactList as $searchCategoryContact) {
617 if (intval($searchCategoryContact) == -2) {
618 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
619 } elseif (intval($searchCategoryContact) > 0) {
620 if ($searchCategoryContactOperator == 0) {
621 $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).
")";
623 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
627 if ($listofcategoryid) {
628 $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).
"))";
630 if ($searchCategoryContactOperator == 1) {
631 if (!empty($searchCategoryContactSqlList)) {
632 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
635 if (!empty($searchCategoryContactSqlList)) {
636 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
642$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
643$searchCategoryCustomerOperator = 0;
645if (!empty($searchCategoryCustomerList)) {
646 $searchCategoryCustomerSqlList = array();
647 $listofcategoryid =
'';
648 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
649 if (intval($searchCategoryCustomer) == -2) {
650 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
651 } elseif (intval($searchCategoryCustomer) > 0) {
652 if ($searchCategoryCustomerOperator == 0) {
653 $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).
")";
655 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
659 if ($listofcategoryid) {
660 $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).
"))";
662 if ($searchCategoryCustomerOperator == 1) {
663 if (!empty($searchCategoryCustomerSqlList)) {
664 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
667 if (!empty($searchCategoryCustomerSqlList)) {
668 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
674$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
675$searchCategorySupplierOperator = 0;
677if (!empty($searchCategorySupplierList)) {
678 $searchCategorySupplierSqlList = array();
679 $listofcategoryid =
'';
680 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
681 if (intval($searchCategorySupplier) == -2) {
682 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
683 } elseif (intval($searchCategorySupplier) > 0) {
684 if ($searchCategorySupplierOperator == 0) {
685 $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).
")";
687 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
691 if ($listofcategoryid) {
692 $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).
"))";
694 if ($searchCategorySupplierOperator == 1) {
695 if (!empty($searchCategorySupplierSqlList)) {
696 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
699 if (!empty($searchCategorySupplierSqlList)) {
700 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
706 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
708if (strlen($search_phone)) {
711if (strlen($search_cti)) {
714if (strlen($search_firstlast_only)) {
715 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
721if ($search_ref_ext) {
724if ($search_lastname) {
727if ($search_firstname) {
730if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
731 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
733 if ($search_societe) {
736 if ($search_societe_alias) {
740if ($search_country) {
741 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
743if (strlen($search_poste)) {
746if (strlen($search_phone_perso)) {
749if (strlen($search_phone_pro)) {
752if (strlen($search_phone_mobile)) {
755if (strlen($search_fax)) {
759 foreach ($socialnetworks as $key => $value) {
760 if ($value[
'active'] && strlen($search_[$key])) {
761 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
762 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
763 $sql .=
" AND p.socialnetworks REGEXP '".$db->escape(
"\"".$db->escapeforlike($key).
"\":\"[^\"]*".$db->escapeforlike($searchkeyinjsonformat)).
"'";
764 } elseif ($db->type ==
'pgsql') {
765 $sql .=
" AND p.socialnetworks ~ '".$db->escape(
"\"".$db->escapeforlike($key).
"\":\"[^\"]*".$db->escapeforlike($searchkeyinjsonformat)).
"'";
768 $sql .=
" AND p.socialnetworks LIKE '".$db->escape(
"%\"".$db->escapeforlike($key.
"\":\"".$searchkeyinjsonformat).
"%").
"'";
775if (strlen($search_email)) {
778if (strlen($search_address)) {
781if (strlen($search_zip)) {
784if (strlen($search_town)) {
793if (count($search_roles) > 0) {
794 $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)).
"))";
796if ($search_no_email != -1 && $search_no_email > 0) {
797 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
799if ($search_no_email != -1 && $search_no_email == 0) {
800 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
802if ($search_note_public !=
'') {
805if ($search_note_private !=
'') {
808if ($search_date_creation_start) {
809 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
811if ($search_date_creation_end) {
812 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
815if ($search_date_modif_start) {
816 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
818if ($search_date_modif_end) {
819 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
821if ($search_status !=
'' && $search_status >= 0) {
822 $sql .=
" AND p.statut = ".((int) $search_status);
824if ($search_import_key) {
828 $sql .=
" AND p.fk_soc IS NULL";
829} elseif ($type ==
"f") {
830 $sql .=
" AND s.fournisseur = 1";
831} elseif ($type ==
"c") {
832 $sql .=
" AND s.client IN (1, 3)";
833} elseif ($type ==
"p") {
834 $sql .=
" AND s.client IN (2, 3)";
837 $sql .=
" AND s.rowid = ".((int) $socid);
839if ($search_birthday_start) {
840 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
842if ($search_birthday_end) {
843 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
847include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
850$parameters = array();
851$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
852$sql .= $hookmanager->resPrint;
856$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
857$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
858$sql .= $hookmanager->resPrint;
862$nbtotalofrecords =
'';
865 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
866 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
867 $resql = $db->query($sqlforcount);
869 $objforcount = $db->fetch_object($resql);
870 $nbtotalofrecords = $objforcount->nbtotalofrecords;
872 dol_print_error($db);
875 if (($page * $limit) > (
int) $nbtotalofrecords) {
883if ($view ==
"recent") {
884 $sql .= $db->order(
"p.datec",
"DESC");
886 $sql .= $db->order($sortfield, $sortorder);
889 $sql .= $db->plimit($limit + 1, $offset);
892$resql = $db->query($sql);
894 dol_print_error($db);
898$num = $db->num_rows($resql);
901if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
902 $obj = $db->fetch_object($resql);
904 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
912llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
914$arrayofselected = is_array($toselect) ? $toselect : array();
918 $param .=
'&mode='.urlencode($mode);
920if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
921 $param .=
'&contextpage='.urlencode($contextpage);
923if ($limit > 0 && $limit !=
$conf->liste_limit) {
924 $param .=
'&limit='.((int) $limit);
926if ($optioncss !=
'') {
927 $param .=
'&optioncss='.urlencode($optioncss);
929$param .=
'&userid='.urlencode((
string) $userid).
'&contactname='.urlencode((
string) $search_all);
930$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
931if (!empty($search_sale) && $search_sale !=
'-1') {
932 $param .=
'&search_sale='.urlencode($search_sale);
934if (!empty($search_categ) && $search_categ !=
'-1') {
935 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
937if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
938 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
940if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
941 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
943if ($search_all !=
'') {
944 $param .=
'&search_all='.urlencode($search_all);
947 $param .=
"&search_id=".((int) $search_id);
949if ($search_ref_ext) {
950 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
952if ($search_lastname !=
'') {
953 $param .=
'&search_lastname='.urlencode($search_lastname);
955if ($search_firstname !=
'') {
956 $param .=
'&search_firstname='.urlencode($search_firstname);
958if ($search_societe !=
'') {
959 $param .=
'&search_societe='.urlencode($search_societe);
961if ($search_societe_alias !=
'') {
962 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
964if ($search_address !=
'') {
965 $param .=
'&search_address='.urlencode($search_address);
967if ($search_zip !=
'') {
968 $param .=
'&search_zip='.urlencode($search_zip);
970if ($search_town !=
'') {
971 $param .=
'&search_town='.urlencode($search_town);
973if ($search_state !=
'') {
974 $param .=
"&search_state=".urlencode($search_state);
976if ($search_region !=
'') {
977 $param .=
"&search_region=".urlencode($search_region);
979if ($search_country !=
'') {
980 $param .=
"&search_country=".urlencode($search_country);
982if ($search_poste !=
'') {
983 $param .=
'&search_poste='.urlencode($search_poste);
985if ($search_phone_pro !=
'') {
986 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
988if ($search_phone_perso !=
'') {
989 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
991if ($search_phone_mobile !=
'') {
992 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
994if ($search_fax !=
'') {
995 $param .=
'&search_fax='.urlencode($search_fax);
997if ($search_email !=
'') {
998 $param .=
'&search_email='.urlencode($search_email);
1000if ($search_no_email !=
'') {
1001 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
1003if ($search_note_private !=
'') {
1004 $param .=
'&search_note_private='.urlencode((
string) ($search_note_private));
1006if ($search_note_public !=
'') {
1007 $param .=
'&search_note_public='.urlencode((
string) ($search_note_public));
1009if ($search_date_creation_startmonth) {
1010 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1012if ($search_date_creation_startyear) {
1013 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1015if ($search_date_creation_startday) {
1016 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1018if ($search_date_creation_start) {
1019 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1021if ($search_date_creation_endmonth) {
1022 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1024if ($search_date_creation_endyear) {
1025 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1027if ($search_date_creation_endday) {
1028 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1030if ($search_date_creation_end) {
1031 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1033if ($search_date_modif_startmonth) {
1034 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1036if ($search_date_modif_startyear) {
1037 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1039if ($search_date_modif_startday) {
1040 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1042if ($search_date_modif_start) {
1043 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1045if ($search_date_modif_endmonth) {
1046 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1048if ($search_date_modif_endyear) {
1049 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1051if ($search_date_modif_endday) {
1052 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1054if ($search_date_modif_end) {
1055 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1057if ($search_stcomm !=
'') {
1058 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1060if ($search_status !=
'') {
1061 $param .=
'&search_status='.urlencode((
string) ($search_status));
1063if ($search_priv ==
'0' || $search_priv ==
'1') {
1064 $param .=
"&search_priv=".urlencode($search_priv);
1066if ($search_stcomm !=
'') {
1067 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1069if (is_array($search_level) && count($search_level)) {
1070 foreach ($search_level as $slevel) {
1071 $param .=
'&search_level[]='.urlencode($slevel);
1074if ($search_import_key !=
'') {
1075 $param .=
'&search_import_key='.urlencode($search_import_key);
1077if (count($search_roles) > 0) {
1078 $param .= implode(
'&search_roles[]=', $search_roles);
1080if ($search_birthday_start) {
1081 $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'));
1083if ($search_birthday_end) {
1084 $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'));
1087include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1090$arrayofmassactions = array(
1091 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1095if (!empty($permissiontodelete)) {
1096 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1098if (
isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
1099 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1101if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
1102 $arrayofmassactions = array();
1105$massactionbutton =
'';
1106if ($contextpage !=
'poslist') {
1107 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1110print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
1111if ($optioncss !=
'') {
1112 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1114print
'<input type="hidden" name="token" value="'.newToken().
'">';
1115print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1116print
'<input type="hidden" name="view" value="'.dolPrintHTMLForAttribute($view).
'">';
1117print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1118print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1120print
'<input type="hidden" name="type" value="'.$type.
'">';
1121print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1122print
'<input type="hidden" name="page_y" value="">';
1123print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1127$parameters = array();
1128$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1129if (empty($reshook)) {
1130 $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'));
1131 $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'));
1133 if ($contextpage !=
'poslist') {
1134 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
1135 } elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
1136 $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);
1137 $label =
'MenuNewCustomer';
1138 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1141 $newcardbutton = $hookmanager->resPrint;
1144print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1146$topicmail =
"Information";
1147$modelmail =
"contact";
1149$trackid =
'ctc'.$object->id;
1150include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1154 foreach ($fieldstosearchall as $key => $val) {
1155 $fieldstosearchall[$key] = $langs->trans($val);
1156 $setupstring .= $key.
"=".$val.
";";
1158 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1159 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1161if ($search_firstlast_only) {
1162 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1168if ($user->hasRight(
'societe',
'client',
'voir')) {
1169 $langs->load(
'commercial');
1170 $moreforfilter .=
'<div class="divsearchfield">';
1171 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1172 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1173 $moreforfilter .=
'</div>';
1176if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1177 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1178 $moreforfilter .=
'<div class="divsearchfield">';
1179 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1180 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1181 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (
int) $search_categ,
'search_categ', 1, $tmptitle);
1182 $moreforfilter .=
'</div>';
1183 if (empty($type) || $type ==
'c' || $type ==
'p') {
1184 $moreforfilter .=
'<div class="divsearchfield">';
1187 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1188 } elseif ($type ==
'p') {
1189 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1191 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1193 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1194 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (
int) $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1195 $moreforfilter .=
'</div>';
1198 if (
isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1199 $moreforfilter .=
'<div class="divsearchfield">';
1200 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1201 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1202 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (
int) $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1203 $moreforfilter .=
'</div>';
1207$moreforfilter .=
'<div class="divsearchfield">';
1208$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1209$moreforfilter .=
'</div>';
1211print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1212print $moreforfilter;
1213$parameters = array(
'type' => $type);
1214$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1215print $hookmanager->resPrint;
1218$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1219$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1220$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1222print
'<div class="div-table-responsive">';
1223print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1227print
'<tr class="liste_titre_filter">';
1229if (
$conf->main_checkbox_left_column) {
1230 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1231 $searchpicto = $form->showFilterButtons(
'left');
1235if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1236 print
'<td class="liste_titre">';
1237 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dolPrintHTMLForAttribute($search_id).
'">';
1240if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1241 print
'<td class="liste_titre">';
1242 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_lastname" value="'.dolPrintHTMLForAttribute($search_lastname).
'">';
1245if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1247 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_firstname" value="'.dolPrintHTMLForAttribute($search_firstname).
'">';
1250if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1251 print
'<td class="liste_titre">';
1252 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_ref_ext" value="'.dolPrintHTMLForAttribute($search_ref_ext).
'">';
1255if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1256 print
'<td class="liste_titre">';
1257 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_poste" value="'.dolPrintHTMLForAttribute($search_poste).
'">';
1260if (!empty($arrayfields[
'p.address'][
'checked'])) {
1261 print
'<td class="liste_titre">';
1262 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dolPrintHTMLForAttribute($search_address).
'">';
1265if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1267 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dolPrintHTMLForAttribute($search_zip).
'">';
1270if (!empty($arrayfields[
'p.town'][
'checked'])) {
1271 print
'<td class="liste_titre">';
1272 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dolPrintHTMLForAttribute($search_town).
'">';
1276if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1277 print
'<td class="liste_titre">';
1278 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dolPrintHTMLForAttribute($search_state).
'">';
1282if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1283 print
'<td class="liste_titre">';
1284 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dolPrintHTMLForAttribute($search_region).
'">';
1288if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1289 print
'<td class="liste_titre center">';
1290 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1293if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1294 print
'<td class="liste_titre">';
1295 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_pro" size="6" value="'.dolPrintHTMLForAttribute($search_phone_pro).
'">';
1298if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1299 print
'<td class="liste_titre">';
1300 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_perso" size="6" value="'.dolPrintHTMLForAttribute($search_phone_perso).
'">';
1303if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1304 print
'<td class="liste_titre">';
1305 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" size="6" value="'.dolPrintHTMLForAttribute($search_phone_mobile).
'">';
1308if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1309 print
'<td class="liste_titre">';
1310 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" size="6" value="'.dolPrintHTMLForAttribute($search_fax).
'">';
1313if (!empty($arrayfields[
'p.email'][
'checked'])) {
1314 print
'<td class="liste_titre">';
1315 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" size="6" value="'.dolPrintHTMLForAttribute($search_email).
'">';
1318if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1319 print
'<td class="liste_titre center">';
1320 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1324 foreach ($socialnetworks as $key => $value) {
1325 if ($value[
'active']) {
1326 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1327 print
'<td class="liste_titre">';
1328 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.dolPrintHTMLForAttribute($search_[$key]).
'">';
1334if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1335 print
'<td class="liste_titre">';
1336 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe" size="8" value="'.dolPrintHTMLForAttribute($search_societe).
'">';
1340if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1341 print
'<td class="liste_titre left">';
1342 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe_alias" value="'.dolPrintHTMLForAttribute($search_societe_alias).
'">';
1345if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1346 print
'<td class="liste_titre center">';
1347 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1348 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1352if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1353 print
'<td class="liste_titre center">';
1354 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1358if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1359 print
'<td class="liste_titre maxwidthonsmartphone center">';
1360 $arraystcomm = array();
1361 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1362 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1364 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1367if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1368 print
'<td class="liste_titre center">';
1369 print
'<div class="nowrap">';
1370 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1372 print
'<div class="nowrap">';
1373 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1379include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1382$parameters = array(
'arrayfields' => $arrayfields);
1383$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1384print $hookmanager->resPrint;
1386if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1387 print
'<td class="liste_titre center nowraponall">';
1391if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1392 print
'<td class="liste_titre center nowraponall">';
1393 print
'<div class="nowrapfordate">';
1394 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'));
1396 print
'<div class="nowrapfordate">';
1397 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'));
1402if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1403 print
'<td class="liste_titre center nowraponall">';
1404 print
'<div class="nowrapfordate">';
1405 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'));
1407 print
'<div class="nowrapfordate">';
1408 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'));
1413if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1414 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1415 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');
1418if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1419 print
'<td class="liste_titre center">';
1420 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" size="3" value="'.dolPrintHTMLForAttribute($search_import_key).
'">';
1424if (!
$conf->main_checkbox_left_column) {
1425 print
'<td class="liste_titre center maxwidthsearch">';
1426 $searchpicto = $form->showFilterButtons();
1432$totalarray = array();
1433$totalarray[
'nbfield'] = 0;
1437print
'<tr class="liste_titre">';
1438if (
$conf->main_checkbox_left_column) {
1439 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1440 $totalarray[
'nbfield']++;
1442if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1443 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1444 $totalarray[
'nbfield']++;
1446if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1448 $totalarray[
'nbfield']++;
1450if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1451 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1452 $totalarray[
'nbfield']++;
1454if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1455 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1456 $totalarray[
'nbfield']++;
1458if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1459 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1460 $totalarray[
'nbfield']++;
1462if (!empty($arrayfields[
'p.address'][
'checked'])) {
1463 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1464 $totalarray[
'nbfield']++;
1466if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1467 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1468 $totalarray[
'nbfield']++;
1470if (!empty($arrayfields[
'p.town'][
'checked'])) {
1471 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1472 $totalarray[
'nbfield']++;
1474if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1475 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1476 $totalarray[
'nbfield']++;
1478if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1479 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1480 $totalarray[
'nbfield']++;
1482if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1483 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1484 $totalarray[
'nbfield']++;
1486if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1487 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1488 $totalarray[
'nbfield']++;
1490if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1491 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1492 $totalarray[
'nbfield']++;
1494if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1495 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1496 $totalarray[
'nbfield']++;
1498if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1499 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1500 $totalarray[
'nbfield']++;
1502if (!empty($arrayfields[
'p.email'][
'checked'])) {
1503 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1504 $totalarray[
'nbfield']++;
1506if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1507 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1508 $totalarray[
'nbfield']++;
1511 foreach ($socialnetworks as $key => $value) {
1512 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1513 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1514 $totalarray[
'nbfield']++;
1518if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1519 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1520 $totalarray[
'nbfield']++;
1522if (!empty($arrayfields[
's.nom'][
'checked'])) {
1523 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1524 $totalarray[
'nbfield']++;
1526if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1529 $totalarray[
'nbfield']++;
1531if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1532 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1533 $totalarray[
'nbfield']++;
1535if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1536 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1537 $totalarray[
'nbfield']++;
1539if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1540 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1541 $totalarray[
'nbfield']++;
1543if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1544 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1545 $totalarray[
'nbfield']++;
1548include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1550$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1551$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1552print $hookmanager->resPrint;
1554if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1555 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1556 $totalarray[
'nbfield']++;
1559if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1561 $totalarray[
'nbfield']++;
1563if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1565 $totalarray[
'nbfield']++;
1567if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1568 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1569 $totalarray[
'nbfield']++;
1571if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1573 $totalarray[
'nbfield']++;
1575if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1576 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1577 $totalarray[
'nbfield']++;
1579if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1580 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1581 $totalarray[
'nbfield']++;
1583if (!
$conf->main_checkbox_left_column) {
1584 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1585 $totalarray[
'nbfield']++;
1593$savnbfield = $totalarray[
'nbfield'];
1594$totalarray = array();
1595$totalarray[
'nbfield'] = 0;
1596$imaxinloop = ($limit ? min($num, $limit) : $num);
1597while ($i < $imaxinloop) {
1598 $obj = $db->fetch_object($resql);
1603 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1604 $contactstatic->id = $obj->rowid;
1605 $contactstatic->ref_ext = $obj->ref_ext;
1606 $contactstatic->lastname = $obj->lastname;
1607 $contactstatic->firstname = $obj->firstname;
1608 $contactstatic->status = $obj->statut;
1609 $contactstatic->statut = $obj->statut;
1610 $contactstatic->poste = $obj->poste;
1611 $contactstatic->email = $obj->email;
1612 $contactstatic->phone_pro = $obj->phone_pro;
1613 $contactstatic->phone_perso = $obj->phone_perso;
1614 $contactstatic->phone_mobile = $obj->phone_mobile;
1615 $contactstatic->address = $obj->address;
1616 $contactstatic->zip = $obj->zip;
1617 $contactstatic->town = $obj->town;
1618 $contactstatic->state = $obj->state_name;
1619 $contactstatic->region = $obj->region_name;
1620 $contactstatic->socialnetworks = $arraysocialnetworks;
1621 $contactstatic->country = $obj->country;
1622 $contactstatic->country_code = $obj->country_code;
1623 $contactstatic->photo = $obj->photo;
1624 $contactstatic->import_key = $obj->import_key;
1625 $contactstatic->photo = $obj->photo;
1626 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1630 if ($mode ==
'kanban') {
1632 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1633 print
'<div class="box-flex-container kanban">';
1636 if ($massactionbutton || $massaction) {
1638 if (in_array(
$object->id, $arrayofselected)) {
1642 if ($obj->socid > 0) {
1643 $contactstatic->fetch_thirdparty($obj->socid);
1645 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1646 if ($i == ($imaxinloop - 1)) {
1652 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select"';
1653 if ($contextpage ==
'poslist') {
1654 print
' onclick="location.href=\'list.php?action=change&token='.newToken().
'&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1659 if ($conf->main_checkbox_left_column) {
1660 print '<td class="nowrap center
">';
1661 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1663 if (in_array($obj->rowid, $arrayofselected)) {
1666 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1670 $totalarray['nbfield']++;
1675 if (!empty($arrayfields['p.rowid']['checked'])) {
1676 print '<td class="tdoverflowmax50
">';
1677 print dolPrintHTML($obj->rowid);
1680 $totalarray['nbfield']++;
1685 if (!empty($arrayfields['p.lastname']['checked'])) {
1686 print '<td class="middle tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1687 if ($contextpage == 'poslist') {
1688 print $contactstatic->lastname;
1690 print $contactstatic->getNomUrl(1);
1694 $totalarray['nbfield']++;
1699 if (!empty($arrayfields['p.firstname']['checked'])) {
1700 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1701 print dolPrintHTML($obj->firstname);
1704 $totalarray['nbfield']++;
1709 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1710 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1711 print dolPrintHTML($contactstatic->ref_ext);
1714 $totalarray['nbfield']++;
1719 if (!empty($arrayfields['p.poste']['checked'])) {
1720 print '<td class="tdoverflowmax100
">'.dolPrintHTML($obj->poste).'</td>';
1722 $totalarray['nbfield']++;
1727 if (!empty($arrayfields['p.address']['checked'])) {
1728 print '<td>'.dolPrintHTML($obj->address).'</td>';
1730 $totalarray['nbfield']++;
1735 if (!empty($arrayfields['p.zip']['checked'])) {
1736 print '<td>'.dolPrintHTML($obj->zip).'</td>';
1738 $totalarray['nbfield']++;
1743 if (!empty($arrayfields['p.town']['checked'])) {
1744 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->town).'">'.dolPrintHTML($obj->town).'</td>';
1746 $totalarray['nbfield']++;
1750 if (!empty($arrayfields['state.nom']['checked'])) {
1751 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
1753 $totalarray['nbfield']++;
1757 if (!empty($arrayfields['region.nom']['checked'])) {
1758 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
1760 $totalarray['nbfield']++;
1764 if (!empty($arrayfields['country.code_iso']['checked'])) {
1765 print '<td class="center
">';
1766 $tmparray = getCountry($obj->fk_pays, 'all');
1767 print dolPrintHTML($tmparray['label']);
1770 $totalarray['nbfield']++;
1775 if (!empty($arrayfields['p.phone']['checked'])) {
1776 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1778 $totalarray['nbfield']++;
1783 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1784 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1786 $totalarray['nbfield']++;
1791 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1792 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1794 $totalarray['nbfield']++;
1799 if (!empty($arrayfields['p.fax']['checked'])) {
1800 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1802 $totalarray['nbfield']++;
1807 if (!empty($arrayfields['p.email']['checked'])) {
1808 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTMLForAttribute((string) $obj->email).'">';
1809 if ($contextpage == 'poslist') {
1812 $showinvalidemail = getDolGlobalInt('MAIN_SHOW_INVALID_EMAIL_IN_LIST', 1); // in list, we check only syntax of emails
1813 print dol_print_email((string) $obj->email, $obj->rowid, $obj->socid, 1, 18, $showinvalidemail, 1);
1817 $totalarray['nbfield']++;
1821 // No EMail Subscription
1822 if (!empty($arrayfields['unsubscribed']['checked'])) {
1823 print '<td class="center
">';
1824 if (empty($obj->email)) {
1825 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1827 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1831 $totalarray['nbfield']++;
1836 if (isModEnabled('socialnetworks')) {
1837 foreach ($socialnetworks as $key => $value) {
1838 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1839 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1841 $totalarray['nbfield']++;
1847 // Company / Third Party
1848 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1849 print '<td class="tdoverflowmax125
">';
1851 $objsoc = new Societe($db);
1852 $objsoc->fetch($obj->socid);
1853 $option_link = 'customer';
1854 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1855 $option_link = 'supplier';
1856 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1859 if ($contextpage == 'poslist') {
1860 print $objsoc->name;
1862 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1869 $totalarray['nbfield']++;
1874 if (!empty($arrayfields['s.name_alias']['checked'])) {
1875 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->alias).'">';
1876 print '<span class="spantitle
">';
1877 print dolPrintHTML($obj->alias);
1881 $totalarray['nbfield']++;
1886 if (!empty($arrayfields['p.priv']['checked'])) {
1887 print '<td class="center
">';
1888 print $contactstatic->LibPubPriv($obj->priv, 2);
1891 $totalarray['nbfield']++;
1896 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1897 print '<td class="center
">';
1898 print $contactstatic->getLibProspLevel();
1901 $totalarray['nbfield']++;
1906 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1907 print '<td class="center nowrap
"><div class="nowrap
">';
1908 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1909 print '</div> - <div class="inline-block
">';
1910 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1911 $titlealt = 'default';
1912 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1913 $titlealt = $val['label'];
1915 if ($obj->stcomm_id != $val['id']) {
1916 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>';
1919 print '</div></div></td>';
1921 $totalarray['nbfield']++;
1926 if (!empty($arrayfields['p.birthday']['checked'])) {
1927 print '<td class="center nowraponall
">';
1928 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1931 $totalarray['nbfield']++;
1936 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1939 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1940 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1941 print $hookmanager->resPrint;
1944 if (!empty($arrayfields['p.ip']['checked'])) {
1945 print '<td class="center nowraponall
">';
1946 print dol_print_ip($obj->ip);
1949 $totalarray['nbfield']++;
1954 if (!empty($arrayfields['p.datec']['checked'])) {
1955 print '<td class="center nowraponall
">';
1956 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1959 $totalarray['nbfield']++;
1963 // Date modification
1964 if (!empty($arrayfields['p.tms']['checked'])) {
1965 print '<td class="center nowraponall
">';
1966 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1969 $totalarray['nbfield']++;
1974 if (!empty($arrayfields['p.note_public']['checked'])) {
1975 print '<td class="flat maxwidth250imp
">';
1976 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1979 $totalarray['nbfield']++;
1983 if (!empty($arrayfields['p.note_private']['checked'])) {
1984 print '<td class="flat maxwidth250imp
">';
1985 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1988 $totalarray['nbfield']++;
1993 if (!empty($arrayfields['p.statut']['checked'])) {
1994 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1996 $totalarray['nbfield']++;
2001 if (!empty($arrayfields['p.import_key']['checked'])) {
2002 print '<td class="tdoverflowmax100
">';
2003 print dolPrintHTML($obj->import_key);
2006 $totalarray['nbfield']++;
2011 if (!$conf->main_checkbox_left_column) {
2012 print '<td class="nowrap center
">';
2013 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2015 if (in_array($obj->rowid, $arrayofselected)) {
2018 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2022 $totalarray['nbfield']++;
2032include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2034// If no record found
2037 foreach ($arrayfields as $key => $val) {
2038 if (!empty($val['checked'])) {
2042 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2047$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2048$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2049print $hookmanager->resPrint;
2051print '</table>'."\n
";
2054print '</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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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_natural_search_phone($db, $fields, $value, $nofirstand=0)
Build a natural_search() SQL fragment for a phone/fax field, tolerant of the international storage fo...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.