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.name_alias, 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) {
725 if (empty($arrayfields[
'p.firstname'][
'checked'])) {
727 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_lastname);
732if ($search_firstname) {
735if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
736 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
738 if ($search_societe) {
741 if ($search_societe_alias) {
745if ($search_country) {
746 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
748if (strlen($search_poste)) {
751if (strlen($search_phone_perso)) {
754if (strlen($search_phone_pro)) {
757if (strlen($search_phone_mobile)) {
760if (strlen($search_fax)) {
764 foreach ($socialnetworks as $key => $value) {
765 if ($value[
'active'] && strlen($search_[$key])) {
766 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
767 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
768 $sql .=
" AND p.socialnetworks REGEXP '".$db->escape(
"\"".$db->escapeforlike($key).
"\":\"[^\"]*".$db->escapeforlike($searchkeyinjsonformat)).
"'";
769 } elseif ($db->type ==
'pgsql') {
770 $sql .=
" AND p.socialnetworks ~ '".$db->escape(
"\"".$db->escapeforlike($key).
"\":\"[^\"]*".$db->escapeforlike($searchkeyinjsonformat)).
"'";
773 $sql .=
" AND p.socialnetworks LIKE '".$db->escape(
"%\"".$db->escapeforlike($key.
"\":\"".$searchkeyinjsonformat).
"%").
"'";
780if (strlen($search_email)) {
783if (strlen($search_address)) {
786if (strlen($search_zip)) {
789if (strlen($search_town)) {
798if (count($search_roles) > 0) {
799 $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)).
"))";
801if ($search_no_email != -1 && $search_no_email > 0) {
802 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
804if ($search_no_email != -1 && $search_no_email == 0) {
805 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
807if ($search_note_public !=
'') {
810if ($search_note_private !=
'') {
813if ($search_date_creation_start) {
814 $sql .=
" AND p.datec >= '".$db->idate($search_date_creation_start).
"'";
816if ($search_date_creation_end) {
817 $sql .=
" AND p.datec <= '".$db->idate($search_date_creation_end).
"'";
820if ($search_date_modif_start) {
821 $sql .=
" AND p.tms >= '".$db->idate($search_date_modif_start).
"'";
823if ($search_date_modif_end) {
824 $sql .=
" AND p.tms <= '".$db->idate($search_date_modif_end).
"'";
826if ($search_status !=
'' && $search_status >= 0) {
827 $sql .=
" AND p.statut = ".((int) $search_status);
829if ($search_import_key) {
833 $sql .=
" AND p.fk_soc IS NULL";
834} elseif ($type ==
"f") {
835 $sql .=
" AND s.fournisseur = 1";
836} elseif ($type ==
"c") {
837 $sql .=
" AND s.client IN (1, 3)";
838} elseif ($type ==
"p") {
839 $sql .=
" AND s.client IN (2, 3)";
842 $sql .=
" AND s.rowid = ".((int) $socid);
844if ($search_birthday_start) {
845 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
847if ($search_birthday_end) {
848 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
852include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
855$parameters = array();
856$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
857$sql .= $hookmanager->resPrint;
861$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
862$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
863$sql .= $hookmanager->resPrint;
867$nbtotalofrecords =
'';
870 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
871 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
872 $resql = $db->query($sqlforcount);
874 $objforcount = $db->fetch_object($resql);
875 $nbtotalofrecords = $objforcount->nbtotalofrecords;
877 dol_print_error($db);
880 if (($page * $limit) > (
int) $nbtotalofrecords) {
888if ($view ==
"recent") {
889 $sql .= $db->order(
"p.datec",
"DESC");
891 $sql .= $db->order($sortfield, $sortorder);
894 $sql .= $db->plimit($limit + 1, $offset);
897$resql = $db->query($sql);
899 dol_print_error($db);
903$num = $db->num_rows($resql);
906if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
907 $obj = $db->fetch_object($resql);
909 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
917llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
919$arrayofselected = is_array($toselect) ? $toselect : array();
923 $param .=
'&mode='.urlencode($mode);
925if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
926 $param .=
'&contextpage='.urlencode($contextpage);
928if ($limit > 0 && $limit !=
$conf->liste_limit) {
929 $param .=
'&limit='.((int) $limit);
931if ($optioncss !=
'') {
932 $param .=
'&optioncss='.urlencode($optioncss);
934$param .=
'&userid='.urlencode((
string) $userid).
'&contactname='.urlencode((
string) $search_all);
935$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
936if (!empty($search_sale) && $search_sale !=
'-1') {
937 $param .=
'&search_sale='.urlencode($search_sale);
939if (!empty($search_categ) && $search_categ !=
'-1') {
940 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
942if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
943 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
945if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
946 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
948if ($search_all !=
'') {
949 $param .=
'&search_all='.urlencode($search_all);
952 $param .=
"&search_id=".((int) $search_id);
954if ($search_ref_ext) {
955 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
957if ($search_lastname !=
'') {
958 $param .=
'&search_lastname='.urlencode($search_lastname);
960if ($search_firstname !=
'') {
961 $param .=
'&search_firstname='.urlencode($search_firstname);
963if ($search_societe !=
'') {
964 $param .=
'&search_societe='.urlencode($search_societe);
966if ($search_societe_alias !=
'') {
967 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
969if ($search_address !=
'') {
970 $param .=
'&search_address='.urlencode($search_address);
972if ($search_zip !=
'') {
973 $param .=
'&search_zip='.urlencode($search_zip);
975if ($search_town !=
'') {
976 $param .=
'&search_town='.urlencode($search_town);
978if ($search_state !=
'') {
979 $param .=
"&search_state=".urlencode($search_state);
981if ($search_region !=
'') {
982 $param .=
"&search_region=".urlencode($search_region);
984if ($search_country !=
'') {
985 $param .=
"&search_country=".urlencode($search_country);
987if ($search_poste !=
'') {
988 $param .=
'&search_poste='.urlencode($search_poste);
990if ($search_phone_pro !=
'') {
991 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
993if ($search_phone_perso !=
'') {
994 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
996if ($search_phone_mobile !=
'') {
997 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
999if ($search_fax !=
'') {
1000 $param .=
'&search_fax='.urlencode($search_fax);
1002if ($search_email !=
'') {
1003 $param .=
'&search_email='.urlencode($search_email);
1005if ($search_no_email !=
'') {
1006 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
1008if ($search_note_private !=
'') {
1009 $param .=
'&search_note_private='.urlencode((
string) ($search_note_private));
1011if ($search_note_public !=
'') {
1012 $param .=
'&search_note_public='.urlencode((
string) ($search_note_public));
1014if ($search_date_creation_startmonth) {
1015 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1017if ($search_date_creation_startyear) {
1018 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1020if ($search_date_creation_startday) {
1021 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1023if ($search_date_creation_start) {
1024 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1026if ($search_date_creation_endmonth) {
1027 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1029if ($search_date_creation_endyear) {
1030 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1032if ($search_date_creation_endday) {
1033 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1035if ($search_date_creation_end) {
1036 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1038if ($search_date_modif_startmonth) {
1039 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1041if ($search_date_modif_startyear) {
1042 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1044if ($search_date_modif_startday) {
1045 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1047if ($search_date_modif_start) {
1048 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1050if ($search_date_modif_endmonth) {
1051 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1053if ($search_date_modif_endyear) {
1054 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1056if ($search_date_modif_endday) {
1057 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1059if ($search_date_modif_end) {
1060 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1062if ($search_stcomm !=
'') {
1063 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1065if ($search_status !=
'') {
1066 $param .=
'&search_status='.urlencode((
string) ($search_status));
1068if ($search_priv ==
'0' || $search_priv ==
'1') {
1069 $param .=
"&search_priv=".urlencode($search_priv);
1071if ($search_stcomm !=
'') {
1072 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
1074if (is_array($search_level) && count($search_level)) {
1075 foreach ($search_level as $slevel) {
1076 $param .=
'&search_level[]='.urlencode($slevel);
1079if ($search_import_key !=
'') {
1080 $param .=
'&search_import_key='.urlencode($search_import_key);
1082if (count($search_roles) > 0) {
1083 $param .= implode(
'&search_roles[]=', $search_roles);
1085if ($search_birthday_start) {
1086 $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'));
1088if ($search_birthday_end) {
1089 $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'));
1092include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1095$arrayofmassactions = array(
1096 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1100if (!empty($permissiontodelete)) {
1101 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1103if (
isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
1104 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1106if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
1107 $arrayofmassactions = array();
1110$massactionbutton =
'';
1111if ($contextpage !=
'poslist') {
1112 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1115print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
1116if ($optioncss !=
'') {
1117 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1119print
'<input type="hidden" name="token" value="'.newToken().
'">';
1120print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1121print
'<input type="hidden" name="view" value="'.dolPrintHTMLForAttribute($view).
'">';
1122print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1123print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1125print
'<input type="hidden" name="type" value="'.$type.
'">';
1126print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1127print
'<input type="hidden" name="page_y" value="">';
1128print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1132$parameters = array();
1133$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1134if (empty($reshook)) {
1135 $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'));
1136 $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'));
1138 if ($contextpage !=
'poslist') {
1139 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
1140 } elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
1141 $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);
1142 $label =
'MenuNewCustomer';
1143 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1146 $newcardbutton = $hookmanager->resPrint;
1149print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1151$topicmail =
"Information";
1152$modelmail =
"contact";
1154$trackid =
'ctc'.$object->id;
1155include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1159 foreach ($fieldstosearchall as $key => $val) {
1160 $fieldstosearchall[$key] = $langs->trans($val);
1161 $setupstring .= $key.
"=".$val.
";";
1163 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1164 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1166if ($search_firstlast_only) {
1167 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1173if ($user->hasRight(
'societe',
'client',
'voir')) {
1174 $langs->load(
'commercial');
1175 $moreforfilter .=
'<div class="divsearchfield">';
1176 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1177 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1178 $moreforfilter .=
'</div>';
1181if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1182 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1183 $moreforfilter .=
'<div class="divsearchfield">';
1184 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1185 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1186 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, (
int) $search_categ,
'search_categ', 1, $tmptitle);
1187 $moreforfilter .=
'</div>';
1188 if (empty($type) || $type ==
'c' || $type ==
'p') {
1189 $moreforfilter .=
'<div class="divsearchfield">';
1192 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1193 } elseif ($type ==
'p') {
1194 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1196 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1198 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1199 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, (
int) $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1200 $moreforfilter .=
'</div>';
1203 if (
isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1204 $moreforfilter .=
'<div class="divsearchfield">';
1205 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1206 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1207 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, (
int) $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1208 $moreforfilter .=
'</div>';
1212$moreforfilter .=
'<div class="divsearchfield">';
1213$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1214$moreforfilter .=
'</div>';
1216print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1217print $moreforfilter;
1218$parameters = array(
'type' => $type);
1219$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1220print $hookmanager->resPrint;
1223$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1224$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1225$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1227print
'<div class="div-table-responsive">';
1228print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1232print
'<tr class="liste_titre_filter">';
1234if (
$conf->main_checkbox_left_column) {
1235 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1236 $searchpicto = $form->showFilterButtons(
'left');
1240if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1241 print
'<td class="liste_titre">';
1242 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dolPrintHTMLForAttribute($search_id).
'">';
1245if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1247 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_lastname" value="'.dolPrintHTMLForAttribute($search_lastname).
'">';
1250if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1251 print
'<td class="liste_titre">';
1252 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_firstname" value="'.dolPrintHTMLForAttribute($search_firstname).
'">';
1255if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1256 print
'<td class="liste_titre">';
1257 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_ref_ext" value="'.dolPrintHTMLForAttribute($search_ref_ext).
'">';
1260if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1261 print
'<td class="liste_titre">';
1262 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_poste" value="'.dolPrintHTMLForAttribute($search_poste).
'">';
1265if (!empty($arrayfields[
'p.address'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1267 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dolPrintHTMLForAttribute($search_address).
'">';
1270if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1271 print
'<td class="liste_titre">';
1272 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dolPrintHTMLForAttribute($search_zip).
'">';
1275if (!empty($arrayfields[
'p.town'][
'checked'])) {
1276 print
'<td class="liste_titre">';
1277 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dolPrintHTMLForAttribute($search_town).
'">';
1281if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1282 print
'<td class="liste_titre">';
1283 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dolPrintHTMLForAttribute($search_state).
'">';
1287if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1288 print
'<td class="liste_titre">';
1289 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dolPrintHTMLForAttribute($search_region).
'">';
1293if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1294 print
'<td class="liste_titre center">';
1295 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1298if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1299 print
'<td class="liste_titre">';
1300 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_pro" size="6" value="'.dolPrintHTMLForAttribute($search_phone_pro).
'">';
1303if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1304 print
'<td class="liste_titre">';
1305 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_perso" size="6" value="'.dolPrintHTMLForAttribute($search_phone_perso).
'">';
1308if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1309 print
'<td class="liste_titre">';
1310 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" size="6" value="'.dolPrintHTMLForAttribute($search_phone_mobile).
'">';
1313if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1314 print
'<td class="liste_titre">';
1315 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" size="6" value="'.dolPrintHTMLForAttribute($search_fax).
'">';
1318if (!empty($arrayfields[
'p.email'][
'checked'])) {
1319 print
'<td class="liste_titre">';
1320 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" size="6" value="'.dolPrintHTMLForAttribute($search_email).
'">';
1323if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1324 print
'<td class="liste_titre center">';
1325 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1329 foreach ($socialnetworks as $key => $value) {
1330 if ($value[
'active']) {
1331 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1332 print
'<td class="liste_titre">';
1333 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.dolPrintHTMLForAttribute($search_[$key]).
'">';
1339if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1340 print
'<td class="liste_titre">';
1341 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe" size="8" value="'.dolPrintHTMLForAttribute($search_societe).
'">';
1345if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1346 print
'<td class="liste_titre left">';
1347 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_societe_alias" value="'.dolPrintHTMLForAttribute($search_societe_alias).
'">';
1350if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1351 print
'<td class="liste_titre center">';
1352 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1353 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1357if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1358 print
'<td class="liste_titre center">';
1359 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1363if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1364 print
'<td class="liste_titre maxwidthonsmartphone center">';
1365 $arraystcomm = array();
1366 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1367 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1369 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1372if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1373 print
'<td class="liste_titre center">';
1374 print
'<div class="nowrap">';
1375 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1377 print
'<div class="nowrap">';
1378 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1384include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1387$parameters = array(
'arrayfields' => $arrayfields);
1388$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1389print $hookmanager->resPrint;
1391if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1392 print
'<td class="liste_titre center nowraponall">';
1396if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1397 print
'<td class="liste_titre center nowraponall">';
1398 print
'<div class="nowrapfordate">';
1399 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'));
1401 print
'<div class="nowrapfordate">';
1402 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'));
1407if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1408 print
'<td class="liste_titre center nowraponall">';
1409 print
'<div class="nowrapfordate">';
1410 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'));
1412 print
'<div class="nowrapfordate">';
1413 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'));
1418if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1419 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1420 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');
1423if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1424 print
'<td class="liste_titre center">';
1425 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" size="3" value="'.dolPrintHTMLForAttribute($search_import_key).
'">';
1429if (!
$conf->main_checkbox_left_column) {
1430 print
'<td class="liste_titre center maxwidthsearch">';
1431 $searchpicto = $form->showFilterButtons();
1437$totalarray = array();
1438$totalarray[
'nbfield'] = 0;
1442print
'<tr class="liste_titre">';
1443if (
$conf->main_checkbox_left_column) {
1444 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1445 $totalarray[
'nbfield']++;
1447if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1448 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1449 $totalarray[
'nbfield']++;
1451if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1452 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1453 $totalarray[
'nbfield']++;
1455if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1456 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1457 $totalarray[
'nbfield']++;
1459if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1460 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1461 $totalarray[
'nbfield']++;
1463if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1464 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1465 $totalarray[
'nbfield']++;
1467if (!empty($arrayfields[
'p.address'][
'checked'])) {
1468 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1469 $totalarray[
'nbfield']++;
1471if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1472 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1473 $totalarray[
'nbfield']++;
1475if (!empty($arrayfields[
'p.town'][
'checked'])) {
1476 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1477 $totalarray[
'nbfield']++;
1479if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1480 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1481 $totalarray[
'nbfield']++;
1483if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1484 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1485 $totalarray[
'nbfield']++;
1487if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1488 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1489 $totalarray[
'nbfield']++;
1491if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1492 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1493 $totalarray[
'nbfield']++;
1495if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1496 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1497 $totalarray[
'nbfield']++;
1499if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1500 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1501 $totalarray[
'nbfield']++;
1503if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1504 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1505 $totalarray[
'nbfield']++;
1507if (!empty($arrayfields[
'p.email'][
'checked'])) {
1508 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1509 $totalarray[
'nbfield']++;
1511if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1512 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1513 $totalarray[
'nbfield']++;
1516 foreach ($socialnetworks as $key => $value) {
1517 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1519 $totalarray[
'nbfield']++;
1523if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1524 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1525 $totalarray[
'nbfield']++;
1527if (!empty($arrayfields[
's.nom'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1529 $totalarray[
'nbfield']++;
1531if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1533 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1534 $totalarray[
'nbfield']++;
1536if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1537 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1538 $totalarray[
'nbfield']++;
1540if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1541 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1542 $totalarray[
'nbfield']++;
1544if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1545 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1546 $totalarray[
'nbfield']++;
1548if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1549 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1550 $totalarray[
'nbfield']++;
1553include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1555$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1556$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1557print $hookmanager->resPrint;
1559if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1561 $totalarray[
'nbfield']++;
1564if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1565 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1566 $totalarray[
'nbfield']++;
1568if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1569 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1570 $totalarray[
'nbfield']++;
1572if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1573 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1574 $totalarray[
'nbfield']++;
1576if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1577 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1578 $totalarray[
'nbfield']++;
1580if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1581 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1582 $totalarray[
'nbfield']++;
1584if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1585 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1586 $totalarray[
'nbfield']++;
1588if (!
$conf->main_checkbox_left_column) {
1589 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1590 $totalarray[
'nbfield']++;
1598$savnbfield = $totalarray[
'nbfield'];
1599$totalarray = array();
1600$totalarray[
'nbfield'] = 0;
1601$imaxinloop = ($limit ? min($num, $limit) : $num);
1602while ($i < $imaxinloop) {
1603 $obj = $db->fetch_object($resql);
1608 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1609 $contactstatic->id = $obj->rowid;
1610 $contactstatic->ref_ext = $obj->ref_ext;
1611 $contactstatic->lastname = $obj->lastname;
1612 $contactstatic->firstname = $obj->firstname;
1613 $contactstatic->status = $obj->statut;
1614 $contactstatic->statut = $obj->statut;
1615 $contactstatic->poste = $obj->poste;
1616 $contactstatic->email = $obj->email;
1617 $contactstatic->phone_pro = $obj->phone_pro;
1618 $contactstatic->phone_perso = $obj->phone_perso;
1619 $contactstatic->phone_mobile = $obj->phone_mobile;
1620 $contactstatic->address = $obj->address;
1621 $contactstatic->zip = $obj->zip;
1622 $contactstatic->town = $obj->town;
1623 $contactstatic->state = $obj->state_name;
1624 $contactstatic->region = $obj->region_name;
1625 $contactstatic->socialnetworks = $arraysocialnetworks;
1626 $contactstatic->country = $obj->country;
1627 $contactstatic->country_code = $obj->country_code;
1628 $contactstatic->photo = $obj->photo;
1629 $contactstatic->import_key = $obj->import_key;
1630 $contactstatic->photo = $obj->photo;
1631 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1635 if ($mode ==
'kanban') {
1637 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1638 print
'<div class="box-flex-container kanban">';
1641 if ($massactionbutton || $massaction) {
1643 if (in_array(
$object->id, $arrayofselected)) {
1647 if ($obj->socid > 0) {
1648 $contactstatic->fetch_thirdparty($obj->socid);
1650 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1651 if ($i == ($imaxinloop - 1)) {
1657 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select"';
1658 if ($contextpage ==
'poslist') {
1659 print
' onclick="location.href=\'list.php?action=change&token='.newToken().
'&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1664 if ($conf->main_checkbox_left_column) {
1665 print '<td class="nowrap center
">';
1666 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1668 if (in_array($obj->rowid, $arrayofselected)) {
1671 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1675 $totalarray['nbfield']++;
1680 if (!empty($arrayfields['p.rowid']['checked'])) {
1681 print '<td class="tdoverflowmax50
">';
1682 print dolPrintHTML($obj->rowid);
1685 $totalarray['nbfield']++;
1690 if (!empty($arrayfields['p.lastname']['checked'])) {
1691 print '<td class="middle tdlineheightsmall
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1692 print '<div class="tdoverflowmax150
inline-block lineheightsmall
">';
1693 if ($contextpage == 'poslist') {
1694 print $contactstatic->lastname;
1695 } elseif (empty($arrayfields['p.firstname']['checked'])) {
1696 // Show only lastname in link and firstname under it when firstname column is not enabled
1697 $contactstatic->firstname = '';
1698 print $contactstatic->getNomUrl(1);
1699 $contactstatic->firstname = $obj->firstname;
1700 if (!empty($obj->firstname)) {
1701 print '<br><span class="spantitle
">'.dolPrintHTML($obj->firstname).'</span>';
1704 print $contactstatic->getNomUrl(1);
1709 $totalarray['nbfield']++;
1714 if (!empty($arrayfields['p.firstname']['checked'])) {
1715 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1716 print dolPrintHTML($obj->firstname);
1719 $totalarray['nbfield']++;
1724 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1725 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1726 print dolPrintHTML($contactstatic->ref_ext);
1729 $totalarray['nbfield']++;
1734 if (!empty($arrayfields['p.poste']['checked'])) {
1735 print '<td class="tdoverflowmax100
">'.dolPrintHTML($obj->poste).'</td>';
1737 $totalarray['nbfield']++;
1742 if (!empty($arrayfields['p.address']['checked'])) {
1743 print '<td>'.dolPrintHTML($obj->address).'</td>';
1745 $totalarray['nbfield']++;
1750 if (!empty($arrayfields['p.zip']['checked'])) {
1751 print '<td>'.dolPrintHTML($obj->zip).'</td>';
1753 $totalarray['nbfield']++;
1758 if (!empty($arrayfields['p.town']['checked'])) {
1759 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->town).'">'.dolPrintHTML($obj->town).'</td>';
1761 $totalarray['nbfield']++;
1765 if (!empty($arrayfields['state.nom']['checked'])) {
1766 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
1768 $totalarray['nbfield']++;
1772 if (!empty($arrayfields['region.nom']['checked'])) {
1773 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
1775 $totalarray['nbfield']++;
1779 if (!empty($arrayfields['country.code_iso']['checked'])) {
1780 print '<td class="center
">';
1781 $tmparray = getCountry($obj->fk_pays, 'all');
1782 print dolPrintHTML($tmparray['label']);
1785 $totalarray['nbfield']++;
1790 if (!empty($arrayfields['p.phone']['checked'])) {
1791 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1793 $totalarray['nbfield']++;
1798 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1799 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1801 $totalarray['nbfield']++;
1806 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1807 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1809 $totalarray['nbfield']++;
1814 if (!empty($arrayfields['p.fax']['checked'])) {
1815 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1817 $totalarray['nbfield']++;
1822 if (!empty($arrayfields['p.email']['checked'])) {
1823 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTMLForAttribute((string) $obj->email).'">';
1824 if ($contextpage == 'poslist') {
1827 $showinvalidemail = getDolGlobalInt('MAIN_SHOW_INVALID_EMAIL_IN_LIST', 1); // in list, we check only syntax of emails
1828 print dol_print_email((string) $obj->email, $obj->rowid, $obj->socid, 1, 18, $showinvalidemail, 1);
1832 $totalarray['nbfield']++;
1836 // No EMail Subscription
1837 if (!empty($arrayfields['unsubscribed']['checked'])) {
1838 print '<td class="center
">';
1839 if (empty($obj->email)) {
1840 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1842 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1846 $totalarray['nbfield']++;
1851 if (isModEnabled('socialnetworks')) {
1852 foreach ($socialnetworks as $key => $value) {
1853 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1854 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1856 $totalarray['nbfield']++;
1862 // Company / Third Party
1863 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1864 print '<td class="tdlineheightsmall
">';
1865 print '<div class="tdoverflowmax150
inline-block lineheightsmall
">';
1867 $objsoc = new Societe($db);
1868 $objsoc->fetch($obj->socid);
1869 $option_link = 'customer';
1870 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1871 $option_link = 'supplier';
1872 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1875 if ($contextpage == 'poslist') {
1876 print $objsoc->name;
1878 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, 1);
1879 // Show alias name under the third party name when alias column is not enabled
1880 if (empty($arrayfields['s.name_alias']['checked']) && !empty($obj->alias)) {
1881 print '<br><span class="spantitle
">'.dolPrintHTML($obj->alias).'</span>';
1890 $totalarray['nbfield']++;
1895 if (!empty($arrayfields['s.name_alias']['checked'])) {
1896 print '<td class="tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($obj->alias).'">';
1897 print '<span class="spantitle
">';
1898 print dolPrintHTML($obj->alias);
1902 $totalarray['nbfield']++;
1907 if (!empty($arrayfields['p.priv']['checked'])) {
1908 print '<td class="center
">';
1909 print $contactstatic->LibPubPriv($obj->priv, 2);
1912 $totalarray['nbfield']++;
1917 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1918 print '<td class="center
">';
1919 print $contactstatic->getLibProspLevel();
1922 $totalarray['nbfield']++;
1927 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1928 print '<td class="center nowrap
"><div class="nowrap
">';
1929 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1930 print '</div> - <div class="inline-block
">';
1931 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1932 $titlealt = 'default';
1933 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1934 $titlealt = $val['label'];
1936 if ($obj->stcomm_id != $val['id']) {
1937 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>';
1940 print '</div></div></td>';
1942 $totalarray['nbfield']++;
1947 if (!empty($arrayfields['p.birthday']['checked'])) {
1948 print '<td class="center nowraponall
">';
1949 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1952 $totalarray['nbfield']++;
1957 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1960 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1961 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1962 print $hookmanager->resPrint;
1965 if (!empty($arrayfields['p.ip']['checked'])) {
1966 print '<td class="center nowraponall
">';
1967 print dol_print_ip($obj->ip);
1970 $totalarray['nbfield']++;
1975 if (!empty($arrayfields['p.datec']['checked'])) {
1976 print '<td class="center nowraponall
">';
1977 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1980 $totalarray['nbfield']++;
1984 // Date modification
1985 if (!empty($arrayfields['p.tms']['checked'])) {
1986 print '<td class="center nowraponall
">';
1987 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1990 $totalarray['nbfield']++;
1995 if (!empty($arrayfields['p.note_public']['checked'])) {
1996 print '<td class="flat maxwidth250imp
">';
1997 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2000 $totalarray['nbfield']++;
2004 if (!empty($arrayfields['p.note_private']['checked'])) {
2005 print '<td class="flat maxwidth250imp
">';
2006 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2009 $totalarray['nbfield']++;
2014 if (!empty($arrayfields['p.statut']['checked'])) {
2015 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
2017 $totalarray['nbfield']++;
2022 if (!empty($arrayfields['p.import_key']['checked'])) {
2023 print '<td class="tdoverflowmax100
">';
2024 print dolPrintHTML($obj->import_key);
2027 $totalarray['nbfield']++;
2032 if (!$conf->main_checkbox_left_column) {
2033 print '<td class="nowrap center
">';
2034 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2036 if (in_array($obj->rowid, $arrayofselected)) {
2039 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2043 $totalarray['nbfield']++;
2053include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2055// If no record found
2058 foreach ($arrayfields as $key => $val) {
2059 if (!empty($val['checked'])) {
2063 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2068$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2069$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2070print $hookmanager->resPrint;
2072print '</table>'."\n
";
2075print '</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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.