2004-10-19 20:58:50 +02:00
< ? php
2015-05-23 18:52:31 +02:00
/* Copyright ( C ) 2001 - 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2002 - 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2016-05-07 18:50:05 +02:00
* Copyright ( C ) 2004 - 2016 Laurent Destailleur < eldy @ users . sourceforge . net >
2015-05-23 18:52:31 +02:00
* Copyright ( C ) 2013 - 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2016-07-15 17:31:44 +02:00
* Copyright ( C ) 2014 - 2016 Juanjo Menent < jmenent @ 2 byte . es >
2003-01-15 00:29:24 +01:00
*
2002-12-30 16:13:28 +01: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
2002-12-30 16:13:28 +01: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
2011-08-01 00:21:57 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2002-12-30 16:13:28 +01:00
*/
2004-08-14 14:37:59 +02:00
2009-02-01 14:47:37 +01:00
/**
2014-09-18 20:33:37 +02:00
* \file htdocs / adherents / list . php
2009-10-10 18:00:35 +02:00
* \ingroup member
2009-05-24 20:36:34 +02:00
* \brief Page to list all members of foundation
2008-11-15 01:10:42 +01:00
*/
2004-08-14 14:37:59 +02:00
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 . '/core/class/html.formother.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php' ;
2016-05-07 18:50:05 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
2004-07-17 01:35:53 +02:00
2017-06-09 17:02:05 +02:00
$langs -> loadLangs ( array ( " members " , " companies " ));
$action = GETPOST ( 'action' , 'aZ09' );
$massaction = GETPOST ( 'massaction' , 'alpha' );
$show_files = GETPOST ( 'show_files' , 'int' );
$confirm = GETPOST ( 'confirm' , 'alpha' );
$toselect = GETPOST ( 'toselect' , 'array' );
2006-04-01 04:07:58 +02:00
2013-01-10 08:27:12 +01:00
// Security check
$result = restrictedArea ( $user , 'adherent' );
2013-01-02 18:43:59 +01:00
2018-03-15 01:33:46 +01:00
$filter = GETPOST ( " filter " , 'alpha' );
2018-04-18 12:23:49 +02:00
$statut = GETPOST ( " statut " , 'intcomma' );
2018-03-15 01:33:46 +01:00
$search = GETPOST ( " search " , 'alpha' );
$search_ref = GETPOST ( " search_ref " , 'alpha' );
$search_lastname = GETPOST ( " search_lastname " , 'alpha' );
$search_firstname = GETPOST ( " search_firstname " , 'alpha' );
$search_login = GETPOST ( " search_login " , 'alpha' );
$search_address = GETPOST ( " search_address " , 'alpha' );
$search_zip = GETPOST ( " search_zip " , 'alpha' );
$search_town = GETPOST ( " search_town " , 'alpha' );
$search_state = GETPOST ( " search_state " , 'alpha' );
$search_country = GETPOST ( " search_country " , 'alpha' );
$search_phone = GETPOST ( " search_phone " , 'alpha' );
$search_phone_perso = GETPOST ( " search_phone_perso " , 'alpha' );
$search_phone_mobile = GETPOST ( " search_phone_mobile " , 'alpha' );
$search_type = GETPOST ( " search_type " , 'alpha' );
$search_email = GETPOST ( " search_email " , 'alpha' );
2012-07-28 00:53:51 +02:00
$search_categ = GETPOST ( " search_categ " , 'int' );
$catid = GETPOST ( " catid " , 'int' );
2015-10-04 10:45:57 +02:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2012-04-02 10:26:06 +02:00
2017-12-12 11:31:30 +01:00
$sall = trim (( GETPOST ( 'search_all' , 'alphanohtml' ) != '' ) ? GETPOST ( 'search_all' , 'alphanohtml' ) : GETPOST ( 'sall' , 'alphanohtml' ));
2016-05-07 18:50:05 +02:00
if ( $statut < - 1 ) $statut = '' ;
2017-06-08 14:55:12 +02:00
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
2012-05-09 16:03:15 +02:00
$sortfield = GETPOST ( " sortfield " , 'alpha' );
$sortorder = GETPOST ( " sortorder " , 'alpha' );
$page = GETPOST ( " page " , 'int' );
2017-06-06 10:53:53 +02:00
if ( empty ( $page ) || $page == - 1 ) { $page = 0 ; } // If $page is not defined, or '' or -1
2016-02-11 20:24:15 +01:00
$offset = $limit * $page ;
2012-05-09 16:03:15 +02:00
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2016-02-10 12:15:22 +01:00
if ( ! $sortorder ) { $sortorder = ( $filter == 'outofdate' ? " DESC " : " ASC " ); }
2013-02-23 11:11:33 +01:00
if ( ! $sortfield ) { $sortfield = ( $filter == 'outofdate' ? " d.datefin " : " d.lastname " ); }
2012-05-09 16:03:15 +02:00
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2018-03-31 18:48:27 +02:00
$object = new Adherent ( $db );
2015-06-22 16:34:25 +02:00
$hookmanager -> initHooks ( array ( 'memberlist' ));
$extrafields = new ExtraFields ( $db );
2016-05-04 14:43:40 +02:00
// fetch optionals attributes and labels
2016-05-07 18:54:36 +02:00
$extralabels = $extrafields -> fetch_name_optionals_label ( 'adherent' );
2016-05-04 14:43:40 +02:00
$search_array_options = $extrafields -> getOptionalsFromPost ( $extralabels , '' , 'search_' );
2015-10-17 00:14:36 +02:00
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array (
2017-10-13 13:28:26 +02:00
'd.rowid' => 'Ref' ,
'd.login' => 'Login' ,
'd.lastname' => 'Lastname' ,
'd.firstname' => 'Firstname' ,
'd.login' => 'Login' ,
2016-05-04 14:43:40 +02:00
'd.societe' => " Company " ,
2017-10-13 13:28:26 +02:00
'd.email' => 'EMail' ,
'd.address' => 'Address' ,
'd.zip' => 'Zip' ,
'd.town' => 'Town' ,
'd.note_public' => 'NotePublic' ,
'd.note_private' => 'NotePrivate' ,
2015-10-17 00:14:36 +02:00
);
2017-10-03 18:12:17 +02:00
if ( $db -> type == 'pgsql' ) unset ( $fieldstosearchall [ 'd.rowid' ]);
2016-05-04 14:43:40 +02:00
$arrayfields = array (
2017-10-13 13:28:26 +02:00
'd.ref' => array ( 'label' => $langs -> trans ( " Ref " ), 'checked' => 1 ),
'd.lastname' => array ( 'label' => $langs -> trans ( " Lastname " ), 'checked' => 1 ),
'd.firstname' => array ( 'label' => $langs -> trans ( " Firstname " ), 'checked' => 1 ),
2016-05-07 18:50:05 +02:00
'd.company' => array ( 'label' => $langs -> trans ( " Company " ), 'checked' => 1 ),
2016-05-04 14:43:40 +02:00
'd.login' => array ( 'label' => $langs -> trans ( " Login " ), 'checked' => 1 ),
2017-10-13 13:28:26 +02:00
'd.morphy' => array ( 'label' => $langs -> trans ( " MorPhy " ), 'checked' => 1 ),
't.libelle' => array ( 'label' => $langs -> trans ( " Type " ), 'checked' => 1 ),
2016-05-04 14:43:40 +02:00
'd.email' => array ( 'label' => $langs -> trans ( " Email " ), 'checked' => 1 ),
2017-10-13 13:28:26 +02:00
'd.address' => array ( 'label' => $langs -> trans ( " Address " ), 'checked' => 0 ),
'd.zip' => array ( 'label' => $langs -> trans ( " Zip " ), 'checked' => 0 ),
'd.town' => array ( 'label' => $langs -> trans ( " Town " ), 'checked' => 0 ),
2016-05-13 17:49:16 +02:00
'd.phone' => array ( 'label' => $langs -> trans ( " Phone " ), 'checked' => 0 ),
2016-05-13 19:06:28 +02:00
'd.phone_perso' => array ( 'label' => $langs -> trans ( " PhonePerso " ), 'checked' => 0 ),
2016-05-13 19:24:55 +02:00
'd.phone_mobile' => array ( 'label' => $langs -> trans ( " PhoneMobile " ), 'checked' => 0 ),
2017-10-13 13:28:26 +02:00
'state.nom' => array ( 'label' => $langs -> trans ( " State " ), 'checked' => 0 ),
2016-05-07 18:50:05 +02:00
'country.code_iso' => array ( 'label' => $langs -> trans ( " Country " ), 'checked' => 0 ),
2017-10-13 13:28:26 +02:00
/* 'd.note_public' => array ( 'label' => $langs -> trans ( " NotePublic " ), 'checked' => 0 ),
2016-05-07 18:50:05 +02:00
'd.note_private' => array ( 'label' => $langs -> trans ( " NotePrivate " ), 'checked' => 0 ), */
2016-05-04 14:43:40 +02:00
'd.datefin' => array ( 'label' => $langs -> trans ( " EndSubscription " ), 'checked' => 1 , 'position' => 500 ),
'd.datec' => array ( 'label' => $langs -> trans ( " DateCreation " ), 'checked' => 0 , 'position' => 500 ),
2017-10-13 13:28:26 +02:00
'd.tms' => array ( 'label' => $langs -> trans ( " DateModificationShort " ), 'checked' => 0 , 'position' => 500 ),
'd.statut' => array ( 'label' => $langs -> trans ( " Status " ), 'checked' => 1 , 'position' => 1000 )
2016-05-04 14:43:40 +02:00
);
// Extra fields
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label ))
{
2017-10-13 13:28:26 +02:00
foreach ( $extrafields -> attribute_label as $key => $val )
{
2017-10-29 11:00:02 +01:00
if ( ! empty ( $extrafields -> attribute_list [ $key ])) $arrayfields [ " ef. " . $key ] = array ( 'label' => $extrafields -> attribute_label [ $key ], 'checked' => (( $extrafields -> attribute_list [ $key ] < 0 ) ? 0 : 1 ), 'position' => $extrafields -> attribute_pos [ $key ], 'enabled' => ( abs ( $extrafields -> attribute_list [ $key ]) != 3 && $extrafields -> attribute_perms [ $key ]));
2017-10-13 13:28:26 +02:00
}
2016-05-04 14:43:40 +02:00
}
2016-11-02 12:48:50 +01:00
2016-05-04 14:43:40 +02:00
/*
* Actions
*/
2017-09-15 10:50:50 +02:00
if ( GETPOST ( 'cancel' , 'alpha' )) { $action = 'list' ; $massaction = '' ; }
if ( ! GETPOST ( 'confirmmassaction' , 'alpha' ) && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills' ) { $massaction = '' ; }
2016-05-04 14:43:40 +02:00
$parameters = array ( 'socid' => $socid );
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
if ( $reshook < 0 ) setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
2016-11-02 12:48:50 +01:00
if ( empty ( $reshook ))
{
2017-10-13 13:28:26 +02:00
// Selection of new fields
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php' ;
// Purge search criteria
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) // All tests are required to be compatible with all browsers
{
$search = " " ;
$search_ref = " " ;
$search_lastname = " " ;
$search_firstname = " " ;
$search_login = " " ;
$search_company = " " ;
$search_type = " " ;
$search_email = " " ;
$search_address = " " ;
$search_zip = " " ;
$search_town = " " ;
$search_state = " " ;
$search_country = '' ;
$search_phone = '' ;
$search_phone_perso = '' ;
$search_phone_mobile = '' ;
$search_morphy = " " ;
$search_categ = " " ;
$catid = " " ;
$sall = " " ;
$statut = '' ;
$toselect = '' ;
$search_array_options = array ();
}
// Mass actions
$objectclass = 'Adherent' ;
$objectlabel = 'Members' ;
$permtoread = $user -> rights -> adherent -> lire ;
$permtodelete = $user -> rights -> adherent -> supprimer ;
$uploaddir = $conf -> adherent -> dir_output ;
include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php' ;
2016-05-04 14:43:40 +02:00
}
2010-07-10 18:42:12 +02:00
2008-12-08 16:07:11 +01:00
/*
* View
*/
2011-12-03 16:14:36 +01:00
$form = new Form ( $db );
$formother = new FormOther ( $db );
2011-12-03 15:44:34 +01:00
$membertypestatic = new AdherentType ( $db );
$memberstatic = new Adherent ( $db );
2010-07-10 18:42:12 +02:00
$now = dol_now ();
2008-12-08 16:07:11 +01:00
2013-02-23 15:26:39 +01:00
$sql = " SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc, " ;
2016-05-07 18:50:05 +02:00
$sql .= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country, " ;
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo, " ;
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update, " ;
2016-09-24 06:48:40 +02:00
$sql .= " t.libelle as type, t.subscription, " ;
2016-05-07 18:50:05 +02:00
$sql .= " state.code_departement as state_code, state.nom as state_name " ;
2017-06-09 17:02:05 +02:00
// Add fields from extrafields
foreach ( $extrafields -> attribute_label as $key => $val ) $sql .= ( $extrafields -> attribute_type [ $key ] != 'separate' ? " ,ef. " . $key . ' as options_' . $key : '' );
2015-06-22 16:34:25 +02:00
// Add fields from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListSelect' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2012-07-28 00:53:51 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " adherent as d " ;
2016-05-07 18:54:36 +02:00
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label )) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " adherent_extrafields as ef on (d.rowid = ef.fk_object) " ;
2012-07-28 22:07:27 +02:00
if ( ! empty ( $search_categ ) || ! empty ( $catid )) $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . " categorie_member as cm ON d.rowid = cm.fk_member " ; // We need this table joined to the select in order to filter by categ
2016-05-07 18:50:05 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_country as country on (country.rowid = d.country) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_departements as state on (state.rowid = d.state_id) " ;
2012-07-28 00:53:51 +02:00
$sql .= " , " . MAIN_DB_PREFIX . " adherent_type as t " ;
2005-08-25 21:38:34 +02:00
$sql .= " WHERE d.fk_adherent_type = t.rowid " ;
2014-07-18 18:21:09 +02:00
if ( $catid > 0 ) $sql .= " AND cm.fk_categorie = " . $db -> escape ( $catid );
2012-07-28 22:07:27 +02:00
if ( $catid == - 2 ) $sql .= " AND cm.fk_categorie IS NULL " ;
2014-07-18 18:21:09 +02:00
if ( $search_categ > 0 ) $sql .= " AND cm.fk_categorie = " . $db -> escape ( $search_categ );
2012-07-28 22:07:27 +02:00
if ( $search_categ == - 2 ) $sql .= " AND cm.fk_categorie IS NULL " ;
2017-05-30 18:50:54 +02:00
$sql .= " AND d.entity IN ( " . getEntity ( 'adherent' ) . " ) " ;
2015-10-17 00:14:36 +02:00
if ( $sall ) $sql .= natural_search ( array_keys ( $fieldstosearchall ), $sall );
2017-06-09 17:02:05 +02:00
if ( $search_type > 0 ) $sql .= " AND t.rowid= " . $db -> escape ( $search_type );
2016-05-07 18:50:05 +02:00
if ( $statut != '' ) $sql .= " AND d.statut in ( " . $db -> escape ( $statut ) . " ) " ; // Peut valoir un nombre ou liste de nombre separes par virgules
2012-04-02 10:43:19 +02:00
if ( $search_ref )
{
2014-07-18 18:21:09 +02:00
if ( is_numeric ( $search_ref )) $sql .= " AND (d.rowid = " . $db -> escape ( $search_ref ) . " ) " ;
2012-04-02 10:43:19 +02:00
else $sql .= " AND 1 = 2 " ; // Always wrong
}
2016-08-28 15:49:00 +02:00
if ( $search_firstname ) $sql .= natural_search ( " d.firstname " , $search_firstname );
2015-06-22 16:34:25 +02:00
if ( $search_lastname ) $sql .= natural_search ( array ( " d.firstname " , " d.lastname " , " d.societe " ), $search_lastname );
if ( $search_login ) $sql .= natural_search ( " d.login " , $search_login );
if ( $search_email ) $sql .= natural_search ( " d.email " , $search_email );
2016-05-07 18:50:05 +02:00
if ( $search_town ) $sql .= natural_search ( " d.town " , $search_town );
if ( $search_zip ) $sql .= natural_search ( " d.zip " , $search_zip );
if ( $search_state ) $sql .= natural_search ( " state.nom " , $search_state );
if ( $search_country ) $sql .= " AND d.country IN ( " . $search_country . ')' ;
2015-06-22 16:34:25 +02:00
if ( $filter == 'uptodate' ) $sql .= " AND datefin >= ' " . $db -> idate ( $now ) . " ' " ;
if ( $filter == 'outofdate' ) $sql .= " AND (datefin IS NULL OR datefin < ' " . $db -> idate ( $now ) . " ') " ;
2016-05-04 14:43:40 +02:00
// Add where from extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php' ;
2015-06-22 16:34:25 +02:00
// Add where from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2010-07-10 18:42:12 +02:00
2016-02-11 20:24:15 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2010-07-10 18:42:12 +02:00
// Count total nb of records with no order and no limits
2017-01-15 20:49:20 +01:00
$nbtotalofrecords = '' ;
2009-02-01 14:47:37 +01:00
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST ))
{
2009-11-07 11:49:52 +01:00
$resql = $db -> query ( $sql );
2015-02-10 10:45:48 +01:00
if ( $resql ) $nbtotalofrecords = $db -> num_rows ( $resql );
2010-07-10 18:42:12 +02:00
else dol_print_error ( $db );
2018-04-24 11:37:57 +02:00
if (( $page * $limit ) > $nbtotalofrecords ) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0 ;
$offset = 0 ;
}
2009-02-01 14:47:37 +01:00
}
2016-02-11 20:24:15 +01:00
// Add limit
$sql .= $db -> plimit ( $limit + 1 , $offset );
2002-12-30 16:13:28 +01:00
2014-06-12 11:31:53 +02:00
dol_syslog ( " get list " , LOG_DEBUG );
2008-11-15 01:10:42 +01:00
$resql = $db -> query ( $sql );
2016-11-02 12:48:50 +01:00
if ( ! $resql )
2002-12-30 16:13:28 +01:00
{
2017-10-13 13:28:26 +02:00
dol_print_error ( $db );
exit ;
2016-11-02 12:48:50 +01:00
}
2010-07-10 18:42:12 +02:00
2016-11-02 12:48:50 +01:00
$num = $db -> num_rows ( $resql );
2010-07-10 18:42:12 +02:00
2017-04-11 09:55:45 +02:00
$arrayofselected = is_array ( $toselect ) ? $toselect : array ();
2016-11-02 12:48:50 +01:00
if ( $num == 1 && ! empty ( $conf -> global -> MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE ) && $sall )
{
2017-10-13 13:28:26 +02:00
$obj = $db -> fetch_object ( $resql );
$id = $obj -> rowid ;
header ( " Location: " . DOL_URL_ROOT . '/adherents/card.php?id=' . $id );
exit ;
2016-11-02 12:48:50 +01:00
}
2010-07-10 18:42:12 +02:00
2016-11-02 12:48:50 +01:00
llxHeader ( '' , $langs -> trans ( " Member " ), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros' );
2015-10-17 00:14:36 +02:00
2016-11-02 12:48:50 +01:00
$titre = $langs -> trans ( " MembersList " );
2018-03-15 01:33:46 +01:00
if ( GETPOSTISSET ( " statut " ))
2016-11-02 12:48:50 +01:00
{
if ( $statut == '-1,1' ) { $titre = $langs -> trans ( " MembersListQualified " ); }
if ( $statut == '-1' ) { $titre = $langs -> trans ( " MembersListToValid " ); }
if ( $statut == '1' && ! $filter ) { $titre = $langs -> trans ( " MembersListValid " ); }
if ( $statut == '1' && $filter == 'uptodate' ) { $titre = $langs -> trans ( " MembersListUpToDate " ); }
if ( $statut == '1' && $filter == 'outofdate' ) { $titre = $langs -> trans ( " MembersListNotUpToDate " ); }
if ( $statut == '0' ) { $titre = $langs -> trans ( " MembersListResiliated " ); }
}
elseif ( $action == 'search' )
{
$titre = $langs -> trans ( " MembersListQualified " );
}
2017-06-09 17:02:05 +02:00
if ( $search_type > 0 )
2016-11-02 12:48:50 +01:00
{
$membertype = new AdherentType ( $db );
2017-06-09 17:02:05 +02:00
$result = $membertype -> fetch ( GETPOST ( " type " , 'int' ));
2017-09-16 10:54:20 +02:00
$titre .= " ( " . $membertype -> label . " ) " ;
2016-11-02 12:48:50 +01:00
}
$param = '' ;
if ( ! empty ( $contextpage ) && $contextpage != $_SERVER [ " PHP_SELF " ]) $param .= '&contextpage=' . $contextpage ;
if ( $limit > 0 && $limit != $conf -> liste_limit ) $param .= '&limit=' . $limit ;
if ( $sall != " " ) $param .= " &sall= " . urlencode ( $sall );
if ( $statut != " " ) $param .= " &statut= " . urlencode ( $statut );
if ( $search_ref ) $param .= " &search_ref= " . urlencode ( $search_ref );
if ( $search_nom ) $param .= " &search_nom= " . urlencode ( $search_nom );
if ( $search_firstname ) $param .= " &search_firstname= " . urlencode ( $search_firstname );
if ( $search_lastname ) $param .= " &search_lastname= " . urlencode ( $search_lastname );
if ( $search_login ) $param .= " &search_login= " . urlencode ( $search_login );
if ( $search_email ) $param .= " &search_email= " . urlencode ( $search_email );
if ( $search_company ) $param .= " &search_company= " . urlencode ( $search_company );
if ( $search_address != '' ) $param .= " &search_address= " . urlencode ( $search_address );
if ( $search_town != '' ) $param .= " &search_town= " . urlencode ( $search_town );
if ( $search_zip != '' ) $param .= " &search_zip= " . urlencode ( $search_zip );
if ( $search_state != '' ) $param .= " &search_state= " . urlencode ( $search_state );
if ( $search_country != '' ) $param .= " &search_country= " . urlencode ( $search_country );
if ( $search_phone != '' ) $param .= " &search_phone= " . urlencode ( $search_phone );
if ( $search_phone_perso != '' ) $param .= " &search_phone_perso= " . urlencode ( $search_phone_perso );
if ( $search_phone_mobile != '' ) $param .= " &search_phone_mobile= " . urlencode ( $search_phone_mobile );
if ( $filter ) $param .= " &filter= " . urlencode ( $filter );
2017-06-09 17:02:05 +02:00
if ( $search_type > 0 ) $param .= " &search_type= " . urlencode ( $search_type );
2016-11-02 12:48:50 +01:00
if ( $optioncss != '' ) $param .= '&optioncss=' . urlencode ( $optioncss );
// Add $param from extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php' ;
2016-11-02 12:48:50 +01:00
2017-04-11 09:55:45 +02:00
// List of mass actions available
$arrayofmassactions = array (
// 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"),
);
2017-11-15 11:39:11 +01:00
if ( $user -> rights -> adherent -> supprimer ) $arrayofmassactions [ 'predelete' ] = $langs -> trans ( " Delete " );
if ( in_array ( $massaction , array ( 'presend' , 'predelete' ))) $arrayofmassactions = array ();
2017-04-11 09:55:45 +02:00
$massactionbutton = $form -> selectMassAction ( '' , $arrayofmassactions );
2016-11-02 12:48:50 +01:00
2018-04-03 15:28:12 +02:00
$newcardbutton = '' ;
if ( $user -> rights -> adherent -> creer )
{
2018-06-13 22:57:41 +02:00
$newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/adherents/card.php?action=create"><span class="valignmiddle">' . $langs -> trans ( 'NewMember' ) . '</span>' ;
2018-04-18 03:26:15 +02:00
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>' ;
$newcardbutton .= '</a>' ;
2018-04-03 15:28:12 +02:00
}
2017-06-09 17:02:05 +02:00
print '<form method="POST" id="searchFormList" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
2016-11-02 12:48:50 +01:00
if ( $optioncss != '' ) print '<input type="hidden" name="optioncss" value="' . $optioncss . '">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2017-05-21 02:43:51 +02:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2017-04-11 09:55:45 +02:00
print '<input type="hidden" name="contextpage" value="' . $contextpage . '">' ;
2016-11-02 12:48:50 +01:00
2018-04-03 15:28:12 +02:00
print_barre_liste ( $titre , $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'title_generic.png' , 0 , $newcardbutton , '' , $limit );
2016-11-02 12:48:50 +01:00
2017-11-15 11:39:11 +01:00
$topicmail = " Information " ;
$modelmail = " member " ;
$objecttmp = new Adherent ( $db );
$trackid = 'mem' . $object -> id ;
include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php' ;
2016-11-02 12:48:50 +01:00
if ( $sall )
{
2017-10-13 13:28:26 +02:00
foreach ( $fieldstosearchall as $key => $val ) $fieldstosearchall [ $key ] = $langs -> trans ( $val );
2018-06-22 22:53:53 +02:00
print '<div class="divsearchfieldfilter">' . $langs -> trans ( " FilterOnInto " , $sall ) . join ( ', ' , $fieldstosearchall ) . '</div>' ;
2016-11-02 12:48:50 +01:00
}
// Filter on categories
$moreforfilter = '' ;
if ( ! empty ( $conf -> categorie -> enabled ))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
2017-10-13 13:28:26 +02:00
$moreforfilter .= '<div class="divsearchfield">' ;
2016-11-02 12:48:50 +01:00
$moreforfilter .= $langs -> trans ( 'Categories' ) . ': ' ;
$moreforfilter .= $formother -> select_categories ( Categorie :: TYPE_MEMBER , $search_categ , 'search_categ' , 1 );
$moreforfilter .= '</div>' ;
}
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldPreListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
if ( empty ( $reshook )) $moreforfilter .= $hookmanager -> resPrint ;
else $moreforfilter = $hookmanager -> resPrint ;
if ( ! empty ( $moreforfilter ))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">' ;
print $moreforfilter ;
print '</div>' ;
}
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
$selectedfields = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage ); // This also change content of $arrayfields
2017-04-11 09:55:45 +02:00
if ( $massactionbutton ) $selectedfields .= $form -> showCheckAddButtons ( 'checkforselect' , 1 );
2016-11-02 12:48:50 +01:00
2017-03-04 12:19:28 +01:00
print '<div class="div-table-responsive">' ;
2016-11-02 12:48:50 +01:00
print '<table class="tagtable liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '">' . " \n " ;
2017-03-28 18:42:23 +02:00
2016-11-02 12:48:50 +01:00
// Line for filters fields
2017-03-28 18:42:23 +02:00
print '<tr class="liste_titre_filter">' ;
2016-11-02 12:48:50 +01:00
// Line numbering
2018-01-07 16:41:45 +01:00
if ( ! empty ( $conf -> global -> MAIN_SHOW_TECHNICAL_ID ))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre"> </td>' ;
}
// Ref
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.ref' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_ref" value="' . dol_escape_htmltag ( $search_ref ) . '">' ;
2017-10-13 13:28:26 +02:00
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.firstname' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_firstname" value="' . dol_escape_htmltag ( $search_firstname ) . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.lastname' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="' . dol_escape_htmltag ( $search_lastname ) . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.company' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_company" value="' . dol_escape_htmltag ( $search_company ) . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.login' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_login" value="' . dol_escape_htmltag ( $search_login ) . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
if ( ! empty ( $arrayfields [ 'd.morphy' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre" align="left">' ;
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 't.libelle' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre">' ;
$listetype = $membertypestatic -> liste_array ();
2017-06-09 17:02:05 +02:00
print $form -> selectarray ( " search_type " , $listetype , $type , 1 , 0 , 0 , '' , 0 , 32 );
2016-11-02 12:48:50 +01:00
print '</td>' ;
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.address' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_address" value="' . $search_address . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.zip' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_zip" value="' . $search_zip . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.town' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_town" value="' . $search_town . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
// State
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre">' ;
print '<input class="flat searchstring maxwidth50" type="text" name="search_state" value="' . dol_escape_htmltag ( $search_state ) . '">' ;
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
// Country
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre" align="center">' ;
print $form -> select_country ( $search_country , 'search_country' , '' , 0 , 'maxwidth100' );
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
// Phone pro
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_phone" value="' . $search_phone . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
// Phone perso
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone_perso' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="' . $search_phone_perso . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
// Phone mobile
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone_mobile' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_phone_mobile" value="' . $search_phone_mobile . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
// Email
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.email' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
2016-12-11 02:31:59 +01:00
print '<input class="flat maxwidth50" type="text" name="search_email" value="' . $search_email . '"></td>' ;
2016-11-02 12:48:50 +01:00
}
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.datefin' ][ 'checked' ]))
2016-11-02 12:48:50 +01:00
{
print '<td class="liste_titre" align="left">' ;
print '</td>' ;
}
// Extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php' ;
2016-11-02 12:48:50 +01:00
// Fields from hook
$parameters = array ( 'arrayfields' => $arrayfields );
$reshook = $hookmanager -> executeHooks ( 'printFieldListOption' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
// Date creation
if ( ! empty ( $arrayfields [ 'd.datec' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre">' ;
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
// Date modification
if ( ! empty ( $arrayfields [ 'd.tms' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre">' ;
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
// Status
if ( ! empty ( $arrayfields [ 'd.statut' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td class="liste_titre maxwidthonsmartphone" align="right">' ;
$liststatus = array (
'-1' => $langs -> trans ( " Draft " ),
'1' => $langs -> trans ( " Validated " ),
'0' => $langs -> trans ( " Resiliated " )
);
print $form -> selectarray ( 'statut' , $liststatus , $statut , - 2 );
print '</td>' ;
2016-11-02 12:48:50 +01:00
}
// Action column
print '<td class="liste_titre" align="middle">' ;
2017-05-14 21:06:33 +02:00
$searchpicto = $form -> showFilterButtons ();
print $searchpicto ;
2016-11-02 12:48:50 +01:00
print '</td>' ;
2010-07-10 18:42:12 +02:00
2016-11-02 12:48:50 +01:00
print " </tr> \n " ;
2017-03-28 18:42:23 +02:00
print '<tr class="liste_titre">' ;
2018-01-07 16:41:45 +01:00
if ( ! empty ( $conf -> global -> MAIN_SHOW_TECHNICAL_ID )) print_liste_field_titre ( " ID " , $_SERVER [ " PHP_SELF " ], '' , '' , $param , 'align="center"' , $sortfield , $sortorder );
2017-03-28 18:42:23 +02:00
if ( ! empty ( $arrayfields [ 'd.ref' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.ref' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.rowid' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.firstname' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.firstname' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.firstname' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.lastname' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.lastname' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.lastname' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.company' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.company' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.societe' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.login' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.login' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.login' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.morphy' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.morphy' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.morphy' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 't.libelle' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 't.libelle' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 't.libelle' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.address' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.address' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.address' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.zip' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.zip' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.zip' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.town' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.town' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.town' , '' , $param , '' , $sortfield , $sortorder );
2017-08-02 13:31:53 +02:00
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'state.town' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " state.nom " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'country.code_iso' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " country.code_iso " , " " , $param , 'align="center"' , $sortfield , $sortorder );
2017-03-28 18:42:23 +02:00
if ( ! empty ( $arrayfields [ 'd.phone' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.phone' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.phone' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.phone_perso' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.phone_perso' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.phone_perso' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.phone_mobile' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.phone_mobile' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.phone_mobile' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.email' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.email' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.email' , '' , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.datefin' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.datefin' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 'd.datefin' , '' , $param , 'align="center"' , $sortfield , $sortorder );
// Extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php' ;
2017-03-28 18:42:23 +02:00
// Hook fields
2018-02-24 15:01:29 +01:00
$parameters = array ( 'arrayfields' => $arrayfields , 'param' => $param , 'sortfield' => $sortfield , 'sortorder' => $sortorder );
2017-03-28 18:42:23 +02:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
if ( ! empty ( $arrayfields [ 'd.datec' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.datec' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " d.datec " , " " , $param , 'align="center" class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.tms' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.tms' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " d.tms " , " " , $param , 'align="center" class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'd.statut' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 'd.statut' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " d.statut " , " " , $param , 'align="right"' , $sortfield , $sortorder );
2017-04-07 14:18:04 +02:00
print_liste_field_titre ( $selectedfields , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="center"' , $sortfield , $sortorder , 'maxwidthsearch ' );
2017-03-28 18:42:23 +02:00
print " </tr> \n " ;
2016-11-02 12:48:50 +01:00
$i = 0 ;
2016-12-11 02:31:59 +01:00
while ( $i < min ( $num , $limit ))
2016-11-02 12:48:50 +01:00
{
$obj = $db -> fetch_object ( $resql );
$datefin = $db -> jdate ( $obj -> datefin );
$memberstatic -> id = $obj -> rowid ;
$memberstatic -> ref = $obj -> rowid ;
$memberstatic -> lastname = $obj -> lastname ;
$memberstatic -> firstname = $obj -> firstname ;
$memberstatic -> statut = $obj -> statut ;
$memberstatic -> datefin = $datefin ;
$memberstatic -> socid = $obj -> fk_soc ;
2017-04-05 14:48:24 +02:00
$memberstatic -> photo = $obj -> photo ;
2017-06-09 17:02:05 +02:00
2016-11-02 12:48:50 +01:00
if ( ! empty ( $obj -> fk_soc )) {
2017-10-13 13:28:26 +02:00
$memberstatic -> fetch_thirdparty ();
2016-11-02 12:48:50 +01:00
$companyname = $memberstatic -> thirdparty -> name ;
} else {
$companyname = $obj -> company ;
2016-02-11 09:41:45 +01:00
}
2018-03-23 23:59:35 +01:00
$memberstatic -> societe = $companyname ;
2016-11-02 12:48:50 +01:00
2017-04-05 14:48:24 +02:00
print '<tr class="oddeven">' ;
2017-06-09 17:02:05 +02:00
2018-01-07 16:41:45 +01:00
if ( ! empty ( $conf -> global -> MAIN_SHOW_TECHNICAL_ID ))
2016-05-08 16:09:00 +02:00
{
2018-01-07 16:41:45 +01:00
print '<td align="center">' . $obj -> rowid . '</td>' ;
2016-11-02 12:48:50 +01:00
}
2016-05-04 14:43:40 +02:00
// Ref
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.ref' ][ 'checked' ]))
2016-05-04 14:43:40 +02:00
{
2016-11-02 12:48:50 +01:00
print " <td> " ;
2017-04-11 09:55:45 +02:00
print $memberstatic -> getNomUrl ( - 1 , 0 , 'card' , 'ref' );
2016-11-02 12:48:50 +01:00
print " </td> \n " ;
2017-06-09 17:02:05 +02:00
}
2016-11-02 12:48:50 +01:00
// Firstname
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.firstname' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print " <td> " ;
2016-11-02 12:48:50 +01:00
print $obj -> firstname ;
print " </td> \n " ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Lastname
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.lastname' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print " <td> " ;
2016-11-02 12:48:50 +01:00
print $obj -> lastname ;
print " </td> \n " ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Company
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.company' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print " <td> " ;
print $companyname ;
2016-11-02 12:48:50 +01:00
print " </td> \n " ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Login
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.login' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2016-11-02 12:48:50 +01:00
print " <td> " . $obj -> login . " </td> \n " ;
2016-05-07 18:50:05 +02:00
}
2016-11-02 12:48:50 +01:00
// Moral/Physique
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.morphy' ][ 'checked' ]))
2016-05-07 18:50:05 +02:00
{
2016-11-02 12:48:50 +01:00
print " <td> " . $memberstatic -> getmorphylib ( $obj -> morphy ) . " </td> \n " ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Type label
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 't.libelle' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
$membertypestatic -> id = $obj -> type_id ;
2017-09-16 10:54:20 +02:00
$membertypestatic -> label = $obj -> type ;
2016-11-02 12:48:50 +01:00
print '<td class="nowrap">' ;
print $membertypestatic -> getNomUrl ( 1 , 32 );
2016-05-07 17:42:34 +02:00
print '</td>' ;
}
2016-11-02 12:48:50 +01:00
// Address
if ( ! empty ( $arrayfields [ 'd.address' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print '<td class="nocellnopadd">' ;
print $obj -> address ;
print '</td>' ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Zip
if ( ! empty ( $arrayfields [ 'd.zip' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print '<td class="nocellnopadd">' ;
print $obj -> zip ;
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// Town
if ( ! empty ( $arrayfields [ 'd.town' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print '<td class="nocellnopadd">' ;
print $obj -> town ;
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 17:42:34 +02:00
}
2016-05-07 18:50:05 +02:00
// State
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print " <td> " . $obj -> state_name . " </td> \n " ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 18:50:05 +02:00
}
// Country
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td align="center">' ;
$tmparray = getCountry ( $obj -> country , 'all' );
print $tmparray [ 'label' ];
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 18:50:05 +02:00
}
2016-05-13 17:49:16 +02:00
// Phone pro
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone' ][ 'checked' ]))
2016-05-13 17:49:16 +02:00
{
2016-11-02 12:48:50 +01:00
print '<td class="nocellnopadd">' ;
2017-10-13 13:28:26 +02:00
print $obj -> phone ;
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-13 17:49:16 +02:00
}
2016-05-13 19:06:28 +02:00
// Phone perso
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone_perso' ][ 'checked' ]))
2016-05-13 19:06:28 +02:00
{
2016-11-02 12:48:50 +01:00
print '<td class="nocellnopadd">' ;
2017-10-13 13:28:26 +02:00
print $obj -> phone_perso ;
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-13 19:06:28 +02:00
}
2016-05-13 19:24:55 +02:00
// Phone mobile
2017-06-09 17:02:05 +02:00
if ( ! empty ( $arrayfields [ 'd.phone_mobile' ][ 'checked' ]))
2016-05-13 19:24:55 +02:00
{
2016-11-02 12:48:50 +01:00
print '<td class="nocellnopadd">' ;
2017-10-13 13:28:26 +02:00
print $obj -> phone_mobile ;
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-13 19:24:55 +02:00
}
2016-11-02 12:48:50 +01:00
// EMail
if ( ! empty ( $arrayfields [ 'd.email' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2017-10-13 13:28:26 +02:00
print " <td> " . dol_print_email ( $obj -> email , 0 , 0 , 1 ) . " </td> \n " ;
2016-05-07 17:42:34 +02:00
}
2016-11-02 12:48:50 +01:00
// End of subscription date
2017-06-09 17:02:05 +02:00
$datefin = $db -> jdate ( $obj -> datefin );
2016-11-02 12:48:50 +01:00
if ( ! empty ( $arrayfields [ 'd.datefin' ][ 'checked' ]))
2016-05-07 17:42:34 +02:00
{
2016-11-02 12:48:50 +01:00
if ( $datefin )
{
print '<td align="center" class="nowrap">' ;
print dol_print_date ( $datefin , 'day' );
if ( $memberstatic -> hasDelay ()) {
2017-10-13 13:28:26 +02:00
$textlate .= ' (' . $langs -> trans ( " DateReference " ) . ' > ' . $langs -> trans ( " DateToday " ) . ' ' . ( ceil ( $conf -> adherent -> subscription -> warning_delay / 60 / 60 / 24 ) >= 0 ? '+' : '' ) . ceil ( $conf -> adherent -> subscription -> warning_delay / 60 / 60 / 24 ) . ' ' . $langs -> trans ( " days " ) . ')' ;
2017-02-07 00:45:14 +01:00
print " " . img_warning ( $langs -> trans ( " SubscriptionLate " ) . $textlate );
2016-11-02 12:48:50 +01:00
}
print '</td>' ;
}
else
{
print '<td align="left" class="nowrap">' ;
if ( $obj -> subscription == 'yes' )
{
print $langs -> trans ( " SubscriptionNotReceived " );
if ( $obj -> statut > 0 ) print " " . img_warning ();
}
else
{
print ' ' ;
}
print '</td>' ;
}
2016-05-07 17:42:34 +02:00
}
2016-05-07 18:50:05 +02:00
// Extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php' ;
2016-05-07 18:50:05 +02:00
// Fields from hook
2016-11-02 12:48:50 +01:00
$parameters = array ( 'arrayfields' => $arrayfields , 'obj' => $obj );
$reshook = $hookmanager -> executeHooks ( 'printFieldListValue' , $parameters ); // Note that $action and $object may have been modified by hook
2016-05-07 18:50:05 +02:00
print $hookmanager -> resPrint ;
// Date creation
if ( ! empty ( $arrayfields [ 'd.datec' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td align="center" class="nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_creation ), 'dayhour' , 'tzuser' );
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 18:50:05 +02:00
}
// Date modification
if ( ! empty ( $arrayfields [ 'd.tms' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td align="center" class="nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_update ), 'dayhour' , 'tzuser' );
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 18:50:05 +02:00
}
// Status
if ( ! empty ( $arrayfields [ 'd.statut' ][ 'checked' ]))
{
2017-10-13 13:28:26 +02:00
print '<td align="right" class="nowrap">' ;
print $memberstatic -> LibStatut ( $obj -> statut , $obj -> subscription , $datefin , 5 );
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2016-05-07 18:50:05 +02:00
}
// Action column
2016-11-02 12:48:50 +01:00
print '<td align="center">' ;
2017-10-13 13:28:26 +02:00
if ( $massactionbutton || $massaction ) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0 ;
2017-06-09 17:02:05 +02:00
if ( in_array ( $obj -> rowid , $arrayofselected )) $selected = 1 ;
print '<input id="cb' . $obj -> rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj -> rowid . '"' . ( $selected ? ' checked="checked"' : '' ) . '>' ;
2017-10-13 13:28:26 +02:00
}
print '</td>' ;
if ( ! $i ) $totalarray [ 'nbfield' ] ++ ;
2017-06-09 17:02:05 +02:00
2016-11-02 12:48:50 +01:00
print " </tr> \n " ;
$i ++ ;
}
2007-05-02 00:35:14 +02:00
2016-11-02 12:48:50 +01:00
$db -> free ( $resql );
2015-06-22 16:34:25 +02:00
2016-11-02 12:48:50 +01:00
$parameters = array ( 'sql' => $sql );
$reshook = $hookmanager -> executeHooks ( 'printFieldListFooter' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2015-06-22 16:34:25 +02:00
2016-11-02 12:48:50 +01:00
print " </table> \n " ;
2016-11-27 11:41:10 +01:00
print " </div> " ;
2016-11-02 12:48:50 +01:00
print '</form>' ;
2006-11-26 08:10:57 +01:00
2016-11-02 12:48:50 +01:00
if ( $num > $limit || $page ) print_barre_liste ( '' , $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , $num , $nbtotalofrecords , 'title_generic.png' , 0 , '' , '' , $limit , 1 );
2002-12-30 16:13:28 +01:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-04-02 10:26:06 +02:00
$db -> close ();