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_ref_ext =
GETPOST(
"search_ref_ext",
"alpha");
83$search_firstlast_only =
GETPOST(
"search_firstlast_only",
'alpha');
84$search_lastname =
GETPOST(
"search_lastname",
'alpha');
85$search_firstname =
GETPOST(
"search_firstname",
'alpha');
86$search_societe =
GETPOST(
"search_societe",
'alpha');
87$search_societe_alias =
GETPOST(
"search_societe_alias",
'alpha');
88$search_poste =
GETPOST(
"search_poste",
'alpha');
89$search_phone_perso =
GETPOST(
"search_phone_perso",
'alpha');
90$search_phone_pro =
GETPOST(
"search_phone_pro",
'alpha');
91$search_phone_mobile =
GETPOST(
"search_phone_mobile",
'alpha');
92$search_fax =
GETPOST(
"search_fax",
'alpha');
93$search_email =
GETPOST(
"search_email",
'alpha');
94if (isModEnabled(
'mailing')) {
95 $search_no_email = GETPOSTISSET(
"search_no_email") ?
GETPOSTINT(
"search_no_email") : -1;
97 $search_no_email = -1;
102if (isModEnabled(
'socialnetworks')) {
103 foreach ($socialnetworks as $key => $value) {
104 if ($value[
'active']) {
105 $search_[$key] =
GETPOST(
"search_".$key,
'alpha');
109$search_priv =
GETPOST(
"search_priv",
'alpha');
110$search_sale =
GETPOST(
'search_sale',
'intcomma');
111$search_categ =
GETPOST(
"search_categ",
'intcomma');
112$search_categ_thirdparty =
GETPOST(
"search_categ_thirdparty",
'intcomma');
113$search_categ_supplier =
GETPOST(
"search_categ_supplier",
'intcomma');
114$search_status =
GETPOST(
"search_status",
"intcomma");
115$search_type =
GETPOST(
'search_type',
'alpha');
116$search_address =
GETPOST(
'search_address',
'alpha');
117$search_zip =
GETPOST(
'search_zip',
'alpha');
118$search_town =
GETPOST(
'search_town',
'alpha');
119$search_import_key =
GETPOST(
"search_import_key",
'alpha');
120$search_country =
GETPOST(
"search_country",
'aZ09');
121$search_roles =
GETPOST(
"search_roles",
'array');
122$search_level =
GETPOST(
"search_level",
'array');
123$search_stcomm =
GETPOST(
'search_stcomm',
'intcomma');
127if ($search_status ===
'') {
130if ($search_no_email ===
'') {
131 $search_no_email = -1;
134$optioncss =
GETPOST(
'optioncss',
'alpha');
136$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
139$view =
GETPOST(
"view",
'alpha');
146$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
147$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
153 $sortfield =
"p.lastname";
155if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159$offset = $limit * $page;
160$pageprev = $page - 1;
161$pagenext = $page + 1;
164$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
166 if (empty($contextpage) || $contextpage ==
'contactlist') {
167 $contextpage =
'contactprospectlist';
169 $title .=
' ('.$langs->trans(
"ThirdPartyProspects").
')';
172 if (empty($contextpage) || $contextpage ==
'contactlist') {
173 $contextpage =
'contactcustomerlist';
175 $title .=
' ('.$langs->trans(
"ThirdPartyCustomers").
')';
176} elseif ($type ==
"f") {
177 if (empty($contextpage) || $contextpage ==
'contactlist') {
178 $contextpage =
'contactsupplierlist';
180 $title .=
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
181} elseif ($type ==
"o") {
182 if (empty($contextpage) || $contextpage ==
'contactlist') {
183 $contextpage =
'contactotherlist';
185 $title .=
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
191$hookmanager->initHooks(array($contextpage));
193if ($user->socid > 0) {
194 $socid = $user->socid;
199$extrafields->fetch_name_optionals_label(
$object->table_element);
201$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
204$fieldstosearchall = array();
205foreach (
$object->fields as $key => $val) {
207 if (!empty($user->socid) && $key ==
"note_private") {
211 if (empty($val[
'searchall'])) {
215 $fieldstosearchall[
'p.'.$key] = $val[
'label'];
220 $fieldstosearchall[
's.nom'] =
"ThirdParty";
221 $fieldstosearchall[
's.name_alias'] =
"AliasNames";
224$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
225$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
227 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
228} elseif ($reshook == 0) {
229 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
233$arrayfields = array();
234foreach (
$object->fields as $key => $val) {
236 if (!empty($val[
'visible'])) {
237 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
238 $arrayfields[
'p.'.$key] = array(
239 'label' => $val[
'label'],
240 'checked' => (($visible < 0) ? 0 : 1),
241 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
242 'position' => $val[
'position'],
243 'help' => isset($val[
'help']) ? $val[
'help'] :
''
249$arrayfields[
'country.code_iso'] = array(
'label' =>
"Country",
'position' => 66,
'checked' => 0);
251 $arrayfields[
's.nom'] = array(
'label' =>
"ThirdParty",
'position' => 113,
'checked' => 1);
252 $arrayfields[
's.name_alias'] = array(
'label' =>
"AliasNameShort",
'position' => 114,
'checked' => 1);
255$arrayfields[
'unsubscribed'] = array(
256 'label' =>
'No_Email',
258 'enabled' => (isModEnabled(
'mailing')),
261if (isModEnabled(
'socialnetworks')) {
262 foreach ($socialnetworks as $key => $value) {
263 if ($value[
'active']) {
264 $arrayfields[
'p.'.$key] = array(
265 'label' => $value[
'label'],
274include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
279'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
282if ((
$id > 0 || !empty($ref)) && $action !=
'add') {
289$permissiontoread = $user->hasRight(
'societe',
'contact',
'lire');
290$permissiontodelete = $user->hasRight(
'societe',
'contact',
'supprimer');
291$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
293if (!$permissiontoread) {
302if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
307 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
308 $result = $db->query($sql);
309 $num_lines = $db->num_rows($result);
310 if ($num_lines == 0) {
311 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
313 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
316 $invoice->module_source =
'takepos';
317 $invoice->pos_source = $_SESSION[
"takeposterminal"];
318 $placeid = $invoice->create($user);
319 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
323 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
324 $resql = $db->query($sql);
327 if (!isset($invoice)) {
328 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
330 $invoice->fetch(0,
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
331 $invoice->delete_linked_contact(
'external',
'BILLING');
333 $invoice->add_contact($idcontact,
'BILLING'); ?>
335 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
336 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
338 <?php
if (!$resql) { ?>
339 alert(
'Error failed to update customer on draft invoice.');
341 parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
342 parent.$.colorbox.close();
349if (
GETPOST(
'cancel',
'alpha')) {
353if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
357$parameters = array(
'arrayfields' => &$arrayfields);
358$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
363if (empty($reshook)) {
365 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
368 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
371 $search_ref_ext =
'';
372 $search_firstlast_only =
"";
373 $search_lastname =
"";
374 $search_firstname =
"";
375 $search_societe =
"";
376 $search_societe_alias =
"";
378 $search_address =
"";
380 $search_country =
"";
383 $search_phone_perso =
"";
384 $search_phone_pro =
"";
385 $search_phone_mobile =
"";
388 $search_no_email = -1;
389 if (isModEnabled(
'socialnetworks')) {
390 foreach ($socialnetworks as $key => $value) {
391 if ($value[
'active']) {
402 $search_categ_thirdparty =
'';
403 $search_categ_supplier =
'';
404 $search_import_key =
'';
406 $search_array_options = array();
407 $search_roles = array();
408 $search_birthday_start =
'';
409 $search_birthday_end =
'';
413 $objectclass =
'Contact';
414 $objectlabel =
'Contact';
415 $uploaddir =
$conf->societe->dir_output;
416 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
418 if ($action ==
'setstcomm' && $permissiontoadd) {
431if ($search_priv < 0) {
436if (!$user->hasRight(
'societe',
'client',
'voir')) {
437 $socid = $user->socid;
445$form =
new Form($db);
448$contactstatic =
new Contact($db);
452$title = $langs->trans(
"Contacts").
" - ".$langs->trans(
"List");
453$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
458 $contactstatic->loadCacheOfProspStatus();
461$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
462$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
466$sql =
"SELECT code, label, sortorder";
467$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
468$sql .=
" WHERE active > 0";
469$sql .=
" ORDER BY sortorder";
470$resql = $db->query($sql);
472 while ($obj = $db->fetch_object($resql)) {
474 $level = $langs->trans($obj->code);
475 if ($level == $obj->code) {
476 $level = $langs->trans($obj->label);
478 $tab_level[$obj->code] = $level;
486$sql =
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
487$sql .=
" p.rowid, p.ref_ext, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.birthday,";
488$sql .=
" p.socialnetworks, p.photo,";
489$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,";
490$sql .=
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,";
491$sql .=
" st.libelle as stcomm, st.picto as stcomm_picto,";
492$sql .=
" co.label as country, co.code as country_code";
494if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
495 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
496 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
499if (isModEnabled(
'mailing')) {
500 $sql .=
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
504$parameters = array();
505$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
506$sql .= $hookmanager->resPrint;
507$sql = preg_replace(
'/,\s*$/',
'', $sql);
511$sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
512if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
513 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
515$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
516$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
517$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
520$parameters = array();
521$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
522$sql .= $hookmanager->resPrint;
523$sql .=
' WHERE p.entity IN ('.getEntity(
'contact').
')';
524if (!empty($userid)) {
525 $sql .=
" AND p.fk_user_creat=".((int) $userid);
528 $sql .=
natural_search(
"p.fk_prospectlevel", implode(
',', $search_level), 3);
530if ($search_stcomm !=
'' && $search_stcomm != -2) {
535if ($search_priv !=
'0' && $search_priv !=
'1') {
536 $sql .=
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
538 if ($search_priv ==
'0') {
539 $sql .=
" AND p.priv='0'";
541 if ($search_priv ==
'1') {
542 $sql .=
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
546if (!empty($search_sale) && $search_sale !=
'-1') {
547 if ($search_sale == -2) {
548 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix().
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
549 } elseif ($search_sale > 0) {
550 $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).
")";
555$searchCategoryContactList = $search_categ ? array($search_categ) : array();
556$searchCategoryContactOperator = 0;
558if (!empty($searchCategoryContactList)) {
559 $searchCategoryContactSqlList = array();
560 $listofcategoryid =
'';
561 foreach ($searchCategoryContactList as $searchCategoryContact) {
562 if (intval($searchCategoryContact) == -2) {
563 $searchCategoryContactSqlList[] =
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
564 } elseif (intval($searchCategoryContact) > 0) {
565 if ($searchCategoryContactOperator == 0) {
566 $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).
")";
568 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryContact);
572 if ($listofcategoryid) {
573 $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).
"))";
575 if ($searchCategoryContactOperator == 1) {
576 if (!empty($searchCategoryContactSqlList)) {
577 $sql .=
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
580 if (!empty($searchCategoryContactSqlList)) {
581 $sql .=
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
587$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
588$searchCategoryCustomerOperator = 0;
590if (!empty($searchCategoryCustomerList)) {
591 $searchCategoryCustomerSqlList = array();
592 $listofcategoryid =
'';
593 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
594 if (intval($searchCategoryCustomer) == -2) {
595 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
596 } elseif (intval($searchCategoryCustomer) > 0) {
597 if ($searchCategoryCustomerOperator == 0) {
598 $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).
")";
600 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
604 if ($listofcategoryid) {
605 $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).
"))";
607 if ($searchCategoryCustomerOperator == 1) {
608 if (!empty($searchCategoryCustomerSqlList)) {
609 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
612 if (!empty($searchCategoryCustomerSqlList)) {
613 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
619$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
620$searchCategorySupplierOperator = 0;
622if (!empty($searchCategorySupplierList)) {
623 $searchCategorySupplierSqlList = array();
624 $listofcategoryid =
'';
625 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
626 if (intval($searchCategorySupplier) == -2) {
627 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
628 } elseif (intval($searchCategorySupplier) > 0) {
629 if ($searchCategorySupplierOperator == 0) {
630 $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).
")";
632 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
636 if ($listofcategoryid) {
637 $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).
"))";
639 if ($searchCategorySupplierOperator == 1) {
640 if (!empty($searchCategorySupplierSqlList)) {
641 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
644 if (!empty($searchCategorySupplierSqlList)) {
645 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
651 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
653if (strlen($search_phone)) {
654 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_phone);
656if (strlen($search_cti)) {
657 $sql .=
natural_search(array(
'p.phone',
'p.phone_perso',
'p.phone_mobile'), $search_cti);
659if (strlen($search_firstlast_only)) {
660 $sql .=
natural_search(array(
'p.lastname',
'p.firstname'), $search_firstlast_only);
666if ($search_ref_ext) {
669if ($search_lastname) {
672if ($search_firstname) {
675if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
676 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
678 if ($search_societe) {
681 if ($search_societe_alias) {
685if ($search_country) {
686 $sql .=
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
688if (strlen($search_poste)) {
691if (strlen($search_phone_perso)) {
694if (strlen($search_phone_pro)) {
697if (strlen($search_phone_mobile)) {
700if (strlen($search_fax)) {
703if (isModEnabled(
'socialnetworks')) {
704 foreach ($socialnetworks as $key => $value) {
705 if ($value[
'active'] && strlen($search_[$key])) {
706 $searchkeyinjsonformat = preg_replace(
'/"$/',
'', preg_replace(
'/^"/',
'', json_encode($search_[$key])));
707 if (in_array($db->type, array(
'mysql',
'mysqli'))) {
708 $sql .=
" AND p.socialnetworks REGEXP '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
709 } elseif ($db->type ==
'pgsql') {
710 $sql .=
" AND p.socialnetworks ~ '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
713 $sql .=
" AND p.socialnetworks LIKE '%\"".$db->escape($db->escapeforlike($key)).
"\":\"".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"%'";
720if (strlen($search_email)) {
723if (strlen($search_address)) {
726if (strlen($search_zip)) {
729if (strlen($search_town)) {
732if (count($search_roles) > 0) {
733 $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)).
"))";
735if ($search_no_email != -1 && $search_no_email > 0) {
736 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
738if ($search_no_email != -1 && $search_no_email == 0) {
739 $sql .=
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
741if ($search_status !=
'' && $search_status >= 0) {
742 $sql .=
" AND p.statut = ".((int) $search_status);
744if ($search_import_key) {
748 $sql .=
" AND p.fk_soc IS NULL";
749} elseif ($type ==
"f") {
750 $sql .=
" AND s.fournisseur = 1";
751} elseif ($type ==
"c") {
752 $sql .=
" AND s.client IN (1, 3)";
753} elseif ($type ==
"p") {
754 $sql .=
" AND s.client IN (2, 3)";
757 $sql .=
" AND s.rowid = ".((int) $socid);
759if ($search_birthday_start) {
760 $sql .=
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
762if ($search_birthday_end) {
763 $sql .=
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
767include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
770$parameters = array();
771$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
772$sql .= $hookmanager->resPrint;
776$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
777$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
778$sql .= $hookmanager->resPrint;
782$nbtotalofrecords =
'';
785 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
786 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
787 $resql = $db->query($sqlforcount);
789 $objforcount = $db->fetch_object($resql);
790 $nbtotalofrecords = $objforcount->nbtotalofrecords;
795 if (($page * $limit) > $nbtotalofrecords) {
803if ($view ==
"recent") {
804 $sql .= $db->order(
"p.datec",
"DESC");
806 $sql .= $db->order($sortfield, $sortorder);
809 $sql .= $db->plimit($limit + 1, $offset);
812$resql = $db->query($sql);
818$num = $db->num_rows($resql);
821if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && !$page) {
822 $obj = $db->fetch_object($resql);
824 header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.
$id);
832llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-societe page-contact-list bodyforlist');
834$arrayofselected = is_array($toselect) ? $toselect : array();
838 $param .=
'&mode='.urlencode($mode);
840if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
841 $param .=
'&contextpage='.urlencode($contextpage);
843if ($limit > 0 && $limit !=
$conf->liste_limit) {
844 $param .=
'&limit='.((int) $limit);
846if ($optioncss !=
'') {
847 $param .=
'&optioncss='.urlencode($optioncss);
849$param .=
'&begin='.urlencode((
string) ($begin)).
'&userid='.urlencode((
string) ($userid)).
'&contactname='.urlencode((
string) ($search_all));
850$param .=
'&type='.urlencode($type).
'&view='.urlencode($view);
851if (!empty($search_sale) && $search_sale !=
'-1') {
852 $param .=
'&search_sale='.urlencode($search_sale);
854if (!empty($search_categ) && $search_categ !=
'-1') {
855 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
857if (!empty($search_categ_thirdparty) && $search_categ_thirdparty !=
'-1') {
858 $param .=
'&search_categ_thirdparty='.urlencode((
string) ($search_categ_thirdparty));
860if (!empty($search_categ_supplier) && $search_categ_supplier !=
'-1') {
861 $param .=
'&search_categ_supplier='.urlencode((
string) ($search_categ_supplier));
863if ($search_all !=
'') {
864 $param .=
'&search_all='.urlencode($search_all);
867 $param .=
"&search_id=".((int) $search_id);
869if ($search_ref_ext) {
870 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
872if ($search_lastname !=
'') {
873 $param .=
'&search_lastname='.urlencode($search_lastname);
875if ($search_firstname !=
'') {
876 $param .=
'&search_firstname='.urlencode($search_firstname);
878if ($search_societe !=
'') {
879 $param .=
'&search_societe='.urlencode($search_societe);
881if ($search_societe_alias !=
'') {
882 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
884if ($search_address !=
'') {
885 $param .=
'&search_address='.urlencode($search_address);
887if ($search_zip !=
'') {
888 $param .=
'&search_zip='.urlencode($search_zip);
890if ($search_town !=
'') {
891 $param .=
'&search_town='.urlencode($search_town);
893if ($search_country !=
'') {
894 $param .=
"&search_country=".urlencode($search_country);
896if ($search_poste !=
'') {
897 $param .=
'&search_poste='.urlencode($search_poste);
899if ($search_phone_pro !=
'') {
900 $param .=
'&search_phone_pro='.urlencode($search_phone_pro);
902if ($search_phone_perso !=
'') {
903 $param .=
'&search_phone_perso='.urlencode($search_phone_perso);
905if ($search_phone_mobile !=
'') {
906 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
908if ($search_fax !=
'') {
909 $param .=
'&search_fax='.urlencode($search_fax);
911if ($search_email !=
'') {
912 $param .=
'&search_email='.urlencode($search_email);
914if ($search_no_email !=
'') {
915 $param .=
'&search_no_email='.urlencode((
string) ($search_no_email));
917if ($search_status !=
'') {
918 $param .=
'&search_status='.urlencode((
string) ($search_status));
920if ($search_priv ==
'0' || $search_priv ==
'1') {
921 $param .=
"&search_priv=".urlencode($search_priv);
923if ($search_stcomm !=
'') {
924 $param .=
'&search_stcomm='.urlencode((
string) ($search_stcomm));
926if (is_array($search_level) && count($search_level)) {
927 foreach ($search_level as $slevel) {
928 $param .=
'&search_level[]='.urlencode($slevel);
931if ($search_import_key !=
'') {
932 $param .=
'&search_import_key='.urlencode($search_import_key);
934if (count($search_roles) > 0) {
935 $param .= implode(
'&search_roles[]=', $search_roles);
937if ($search_birthday_start) {
938 $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'));
940if ($search_birthday_end) {
941 $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'));
944include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
947$arrayofmassactions = array(
948 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
952if (!empty($permissiontodelete)) {
953 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
955if (isModEnabled(
'category') && $user->hasRight(
'societe',
'creer')) {
956 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
958if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
959 $arrayofmassactions = array();
962$massactionbutton =
'';
963if ($contextpage !=
'poslist') {
964 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
967print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
968if ($optioncss !=
'') {
969 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
971print
'<input type="hidden" name="token" value="'.newToken().
'">';
972print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
973print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
974print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
975print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
977print
'<input type="hidden" name="type" value="'.$type.
'">';
978print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
979print
'<input type="hidden" name="page_y" value="">';
980print
'<input type="hidden" name="mode" value="'.$mode.
'">';
984$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'));
985$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'));
987if ($contextpage !=
'poslist') {
988 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContactAddress'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create',
'', $permissiontoadd);
989} elseif ($user->hasRight(
'societe',
'contact',
'creer')) {
990 $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);
991 $label =
'MenuNewCustomer';
992 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
995print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'address', 0, $newcardbutton,
'', $limit, 0, 0, 1);
997$topicmail =
"Information";
998$modelmail =
"contact";
1000$trackid =
'ctc'.$object->id;
1001include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1005 foreach ($fieldstosearchall as $key => $val) {
1006 $fieldstosearchall[$key] = $langs->trans($val);
1007 $setupstring .= $key.
"=".$val.
";";
1009 print
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1010 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1012if ($search_firstlast_only) {
1013 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
1019if ($user->hasRight(
'societe',
'client',
'voir')) {
1020 $langs->load(
'commercial');
1021 $moreforfilter .=
'<div class="divsearchfield">';
1022 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1023 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1024 $moreforfilter .=
'</div>';
1027if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1028 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1029 $moreforfilter .=
'<div class="divsearchfield">';
1030 $tmptitle = $langs->trans(
'ContactCategoriesShort');
1031 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1032 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ,
'search_categ', 1, $tmptitle);
1033 $moreforfilter .=
'</div>';
1034 if (empty($type) || $type ==
'c' || $type ==
'p') {
1035 $moreforfilter .=
'<div class="divsearchfield">';
1038 $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
1039 } elseif ($type ==
'p') {
1040 $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
1042 $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
1044 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1045 $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty,
'search_categ_thirdparty', 1, $tmptitle);
1046 $moreforfilter .=
'</div>';
1049 if (isModEnabled(
"fournisseur") && (empty($type) || $type ==
'f')) {
1050 $moreforfilter .=
'<div class="divsearchfield">';
1051 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1052 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1053 $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier,
'search_categ_supplier', 1, $tmptitle);
1054 $moreforfilter .=
'</div>';
1058$moreforfilter .=
'<div class="divsearchfield">';
1059$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp,
'edit', $search_roles,
'minwidth500', $langs->transnoentitiesnoconv(
'ContactRoles'));
1060$moreforfilter .=
'</div>';
1062print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1063print $moreforfilter;
1064$parameters = array(
'type' => $type);
1065$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1066print $hookmanager->resPrint;
1069$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1070$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1071$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1073print
'<div class="div-table-responsive">';
1074print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1078print
'<tr class="liste_titre_filter">';
1081 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1082 $searchpicto = $form->showFilterButtons(
'left');
1086if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1087 print
'<td class="liste_titre">';
1088 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1091if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1092 print
'<td class="liste_titre">';
1093 print
'<input class="flat width75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
1096if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1097 print
'<td class="liste_titre">';
1098 print
'<input class="flat width75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
1101if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1102 print
'<td class="liste_titre">';
1103 print
'<input class="flat width50" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1106if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1107 print
'<td class="liste_titre">';
1108 print
'<input class="flat width50" type="text" name="search_poste" value="'.dol_escape_htmltag($search_poste).
'">';
1111if (!empty($arrayfields[
'p.address'][
'checked'])) {
1112 print
'<td class="liste_titre">';
1113 print
'<input class="flat width50" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1116if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1117 print
'<td class="liste_titre">';
1118 print
'<input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1121if (!empty($arrayfields[
'p.town'][
'checked'])) {
1122 print
'<td class="liste_titre">';
1123 print
'<input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1146if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1147 print
'<td class="liste_titre center">';
1148 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1151if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1152 print
'<td class="liste_titre">';
1153 print
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
1156if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1157 print
'<td class="liste_titre">';
1158 print
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
1161if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1162 print
'<td class="liste_titre">';
1163 print
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1166if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1167 print
'<td class="liste_titre">';
1168 print
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
1171if (!empty($arrayfields[
'p.email'][
'checked'])) {
1172 print
'<td class="liste_titre">';
1173 print
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
1176if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1177 print
'<td class="liste_titre center">';
1178 print $form->selectarray(
'search_no_email', array(
'-1' =>
'',
'0' => $langs->trans(
'No'),
'1' => $langs->trans(
'Yes')), $search_no_email);
1181if (isModEnabled(
'socialnetworks')) {
1182 foreach ($socialnetworks as $key => $value) {
1183 if ($value[
'active']) {
1184 if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
1185 print
'<td class="liste_titre">';
1186 print
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
1192if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
1193 print
'<td class="liste_titre">';
1194 print
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
1198if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1199 print
'<td class="liste_titre" align="left">';
1200 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1203if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1204 print
'<td class="liste_titre center">';
1205 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1206 print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
1210if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1211 print
'<td class="liste_titre center">';
1212 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1216if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1217 print
'<td class="liste_titre maxwidthonsmartphone center">';
1218 $arraystcomm = array();
1219 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1220 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1222 print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'nowrap ');
1225if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1226 print
'<td class="liste_titre center">';
1227 print
'<div class="nowrap">';
1228 print $form->selectDate($search_birthday_start ? $search_birthday_start : -1,
'search_birthday_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1230 print
'<div class="nowrap">';
1231 print $form->selectDate($search_birthday_end ? $search_birthday_end : -1,
'search_birthday_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1237include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1240$parameters = array(
'arrayfields' => $arrayfields);
1241$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1242print $hookmanager->resPrint;
1244if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1249if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1250 print
'<td class="liste_titre">';
1254if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1255 print
'<td class="liste_titre">';
1259if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1260 print
'<td class="liste_titre center parentonrightofpage">';
1261 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');
1264if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1265 print
'<td class="liste_titre center">';
1266 print
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
1271 print
'<td class="liste_titre center maxwidthsearch">';
1272 $searchpicto = $form->showFilterButtons();
1278$totalarray = array();
1279$totalarray[
'nbfield'] = 0;
1283print
'<tr class="liste_titre">';
1285 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1286 $totalarray[
'nbfield']++;
1288if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
1289 print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"p.rowid",
"", $param,
"", $sortfield, $sortorder);
1290 $totalarray[
'nbfield']++;
1292if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
1293 print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.lastname", $begin, $param,
'', $sortfield, $sortorder);
1294 $totalarray[
'nbfield']++;
1296if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
1297 print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"p.firstname", $begin, $param,
'', $sortfield, $sortorder);
1298 $totalarray[
'nbfield']++;
1300if (!empty($arrayfields[
'p.ref_ext'][
'checked'])) {
1301 print_liste_field_titre($arrayfields[
'p.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref_ext", $begin, $param,
'', $sortfield, $sortorder);
1302 $totalarray[
'nbfield']++;
1304if (!empty($arrayfields[
'p.poste'][
'checked'])) {
1305 print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"],
"p.poste", $begin, $param,
'', $sortfield, $sortorder);
1306 $totalarray[
'nbfield']++;
1308if (!empty($arrayfields[
'p.address'][
'checked'])) {
1309 print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"],
"p.address", $begin, $param,
'', $sortfield, $sortorder);
1310 $totalarray[
'nbfield']++;
1312if (!empty($arrayfields[
'p.zip'][
'checked'])) {
1313 print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.zip", $begin, $param,
'', $sortfield, $sortorder);
1314 $totalarray[
'nbfield']++;
1316if (!empty($arrayfields[
'p.town'][
'checked'])) {
1317 print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"],
"p.town", $begin, $param,
'', $sortfield, $sortorder);
1318 $totalarray[
'nbfield']++;
1322if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1323 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"co.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1324 $totalarray[
'nbfield']++;
1326if (!empty($arrayfields[
'p.phone'][
'checked'])) {
1327 print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone", $begin, $param,
'', $sortfield, $sortorder);
1328 $totalarray[
'nbfield']++;
1330if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
1331 print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_perso", $begin, $param,
'', $sortfield, $sortorder);
1332 $totalarray[
'nbfield']++;
1334if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"p.phone_mobile", $begin, $param,
'', $sortfield, $sortorder);
1336 $totalarray[
'nbfield']++;
1338if (!empty($arrayfields[
'p.fax'][
'checked'])) {
1339 print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fax", $begin, $param,
'', $sortfield, $sortorder);
1340 $totalarray[
'nbfield']++;
1342if (!empty($arrayfields[
'p.email'][
'checked'])) {
1343 print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"],
"p.email", $begin, $param,
'', $sortfield, $sortorder);
1344 $totalarray[
'nbfield']++;
1346if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
1347 print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"],
"unsubscribed", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1348 $totalarray[
'nbfield']++;
1350if (isModEnabled(
'socialnetworks')) {
1351 foreach ($socialnetworks as $key => $value) {
1352 if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"],
"p.".$key, $begin, $param,
'', $sortfield, $sortorder);
1354 $totalarray[
'nbfield']++;
1358if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_soc", $begin, $param,
'', $sortfield, $sortorder);
1360 $totalarray[
'nbfield']++;
1362if (!empty($arrayfields[
's.nom'][
'checked'])) {
1363 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom", $begin, $param,
'', $sortfield, $sortorder);
1364 $totalarray[
'nbfield']++;
1366if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias", $begin, $param,
'', $sortfield, $sortorder);
1369 $totalarray[
'nbfield']++;
1371if (!empty($arrayfields[
'p.priv'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"],
"p.priv", $begin, $param,
'', $sortfield, $sortorder,
'center ');
1373 $totalarray[
'nbfield']++;
1375if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
1376 print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1377 $totalarray[
'nbfield']++;
1379if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_stcommcontact",
"", $param,
'', $sortfield, $sortorder,
'center ');
1381 $totalarray[
'nbfield']++;
1383if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"],
"p.birthday",
"", $param,
'', $sortfield, $sortorder,
'center ');
1385 $totalarray[
'nbfield']++;
1388include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1390$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1391$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1392print $hookmanager->resPrint;
1394if (!empty($arrayfields[
'p.ip'][
'checked'])) {
1395 print_liste_field_titre($arrayfields[
'p.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1396 $totalarray[
'nbfield']++;
1399if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1400 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1401 $totalarray[
'nbfield']++;
1403if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1404 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1405 $totalarray[
'nbfield']++;
1407if (!empty($arrayfields[
'p.statut'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1409 $totalarray[
'nbfield']++;
1411if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1412 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1413 $totalarray[
'nbfield']++;
1416 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1417 $totalarray[
'nbfield']++;
1425$savnbfield = $totalarray[
'nbfield'];
1426$totalarray = array();
1427$totalarray[
'nbfield'] = 0;
1428$imaxinloop = ($limit ? min($num, $limit) : $num);
1429while ($i < $imaxinloop) {
1430 $obj = $db->fetch_object($resql);
1435 $arraysocialnetworks = (array) json_decode($obj->socialnetworks,
true);
1436 $contactstatic->id = $obj->rowid;
1437 $contactstatic->ref_ext = $obj->ref_ext;
1438 $contactstatic->lastname = $obj->lastname;
1439 $contactstatic->firstname = $obj->firstname;
1440 $contactstatic->statut = $obj->statut;
1441 $contactstatic->poste = $obj->poste;
1442 $contactstatic->email = $obj->email;
1443 $contactstatic->phone_pro = $obj->phone_pro;
1444 $contactstatic->phone_perso = $obj->phone_perso;
1445 $contactstatic->phone_mobile = $obj->phone_mobile;
1446 $contactstatic->address = $obj->address;
1447 $contactstatic->zip = $obj->zip;
1448 $contactstatic->town = $obj->town;
1449 $contactstatic->socialnetworks = $arraysocialnetworks;
1450 $contactstatic->country = $obj->country;
1451 $contactstatic->country_code = $obj->country_code;
1452 $contactstatic->photo = $obj->photo;
1453 $contactstatic->import_key = $obj->import_key;
1454 $contactstatic->photo = $obj->photo;
1455 $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
1459 if ($mode ==
'kanban') {
1461 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1462 print
'<div class="box-flex-container kanban">';
1465 if ($massactionbutton || $massaction) {
1467 if (in_array(
$object->id, $arrayofselected)) {
1471 if ($obj->socid > 0) {
1472 $contactstatic->fetch_thirdparty($obj->socid);
1474 print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
1475 if ($i == ($imaxinloop - 1)) {
1481 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
1482 if ($contextpage ==
'poslist') {
1483 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1488 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1489 print '<td class="nowrap center
">';
1490 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1492 if (in_array($obj->rowid, $arrayofselected)) {
1495 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1499 $totalarray['nbfield']++;
1504 if (!empty($arrayfields['p.rowid']['checked'])) {
1505 print '<td class="tdoverflowmax50
">';
1506 print dol_escape_htmltag($obj->rowid);
1509 $totalarray['nbfield']++;
1514 if (!empty($arrayfields['p.lastname']['checked'])) {
1515 print '<td class="middle tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($contactstatic->lastname).'">';
1516 if ($contextpage == 'poslist') {
1517 print $contactstatic->lastname;
1519 print $contactstatic->getNomUrl(1);
1523 $totalarray['nbfield']++;
1528 if (!empty($arrayfields['p.firstname']['checked'])) {
1529 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->firstname).'">';
1530 print dolPrintHTML($obj->firstname);
1533 $totalarray['nbfield']++;
1538 if (!empty($arrayfields['p.ref_ext']['checked'])) {
1539 print '<td class="middle tdoverflowmax100
" title="'.dolPrintHTMLForAttribute($contactstatic->ref_ext).'">';
1540 print dolPrintHTML($contactstatic->ref_ext);
1543 $totalarray['nbfield']++;
1548 if (!empty($arrayfields['p.poste']['checked'])) {
1549 print '<td class="tdoverflowmax100
">'.dol_escape_htmltag($obj->poste).'</td>';
1551 $totalarray['nbfield']++;
1556 if (!empty($arrayfields['p.address']['checked'])) {
1557 print '<td>'.dol_escape_htmltag($obj->address).'</td>';
1559 $totalarray['nbfield']++;
1564 if (!empty($arrayfields['p.zip']['checked'])) {
1565 print '<td>'.dol_escape_htmltag($obj->zip).'</td>';
1567 $totalarray['nbfield']++;
1572 if (!empty($arrayfields['p.town']['checked'])) {
1573 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town).'</td>';
1575 $totalarray['nbfield']++;
1581 if (!empty($arrayfields['state.nom']['checked']))
1583 print "<td>
".$obj->state_name."</td>\n
";
1584 if (! $i) $totalarray['nbfield']++;
1588 if (!empty($arrayfields['region.nom']['checked']))
1590 print "<td>
".$obj->region_name."</td>\n
";
1591 if (! $i) $totalarray['nbfield']++;
1595 if (!empty($arrayfields['country.code_iso']['checked'])) {
1596 print '<td class="center
">';
1597 $tmparray = getCountry($obj->fk_pays, 'all');
1598 print dol_escape_htmltag($tmparray['label']);
1601 $totalarray['nbfield']++;
1606 if (!empty($arrayfields['p.phone']['checked'])) {
1607 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1609 $totalarray['nbfield']++;
1614 if (!empty($arrayfields['p.phone_perso']['checked'])) {
1615 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
1617 $totalarray['nbfield']++;
1622 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
1623 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
1625 $totalarray['nbfield']++;
1630 if (!empty($arrayfields['p.fax']['checked'])) {
1631 print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
1633 $totalarray['nbfield']++;
1638 if (!empty($arrayfields['p.email']['checked'])) {
1639 print '<td class="nowraponall tdoverflowmax200
" title="'.dolPrintHTML($obj->email).'">';
1640 if ($contextpage == 'poslist') {
1643 print dol_print_email($obj->email, $obj->rowid, $obj->socid, 1, 18, 0, 1);
1647 $totalarray['nbfield']++;
1651 // No EMail Subscription
1652 if (!empty($arrayfields['unsubscribed']['checked'])) {
1653 print '<td class="center
">';
1654 if (empty($obj->email)) {
1655 //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>';
1657 print yn(($obj->unsubscribed > 0) ? 1 : 0);
1661 $totalarray['nbfield']++;
1666 if (isModEnabled('socialnetworks')) {
1667 foreach ($socialnetworks as $key => $value) {
1668 if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
1669 print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
1671 $totalarray['nbfield']++;
1677 // Company / Third Party
1678 if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
1679 print '<td class="tdoverflowmax125
">';
1681 $objsoc = new Societe($db);
1682 $objsoc->fetch($obj->socid);
1683 $option_link = 'customer';
1684 if ($objsoc->client == 0 && $objsoc->fournisseur > 0) {
1685 $option_link = 'supplier';
1686 } elseif ($objsoc->client == 0 && $objsoc->fournisseur == 0) {
1689 if ($contextpage == 'poslist') {
1690 print $objsoc->name;
1692 print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1699 $totalarray['nbfield']++;
1704 if (!empty($arrayfields['s.name_alias']['checked'])) {
1705 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->alias).'">';
1706 print dol_escape_htmltag($obj->alias);
1709 $totalarray['nbfield']++;
1714 if (!empty($arrayfields['p.priv']['checked'])) {
1715 print '<td class="center
">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
1717 $totalarray['nbfield']++;
1722 if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
1723 print '<td class="center
">';
1724 print $contactstatic->getLibProspLevel();
1727 $totalarray['nbfield']++;
1732 if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
1733 print '<td class="center nowrap
"><div class="nowrap
">';
1734 print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1735 print '</div> - <div class="inline-block
">';
1736 foreach ($contactstatic->cacheprospectstatus as $key => $val) {
1737 $titlealt = 'default';
1738 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1739 $titlealt = $val['label'];
1741 if ($obj->stcomm_id != $val['id']) {
1742 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>';
1745 print '</div></div></td>';
1747 $totalarray['nbfield']++;
1752 if (!empty($arrayfields['p.birthday']['checked'])) {
1753 print '<td class="center nowraponall
">';
1754 print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser');
1757 $totalarray['nbfield']++;
1762 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1765 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1766 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1767 print $hookmanager->resPrint;
1770 if (!empty($arrayfields['p.ip']['checked'])) {
1771 print '<td class="center nowraponall
">';
1772 print dol_print_ip($obj->ip);
1775 $totalarray['nbfield']++;
1780 if (!empty($arrayfields['p.datec']['checked'])) {
1781 print '<td class="center nowraponall
">';
1782 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1785 $totalarray['nbfield']++;
1789 // Date modification
1790 if (!empty($arrayfields['p.tms']['checked'])) {
1791 print '<td class="center nowraponall
">';
1792 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1795 $totalarray['nbfield']++;
1800 if (!empty($arrayfields['p.statut']['checked'])) {
1801 print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>';
1803 $totalarray['nbfield']++;
1808 if (!empty($arrayfields['p.import_key']['checked'])) {
1809 print '<td class="tdoverflowmax100
">';
1810 print dol_escape_htmltag($obj->import_key);
1813 $totalarray['nbfield']++;
1818 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1819 print '<td class="nowrap center
">';
1820 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1822 if (in_array($obj->rowid, $arrayofselected)) {
1825 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1829 $totalarray['nbfield']++;
1839include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1841// If no record found
1844 foreach ($arrayfields as $key => $val) {
1845 if (!empty($val['checked'])) {
1849 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
1854$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1855$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1856print $hookmanager->resPrint;
1858print '</table>'."\n
";
1861print '</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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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.