2011-08-21 15:19:26 +02:00
< ? php
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2003 Eric Seigne < erics @ rycks . com >
2012-02-01 00:24:16 +01:00
* Copyright ( C ) 2004 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
2013-03-15 15:44:23 +01:00
* Copyright ( C ) 2013 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2013-09-10 16:43:06 +02:00
* Copyright ( C ) 2013 Cédric Salvador < csalvador @ gpcsolutions . fr >
2013-11-04 21:41:36 +01:00
* Copyright ( C ) 2013 Alexandre Spangaro < alexandre . spangaro @ gmail . com >
2011-08-21 15:19:26 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2011-08-21 15:19:26 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http :// www . gnu . org / licenses />.
*/
/**
* \file htdocs / contact / list . php
* \ingroup societe
* \brief Page to list all contacts
*/
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2013-07-16 21:04:58 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2011-08-21 15:19:26 +02:00
$langs -> load ( " companies " );
$langs -> load ( " suppliers " );
// Security check
2012-07-10 22:10:12 +02:00
$contactid = GETPOST ( 'id' , 'int' );
2011-08-21 15:19:26 +02:00
if ( $user -> societe_id ) $socid = $user -> societe_id ;
$result = restrictedArea ( $user , 'contact' , $contactid , '' );
2013-02-23 16:08:35 +01:00
$search_lastname = GETPOST ( " search_lastname " );
$search_firstname = GETPOST ( " search_firstname " );
2011-08-21 15:19:26 +02:00
$search_societe = GETPOST ( " search_societe " );
$search_poste = GETPOST ( " search_poste " );
$search_phone = GETPOST ( " search_phone " );
$search_phoneper = GETPOST ( " search_phoneper " );
$search_phonepro = GETPOST ( " search_phonepro " );
$search_phonemob = GETPOST ( " search_phonemob " );
$search_fax = GETPOST ( " search_fax " );
$search_email = GETPOST ( " search_email " );
2013-11-04 21:41:36 +01:00
$search_skype = GETPOST ( " search_skype " );
2011-08-21 15:19:26 +02:00
$search_priv = GETPOST ( " search_priv " );
2013-07-16 21:04:58 +02:00
$search_categ = GETPOST ( " search_categ " , 'int' );
2013-11-12 15:40:00 +01:00
$search_status = GETPOST ( " search_status " , 'int' );
if ( $search_status == '' ) $search_status = 1 ; // always display activ customer first
2013-07-10 12:28:28 +02:00
2011-08-21 15:19:26 +02:00
$type = GETPOST ( " type " );
$view = GETPOST ( " view " );
$sall = GETPOST ( " contactname " );
2012-10-13 10:39:16 +02:00
$sortfield = GETPOST ( 'sortfield' , 'alpha' );
$sortorder = GETPOST ( 'sortorder' , 'alpha' );
$page = GETPOST ( 'page' , 'int' );
$userid = GETPOST ( 'userid' , 'int' );
2012-07-10 22:10:12 +02:00
$begin = GETPOST ( 'begin' );
2011-08-21 15:19:26 +02:00
if ( ! $sortorder ) $sortorder = " ASC " ;
2013-03-01 18:11:34 +01:00
if ( ! $sortfield ) $sortfield = " p.lastname " ;
2012-02-10 10:53:11 +01:00
if ( $page < 0 ) { $page = 0 ; }
2011-08-21 15:19:26 +02:00
$limit = $conf -> liste_limit ;
2012-02-10 10:53:11 +01:00
$offset = $limit * $page ;
2011-08-21 15:19:26 +02:00
$langs -> load ( " companies " );
2012-03-14 15:32:48 +01:00
$titre = ( ! empty ( $conf -> global -> SOCIETE_ADDRESSES_MANAGEMENT ) ? $langs -> trans ( " ListOfContacts " ) : $langs -> trans ( " ListOfContactsAddresses " ));
2013-02-12 19:16:48 +01:00
if ( $type == " c " || $type == " p " )
2011-08-21 15:19:26 +02:00
{
2012-03-14 15:32:48 +01:00
$titre .= ' (' . $langs -> trans ( " ThirdPartyCustomers " ) . ')' ;
2011-08-21 15:19:26 +02:00
$urlfiche = " fiche.php " ;
}
2012-03-14 15:32:48 +01:00
else if ( $type == " f " )
{
$titre .= ' (' . $langs -> trans ( " ThirdPartySuppliers " ) . ')' ;
2011-08-21 15:19:26 +02:00
$urlfiche = " fiche.php " ;
}
2012-03-14 15:32:48 +01:00
else if ( $type == " o " )
{
$titre .= ' (' . $langs -> trans ( " OthersNotLinkedToThirdParty " ) . ')' ;
2011-08-21 15:19:26 +02:00
$urlfiche = " " ;
}
2012-07-10 22:10:12 +02:00
if ( GETPOST ( 'button_removefilter' ))
2011-08-21 15:19:26 +02:00
{
2013-02-23 16:08:35 +01:00
$search_lastname = " " ;
$search_firstname = " " ;
2011-08-21 15:19:26 +02:00
$search_societe = " " ;
$search_poste = " " ;
$search_phone = " " ;
$search_phoneper = " " ;
$search_phonepro = " " ;
$search_phonemob = " " ;
$search_fax = " " ;
$search_email = " " ;
2013-11-04 21:41:36 +01:00
$search_skype = " " ;
2011-08-21 15:19:26 +02:00
$search_priv = " " ;
$sall = " " ;
2013-11-12 15:40:00 +01:00
$seach_status = 1 ;
2011-08-21 15:19:26 +02:00
}
if ( $search_priv < 0 ) $search_priv = '' ;
/*
* View
*/
2012-03-14 15:32:48 +01:00
$title = ( ! empty ( $conf -> global -> SOCIETE_ADDRESSES_MANAGEMENT ) ? $langs -> trans ( " Contacts " ) : $langs -> trans ( " ContactsAddresses " ));
llxHeader ( '' , $title , 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas' );
2011-08-21 15:19:26 +02:00
$form = new Form ( $db );
2013-07-16 21:04:58 +02:00
$formother = new FormOther ( $db );
2011-08-21 15:19:26 +02:00
2012-02-01 00:24:16 +01:00
$sql = " SELECT s.rowid as socid, s.nom as name, " ;
2013-11-04 21:41:36 +01:00
$sql .= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.poste, p.email, p.skype, " ;
2012-01-10 17:16:17 +01:00
$sql .= " p.phone, p.phone_mobile, p.fax, p.fk_pays, p.priv, p.tms, " ;
2013-02-25 09:52:24 +01:00
$sql .= " cp.code as country_code " ;
2011-08-21 15:19:26 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " socpeople as p " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_pays as cp ON cp.rowid = p.fk_pays " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe as s ON s.rowid = p.fk_soc " ;
2013-09-05 21:03:03 +02:00
if ( ! empty ( $search_categ )) $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . " categorie_contact as cs ON p.rowid = cs.fk_socpeople " ; // We need this table joined to the select in order to filter by categ
2011-08-21 15:19:26 +02:00
if ( ! $user -> rights -> societe -> client -> voir && ! $socid ) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe_commerciaux as sc ON s.rowid = sc.fk_soc " ;
2012-01-11 14:14:14 +01:00
$sql .= ' WHERE p.entity IN (' . getEntity ( 'societe' , 1 ) . ')' ;
2011-08-21 15:19:26 +02:00
if ( ! $user -> rights -> societe -> client -> voir && ! $socid ) //restriction
{
$sql .= " AND (sc.fk_user = " . $user -> id . " OR p.fk_soc IS NULL) " ;
}
2012-10-13 10:39:16 +02:00
if ( ! empty ( $userid )) // propre au commercial
2011-08-21 15:19:26 +02:00
{
2012-10-13 10:39:16 +02:00
$sql .= " AND p.fk_user_creat= " . $db -> escape ( $userid );
2011-08-21 15:19:26 +02:00
}
// Filter to exclude not owned private contacts
if ( $search_priv != '0' && $search_priv != '1' )
{
$sql .= " AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat= " . $user -> id . " )) " ;
}
else
{
if ( $search_priv == '0' ) $sql .= " AND p.priv='0' " ;
if ( $search_priv == '1' ) $sql .= " AND (p.priv='1' AND p.fk_user_creat= " . $user -> id . " ) " ;
}
2013-07-16 21:04:58 +02:00
if ( $search_categ > 0 ) $sql .= " AND cs.fk_categorie = " . $search_categ ;
if ( $search_categ == - 2 ) $sql .= " AND cs.fk_categorie IS NULL " ;
2013-09-10 16:43:06 +02:00
if ( $search_lastname ) { // filter on lastname
2013-09-13 10:52:04 +02:00
$sql .= natural_search ( 'p.lastname' , $search_lastname );
2011-08-21 15:19:26 +02:00
}
2013-09-10 16:43:06 +02:00
if ( $search_firstname ) { // filter on firstname
2013-09-13 10:52:04 +02:00
$sql .= natural_search ( 'p.firstname' , $search_firstname );
2011-08-21 15:19:26 +02:00
}
2013-09-10 16:43:06 +02:00
if ( $search_societe ) { // filtre sur la societe
2013-09-13 10:52:04 +02:00
$sql .= natural_search ( 's.nom' , $search_societe );
2011-08-21 15:19:26 +02:00
}
2013-09-10 16:43:06 +02:00
if ( strlen ( $search_poste )) { // filtre sur la societe
2013-09-13 10:52:04 +02:00
$sql .= natural_search ( 'p.poste' , $search_poste );
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_phone ))
{
2012-01-10 17:16:17 +01:00
$sql .= " AND (p.phone LIKE '% " . $db -> escape ( $search_phone ) . " %' OR p.phone_perso LIKE '% " . $db -> escape ( $search_phone ) . " %' OR p.phone_mobile LIKE '% " . $db -> escape ( $search_phone ) . " %') " ;
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_phoneper ))
{
2012-01-10 17:16:17 +01:00
$sql .= " AND p.phone LIKE '% " . $db -> escape ( $search_phoneper ) . " %' " ;
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_phonepro ))
{
2012-01-10 17:16:17 +01:00
$sql .= " AND p.phone_perso LIKE '% " . $db -> escape ( $search_phonepro ) . " %' " ;
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_phonemob ))
{
2012-01-10 17:16:17 +01:00
$sql .= " AND p.phone_mobile LIKE '% " . $db -> escape ( $search_phonemob ) . " %' " ;
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_fax ))
{
2012-01-10 17:16:17 +01:00
$sql .= " AND p.fax LIKE '% " . $db -> escape ( $search_fax ) . " %' " ;
2011-08-21 15:19:26 +02:00
}
if ( strlen ( $search_email )) // filtre sur l'email
{
2012-01-10 17:16:17 +01:00
$sql .= " AND p.email LIKE '% " . $db -> escape ( $search_email ) . " %' " ;
2011-08-21 15:19:26 +02:00
}
2013-11-04 21:41:36 +01:00
if ( strlen ( $search_skype )) // filtre sur skype
{
$sql .= " AND p.skype LIKE '% " . $db -> escape ( $search_skype ) . " %' " ;
}
2013-11-12 15:40:00 +01:00
if ( $search_status != '' ) $sql .= " AND p.statut = " . $db -> escape ( $search_status );
2011-08-21 15:19:26 +02:00
if ( $type == " o " ) // filtre sur type
{
$sql .= " AND p.fk_soc IS NULL " ;
}
2012-01-10 17:16:17 +01:00
else if ( $type == " f " ) // filtre sur type
2011-08-21 15:19:26 +02:00
{
2012-01-10 17:16:17 +01:00
$sql .= " AND s.fournisseur = 1 " ;
2011-08-21 15:19:26 +02:00
}
2012-01-10 17:16:17 +01:00
else if ( $type == " c " ) // filtre sur type
2011-08-21 15:19:26 +02:00
{
2012-01-10 17:16:17 +01:00
$sql .= " AND s.client IN (1, 3) " ;
2011-08-21 15:19:26 +02:00
}
2012-01-10 17:16:17 +01:00
else if ( $type == " p " ) // filtre sur type
2011-08-21 15:19:26 +02:00
{
2012-01-10 17:16:17 +01:00
$sql .= " AND s.client IN (2, 3) " ;
2011-08-21 15:19:26 +02:00
}
if ( $sall )
{
2013-09-10 16:43:06 +02:00
$sql .= natural_search ( array ( 'p.lastname' , 'p.firstname' , 'p.email' ), $sall );
2011-08-21 15:19:26 +02:00
}
2012-07-10 22:10:12 +02:00
if ( ! empty ( $socid ))
2011-08-21 15:19:26 +02:00
{
$sql .= " AND s.rowid = " . $socid ;
}
// Count total nb of records
$nbtotalofrecords = 0 ;
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST ))
{
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
}
// Add order and limit
if ( $view == " recent " )
{
$sql .= " ORDER BY p.datec DESC " ;
$sql .= " " . $db -> plimit ( $conf -> liste_limit + 1 , $offset );
}
else
{
$sql .= " ORDER BY $sortfield $sortorder " ;
$sql .= " " . $db -> plimit ( $conf -> liste_limit + 1 , $offset );
}
//print $sql;
dol_syslog ( " contact/list.php sql= " . $sql );
$result = $db -> query ( $sql );
if ( $result )
{
$contactstatic = new Contact ( $db );
2012-07-10 22:10:12 +02:00
$param = '&begin=' . urlencode ( $begin ) . '&view=' . urlencode ( $view ) . '&userid=' . urlencode ( $userid ) . '&contactname=' . urlencode ( $sall );
2013-02-23 16:08:35 +01:00
$param .= '&type=' . urlencode ( $type ) . '&view=' . urlencode ( $view ) . '&search_lastname=' . urlencode ( $search_lastname ) . '&search_firstname=' . urlencode ( $search_firstname ) . '&search_societe=' . urlencode ( $search_societe ) . '&search_email=' . urlencode ( $search_email );
2013-07-16 21:04:58 +02:00
if ( ! empty ( $search_categ )) $param .= '&search_categ=' . $search_categ ;
2013-11-12 15:40:00 +01:00
if ( $search_status != '' ) $param .= '&search_status=' . $search_status ;
2013-07-16 21:04:58 +02:00
if ( $search_priv == '0' || $search_priv == '1' ) $param .= " &search_priv= " . urlencode ( $search_priv );
2011-08-21 15:19:26 +02:00
$num = $db -> num_rows ( $result );
$i = 0 ;
2011-09-16 19:57:09 +02:00
print_barre_liste ( $titre , $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , $num , $nbtotalofrecords );
2011-08-21 15:19:26 +02:00
2011-08-23 22:57:41 +02:00
print '<form method="post" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
2011-08-21 15:19:26 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="view" value="' . $view . '">' ;
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2013-07-16 21:04:58 +02:00
if ( ! empty ( $conf -> categorie -> enabled ))
{
$moreforfilter .= $langs -> trans ( 'Categories' ) . ': ' ;
$moreforfilter .= $formother -> select_categories ( 4 , $search_categ , 'search_categ' , 1 );
$moreforfilter .= ' ' ;
}
if ( $moreforfilter )
{
print '<div class="liste_titre">' ;
print $moreforfilter ;
print '</div>' ;
}
2011-08-21 15:19:26 +02:00
if ( $sall )
{
print $langs -> trans ( " Filter " ) . " ( " . $langs -> trans ( " Lastname " ) . " , " . $langs -> trans ( " Firstname " ) . " " . $langs -> trans ( " or " ) . " " . $langs -> trans ( " EMail " ) . " ): " . $sall ;
}
print '<table class="liste" width="100%">' ;
// Ligne des titres
print '<tr class="liste_titre">' ;
2013-03-01 18:11:34 +01:00
print_liste_field_titre ( $langs -> trans ( " Lastname " ), $_SERVER [ " PHP_SELF " ], " p.lastname " , $begin , $param , '' , $sortfield , $sortorder );
2011-08-23 22:57:41 +02:00
print_liste_field_titre ( $langs -> trans ( " Firstname " ), $_SERVER [ " PHP_SELF " ], " p.firstname " , $begin , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( $langs -> trans ( " PostOrFunction " ), $_SERVER [ " PHP_SELF " ], " p.poste " , $begin , $param , '' , $sortfield , $sortorder );
if ( empty ( $conf -> global -> SOCIETE_DISABLE_CONTACTS )) print_liste_field_titre ( $langs -> trans ( " Company " ), $_SERVER [ " PHP_SELF " ], " s.nom " , $begin , $param , '' , $sortfield , $sortorder );
2013-03-15 02:11:23 +01:00
print_liste_field_titre ( $langs -> trans ( " Phone " ), $_SERVER [ " PHP_SELF " ], " p.phone " , $begin , $param , '' , $sortfield , $sortorder );
2013-05-06 22:24:05 +02:00
print_liste_field_titre ( $langs -> trans ( " PhoneMobile " ), $_SERVER [ " PHP_SELF " ], " p.phone_mob " , $begin , $param , '' , $sortfield , $sortorder );
2013-03-15 02:11:23 +01:00
print_liste_field_titre ( $langs -> trans ( " Fax " ), $_SERVER [ " PHP_SELF " ], " p.fax " , $begin , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( $langs -> trans ( " EMail " ), $_SERVER [ " PHP_SELF " ], " p.email " , $begin , $param , '' , $sortfield , $sortorder );
2013-11-04 21:41:36 +01:00
if ( ! empty ( $conf -> skype -> enabled )) { print_liste_field_titre ( $langs -> trans ( " Skype " ), $_SERVER [ " PHP_SELF " ], " p.skype " , $begin , $param , '' , $sortfield , $sortorder ); }
2011-08-23 22:57:41 +02:00
print_liste_field_titre ( $langs -> trans ( " DateModificationShort " ), $_SERVER [ " PHP_SELF " ], " p.tms " , $begin , $param , 'align="center"' , $sortfield , $sortorder );
print_liste_field_titre ( $langs -> trans ( " ContactVisibility " ), $_SERVER [ " PHP_SELF " ], " p.priv " , $begin , $param , 'align="center"' , $sortfield , $sortorder );
2013-10-30 12:24:51 +01:00
print_liste_field_titre ( $langs -> trans ( " Status " ), $_SERVER [ " PHP_SELF " ], " p.statut " , $begin , $param , 'align="center"' , $sortfield , $sortorder );
2011-08-21 15:19:26 +02:00
print '<td class="liste_titre"> </td>' ;
print " </tr> \n " ;
// Ligne des champs de filtres
print '<tr class="liste_titre">' ;
print '<td class="liste_titre">' ;
2013-02-23 16:08:35 +01:00
print '<input class="flat" type="text" name="search_lastname" size="9" value="' . $search_lastname . '">' ;
2011-08-21 15:19:26 +02:00
print '</td>' ;
print '<td class="liste_titre">' ;
2013-02-23 16:08:35 +01:00
print '<input class="flat" type="text" name="search_firstname" size="9" value="' . $search_firstname . '">' ;
2011-08-21 15:19:26 +02:00
print '</td>' ;
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_poste" size="9" value="' . $search_poste . '">' ;
print '</td>' ;
if ( empty ( $conf -> global -> SOCIETE_DISABLE_CONTACTS ))
{
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_societe" size="9" value="' . $search_societe . '">' ;
print '</td>' ;
}
2013-03-15 02:11:23 +01:00
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_phonepro" size="8" value="' . $search_phonepro . '">' ;
print '</td>' ;
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_phonemob" size="8" value="' . $search_phonemob . '">' ;
print '</td>' ;
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_fax" size="8" value="' . $search_fax . '">' ;
print '</td>' ;
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_email" size="8" value="' . $search_email . '">' ;
print '</td>' ;
2013-11-04 21:41:36 +01:00
if ( ! empty ( $conf -> skype -> enabled ))
{
print '<td class="liste_titre">' ;
print '<input class="flat" type="text" name="search_skype" size="8" value="' . $search_skype . '">' ;
print '</td>' ;
}
2011-08-21 15:19:26 +02:00
print '<td class="liste_titre"> </td>' ;
print '<td class="liste_titre" align="center">' ;
$selectarray = array ( '0' => $langs -> trans ( " ContactPublic " ), '1' => $langs -> trans ( " ContactPrivate " ));
print $form -> selectarray ( 'search_priv' , $selectarray , $search_priv , 1 );
print '</td>' ;
2013-11-12 15:40:00 +01:00
print '<td class="liste_titre" align="center">' ;
print $form -> selectarray ( 'search_status' , array ( '0' => $langs -> trans ( 'ActivityCeased' ), '1' => $langs -> trans ( 'InActivity' )), $search_status );
print '</td>' ;
2011-08-21 15:19:26 +02:00
print '<td class="liste_titre" align="right">' ;
2014-01-12 21:45:52 +01:00
print '<input type="image" value="button_search" class="liste_titre" src="' . img_picto ( $langs -> trans ( " Search " ), 'search.png' , '' , '' , 1 ) . '" value="' . dol_escape_htmltag ( $langs -> trans ( " Search " )) . '" title="' . dol_escape_htmltag ( $langs -> trans ( " Search " )) . '">' ;
2011-08-21 15:19:26 +02:00
print ' ' ;
2014-01-12 21:45:52 +01:00
print '<input type="image" value="button_removefilter" class="liste_titre" src="' . img_picto ( $langs -> trans ( " Search " ), 'searchclear.png' , '' , '' , 1 ) . '" value="' . dol_escape_htmltag ( $langs -> trans ( " RemoveFilter " )) . '" title="' . dol_escape_htmltag ( $langs -> trans ( " RemoveFilter " )) . '">' ;
2011-08-21 15:19:26 +02:00
print '</td>' ;
print '</tr>' ;
$var = True ;
while ( $i < min ( $num , $limit ))
{
$obj = $db -> fetch_object ( $result );
2013-10-30 12:24:51 +01:00
$var =! $var ;
2013-06-20 09:18:12 +02:00
print " <tr " . $bc [ $var ] . " > " ;
2011-08-21 15:19:26 +02:00
// Name
print '<td valign="middle">' ;
2012-02-01 00:24:16 +01:00
$contactstatic -> lastname = $obj -> lastname ;
2011-08-21 15:19:26 +02:00
$contactstatic -> firstname = '' ;
$contactstatic -> id = $obj -> cidp ;
2013-10-30 12:24:51 +01:00
$contactstatic -> statut = $obj -> statut ;
2011-08-21 15:19:26 +02:00
print $contactstatic -> getNomUrl ( 1 , '' , 20 );
print '</td>' ;
// Firstname
print '<td>' . dol_trunc ( $obj -> firstname , 20 ) . '</td>' ;
// Function
print '<td>' . dol_trunc ( $obj -> poste , 20 ) . '</td>' ;
// Company
if ( empty ( $conf -> global -> SOCIETE_DISABLE_CONTACTS ))
{
print '<td>' ;
if ( $obj -> socid )
{
print '<a href="' . DOL_URL_ROOT . '/comm/fiche.php?socid=' . $obj -> socid . '">' ;
2012-02-01 00:24:16 +01:00
print img_object ( $langs -> trans ( " ShowCompany " ), " company " ) . ' ' . dol_trunc ( $obj -> name , 20 ) . '</a>' ;
2011-08-21 15:19:26 +02:00
}
else
{
print ' ' ;
}
print '</td>' ;
}
2013-03-15 02:11:23 +01:00
// Phone
print '<td>' . dol_print_phone ( $obj -> phone , $obj -> country_code , $obj -> cidp , $obj -> socid , 'AC_TEL' ) . '</td>' ;
// Phone mobile
print '<td>' . dol_print_phone ( $obj -> phone_mobile , $obj -> country_code , $obj -> cidp , $obj -> socid , 'AC_TEL' ) . '</td>' ;
// Fax
print '<td>' . dol_print_phone ( $obj -> fax , $obj -> country_code , $obj -> cidp , $obj -> socid , 'AC_TEL' ) . '</td>' ;
// EMail
print '<td>' . dol_print_email ( $obj -> email , $obj -> cidp , $obj -> socid , 'AC_EMAIL' , 18 ) . '</td>' ;
2013-11-04 21:41:36 +01:00
// Skype
if ( ! empty ( $conf -> skype -> enabled )) { print '<td>' . dol_print_skype ( $obj -> skype , $obj -> cidp , $obj -> socid , 'AC_SKYPE' , 18 ) . '</td>' ; }
2011-08-21 15:19:26 +02:00
// Date
print '<td align="center">' . dol_print_date ( $db -> jdate ( $obj -> tms ), " day " ) . '</td>' ;
// Private/Public
print '<td align="center">' . $contactstatic -> LibPubPriv ( $obj -> priv ) . '</td>' ;
2013-10-30 12:24:51 +01:00
// Status
print '<td align="center">' . $contactstatic -> getLibStatut ( 3 ) . '</td>' ;
2011-08-21 15:19:26 +02:00
// Links Add action and Export vcard
print '<td align="right">' ;
print '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create&backtopage=1&contactid=' . $obj -> cidp . '&socid=' . $obj -> socid . '">' . img_object ( $langs -> trans ( " AddAction " ), " action " ) . '</a>' ;
print ' ' ;
2013-04-28 01:12:40 +02:00
print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/contact/vcard.php?id=' . $obj -> cidp . '">' ;
2011-08-21 15:19:26 +02:00
print img_picto ( $langs -> trans ( " VCard " ), 'vcard.png' ) . ' ' ;
print '</a></td>' ;
print " </tr> \n " ;
$i ++ ;
}
print " </table> " ;
print '</form>' ;
2012-07-10 22:10:12 +02:00
if ( $num > $limit ) print_barre_liste ( '' , $page , $_SERVER [ " PHP_SELF " ], '&begin=' . $begin . '&view=' . $view . '&userid=' . $userid , $sortfield , $sortorder , '' , $num , $nbtotalofrecords , '' );
2011-08-21 15:19:26 +02:00
$db -> free ( $result );
}
else
{
dol_print_error ( $db );
}
print '<br>' ;
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-07-10 22:10:12 +02:00
$db -> close ();
2011-08-21 15:19:26 +02:00
?>