38require 
'../main.inc.php';
 
   39require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
 
   40require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
 
   42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   45$langs->loadLangs(array(
"companies", 
"suppliers", 
"categories"));
 
   50$action = 
GETPOST(
'action', 
'aZ09');
 
   51$massaction = 
GETPOST(
'massaction', 
'alpha');
 
   52$show_files = 
GETPOST(
'show_files', 
'int');
 
   53$confirm = 
GETPOST(
'confirm', 
'alpha');
 
   54$toselect = 
GETPOST(
'toselect', 
'array');
 
   55$contextpage = 
GETPOST(
'contextpage', 
'aZ') ? 
GETPOST(
'contextpage', 
'aZ') : 
'contactlist';
 
   56$mode = 
GETPOST(
'mode', 
'alpha');
 
   58if ($contextpage == 
'poslist') {
 
   59  $_GET[
'optioncss'] = 
'print';
 
   64$contactid = 
GETPOST(
'id', 
'int');
 
   67  $socid = $user->socid;
 
   71$search_all = trim((
GETPOST(
'search_all', 
'alphanohtml') != 
'') ? 
GETPOST(
'search_all', 
'alphanohtml') : 
GETPOST(
'sall', 
'alphanohtml'));
 
   72$search_cti = preg_replace(
'/^0+/', 
'', preg_replace(
'/[^0-9]/', 
'', 
GETPOST(
'search_cti', 
'alphanohtml'))); 
 
   73$search_phone = 
GETPOST(
"search_phone", 
'alpha');
 
   75$search_id = 
GETPOST(
"search_id", 
"int");
 
   76$search_firstlast_only = 
GETPOST(
"search_firstlast_only", 
'alpha');
 
   77$search_lastname = 
GETPOST(
"search_lastname", 
'alpha');
 
   78$search_firstname = 
GETPOST(
"search_firstname", 
'alpha');
 
   79$search_societe = 
GETPOST(
"search_societe", 
'alpha');
 
   80$search_societe_alias = 
GETPOST(
"search_societe_alias", 
'alpha');
 
   81$search_poste = 
GETPOST(
"search_poste", 
'alpha');
 
   82$search_phone_perso = 
GETPOST(
"search_phone_perso", 
'alpha');
 
   83$search_phone_pro = 
GETPOST(
"search_phone_pro", 
'alpha');
 
   84$search_phone_mobile = 
GETPOST(
"search_phone_mobile", 
'alpha');
 
   85$search_fax = 
GETPOST(
"search_fax", 
'alpha');
 
   86$search_email = 
GETPOST(
"search_email", 
'alpha');
 
   87if (isModEnabled(
'mailing')) {
 
   88  $search_no_email = GETPOSTISSET(
"search_no_email") ? 
GETPOST(
"search_no_email", 
'int') : -1;
 
   90  $search_no_email = -1;
 
   92if (isModEnabled(
'socialnetworks')) {
 
   93  foreach ($socialnetworks as $key => $value) {
 
   94    if ($value[
'active']) {
 
   95      $search_[$key] = 
GETPOST(
"search_".$key, 
'alpha');
 
   99$search_priv = 
GETPOST(
"search_priv", 
'alpha');
 
  100$search_categ = 
GETPOST(
"search_categ", 
'int');
 
  101$search_categ_thirdparty = 
GETPOST(
"search_categ_thirdparty", 
'int');
 
  102$search_categ_supplier = 
GETPOST(
"search_categ_supplier", 
'int');
 
  103$search_status = 
GETPOST(
"search_status", 
'int');
 
  104$search_type = 
GETPOST(
'search_type', 
'alpha');
 
  105$search_address = 
GETPOST(
'search_address', 
'alpha');
 
  106$search_zip = 
GETPOST(
'search_zip', 
'alpha');
 
  107$search_town = 
GETPOST(
'search_town', 
'alpha');
 
  108$search_import_key = 
GETPOST(
"search_import_key", 
'alpha');
 
  109$search_country = 
GETPOST(
"search_country", 
'intcomma');
 
  110$search_roles = 
GETPOST(
"search_roles", 
'array');
 
  111$search_level = 
GETPOST(
"search_level", 
'array');
 
  112$search_stcomm = 
GETPOST(
'search_stcomm', 
'int');
 
  113$search_birthday_start = 
dol_mktime(0, 0, 0, 
GETPOST(
'search_birthday_startmonth', 
'int'), 
GETPOST(
'search_birthday_startday', 
'int'), 
GETPOST(
'search_birthday_startyear', 
'int'));
 
  114$search_birthday_end = 
dol_mktime(23, 59, 59, 
GETPOST(
'search_birthday_endmonth', 
'int'), 
GETPOST(
'search_birthday_endday', 
'int'), 
GETPOST(
'search_birthday_endyear', 
'int'));
 
  116if ($search_status === 
'') {
 
  119if ($search_no_email === 
'') {
 
  120  $search_no_email = -1;
 
  123$optioncss = 
GETPOST(
'optioncss', 
'alpha');
 
  125$place = 
GETPOST(
'place', 
'aZ09') ? 
GETPOST(
'place', 
'aZ09') : 
'0'; 
 
  128$view = 
GETPOST(
"view", 
'alpha');
 
  130$userid = 
GETPOST(
'userid', 
'int');
 
  134$limit = 
GETPOST(
'limit', 
'int') ? 
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
  135$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
  136$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
  137$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
  142  $sortfield = 
"p.lastname";
 
  144if (empty($page) || $page < 0 || 
GETPOST(
'button_search', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) {
 
  148$offset = $limit * $page;
 
  149$pageprev = $page - 1;
 
  150$pagenext = $page + 1;
 
  153$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
 
  155  if (empty($contextpage) || $contextpage == 
'contactlist') {
 
  156    $contextpage = 
'contactprospectlist';
 
  158  $title .= 
'  ('.$langs->trans(
"ThirdPartyProspects").
')';
 
  159  $urlfiche = 
"card.php";
 
  162  if (empty($contextpage) || $contextpage == 
'contactlist') {
 
  163    $contextpage = 
'contactcustomerlist';
 
  165  $title .= 
'  ('.$langs->trans(
"ThirdPartyCustomers").
')';
 
  166  $urlfiche = 
"card.php";
 
  167} elseif ($type == 
"f") {
 
  168  if (empty($contextpage) || $contextpage == 
'contactlist') {
 
  169    $contextpage = 
'contactsupplierlist';
 
  171  $title .= 
' ('.$langs->trans(
"ThirdPartySuppliers").
')';
 
  172  $urlfiche = 
"card.php";
 
  173} elseif ($type == 
"o") {
 
  174  if (empty($contextpage) || $contextpage == 
'contactlist') {
 
  175    $contextpage = 
'contactotherlist';
 
  177  $title .= 
' ('.$langs->trans(
"OthersNotLinkedToThirdParty").
')';
 
  184$hookmanager->initHooks(array($contextpage));
 
  187$extrafields->fetch_name_optionals_label($object->table_element);
 
  189$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, 
'', 
'search_');
 
  192$fieldstosearchall = array();
 
  193foreach ($object->fields as $key => $val) {
 
  195  if (!empty($user->socid) && $key == 
"note_private") {
 
  199  if (empty($val[
'searchall'])) {
 
  203  $fieldstosearchall[
'p.'.$key] = $val[
'label'];
 
  208  $fieldstosearchall[
's.nom'] = 
"ThirdParty";
 
  209  $fieldstosearchall[
's.name_alias'] = 
"AliasNames";
 
  212$parameters = array(
'fieldstosearchall'=>$fieldstosearchall);
 
  213$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action); 
 
  215  $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
 
  216} elseif ($reshook == 0) {
 
  217  $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
 
  221$arrayfields = array();
 
  222foreach ($object->fields as $key => $val) {
 
  224  if (!empty($val[
'visible'])) {
 
  225    $visible = (int) 
dol_eval($val[
'visible'], 1);
 
  226    $arrayfields[
'p.'.$key] = array(
 
  227      'label'=>$val[
'label'],
 
  228      'checked'=>(($visible < 0) ? 0 : 1),
 
  229      'enabled'=>(abs($visible) != 3 && 
dol_eval($val[
'enabled'], 1)),
 
  230      'position'=>$val[
'position'],
 
  231      'help'=> isset($val[
'help']) ? $val[
'help'] : 
'' 
  237$arrayfields[
'country.code_iso'] = array(
'label'=>
"Country", 
'position'=>66, 
'checked'=>0);
 
  239  $arrayfields[
's.nom'] = array(
'label'=>
"ThirdParty", 
'position'=>113, 
'checked'=> 1);
 
  240  $arrayfields[
's.name_alias'] = array(
'label'=>
"AliasNameShort", 
'position'=>114, 
'checked'=> 1);
 
  243$arrayfields[
'unsubscribed'] = array(
 
  246    'enabled'=>(isModEnabled(
'mailing')),
 
  249if (isModEnabled(
'socialnetworks')) {
 
  250  foreach ($socialnetworks as $key => $value) {
 
  251    if ($value[
'active']) {
 
  252      $arrayfields[
'p.'.$key] = array(
 
  253        'label' => $value[
'label'],
 
  262include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  269if (($id > 0 || !empty($ref)) && $action != 
'add') {
 
  270  $result = $object->fetch($id, $ref);
 
  276$permissiontoread = $user->hasRight(
'societe', 
'lire');
 
  277$permissiontodelete = $user->hasRight(
'societe', 
'supprimer');
 
  278$permissiontoadd = $user->hasRight(
'societe', 
'creer');
 
  280if (!$permissiontoread) {
 
  289if ($action == 
"change" && $user->hasRight(
'takepos', 
'run')) { 
 
  290  $idcustomer = 
GETPOST(
'idcustomer', 
'int');
 
  291  $idcontact = 
GETPOST(
'idcontact', 
'int');
 
  294  $sql = 
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
 
  295  $result = $db->query($sql);
 
  296  $num_lines = $db->num_rows($result);
 
  297  if ($num_lines == 0) {
 
  298    require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
 
  300    $constforthirdpartyid = 
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
 
  303    $invoice->module_source = 
'takepos';
 
  304    $invoice->pos_source = $_SESSION[
"takeposterminal"];
 
  305    $placeid = $invoice->create($user);
 
  306    $sql = 
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
 
  310  $sql = 
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
 
  311  $resql = $db->query($sql);
 
  314  if (!isset($invoice)) {
 
  315    require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
 
  317    $invoice->fetch(
null, 
"(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")");
 
  318    $invoice->delete_linked_contact(
'external', 
'BILLING');
 
  320  $invoice->add_contact($idcontact, 
'BILLING'); ?>
 
  322    console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
 
  323    parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>", 
function() {
 
  325      <?php 
if (!$resql) { ?>
 
  326        alert(
'Error failed to update customer on draft invoice.');
 
  328      parent.$(
"#idcustomer").val(<?php echo $idcustomer; ?>);
 
  329      parent.$.colorbox.close(); 
 
  336if (
GETPOST(
'cancel', 
'alpha')) {
 
  340if (!
GETPOST(
'confirmmassaction', 
'alpha') && $massaction != 
'presend' && $massaction != 
'confirm_presend') {
 
  344$parameters = array();
 
  345$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  350if (empty($reshook)) {
 
  352  include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
 
  355  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) {  
 
  358    $search_firstlast_only = 
"";
 
  359    $search_lastname = 
"";
 
  360    $search_firstname = 
"";
 
  361    $search_societe = 
"";
 
  362    $search_societe_alias = 
"";
 
  364    $search_address = 
"";
 
  366    $search_country = 
"";
 
  369    $search_phone_perso = 
"";
 
  370    $search_phone_pro = 
"";
 
  371    $search_phone_mobile = 
"";
 
  374    $search_no_email = -1;
 
  375    if (isModEnabled(
'socialnetworks')) {
 
  376      foreach ($socialnetworks as $key => $value) {
 
  377        if ($value[
'active']) {
 
  387    $search_categ_thirdparty = 
'';
 
  388    $search_categ_supplier = 
'';
 
  389    $search_import_key = 
'';
 
  391    $search_array_options = array();
 
  392    $search_roles = array();
 
  393    $search_birthday_start = 
'';
 
  394    $search_birthday_end = 
'';
 
  398  $objectclass = 
'Contact';
 
  399  $objectlabel = 
'Contact';
 
  400  $uploaddir = $conf->societe->dir_output;
 
  401  include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
 
  403  if ($action == 
'setstcomm') {
 
  405    $result = $object->fetch(
GETPOST(
'stcommcontactid'));
 
  407    $result = $object->update($object->id, $user);
 
  416if ($search_priv < 0) {
 
  425$form = 
new Form($db);
 
  428$contactstatic = 
new Contact($db);
 
  432$title = $langs->trans(
"Contacts").
" - ".$langs->trans(
"List");
 
  433$help_url = 
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
 
  438  $contactstatic->loadCacheOfProspStatus();
 
  441$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
  442$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage); 
 
  446$sql = 
"SELECT code, label, sortorder";
 
  447$sql .= 
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
 
  448$sql .= 
" WHERE active > 0";
 
  449$sql .= 
" ORDER BY sortorder";
 
  450$resql = $db->query($sql);
 
  452  while ($obj = $db->fetch_object($resql)) {
 
  454    $level = $langs->trans($obj->code);
 
  455    if ($level == $obj->code) {
 
  456      $level = $langs->trans($obj->label);
 
  458    $tab_level[$obj->code] = $level;
 
  466$sql = 
"SELECT s.rowid as socid, s.nom as name, s.name_alias as alias,";
 
  467$sql .= 
" p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.birthday,";
 
  468$sql .= 
" p.socialnetworks, p.photo,";
 
  469$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_update,";
 
  470$sql .= 
" p.import_key, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,";
 
  471$sql .= 
" st.libelle as stcomm, st.picto as stcomm_picto,";
 
  472$sql .= 
" co.label as country, co.code as country_code";
 
  474if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  475  foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  476    $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef.".$key.
" as options_".$key : 
'');
 
  479if (isModEnabled(
'mailing')) {
 
  480  $sql .= 
", (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) as unsubscribed";
 
  484$parameters = array();
 
  485$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action); 
 
  486$sql .= $hookmanager->resPrint;
 
  487$sql = preg_replace(
'/,\s*$/', 
'', $sql);
 
  491$sql .= 
" FROM ".MAIN_DB_PREFIX.
"socpeople as p";
 
  492if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  493  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
 
  495$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = p.fk_pays";
 
  496$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
 
  497$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_stcommcontact as st ON st.id = p.fk_stcommcontact";
 
  498if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  499  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
 
  503$parameters = array();
 
  504$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);    
 
  505$sql .= $hookmanager->resPrint;
 
  506$sql .= 
' WHERE p.entity IN ('.getEntity(
'contact').
')';
 
  507if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) { 
 
  508  $sql .= 
" AND (sc.fk_user = ".((int) $user->id).
" OR p.fk_soc IS NULL)";
 
  510if (!empty($userid)) {    
 
  511  $sql .= 
" AND p.fk_user_creat=".((int) $userid);
 
  514  $sql .= 
natural_search(
"p.fk_prospectlevel", join(
',', $search_level), 3);
 
  516if ($search_stcomm != 
'' && $search_stcomm != -2) {
 
  521if ($search_priv != 
'0' && $search_priv != 
'1') {
 
  522  $sql .= 
" AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
"))";
 
  524  if ($search_priv == 
'0') {
 
  525    $sql .= 
" AND p.priv='0'";
 
  527  if ($search_priv == 
'1') {
 
  528    $sql .= 
" AND (p.priv='1' AND p.fk_user_creat=".((int) $user->id).
")";
 
  534$searchCategoryContactList = $search_categ ? array($search_categ) : array();
 
  535$searchCategoryContactOperator = 0;
 
  537if (!empty($searchCategoryContactList)) {
 
  538  $searchCategoryContactSqlList = array();
 
  539  $listofcategoryid = 
'';
 
  540  foreach ($searchCategoryContactList as $searchCategoryContact) {
 
  541    if (intval($searchCategoryContact) == -2) {
 
  542      $searchCategoryContactSqlList[] = 
"NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX.
"categorie_contact as ck WHERE p.rowid = ck.fk_socpeople)";
 
  543    } elseif (intval($searchCategoryContact) > 0) {
 
  544      if ($searchCategoryContactOperator == 0) {
 
  545        $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).
")";
 
  547        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategoryContact);
 
  551  if ($listofcategoryid) {
 
  552    $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).
"))";
 
  554  if ($searchCategoryContactOperator == 1) {
 
  555    if (!empty($searchCategoryContactSqlList)) {
 
  556      $sql .= 
" AND (".implode(
' OR ', $searchCategoryContactSqlList).
")";
 
  559    if (!empty($searchCategoryContactSqlList)) {
 
  560      $sql .= 
" AND (".implode(
' AND ', $searchCategoryContactSqlList).
")";
 
  566$searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
 
  567$searchCategoryCustomerOperator = 0;
 
  569if (!empty($searchCategoryCustomerList)) {
 
  570  $searchCategoryCustomerSqlList = array();
 
  571  $listofcategoryid = 
'';
 
  572  foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
 
  573    if (intval($searchCategoryCustomer) == -2) {
 
  574      $searchCategoryCustomerSqlList[] = 
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
 
  575    } elseif (intval($searchCategoryCustomer) > 0) {
 
  576      if ($searchCategoryCustomerOperator == 0) {
 
  577        $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).
")";
 
  579        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategoryCustomer);
 
  583  if ($listofcategoryid) {
 
  584    $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).
"))";
 
  586  if ($searchCategoryCustomerOperator == 1) {
 
  587    if (!empty($searchCategoryCustomerSqlList)) {
 
  588      $sql .= 
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
 
  591    if (!empty($searchCategoryCustomerSqlList)) {
 
  592      $sql .= 
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
 
  598$searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
 
  599$searchCategorySupplierOperator = 0;
 
  601if (!empty($searchCategorySupplierList)) {
 
  602  $searchCategorySupplierSqlList = array();
 
  603  $listofcategoryid = 
'';
 
  604  foreach ($searchCategorySupplierList as $searchCategorySupplier) {
 
  605    if (intval($searchCategorySupplier) == -2) {
 
  606      $searchCategorySupplierSqlList[] = 
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
 
  607    } elseif (intval($searchCategorySupplier) > 0) {
 
  608      if ($searchCategorySupplierOperator == 0) {
 
  609        $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).
")";
 
  611        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategorySupplier);
 
  615  if ($listofcategoryid) {
 
  616    $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).
"))";
 
  618  if ($searchCategorySupplierOperator == 1) {
 
  619    if (!empty($searchCategorySupplierSqlList)) {
 
  620      $sql .= 
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
 
  623    if (!empty($searchCategorySupplierSqlList)) {
 
  624      $sql .= 
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
 
  630  $sql .= 
natural_search(array_keys($fieldstosearchall), $search_all);
 
  632if (strlen($search_phone)) {
 
  633  $sql .= 
natural_search(array(
'p.phone', 
'p.phone_perso', 
'p.phone_mobile'), $search_phone);
 
  635if (strlen($search_cti)) {
 
  636  $sql .= 
natural_search(array(
'p.phone', 
'p.phone_perso', 
'p.phone_mobile'), $search_cti);
 
  638if (strlen($search_firstlast_only)) {
 
  639  $sql .= 
natural_search(array(
'p.lastname', 
'p.firstname'), $search_firstlast_only);
 
  645if ($search_lastname) {
 
  648if ($search_firstname) {
 
  651if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
 
  652  $sql .= 
natural_search(array(
"s.nom", 
"s.name_alias"), $search_societe);
 
  654  if ($search_societe) {
 
  657  if ($search_societe_alias) {
 
  661if ($search_country) {
 
  662  $sql .= 
" AND p.fk_pays IN (".$db->sanitize($search_country).
')';
 
  664if (strlen($search_poste)) {
 
  667if (strlen($search_phone_perso)) {
 
  670if (strlen($search_phone_pro)) {
 
  673if (strlen($search_phone_mobile)) {
 
  676if (strlen($search_fax)) {
 
  679if (isModEnabled(
'socialnetworks')) {
 
  680  foreach ($socialnetworks as $key => $value) {
 
  681    if ($value[
'active'] && strlen($search_[$key])) {
 
  682      $searchkeyinjsonformat = preg_replace(
'/"$/', 
'', preg_replace(
'/^"/', 
'', json_encode($search_[$key])));
 
  683      if (in_array($db->type, array(
'mysql', 
'mysqli'))) {
 
  684        $sql .= 
" AND p.socialnetworks REGEXP '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
 
  685      } elseif ($db->type == 
'pgsql') {
 
  686        $sql .= 
" AND p.socialnetworks ~ '\"".$db->escape($db->escapeforlike($key)).
"\":\"[^\"]*".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"'";
 
  689        $sql .= 
" AND p.socialnetworks LIKE '%\"".$db->escape($db->escapeforlike($key)).
"\":\"".$db->escape($db->escapeforlike($searchkeyinjsonformat)).
"%'";
 
  696if (strlen($search_email)) {
 
  699if (strlen($search_address)) {
 
  702if (strlen($search_zip)) {
 
  705if (strlen($search_town)) {
 
  708if (count($search_roles) > 0) {
 
  709  $sql .= 
" AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX.
"societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(
',', $search_roles)).
"))";
 
  711if ($search_no_email != -1 && $search_no_email > 0) {
 
  712  $sql .= 
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) > 0";
 
  714if ($search_no_email != -1 && $search_no_email == 0) {
 
  715  $sql .= 
" AND (SELECT count(*) FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL  AND p.email <> ''";
 
  717if ($search_status != 
'' && $search_status >= 0) {
 
  718  $sql .= 
" AND p.statut = ".((int) $search_status);
 
  720if ($search_import_key) {
 
  724  $sql .= 
" AND p.fk_soc IS NULL";
 
  725} elseif ($type == 
"f") {        
 
  726  $sql .= 
" AND s.fournisseur = 1";
 
  727} elseif ($type == 
"c") {        
 
  728  $sql .= 
" AND s.client IN (1, 3)";
 
  729} elseif ($type == 
"p") {        
 
  730  $sql .= 
" AND s.client IN (2, 3)";
 
  733  $sql .= 
" AND s.rowid = ".((int) $socid);
 
  735if ($search_birthday_start) {
 
  736  $sql .= 
" AND p.birthday >= '".$db->idate($search_birthday_start).
"'";
 
  738if ($search_birthday_end) {
 
  739  $sql .= 
" AND p.birthday <= '".$db->idate($search_birthday_end).
"'";
 
  743include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  746$parameters = array();
 
  747$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action); 
 
  748$sql .= $hookmanager->resPrint;
 
  752$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
 
  753$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action); 
 
  754$sql .= $hookmanager->resPrint;
 
  757$nbtotalofrecords = 
'';
 
  760  $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields, 
'/').
'/', 
'SELECT COUNT(*) as nbtotalofrecords', $sql);
 
  761  $sqlforcount = preg_replace(
'/GROUP BY .*$/', 
'', $sqlforcount);
 
  762  $resql = $db->query($sqlforcount);
 
  764    $objforcount = $db->fetch_object($resql);
 
  765    $nbtotalofrecords = $objforcount->nbtotalofrecords;
 
  770  if (($page * $limit) > $nbtotalofrecords) { 
 
  778if ($view == 
"recent") {
 
  779  $sql .= $db->order(
"p.datec", 
"DESC");
 
  781  $sql .= $db->order($sortfield, $sortorder);
 
  784  $sql .= $db->plimit($limit + 1, $offset);
 
  787$resql = $db->query($sql);
 
  793$num = $db->num_rows($resql);
 
  796if ($num == 1 && 
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all != 
'' || $search_cti != 
'') && !$page) {
 
  797  $obj = $db->fetch_object($resql);
 
  799  header(
"Location: ".DOL_URL_ROOT.
'/contact/card.php?id='.$id);
 
  807llxHeader(
'', $title, $help_url, 
'', 0, 0, $morejs, $morecss, 
'', 
'bodyforlist');
 
  809$arrayofselected = is_array($toselect) ? $toselect : array();
 
  813  $param .= 
'&mode='.urlencode($mode);
 
  815if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  816  $param .= 
'&contextpage='.urlencode($contextpage);
 
  818if ($limit > 0 && $limit != $conf->liste_limit) {
 
  819  $param .= 
'&limit='.((int) $limit);
 
  821if ($optioncss != 
'') {
 
  822  $param .= 
'&optioncss='.urlencode($optioncss);
 
  824$param .= 
'&begin='.urlencode($begin).
'&userid='.urlencode($userid).
'&contactname='.urlencode($search_all);
 
  825$param .= 
'&type='.urlencode($type).
'&view='.urlencode($view);
 
  826if (!empty($search_categ) && $search_categ != 
'-1') {
 
  827  $param .= 
'&search_categ='.urlencode($search_categ);
 
  829if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != 
'-1') {
 
  830  $param .= 
'&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
 
  832if (!empty($search_categ_supplier) && $search_categ_supplier != 
'-1') {
 
  833  $param .= 
'&search_categ_supplier='.urlencode($search_categ_supplier);
 
  835if ($search_all != 
'') {
 
  836  $param .= 
'&search_all='.urlencode($search_all);
 
  839  $param .= 
"&search_id=".urlencode($search_id);
 
  841if ($search_lastname != 
'') {
 
  842  $param .= 
'&search_lastname='.urlencode($search_lastname);
 
  844if ($search_firstname != 
'') {
 
  845  $param .= 
'&search_firstname='.urlencode($search_firstname);
 
  847if ($search_societe != 
'') {
 
  848  $param .= 
'&search_societe='.urlencode($search_societe);
 
  850if ($search_societe_alias != 
'') {
 
  851  $param .= 
'&search_societe_alias='.urlencode($search_societe_alias);
 
  853if ($search_address != 
'') {
 
  854  $param .= 
'&search_address='.urlencode($search_address);
 
  856if ($search_zip != 
'') {
 
  857  $param .= 
'&search_zip='.urlencode($search_zip);
 
  859if ($search_town != 
'') {
 
  860  $param .= 
'&search_town='.urlencode($search_town);
 
  862if ($search_country != 
'') {
 
  863  $param .= 
"&search_country=".urlencode($search_country);
 
  865if ($search_poste != 
'') {
 
  866  $param .= 
'&search_poste='.urlencode($search_poste);
 
  868if ($search_phone_pro != 
'') {
 
  869  $param .= 
'&search_phone_pro='.urlencode($search_phone_pro);
 
  871if ($search_phone_perso != 
'') {
 
  872  $param .= 
'&search_phone_perso='.urlencode($search_phone_perso);
 
  874if ($search_phone_mobile != 
'') {
 
  875  $param .= 
'&search_phone_mobile='.urlencode($search_phone_mobile);
 
  877if ($search_fax != 
'') {
 
  878  $param .= 
'&search_fax='.urlencode($search_fax);
 
  880if ($search_email != 
'') {
 
  881  $param .= 
'&search_email='.urlencode($search_email);
 
  883if ($search_no_email != 
'') {
 
  884  $param .= 
'&search_no_email='.urlencode($search_no_email);
 
  886if ($search_status != 
'') {
 
  887  $param .= 
'&search_status='.urlencode($search_status);
 
  889if ($search_priv == 
'0' || $search_priv == 
'1') {
 
  890  $param .= 
"&search_priv=".urlencode($search_priv);
 
  892if ($search_stcomm != 
'') {
 
  893  $param .= 
'&search_stcomm='.urlencode($search_stcomm);
 
  895if (is_array($search_level) && count($search_level)) {
 
  896  foreach ($search_level as $slevel) {
 
  897    $param .= 
'&search_level[]='.urlencode($slevel);
 
  900if ($search_import_key != 
'') {
 
  901  $param .= 
'&search_import_key='.urlencode($search_import_key);
 
  903if (count($search_roles) > 0) {
 
  904  $param .= implode(
'&search_roles[]=', $search_roles);
 
  906if ($search_birthday_start) {
 
  907  $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'));
 
  909if ($search_birthday_end) {
 
  910  $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'));
 
  913include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
 
  916$arrayofmassactions = array(
 
  917  'presend' => 
img_picto(
'', 
'email', 
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
 
  921if (!empty($permissiontodelete)) {
 
  922  $arrayofmassactions[
'predelete'] = 
img_picto(
'', 
'delete', 
'class="pictofixedwidth"').$langs->trans(
"Delete");
 
  924if (isModEnabled(
'category') && $user->hasRight(
'societe', 
'creer')) {
 
  925  $arrayofmassactions[
'preaffecttag'] = 
img_picto(
'', 
'category', 
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
 
  927if (
GETPOST(
'nomassaction', 
'int') || in_array($massaction, array(
'presend', 
'predelete',
'preaffecttag'))) {
 
  928  $arrayofmassactions = array();
 
  930if ($contextpage != 
'poslist') {
 
  931  $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
  934print 
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter">';
 
  935if ($optioncss != 
'') {
 
  936  print 
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
 
  938print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  939print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
  940print 
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
 
  941print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
  942print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
  944print 
'<input type="hidden" name="type" value="'.$type.
'">';
 
  945print 
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
 
  946print 
'<input type="hidden" name="page_y" value="">';
 
  947print 
'<input type="hidden" name="mode" value="'.$mode.
'">';
 
  951$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'));
 
  952$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'));
 
  954if ($contextpage != 
'poslist') {
 
  955  $newcardbutton .= 
dolGetButtonTitle($langs->trans(
'NewContactAddress'), 
'', 
'fa fa-plus-circle', DOL_URL_ROOT.
'/contact/card.php?action=create', 
'', $permissiontoadd);
 
  956} elseif ($user->hasRight(
'societe', 
'contact', 
'creer')) {
 
  957  $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);
 
  958  $label = 
'MenuNewCustomer';
 
  959  $newcardbutton .= 
dolGetButtonTitle($langs->trans($label), 
'', 
'fa fa-plus-circle', $url);
 
  962print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'address', 0, $newcardbutton, 
'', $limit, 0, 0, 1);
 
  964$topicmail = 
"Information";
 
  965$modelmail = 
"contact";
 
  967$trackid = 
'ctc'.$object->id;
 
  968include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
 
  972  foreach ($fieldstosearchall as $key => $val) {
 
  973    $fieldstosearchall[$key] = $langs->trans($val);
 
  974    $setupstring .= $key.
"=".$val.
";";
 
  976  print 
'<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
 
  977  print 
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
 
  979if ($search_firstlast_only) {
 
  980  print 
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_firstlast_only).$langs->trans(
"Lastname").
", ".$langs->trans(
"Firstname").
'</div>';
 
  984if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire')) {
 
  985  require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
  986  $moreforfilter .= 
'<div class="divsearchfield">';
 
  987  $tmptitle = $langs->trans(
'ContactCategoriesShort');
 
  988  $moreforfilter .= 
img_picto($tmptitle, 
'category', 
'class="pictofixedwidth"');
 
  989  $moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ, 
'search_categ', 1, $tmptitle);
 
  990  $moreforfilter .= 
'</div>';
 
  991  if (empty($type) || $type == 
'c' || $type == 
'p') {
 
  992    $moreforfilter .= 
'<div class="divsearchfield">';
 
  995      $tmptitle .= $langs->trans(
'CustomersCategoriesShort');
 
  996    } elseif ($type == 
'p') {
 
  997      $tmptitle .= $langs->trans(
'ProspectsCategoriesShort');
 
  999      $tmptitle .= $langs->trans(
'CustomersProspectsCategoriesShort');
 
 1001    $moreforfilter .= 
img_picto($tmptitle, 
'category', 
'class="pictofixedwidth"');
 
 1002    $moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty, 
'search_categ_thirdparty', 1, $tmptitle);
 
 1003    $moreforfilter .= 
'</div>';
 
 1006  if (isModEnabled(
"fournisseur") && (empty($type) || $type == 
'f')) {
 
 1007    $moreforfilter .= 
'<div class="divsearchfield">';
 
 1008    $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
 
 1009    $moreforfilter .= 
img_picto($tmptitle, 
'category', 
'class="pictofixedwidth"');
 
 1010    $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 
'search_categ_supplier', 1, $tmptitle);
 
 1011    $moreforfilter .= 
'</div>';
 
 1015$moreforfilter .= 
'<div class="divsearchfield">';
 
 1016$moreforfilter .= $langs->trans(
'Roles').
': ';
 
 1017$moreforfilter .= $formcompany->showRoles(
"search_roles", $objecttmp, 
'edit', $search_roles);
 
 1018$moreforfilter .= 
'</div>';
 
 1020print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
 1021print $moreforfilter;
 
 1022$parameters = array(
'type'=>$type);
 
 1023$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action); 
 
 1024print $hookmanager->resPrint;
 
 1027$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
 1028$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, 
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN', 
'')); 
 
 1029$selectedfields .= ((count($arrayofmassactions) && $contextpage != 
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) : 
'');
 
 1031print 
'<div class="div-table-responsive">';
 
 1032print 
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ? 
" listwithfilterbefore" : 
"").
'">'.
"\n";
 
 1036print 
'<tr class="liste_titre_filter">';
 
 1039  print 
'<td class="liste_titre center maxwidthsearch actioncolumn">';
 
 1040  $searchpicto = $form->showFilterButtons(
'left');
 
 1044if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
 
 1045  print 
'<td class="liste_titre">';
 
 1046  print 
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
 
 1049if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
 
 1050  print 
'<td class="liste_titre">';
 
 1051  print 
'<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).
'">';
 
 1054if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
 
 1055  print 
'<td class="liste_titre">';
 
 1056  print 
'<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).
'">';
 
 1059if (!empty($arrayfields[
'p.poste'][
'checked'])) {
 
 1060  print 
'<td class="liste_titre">';
 
 1061  print 
'<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).
'">';
 
 1064if (!empty($arrayfields[
'p.address'][
'checked'])) {
 
 1065  print 
'<td class="liste_titre">';
 
 1066  print 
'<input class="flat" type="text" name="search_address" size="6" value="'.dol_escape_htmltag($search_address).
'">';
 
 1069if (!empty($arrayfields[
'p.zip'][
'checked'])) {
 
 1070  print 
'<td class="liste_titre">';
 
 1071  print 
'<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).
'">';
 
 1074if (!empty($arrayfields[
'p.town'][
'checked'])) {
 
 1075  print 
'<td class="liste_titre">';
 
 1076  print 
'<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).
'">';
 
 1099if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1100  print 
'<td class="liste_titre center">';
 
 1101  print $form->select_country($search_country, 
'search_country', 
'', 0, 
'minwidth100imp maxwidth100');
 
 1104if (!empty($arrayfields[
'p.phone'][
'checked'])) {
 
 1105  print 
'<td class="liste_titre">';
 
 1106  print 
'<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).
'">';
 
 1109if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
 
 1110  print 
'<td class="liste_titre">';
 
 1111  print 
'<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).
'">';
 
 1114if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
 
 1115  print 
'<td class="liste_titre">';
 
 1116  print 
'<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
 
 1119if (!empty($arrayfields[
'p.fax'][
'checked'])) {
 
 1120  print 
'<td class="liste_titre">';
 
 1121  print 
'<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).
'">';
 
 1124if (!empty($arrayfields[
'p.email'][
'checked'])) {
 
 1125  print 
'<td class="liste_titre">';
 
 1126  print 
'<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).
'">';
 
 1129if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
 
 1130  print 
'<td class="liste_titre center">';
 
 1131  print $form->selectarray(
'search_no_email', array(
'-1'=>
'', 
'0'=>$langs->trans(
'No'), 
'1'=>$langs->trans(
'Yes')), $search_no_email);
 
 1134if (isModEnabled(
'socialnetworks')) {
 
 1135  foreach ($socialnetworks as $key => $value) {
 
 1136    if ($value[
'active']) {
 
 1137      if (!empty($arrayfields[
'p.'.$key][
'checked'])) {
 
 1138        print 
'<td class="liste_titre">';
 
 1139        print 
'<input class="flat" type="text" name="search_'.$key.
'" size="6" value="'.
dol_escape_htmltag($search_[$key]).
'">';
 
 1145if (!empty($arrayfields[
'p.fk_soc'][
'checked']) || !empty($arrayfields[
's.nom'][
'checked'])) {
 
 1146  print 
'<td class="liste_titre">';
 
 1147  print 
'<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).
'">';
 
 1151if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
 
 1152  print 
'<td class="liste_titre" align="left">';
 
 1153  print 
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
 
 1156if (!empty($arrayfields[
'p.priv'][
'checked'])) {
 
 1157  print 
'<td class="liste_titre center">';
 
 1158  $selectarray = array(
'0'=>$langs->trans(
"ContactPublic"), 
'1'=>$langs->trans(
"ContactPrivate"));
 
 1159  print $form->selectarray(
'search_priv', $selectarray, $search_priv, 1);
 
 1163if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
 
 1164  print 
'<td class="liste_titre center">';
 
 1165  print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0, 
'width75', 0, 0, 
'', 
'', 
'', 2);
 
 1169if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
 
 1170  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1171  $arraystcomm = array();
 
 1172  foreach ($contactstatic->cacheprospectstatus as $key => $val) {
 
 1173    $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) != 
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
 
 1175  print $form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, 
'', 0, 0, 0, 
'', 
'nowrap ');
 
 1178if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
 
 1179  print 
'<td class="liste_titre center">';
 
 1180  print 
'<div class="nowrap">';
 
 1181  print $form->selectDate($search_birthday_start ? $search_birthday_start : -1, 
'search_birthday_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
 1183  print 
'<div class="nowrap">';
 
 1184  print $form->selectDate($search_birthday_end ? $search_birthday_end : -1, 
'search_birthday_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
 1190include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
 
 1193$parameters = array(
'arrayfields'=>$arrayfields);
 
 1194$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action); 
 
 1195print $hookmanager->resPrint;
 
 1197if (!empty($arrayfields[
'p.datec'][
'checked'])) {
 
 1198  print 
'<td class="liste_titre">';
 
 1202if (!empty($arrayfields[
'p.tms'][
'checked'])) {
 
 1203  print 
'<td class="liste_titre">';
 
 1207if (!empty($arrayfields[
'p.statut'][
'checked'])) {
 
 1208  print 
'<td class="liste_titre center parentonrightofpage">';
 
 1209  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');
 
 1212if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
 
 1213  print 
'<td class="liste_titre center">';
 
 1214  print 
'<input class="flat searchstring" type="text" name="search_import_key" size="3" value="'.dol_escape_htmltag($search_import_key).
'">';
 
 1219  print 
'<td class="liste_titre center maxwidthsearch">';
 
 1220  $searchpicto = $form->showFilterButtons();
 
 1226$totalarray = array();
 
 1227$totalarray[
'nbfield'] = 0;
 
 1231print 
'<tr class="liste_titre">';
 
 1233  print 
getTitleFieldOfList(($mode != 
'kanban' ? $selectedfields : 
''), 0, $_SERVER[
"PHP_SELF"], 
'', 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ').
"\n";
 
 1234  $totalarray[
'nbfield']++;
 
 1236if (!empty($arrayfields[
'p.rowid'][
'checked'])) {
 
 1237  print_liste_field_titre($arrayfields[
'p.rowid'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.rowid", 
"", $param, 
"", $sortfield, $sortorder);
 
 1238  $totalarray[
'nbfield']++;
 
 1240if (!empty($arrayfields[
'p.lastname'][
'checked'])) {
 
 1241  print_liste_field_titre($arrayfields[
'p.lastname'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.lastname", $begin, $param, 
'', $sortfield, $sortorder);
 
 1242  $totalarray[
'nbfield']++;
 
 1244if (!empty($arrayfields[
'p.firstname'][
'checked'])) {
 
 1245  print_liste_field_titre($arrayfields[
'p.firstname'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.firstname", $begin, $param, 
'', $sortfield, $sortorder);
 
 1246  $totalarray[
'nbfield']++;
 
 1248if (!empty($arrayfields[
'p.poste'][
'checked'])) {
 
 1249  print_liste_field_titre($arrayfields[
'p.poste'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.poste", $begin, $param, 
'', $sortfield, $sortorder);
 
 1250  $totalarray[
'nbfield']++;
 
 1252if (!empty($arrayfields[
'p.address'][
'checked'])) {
 
 1253  print_liste_field_titre($arrayfields[
'p.address'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.address", $begin, $param, 
'', $sortfield, $sortorder);
 
 1254  $totalarray[
'nbfield']++;
 
 1256if (!empty($arrayfields[
'p.zip'][
'checked'])) {
 
 1257  print_liste_field_titre($arrayfields[
'p.zip'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.zip", $begin, $param, 
'', $sortfield, $sortorder);
 
 1258  $totalarray[
'nbfield']++;
 
 1260if (!empty($arrayfields[
'p.town'][
'checked'])) {
 
 1261  print_liste_field_titre($arrayfields[
'p.town'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.town", $begin, $param, 
'', $sortfield, $sortorder);
 
 1262  $totalarray[
'nbfield']++;
 
 1266if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1267  print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"], 
"co.code_iso", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1268  $totalarray[
'nbfield']++;
 
 1270if (!empty($arrayfields[
'p.phone'][
'checked'])) {
 
 1271  print_liste_field_titre($arrayfields[
'p.phone'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.phone", $begin, $param, 
'', $sortfield, $sortorder);
 
 1272  $totalarray[
'nbfield']++;
 
 1274if (!empty($arrayfields[
'p.phone_perso'][
'checked'])) {
 
 1275  print_liste_field_titre($arrayfields[
'p.phone_perso'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.phone_perso", $begin, $param, 
'', $sortfield, $sortorder);
 
 1276  $totalarray[
'nbfield']++;
 
 1278if (!empty($arrayfields[
'p.phone_mobile'][
'checked'])) {
 
 1279  print_liste_field_titre($arrayfields[
'p.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.phone_mobile", $begin, $param, 
'', $sortfield, $sortorder);
 
 1280  $totalarray[
'nbfield']++;
 
 1282if (!empty($arrayfields[
'p.fax'][
'checked'])) {
 
 1283  print_liste_field_titre($arrayfields[
'p.fax'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.fax", $begin, $param, 
'', $sortfield, $sortorder);
 
 1284  $totalarray[
'nbfield']++;
 
 1286if (!empty($arrayfields[
'p.email'][
'checked'])) {
 
 1287  print_liste_field_titre($arrayfields[
'p.email'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.email", $begin, $param, 
'', $sortfield, $sortorder);
 
 1288  $totalarray[
'nbfield']++;
 
 1290if (!empty($arrayfields[
'unsubscribed'][
'checked'])) {
 
 1291  print_liste_field_titre($arrayfields[
'unsubscribed'][
'label'], $_SERVER[
"PHP_SELF"], 
"unsubscribed", $begin, $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1292  $totalarray[
'nbfield']++;
 
 1294if (isModEnabled(
'socialnetworks')) {
 
 1295  foreach ($socialnetworks as $key => $value) {
 
 1296    if ($value[
'active'] && !empty($arrayfields[
'p.'.$key][
'checked'])) {
 
 1297      print_liste_field_titre($arrayfields[
'p.'.$key][
'label'], $_SERVER[
"PHP_SELF"], 
"p.".$key, $begin, $param, 
'', $sortfield, $sortorder);
 
 1298      $totalarray[
'nbfield']++;
 
 1302if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
 
 1303  print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.fk_soc", $begin, $param, 
'', $sortfield, $sortorder);
 
 1304  $totalarray[
'nbfield']++;
 
 1306if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
 1307  print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.nom", $begin, $param, 
'', $sortfield, $sortorder);
 
 1308  $totalarray[
'nbfield']++;
 
 1310if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
 
 1311  print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.name_alias", $begin, $param, 
'', $sortfield, $sortorder);
 
 1312  $totalarray[
'nbfield']++;
 
 1314if (!empty($arrayfields[
'p.priv'][
'checked'])) {
 
 1315  print_liste_field_titre($arrayfields[
'p.priv'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.priv", $begin, $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1316  $totalarray[
'nbfield']++;
 
 1318if (!empty($arrayfields[
'p.fk_prospectlevel'][
'checked'])) {
 
 1319  print_liste_field_titre($arrayfields[
'p.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.fk_prospectlevel", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1320  $totalarray[
'nbfield']++;
 
 1322if (!empty($arrayfields[
'p.fk_stcommcontact'][
'checked'])) {
 
 1323  print_liste_field_titre($arrayfields[
'p.fk_stcommcontact'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.fk_stcommcontact", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1324  $totalarray[
'nbfield']++;
 
 1326if (!empty($arrayfields[
'p.birthday'][
'checked'])) {
 
 1327  print_liste_field_titre($arrayfields[
'p.birthday'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.birthday", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1328  $totalarray[
'nbfield']++;
 
 1331include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
 
 1333$parameters = array(
'arrayfields'=>$arrayfields, 
'param'=>$param, 
'sortfield'=>$sortfield, 
'sortorder'=>$sortorder, 
'totalarray'=>&$totalarray);
 
 1334$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action); 
 
 1335print $hookmanager->resPrint;
 
 1336if (!empty($arrayfields[
'p.datec'][
'checked'])) {
 
 1337  print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.datec", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1338  $totalarray[
'nbfield']++;
 
 1340if (!empty($arrayfields[
'p.tms'][
'checked'])) {
 
 1341  print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.tms", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1342  $totalarray[
'nbfield']++;
 
 1344if (!empty($arrayfields[
'p.statut'][
'checked'])) {
 
 1345  print_liste_field_titre($arrayfields[
'p.statut'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.statut", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1346  $totalarray[
'nbfield']++;
 
 1348if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
 
 1349  print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"], 
"p.import_key", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1350  $totalarray[
'nbfield']++;
 
 1353  print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"], 
"", 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ');
 
 1354  $totalarray[
'nbfield']++;
 
 1362$savnbfield = $totalarray[
'nbfield'];
 
 1363$totalarray = array();
 
 1364$totalarray[
'nbfield'] = 0;
 
 1365$imaxinloop = ($limit ? min($num, $limit) : $num);
 
 1366while ($i < $imaxinloop) {
 
 1367  $obj = $db->fetch_object($resql);
 
 1372  $arraysocialnetworks = (array) json_decode($obj->socialnetworks, 
true);
 
 1373  $contactstatic->lastname = $obj->lastname;
 
 1374  $contactstatic->firstname = 
'';
 
 1375  $contactstatic->id = $obj->rowid;
 
 1376  $contactstatic->statut = $obj->statut;
 
 1377  $contactstatic->poste = $obj->poste;
 
 1378  $contactstatic->email = $obj->email;
 
 1379  $contactstatic->phone_pro = $obj->phone_pro;
 
 1380  $contactstatic->phone_perso = $obj->phone_perso;
 
 1381  $contactstatic->phone_mobile = $obj->phone_mobile;
 
 1382  $contactstatic->address = $obj->address;
 
 1383  $contactstatic->zip = $obj->zip;
 
 1384  $contactstatic->town = $obj->town;
 
 1385  $contactstatic->socialnetworks = $arraysocialnetworks;
 
 1386  $contactstatic->country = $obj->country;
 
 1387  $contactstatic->country_code = $obj->country_code;
 
 1388  $contactstatic->photo = $obj->photo;
 
 1389  $contactstatic->import_key = $obj->import_key;
 
 1390  $contactstatic->photo = $obj->photo;
 
 1391  $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
 
 1393  if ($mode == 
'kanban') {
 
 1395      print 
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
 
 1396      print 
'<div class="box-flex-container kanban">';
 
 1399    if ($massactionbutton || $massaction) { 
 
 1401      if (in_array($object->id, $arrayofselected)) {
 
 1405    if ($obj->socid > 0) {
 
 1406      $contactstatic->fetch_thirdparty($obj->socid);
 
 1408    print $contactstatic->getKanbanView(
'', array(
'selected' => in_array($contactstatic->id, $arrayofselected)));
 
 1409    if ($i == ($imaxinloop - 1)) {
 
 1416    print 
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
 
 1417    if ($contextpage == 
'poslist') {
 
 1418      print 
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->socid.
'&idcontact='.$obj->rowid.
'&place='.urlencode($place).
'\'"'; 
 1423    if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { 
 1424      print '<td class="nowrap center
">'; 
 1425      if ($massactionbutton || $massaction) {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 
 1427        if (in_array($obj->rowid, $arrayofselected)) { 
 1430        print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>'; 
 1434        $totalarray['nbfield']++; 
 1439    if (!empty($arrayfields['p.rowid']['checked'])) { 
 1440      print '<td class="tdoverflowmax50
">'; 
 1441      print dol_escape_htmltag($obj->rowid); 
 1444        $totalarray['nbfield']++; 
 1449    if (!empty($arrayfields['p.lastname']['checked'])) { 
 1450      print '<td class="middle tdoverflowmax150
">'; 
 1451      if ($contextpage == 'poslist') { 
 1452        print $contactstatic->lastname; 
 1454        print $contactstatic->getNomUrl(1); 
 1458        $totalarray['nbfield']++; 
 1463    if (!empty($arrayfields['p.firstname']['checked'])) { 
 1464      print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>'; 
 1466        $totalarray['nbfield']++; 
 1471    if (!empty($arrayfields['p.poste']['checked'])) { 
 1472      print '<td class="tdoverflowmax100
">'.dol_escape_htmltag($obj->poste).'</td>'; 
 1474        $totalarray['nbfield']++; 
 1479    if (!empty($arrayfields['p.address']['checked'])) { 
 1480      print '<td>'.dol_escape_htmltag($obj->address).'</td>'; 
 1482        $totalarray['nbfield']++; 
 1487    if (!empty($arrayfields['p.zip']['checked'])) { 
 1488      print '<td>'.dol_escape_htmltag($obj->zip).'</td>'; 
 1490        $totalarray['nbfield']++; 
 1495    if (!empty($arrayfields['p.town']['checked'])) { 
 1496      print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town).'</td>'; 
 1498        $totalarray['nbfield']++; 
 1504    if (!empty($arrayfields['state.nom']['checked'])) 
 1506      print "<td>
".$obj->state_name."</td>\n
"; 
 1507      if (! $i) $totalarray['nbfield']++; 
 1511    if (!empty($arrayfields['region.nom']['checked'])) 
 1513      print "<td>
".$obj->region_name."</td>\n
"; 
 1514      if (! $i) $totalarray['nbfield']++; 
 1518    if (!empty($arrayfields['country.code_iso']['checked'])) { 
 1519      print '<td class="center
">'; 
 1520      $tmparray = getCountry($obj->fk_pays, 'all'); 
 1521      print dol_escape_htmltag($tmparray['label']); 
 1524        $totalarray['nbfield']++; 
 1529    if (!empty($arrayfields['p.phone']['checked'])) { 
 1530      print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>'; 
 1532        $totalarray['nbfield']++; 
 1537    if (!empty($arrayfields['p.phone_perso']['checked'])) { 
 1538      print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>'; 
 1540        $totalarray['nbfield']++; 
 1545    if (!empty($arrayfields['p.phone_mobile']['checked'])) { 
 1546      print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>'; 
 1548        $totalarray['nbfield']++; 
 1553    if (!empty($arrayfields['p.fax']['checked'])) { 
 1554      print '<td class="nowraponall tdoverflowmax150
">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>'; 
 1556        $totalarray['nbfield']++; 
 1561    if (!empty($arrayfields['p.email']['checked'])) { 
 1562      print '<td class="nowraponall tdoverflowmax300
">'; 
 1563      if ($contextpage == 'poslist') { 
 1566        print dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1); 
 1570        $totalarray['nbfield']++; 
 1574    // No EMail Subscription 
 1575    if (!empty($arrayfields['unsubscribed']['checked'])) { 
 1576      print '<td class="center
">'; 
 1577      if (empty($obj->email)) { 
 1578        //print '<span class="opacitymedium
">'.$langs->trans("NoEmail
").'</span>'; 
 1580        print yn(($obj->unsubscribed > 0) ? 1 : 0); 
 1584        $totalarray['nbfield']++; 
 1589    if (isModEnabled('socialnetworks')) { 
 1590      foreach ($socialnetworks as $key => $value) { 
 1591        if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { 
 1592          print '<td class="tdoverflowmax100
">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>'; 
 1594            $totalarray['nbfield']++; 
 1600    // Company / Third Party 
 1601    if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) { 
 1602      print '<td class="tdoverflowmax200
">'; 
 1604        $objsoc = new Societe($db); 
 1605        $objsoc->fetch($obj->socid); 
 1606        $option_link = 'customer'; 
 1607        if ($objsoc->client == 0 && $objsoc->fournisseur > 0) { 
 1608          $option_link = 'supplier'; 
 1610        if ($contextpage == 'poslist') { 
 1611          print $objsoc->name; 
 1613          print $objsoc->getNomUrl(1, $option_link, 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); 
 1620        $totalarray['nbfield']++; 
 1625    if (!empty($arrayfields['s.name_alias']['checked'])) { 
 1626      print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->alias).'">'; 
 1627      print dol_escape_htmltag($obj->alias); 
 1630        $totalarray['nbfield']++; 
 1635    if (!empty($arrayfields['p.priv']['checked'])) { 
 1636      print '<td class="center
">'.$contactstatic->LibPubPriv($obj->priv).'</td>'; 
 1638        $totalarray['nbfield']++; 
 1643    if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { 
 1644      print '<td class="center
">'; 
 1645      print $contactstatic->getLibProspLevel(); 
 1648        $totalarray['nbfield']++; 
 1653    if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) { 
 1654      print '<td class="center nowrap
"><div class="nowrap
">'; 
 1655      print '<div class="inline-block
">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); 
 1656      print '</div> - <div class="inline-block
">'; 
 1657      foreach ($contactstatic->cacheprospectstatus as $key => $val) { 
 1658        $titlealt = 'default'; 
 1659        if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) { 
 1660          $titlealt = $val['label']; 
 1662        if ($obj->stcomm_id != $val['id']) { 
 1663          print '<a class="pictosubstatus
" href="'.$_SERVER["PHP_SELF"].'?stcommcontactid=
'.$obj->rowid.'&stcomm=
'.urlencode($val['code
']).'&action=setstcomm&token=
'.newToken().$param.($page ? '&page=
'.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>'; 
 1666      print '</div></div></td>'; 
 1668        $totalarray['nbfield']++; 
 1673    if (!empty($arrayfields['p.birthday']['checked'])) { 
 1674      print '<td class="center nowraponall
">'; 
 1675      print dol_print_date($db->jdate($obj->birthday), 'day', 'tzuser'); 
 1678        $totalarray['nbfield']++; 
 1683    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; 
 1686    $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); 
 1687    $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook 
 1688    print $hookmanager->resPrint; 
 1690    if (!empty($arrayfields['p.datec']['checked'])) { 
 1691      print '<td class="center nowraponall
">'; 
 1692      print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); 
 1695        $totalarray['nbfield']++; 
 1699    // Date modification 
 1700    if (!empty($arrayfields['p.tms']['checked'])) { 
 1701      print '<td class="center nowraponall
">'; 
 1702      print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); 
 1705        $totalarray['nbfield']++; 
 1710    if (!empty($arrayfields['p.statut']['checked'])) { 
 1711      print '<td class="center
">'.$contactstatic->getLibStatut(5).'</td>'; 
 1713        $totalarray['nbfield']++; 
 1718    if (!empty($arrayfields['p.import_key']['checked'])) { 
 1719      print '<td class="tdoverflowmax100
">'; 
 1720      print dol_escape_htmltag($obj->import_key); 
 1723        $totalarray['nbfield']++; 
 1728    if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { 
 1729      print '<td class="nowrap center
">'; 
 1730      if ($massactionbutton || $massaction) {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 
 1732        if (in_array($obj->rowid, $arrayofselected)) { 
 1735        print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>'; 
 1739        $totalarray['nbfield']++; 
 1749include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; 
 1751// If no record found 
 1754  foreach ($arrayfields as $key => $val) { 
 1755    if (!empty($val['checked'])) { 
 1759  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>'; 
 1764$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); 
 1765$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook 
 1766print $hookmanager->resPrint; 
 1768print '</table>'."\n
"; 
 1771print '</form>'."\n
"; 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
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 informations (by default a local PHP server timestamp) Re...
 
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
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.
 
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
 
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
 
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.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
 
getDolGlobalString($key, $default='')
Return 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...
 
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.