40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
55$langs->loadLangs(array(
"companies",
"suppliers",
"categories"));
60$action =
GETPOST(
'action',
'aZ09');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contactlist';
66$mode =
GETPOST(
'mode',
'alpha');
68if ($contextpage ==
'poslist') {
77$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
78$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
79$search_phone =
GETPOST(
"search_phone",
'alpha');
81$search_id =
GETPOST(
"search_id",
"intcomma");
82$search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
83$search_lastname =
GETPOST(
"search_lastname",
'alpha');
84$search_firstname =
GETPOST(
"search_firstname",
'alpha');
85$search_societe =
GETPOST(
"search_societe",
'alpha');
86$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
87$search_poste =
GETPOST(
"search_poste",
'alpha');
88$search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
89$search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
90$search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
91$search_fax =
GETPOST(
"search_fax",
'alpha');
92$search_email =
GETPOST(
"search_email",
'alpha');
93if (isModEnabled(
'mailing')) {
94 $search_no_email = GETPOSTISSET(
"search_no_email") ?
GETPOSTINT(
"search_no_email") : -1;
96 $search_no_email = -1;
101if (isModEnabled(
'socialnetworks')) {
102 foreach ($socialnetworks as $key => $value) {
103 if ($value[
'active']) {
104 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
108$search_priv =
GETPOST(
"search_priv",
'alpha');
109$search_sale =
GETPOST(
'search_sale',
'intcomma');
110$search_categ =
GETPOST(
"search_categ",
'intcomma');
111$search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'intcomma');
112$search_categ_supplier =
GETPOST(
"search_categ_supplier",
'intcomma');
113$search_status =
GETPOST(
"search_status",
"intcomma");
114$search_type =
GETPOST(
'search_type',
'alpha');
115$search_address =
GETPOST(
'search_address',
'alpha');
116$search_zip =
GETPOST(
'search_zip',
'alpha');
117$search_town =
GETPOST(
'search_town',
'alpha');
118$search_import_key =
GETPOST(
"search_import_key",
'alpha');
119$search_country =
GETPOST(
"search_country",
'aZ09');
120$search_roles =
GETPOST(
"search_roles",
'array');
121$search_level =
GETPOST(
"search_level",
'array');
122$search_stcomm =
GETPOST(
'search_stcomm',
'intcomma');
126if ($search_status ===
'') {
129if ($search_no_email ===
'') {
130 $search_no_email = -1;
133$optioncss =
GETPOST(
'optioncss',
'alpha');
135$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
138$view =
GETPOST(
"view",
'alpha');
145$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
146$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
152 $sortfield =
"p.lastname";
154if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
158$offset = $limit * $page;
159$pageprev = $page - 1;
160$pagenext = $page + 1;
163$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
165 if (empty($contextpage) || $contextpage ==
'contactlist') {
166 $contextpage =
'contactprospectlist';
168 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
171 if (empty($contextpage) || $contextpage ==
'contactlist') {
172 $contextpage =
'contactcustomerlist';
174 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
175} elseif ($type ==
"f") {
176 if (empty($contextpage) || $contextpage ==
'contactlist') {
177 $contextpage =
'contactsupplierlist';
179 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
180} elseif ($type ==
"o") {
181 if (empty($contextpage) || $contextpage ==
'contactlist') {
182 $contextpage =
'contactotherlist';
184 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
190$hookmanager->initHooks(array($contextpage));
192if ($user->socid > 0) {
193 $socid = $user->socid;
198$extrafields->fetch_name_optionals_label(
$object->table_element);
200$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
203$fieldstosearchall = array();
204foreach (
$object->fields as $key => $val) {
206 if (!empty($user->socid) && $key ==
"note_private") {
210 if (empty($val[
'searchall'])) {
214 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
219 $fieldstosearchall[
's.nom'] =
"ThirdParty";
220 $fieldstosearchall[
's.name_alias'] =
"AliasNames";
223$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
224$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
226 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
227} elseif ($reshook == 0) {
228 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
232$arrayfields = array();
233foreach (
$object->fields as $key => $val) {
235 if (!empty($val[
'visible'])) {
236 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
237 $arrayfields[
'p.'.$key] = array(
238 'label' => $val[
'label'],
239 'checked' => (($visible < 0) ? 0 : 1),
240 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
241 'position' => $val[
'position'],
242 'help' => isset($val[
'help']) ? $val[
'help'] :
''
248$arrayfields[
'country.code_iso'] = array(
'label' =>
"Country",
'position' => 66,
'checked' => 0);
250 $arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'position' => 113,
'checked' => 1);
251 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'position' => 114,
'checked' => 1);
254$arrayfields[
'unsubscribed'] = array(
255 'label' =>
'No_Email',
257 'enabled' => (isModEnabled(
'mailing')),
260if (isModEnabled(
'socialnetworks')) {
261 foreach ($socialnetworks as $key => $value) {
262 if ($value[
'active']) {
263 $arrayfields[
'p.'.$key] = array(
264 'label' => $value[
'label'],
273include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
278'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
281if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
288$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
289$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
290$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
292if (!$permissiontoread) {
301if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
306 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
307 $result = $db->query($sql);
308 $num_lines = $db->num_rows($result);
309 if ($num_lines == 0) {
310 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
312 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
315 $invoice->module_source =
'takepos';
316 $invoice->pos_source = $_SESSION[
"takeposterminal"];
317 $placeid = $invoice->create($user);
318 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
322 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
323 $resql = $db->query($sql);
326 if (!isset($invoice)) {
327 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
329 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
330 $invoice->delete_linked_contact(
'external',
'BILLING');
332 $invoice->add_contact($idcontact,
'BILLING'); ?>
334 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
335 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
337 <?php
if (!$resql) { ?>
338 alert(
'Error failed to update customer on draft invoice.');
340 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
341 parent.$.colorbox.close();
348if (
GETPOST(
'cancel',
'alpha')) {
352if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
356$parameters = array(
'arrayfields' => &$arrayfields);
357$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
362if (empty($reshook)) {
364 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
367 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
370 $search_firstlast_only =
"";
371 $search_lastname =
"";
372 $search_firstname =
"";
373 $search_societe =
"";
374 $search_societe_alias =
"";
376 $search_address =
"";
378 $search_country =
"";
381 $search_phone_perso =
"";
382 $search_phone_pro =
"";
383 $search_phone_mobile =
"";
386 $search_no_email = -1;
387 if (isModEnabled(
'socialnetworks')) {
388 foreach ($socialnetworks as $key => $value) {
389 if ($value[
'active']) {
400 $search_categ_thirdparty =
'';
401 $search_categ_supplier =
'';
402 $search_import_key =
'';
404 $search_array_options = array();
405 $search_roles = array();
406 $search_birthday_start =
'';
407 $search_birthday_end =
'';
411 $objectclass =
'Contact';
412 $objectlabel =
'Contact';
413 $uploaddir =
$conf->societe->dir_output;
414 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
416 if ($action ==
'setstcomm' && $permissiontoadd) {
429if ($search_priv < 0) {
434if (!$user->hasRight(
'societe',
'client',
'voir')) {
435 $socid = $user->socid;
443$form =
new Form($db);
446$contactstatic =
new Contact($db);
450$title = $langs->trans(
"Contacts").
" - ".$langs->trans(
"List");
451$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
456 $contactstatic->loadCacheOfProspStatus();
459$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
460$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
464$sql =
"SELECT code, label, sortorder";
465$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
466$sql .=
" WHERE active > 0";
467$sql .=
" ORDER BY sortorder";
468$resql = $db->query($sql);
470 while ($obj = $db->fetch_object($resql)) {
472 $level = $langs->trans($obj->code);
473 if ($level == $obj->code) {
474 $level = $langs->trans($obj->label);
476 $tab_level[$obj->code] = $level;
484$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
485$sql .=
" p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.birthday,";
486$sql .=
" p.socialnetworks, p.photo,";
487$sql .=
" p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_modification,";
488$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,";
489$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
490$sql .=
" co.label as country, co.code as country_code";
492if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
493 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
494 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
497if (isModEnabled(
'mailing')) {
498 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
502$parameters = array();
503$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
504$sql .= $hookmanager->resPrint;
505$sql = preg_replace(
'/,\s*$/',
'', $sql);
509$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
510if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
511 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
513$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
514$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
515$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
518$parameters = array();
519$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
520$sql .= $hookmanager->resPrint;
521$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
522if (!empty($userid)) {
523 $sql .=
" AND p.fk_user_creat=".((int) $userid);
526 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
528if ($search_stcomm !=
'' && $search_stcomm != -2) {
533if ($search_priv !=
'0' && $search_priv !=
'1') {
534 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
536 if ($search_priv ==
'0') {
537 $sql .=
" AND p.priv='0'";
539 if ($search_priv ==
'1') {
540 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
544if (!empty($search_sale) && $search_sale !=
'-1') {
545 if ($search_sale == -2) {
546 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
547 } elseif ($search_sale > 0) {
548 $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).
")";
553$searchCategoryContactList = $search_categ ? array($search_categ) : array();
554$searchCategoryContactOperator = 0;
556if (!empty($searchCategoryContactList)) {
557 $searchCategoryContactSqlList = array();
558 $listofcategoryid =
'';
559 foreach ($searchCategoryContactList as $searchCategoryContact) {
560 if (intval($searchCategoryContact) == -2) {
561 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
562 } elseif (intval($searchCategoryContact) > 0) {
563 if ($searchCategoryContactOperator == 0) {
564 $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).
")";
566 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
570 if ($listofcategoryid) {
571 $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).
"))";
573 if ($searchCategoryContactOperator == 1) {
574 if (!empty($searchCategoryContactSqlList)) {
575 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
578 if (!empty($searchCategoryContactSqlList)) {
579 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
585$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
586$searchCategoryCustomerOperator = 0;
588if (!empty($searchCategoryCustomerList)) {
589 $searchCategoryCustomerSqlList = array();
590 $listofcategoryid =
'';
591 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
592 if (intval($searchCategoryCustomer) == -2) {
593 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
594 } elseif (intval($searchCategoryCustomer) > 0) {
595 if ($searchCategoryCustomerOperator == 0) {
596 $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).
")";
598 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
602 if ($listofcategoryid) {
603 $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).
"))";
605 if ($searchCategoryCustomerOperator == 1) {
606 if (!empty($searchCategoryCustomerSqlList)) {
607 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
610 if (!empty($searchCategoryCustomerSqlList)) {
611 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
617$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
618$searchCategorySupplierOperator = 0;
620if (!empty($searchCategorySupplierList)) {
621 $searchCategorySupplierSqlList = array();
622 $listofcategoryid =
'';
623 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
624 if (intval($searchCategorySupplier) == -2) {
625 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
626 } elseif (intval($searchCategorySupplier) > 0) {
627 if ($searchCategorySupplierOperator == 0) {
628 $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).
")";
630 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
634 if ($listofcategoryid) {
635 $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).
"))";
637 if ($searchCategorySupplierOperator == 1) {
638 if (!empty($searchCategorySupplierSqlList)) {
639 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
642 if (!empty($searchCategorySupplierSqlList)) {
643 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
649 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
651if (strlen($search_phone)) {
652 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
654if (strlen($search_cti)) {
655 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
657if (strlen($search_firstlast_only)) {
658 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
664if ($search_lastname) {
667if ($search_firstname) {
670if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
671 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
673 if ($search_societe) {
676 if ($search_societe_alias) {
680if ($search_country) {
681 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
683if (strlen($search_poste)) {
686if (strlen($search_phone_perso)) {
689if (strlen($search_phone_pro)) {
692if (strlen($search_phone_mobile)) {
695if (strlen($search_fax)) {
698if (isModEnabled(
'socialnetworks')) {
699 foreach ($socialnetworks as $key => $value) {
700 if ($value[
'active'] && strlen($search_[$key])) {
701 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
702 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
703 $sql .=
" AND p.socialnetworks REGEXP '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
704 } elseif ($db->type ==
'pgsql') {
705 $sql .=
" AND p.socialnetworks ~ '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
708 $sql .=
" AND p.socialnetworks LIKE '%\"".$db->escape($db->escapeforlike($key)).
"\":\"".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"%'";
715if (strlen($search_email)) {
718if (strlen($search_address)) {
721if (strlen($search_zip)) {
724if (strlen($search_town)) {
727if (count($search_roles) > 0) {
728 $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)).
"))";
730if ($search_no_email != -1 && $search_no_email > 0) {
731 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
733if ($search_no_email != -1 && $search_no_email == 0) {
734 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
736if ($search_status !=
'' && $search_status >= 0) {
737 $sql .=
" AND p.statut = ".((int) $search_status);
739if ($search_import_key) {
743 $sql .=
" AND p.fk_soc IS NULL";
744} elseif ($type ==
"f") {
745 $sql .=
" AND s.fournisseur = 1";
746} elseif ($type ==
"c") {
747 $sql .=
" AND s.client IN (1, 3)";
748} elseif ($type ==
"p") {
749 $sql .=
" AND s.client IN (2, 3)";
752 $sql .=
" AND s.rowid = ".((int) $socid);
754if ($search_birthday_start) {
755 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
757if ($search_birthday_end) {
758 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
762include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
765$parameters = array();
766$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
767$sql .= $hookmanager->resPrint;
771$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
772$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
773$sql .= $hookmanager->resPrint;
777$nbtotalofrecords =
'';
780 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
781 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
782 $resql = $db->query($sqlforcount);
784 $objforcount = $db->fetch_object($resql);
785 $nbtotalofrecords = $objforcount->nbtotalofrecords;
790 if (($page * $limit) > $nbtotalofrecords) {
798if ($view ==
"recent") {
799 $sql .= $db->order(
"p.datec",
"DESC");
801 $sql .= $db->order($sortfield, $sortorder);
804 $sql .= $db->plimit($limit + 1, $offset);
807$resql = $db->query($sql);
813$num = $db->num_rows($resql);
816if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
817 $obj = $db->fetch_object($resql);
819 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
827llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
829$arrayofselected = is_array($toselect) ? $toselect : array();
833 $param .=
'&mode='.urlencode($mode);
835if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
836 $param .=
'&contextpage='.urlencode($contextpage);
838if ($limit > 0 && $limit !=
$conf->liste_limit) {
839 $param .=
'&limit='.((int) $limit);
841if ($optioncss !=
'') {
842 $param .=
'&optioncss='.urlencode($optioncss);
844$param .=
'&begin='.urlencode((
string) ($begin)).
'&userid='.urlencode((
string) ($userid)).
'&contactname='.urlencode((
string) ($search_all));
845$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
846if (!empty($search_sale) && $search_sale !=
'-1') {
847 $param .=
'&search_sale='.urlencode($search_sale);
849if (!empty($search_categ) && $search_categ !=
'-1') {
850 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
852if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
853 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
855if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
856 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
858if ($search_all !=
'') {
859 $param .=
'&search_all='.urlencode($search_all);
862 $param .=
"&search_id=".urlencode((
string) ($search_id));
864if ($search_lastname !=
'') {
865 $param .=
'&search_lastname='.urlencode($search_lastname);
867if ($search_firstname !=
'') {
868 $param .=
'&search_firstname='.urlencode($search_firstname);
870if ($search_societe !=
'') {
871 $param .=
'&search_societe='.urlencode($search_societe);
873if ($search_societe_alias !=
'') {
874 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
876if ($search_address !=
'') {
877 $param .=
'&search_address='.urlencode($search_address);
879if ($search_zip !=
'') {
880 $param .=
'&search_zip='.urlencode($search_zip);
882if ($search_town !=
'') {
883 $param .=
'&search_town='.urlencode($search_town);
885if ($search_country !=
'') {
886 $param .=
"&search_country=".urlencode($search_country);
888if ($search_poste !=
'') {
889 $param .=
'&search_poste='.urlencode($search_poste);
891if ($search_phone_pro !=
'') {
892 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
894if ($search_phone_perso !=
'') {
895 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
897if ($search_phone_mobile !=
'') {
898 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
900if ($search_fax !=
'') {
901 $param .=
'&search_fax='.urlencode($search_fax);
903if ($search_email !=
'') {
904 $param .=
'&search_email='.urlencode($search_email);
906if ($search_no_email !=
'') {
907 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
909if ($search_status !=
'') {
910 $param .=
'&search_status='.urlencode((
string) ($search_status));
912if ($search_priv ==
'0' || $search_priv ==
'1') {
913 $param .=
"&search_priv=".urlencode($search_priv);
915if ($search_stcomm !=
'') {
916 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
918if (is_array($search_level) && count($search_level)) {
919 foreach ($search_level as $slevel) {
920 $param .=
'&search_level[]='.urlencode($slevel);
923if ($search_import_key !=
'') {
924 $param .=
'&search_import_key='.urlencode($search_import_key);
926if (count($search_roles) > 0) {
927 $param .= implode(
'&search_roles[]=', $search_roles);
929if ($search_birthday_start) {
930 $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'));
932if ($search_birthday_end) {
933 $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'));
936include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
939$arrayofmassactions = array(
940 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
944if (!empty($permissiontodelete)) {
945 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
947if (isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
948 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
950if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
951 $arrayofmassactions = array();
954$massactionbutton =
'';
955if ($contextpage !=
'poslist') {
956 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
959print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
960if ($optioncss !=
'') {
961 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
963print
'<input type="hidden" name="token" value="'.newToken().
'">';
964print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
965print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
966print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
967print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
969print
'<input type="hidden" name="type" value="'.$type.
'">';
970print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
971print
'<input type="hidden" name="page_y" value="">';
972print
'<input type="hidden" name="mode" value="'.$mode.
'">';
976$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'));
977$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'));
979if ($contextpage !=
'poslist') {
980 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
981} elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
982 $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);
983 $label =
'MenuNewCustomer';
984 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
987print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
989$topicmail =
"Information";
990$modelmail =
"contact";
992$trackid =
'ctc'.$object->id;
993include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
997 foreach ($fieldstosearchall as $key => $val) {
998 $fieldstosearchall[$key] = $langs->trans($val);
999 $setupstring .= $key.
"=".$val.
";";
1001 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1002 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1004if ($search_firstlast_only) {
1005 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1011if ($user->hasRight(
'societe',
'client',
'voir')) {
1012 $langs->load(
'commercial');
1013 $moreforfilter .=
'<div class="divsearchfield">';
1014 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1015 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1016 $moreforfilter .=
'</div>';
1019if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1020 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1021 $moreforfilter .=
'<div class="divsearchfield">';
1022 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1023 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1024 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ,
'search_categ', 1, $tmptitle);
1025 $moreforfilter .=
'</div>';
1026 if (empty($type) || $type ==
'c' || $type ==
'p') {
1027 $moreforfilter .=
'<div class="divsearchfield">';
1030 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1031 } elseif ($type ==
'p') {
1032 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1034 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1036 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1037 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1038 $moreforfilter .=
'</div>';
1041 if (isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1042 $moreforfilter .=
'<div class="divsearchfield">';
1043 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1044 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1045 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1046 $moreforfilter .=
'</div>';
1050$moreforfilter .=
'<div class="divsearchfield">';
1051$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1052$moreforfilter .=
'</div>';
1054print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1055print $moreforfilter;
1056$parameters = array(
'type' => $type);
1057$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1058print $hookmanager->resPrint;
1061$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1062$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1063$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1065print
'<div class="div-table-responsive">';
1066print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1070print
'<tr class="liste_titre_filter">';
1073 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1074 $searchpicto = $form->showFilterButtons(
'left');
1078if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1079 print
'<td class="liste_titre">';
1080 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1083if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1084 print
'<td class="liste_titre">';
1085 print
'<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).
'">';
1088if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1089 print
'<td class="liste_titre">';
1090 print
'<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).
'">';
1093if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1094 print
'<td class="liste_titre">';
1095 print
'<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).
'">';
1098if (!empty($arrayfields[
'p.address'][
'checked'])) {
1099 print
'<td class="liste_titre">';
1100 print
'<input class="flat" type="text" name="search_address" size="6" value="'.dol_escape_htmltag($search_address).
'">';
1103if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1104 print
'<td class="liste_titre">';
1105 print
'<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).
'">';
1108if (!empty($arrayfields[
'p.town'][
'checked'])) {
1109 print
'<td class="liste_titre">';
1110 print
'<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).
'">';
1133if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1134 print
'<td class="liste_titre center">';
1135 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1138if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1139 print
'<td class="liste_titre">';
1140 print
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
1143if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1145 print
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
1148if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1149 print
'<td class="liste_titre">';
1150 print
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1153if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1154 print
'<td class="liste_titre">';
1155 print
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
1158if (!empty($arrayfields[
'p.email'][
'checked'])) {
1159 print
'<td class="liste_titre">';
1160 print
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
1163if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1164 print
'<td class="liste_titre center">';
1165 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1168if (isModEnabled(
'socialnetworks')) {
1169 foreach ($socialnetworks as $key => $value) {
1170 if ($value[
'active']) {
1171 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1172 print
'<td class="liste_titre">';
1173 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
1179if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1180 print
'<td class="liste_titre">';
1181 print
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1185if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1186 print
'<td class="liste_titre" align="left">';
1187 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1190if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1191 print
'<td class="liste_titre center">';
1192 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1193 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1197if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1198 print
'<td class="liste_titre center">';
1199 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1203if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1204 print
'<td class="liste_titre maxwidthonsmartphone center">';
1205 $arraystcomm = array();
1206 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1207 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1209 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1212if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1213 print
'<td class="liste_titre center">';
1214 print
'<div class="nowrap">';
1215 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1217 print
'<div class="nowrap">';
1218 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1224include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1227$parameters = array(
'arrayfields' => $arrayfields);
1228$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1229print $hookmanager->resPrint;
1231if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1232 print
'<td class="liste_titre">';
1236if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1237 print
'<td class="liste_titre">';
1241if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1242 print
'<td class="liste_titre center parentonrightofpage">';
1243 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');
1246if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1247 print
'<td class="liste_titre center">';
1248 print
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
1253 print
'<td class="liste_titre center maxwidthsearch">';
1254 $searchpicto = $form->showFilterButtons();
1260$totalarray = array();
1261$totalarray[
'nbfield'] = 0;
1265print
'<tr class="liste_titre">';
1267 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1268 $totalarray[
'nbfield']++;
1270if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1271 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1272 $totalarray[
'nbfield']++;
1274if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1275 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1276 $totalarray[
'nbfield']++;
1278if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1279 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1280 $totalarray[
'nbfield']++;
1282if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1283 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1284 $totalarray[
'nbfield']++;
1286if (!empty($arrayfields[
'p.address'][
'checked'])) {
1287 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1288 $totalarray[
'nbfield']++;
1290if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1291 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1292 $totalarray[
'nbfield']++;
1294if (!empty($arrayfields[
'p.town'][
'checked'])) {
1295 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1296 $totalarray[
'nbfield']++;
1300if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1301 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1302 $totalarray[
'nbfield']++;
1304if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1305 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1306 $totalarray[
'nbfield']++;
1308if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1309 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1310 $totalarray[
'nbfield']++;
1312if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1313 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1314 $totalarray[
'nbfield']++;
1316if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1317 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1318 $totalarray[
'nbfield']++;
1320if (!empty($arrayfields[
'p.email'][
'checked'])) {
1321 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1322 $totalarray[
'nbfield']++;
1324if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1325 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1326 $totalarray[
'nbfield']++;
1328if (isModEnabled(
'socialnetworks')) {
1329 foreach ($socialnetworks as $key => $value) {
1330 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1331 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1332 $totalarray[
'nbfield']++;
1336if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1337 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1338 $totalarray[
'nbfield']++;
1340if (!empty($arrayfields[
's.nom'][
'checked'])) {
1341 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1342 $totalarray[
'nbfield']++;
1344if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1346 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1347 $totalarray[
'nbfield']++;
1349if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1350 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1351 $totalarray[
'nbfield']++;
1353if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1354 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1355 $totalarray[
'nbfield']++;
1357if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1358 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1359 $totalarray[
'nbfield']++;
1361if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1363 $totalarray[
'nbfield']++;
1366include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1368$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1369$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1370print $hookmanager->resPrint;
1371if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1373 $totalarray[
'nbfield']++;
1375if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1376 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1377 $totalarray[
'nbfield']++;
1379if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1381 $totalarray[
'nbfield']++;
1383if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1385 $totalarray[
'nbfield']++;
1388 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1389 $totalarray[
'nbfield']++;
1397$savnbfield = $totalarray[
'nbfield'];
1398$totalarray = array();
1399$totalarray[
'nbfield'] = 0;
1400$imaxinloop = ($limit ? min($num, $limit) : $num);
1401while ($i < $imaxinloop) {
1402 $obj = $db->fetch_object($resql);
1407 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1408 $contactstatic->lastname = $obj->lastname;
1409 $contactstatic->firstname = $obj->firstname;
1410 $contactstatic->id = $obj->rowid;
1411 $contactstatic->statut = $obj->statut;
1412 $contactstatic->poste = $obj->poste;
1413 $contactstatic->email = $obj->email;
1414 $contactstatic->phone_pro = $obj->phone_pro;
1415 $contactstatic->phone_perso = $obj->phone_perso;
1416 $contactstatic->phone_mobile = $obj->phone_mobile;
1417 $contactstatic->address = $obj->address;
1418 $contactstatic->zip = $obj->zip;
1419 $contactstatic->town = $obj->town;
1420 $contactstatic->socialnetworks = $arraysocialnetworks;
1421 $contactstatic->country = $obj->country;
1422 $contactstatic->country_code = $obj->country_code;
1423 $contactstatic->photo = $obj->photo;
1424 $contactstatic->import_key = $obj->import_key;
1425 $contactstatic->photo = $obj->photo;
1426 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1430 if ($mode ==
'kanban') {
1432 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1433 print
'<div class="box-flex-container kanban">';
1436 if ($massactionbutton || $massaction) {
1438 if (in_array(
$object->id, $arrayofselected)) {
1442 if ($obj->socid > 0) {
1443 $contactstatic->fetch_thirdparty($obj->socid);
1445 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1446 if ($i == ($imaxinloop - 1)) {
1452 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
1453 if ($contextpage ==
'poslist') {
1454 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1459 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1460 print '<td class="nowrap center
">';
1461 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1463 if (in_array($obj->rowid, $arrayofselected)) {
1466 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1470 $totalarray['nbfield']++;
1475 if (!empty($arrayfields['p.rowid']['checked'])) {
1476 print '<td class="tdoverflowmax50
">';
1477 print dol_escape_htmltag($obj->rowid);
1480 $totalarray['nbfield']++;
1485 if (!empty($arrayfields['p.lastname']['checked'])) {
1486 print '<td class="middle tdoverflowmax150
">';
1487 if ($contextpage == 'poslist') {
1488 print $contactstatic->lastname;
1490 print $contactstatic->getNomUrl(1);
1494 $totalarray['nbfield']++;
1499 if (!empty($arrayfields['p.firstname']['checked'])) {
1500 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
1502 $totalarray['nbfield']++;
1507 if (!empty($arrayfields['p.poste']['checked'])) {
1508 print '<td class="tdoverflowmax100
">'.dol_escape_htmltag($obj->poste).'</td>';
1510 $totalarray['nbfield']++;
1515 if (!empty($arrayfields['p.address']['checked'])) {
1516 print '<td>'.dol_escape_htmltag($obj->address).'</td>';
1518 $totalarray['nbfield']++;
1523 if (!empty($arrayfields['p.zip']['checked'])) {
1524 print '<td>'.dol_escape_htmltag($obj->zip).'</td>';
1526 $totalarray['nbfield']++;
1531 if (!empty($arrayfields['p.town']['checked'])) {
1532 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town).'</td>';
1534 $totalarray['nbfield']++;
1540 if (!empty($arrayfields['state.nom']['checked']))
1542 print "<td>
".$obj->state_name."</td>\n
";
1543 if (! $i) $totalarray['nbfield']++;
1547 if (!empty($arrayfields['region.nom']['checked']))
1549 print "<td>
".$obj->region_name."</td>\n
";
1550 if (! $i) $totalarray['nbfield']++;
1554 if (!empty($arrayfields['country.code_iso']['checked'])) {
1555 print '<td class="center
">';
1556 $tmparray = getCountry($obj->fk_pays, 'all');
1557 print dol_escape_htmltag($tmparray['label']);
1560 $totalarray['nbfield']++;
1565 if (!empty($arrayfields['p.phone']['checked'])) {
1566 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1568 $totalarray['nbfield']++;
1573 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1574 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1576 $totalarray['nbfield']++;
1581 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1582 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1584 $totalarray['nbfield']++;
1589 if (!empty($arrayfields['p.fax']['checked'])) {
1590 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1592 $totalarray['nbfield']++;
1597 if (!empty($arrayfields['p.email']['checked'])) {
1598 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTML($obj->email).'">';
1599 if ($contextpage == 'poslist') {
1602 print dol_print_email($obj->email, $obj->rowid, $obj->socid, 1, 18, 0, 1);
1606 $totalarray['nbfield']++;
1610 // No EMail Subscription
1611 if (!empty($arrayfields['unsubscribed']['checked'])) {
1612 print '<td class="center
">';
1613 if (empty($obj->email)) {
1614 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1616 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1620 $totalarray['nbfield']++;
1625 if (isModEnabled('socialnetworks')) {
1626 foreach ($socialnetworks as $key => $value) {
1627 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1628 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1630 $totalarray['nbfield']++;
1636 // Company / Third Party
1637 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1638 print '<td class="tdoverflowmax125
">';
1640 $objsoc = new Societe($db);
1641 $objsoc->fetch($obj->socid);
1642 $option_link = 'customer';
1643 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1644 $option_link = 'supplier';
1645 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1648 if ($contextpage == 'poslist') {
1649 print $objsoc->name;
1651 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1658 $totalarray['nbfield']++;
1663 if (!empty($arrayfields['s.name_alias']['checked'])) {
1664 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->alias).'">';
1665 print dol_escape_htmltag($obj->alias);
1668 $totalarray['nbfield']++;
1673 if (!empty($arrayfields['p.priv']['checked'])) {
1674 print '<td class="center
">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
1676 $totalarray['nbfield']++;
1681 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1682 print '<td class="center
">';
1683 print $contactstatic->getLibProspLevel();
1686 $totalarray['nbfield']++;
1691 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1692 print '<td class="center nowrap
"><div class="nowrap
">';
1693 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1694 print '</div> - <div class="inline-block
">';
1695 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1696 $titlealt = 'default';
1697 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1698 $titlealt = $val['label'];
1700 if ($obj->stcomm_id != $val['id']) {
1701 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>';
1704 print '</div></div></td>';
1706 $totalarray['nbfield']++;
1711 if (!empty($arrayfields['p.birthday']['checked'])) {
1712 print '<td class="center nowraponall
">';
1713 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1716 $totalarray['nbfield']++;
1721 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1724 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1725 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1726 print $hookmanager->resPrint;
1728 if (!empty($arrayfields['p.datec']['checked'])) {
1729 print '<td class="center nowraponall
">';
1730 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1733 $totalarray['nbfield']++;
1737 // Date modification
1738 if (!empty($arrayfields['p.tms']['checked'])) {
1739 print '<td class="center nowraponall
">';
1740 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1743 $totalarray['nbfield']++;
1748 if (!empty($arrayfields['p.statut']['checked'])) {
1749 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1751 $totalarray['nbfield']++;
1756 if (!empty($arrayfields['p.import_key']['checked'])) {
1757 print '<td class="tdoverflowmax100
">';
1758 print dol_escape_htmltag($obj->import_key);
1761 $totalarray['nbfield']++;
1766 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1767 print '<td class="nowrap center
">';
1768 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1770 if (in_array($obj->rowid, $arrayofselected)) {
1773 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1777 $totalarray['nbfield']++;
1787include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1789// If no record found
1792 foreach ($arrayfields as $key => $val) {
1793 if (!empty($val['checked'])) {
1797 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
1802$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1803$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1804print $hookmanager->resPrint;
1806print '</table>'."\n
";
1809print '</form>'."\n
";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
getArrayOfSocialNetworks()
Get array of social network dictionary.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.