2004-10-20 23:06:45 +02:00
< ? php
2015-05-23 18:52:31 +02:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
* Copyright ( C ) 2012 Marcos García < marcosgdf @ gmail . com >
* Copyright ( C ) 2013 - 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2016-05-18 19:27:57 +02:00
* Copyright ( C ) 2015 Florian Henry < florian . henry @ open - concept . pro >
* Copyright ( C ) 2016 Josep Lluis Amador < joseplluis @ lliuretic . cat >
2016-09-09 13:58:41 +02:00
* Copyright ( C ) 2016 Ferran Marcet < fmarcet @ 2 byte . es >
2002-12-13 17:31:44 +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-13 17:31:44 +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 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2002-12-13 17:31:44 +01:00
*/
2004-10-31 15:33:57 +01:00
2005-01-30 22:23:56 +01:00
/**
2015-06-22 15:48:48 +02:00
* \file htdocs / societe / list . php
2008-08-29 23:15:34 +02:00
* \ingroup societe
2013-09-23 12:31:10 +02:00
* \brief Page to show list of third parties
2008-08-29 23:15:34 +02:00
*/
2012-08-22 23:11:24 +02:00
require_once '../main.inc.php' ;
2012-08-23 02:04:35 +02:00
include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2015-09-10 11:55:05 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php' ;
2015-10-23 13:52:51 +02:00
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php' ;
2002-12-13 17:31:44 +01:00
2004-08-13 23:34:55 +02:00
$langs -> load ( " companies " );
$langs -> load ( " customers " );
$langs -> load ( " suppliers " );
2015-10-23 13:52:51 +02:00
$langs -> load ( " bills " );
2015-11-15 11:31:09 +01:00
$langs -> load ( " compta " );
2004-08-13 23:34:55 +02:00
2008-02-24 14:18:40 +01:00
// Security check
2012-02-27 22:26:22 +01:00
$socid = GETPOST ( 'socid' , 'int' );
2008-02-25 21:03:21 +01:00
if ( $user -> societe_id ) $socid = $user -> societe_id ;
2011-02-14 18:27:08 +01:00
$result = restrictedArea ( $user , 'societe' , $socid , '' );
2008-01-22 21:23:51 +01:00
2015-10-16 23:03:20 +02:00
$search_all = trim ( GETPOST ( " sall " ));
2011-09-13 14:00:37 +02:00
$search_nom = trim ( GETPOST ( " search_nom " ));
$search_nom_only = trim ( GETPOST ( " search_nom_only " ));
2015-10-16 23:03:20 +02:00
$search_barcode = trim ( GETPOST ( " sbarcode " ));
$search_customer_code = trim ( GETPOST ( 'search_customer_code' ));
$search_supplier_code = trim ( GETPOST ( 'search_supplier_code' ));
$search_account_customer_code = trim ( GETPOST ( 'search_account_customer_code' ));
$search_account_supplier_code = trim ( GETPOST ( 'search_account_supplier_code' ));
2013-02-23 10:43:16 +01:00
$search_town = trim ( GETPOST ( " search_town " ));
2015-10-14 23:50:36 +02:00
$search_zip = trim ( GETPOST ( " search_zip " ));
2016-01-15 23:48:06 +01:00
$search_state = trim ( GETPOST ( " search_state " ));
2011-09-13 14:00:37 +02:00
$search_idprof1 = trim ( GETPOST ( 'search_idprof1' ));
$search_idprof2 = trim ( GETPOST ( 'search_idprof2' ));
$search_idprof3 = trim ( GETPOST ( 'search_idprof3' ));
$search_idprof4 = trim ( GETPOST ( 'search_idprof4' ));
2012-12-20 17:42:23 +01:00
$search_idprof5 = trim ( GETPOST ( 'search_idprof5' ));
$search_idprof6 = trim ( GETPOST ( 'search_idprof6' ));
2015-10-22 01:10:25 +02:00
$search_sale = trim ( GETPOST ( " search_sale " , 'int' ));
$search_categ = trim ( GETPOST ( " search_categ " , 'int' ));
2015-10-04 20:57:00 +02:00
$search_country = GETPOST ( " search_country " , 'int' );
$search_type_thirdparty = GETPOST ( " search_type_thirdparty " , 'int' );
2015-10-04 19:37:49 +02:00
$search_status = GETPOST ( " search_status " , 'int' );
2015-11-03 15:32:16 +01:00
$search_type = GETPOST ( 'search_type' , 'alpha' );
2015-10-23 13:52:51 +02:00
$search_level_from = GETPOST ( " search_level_from " , " alpha " );
$search_level_to = GETPOST ( " search_level_to " , " alpha " );
$search_stcomm = GETPOST ( 'search_stcomm' , 'int' );
2011-09-13 14:00:37 +02:00
2015-10-22 01:10:25 +02:00
$type = GETPOST ( 'type' );
2015-10-04 20:57:00 +02:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2011-09-13 14:00:37 +02:00
$mode = GETPOST ( " mode " );
2015-10-23 13:52:51 +02:00
$action = GETPOST ( 'action' );
2011-09-13 14:00:37 +02:00
2015-10-29 22:12:11 +01:00
$limit = GETPOST ( " limit " ) ? GETPOST ( " limit " , " int " ) : $conf -> liste_limit ;
2012-10-13 14:47:46 +02:00
$sortfield = GETPOST ( " sortfield " , 'alpha' );
$sortorder = GETPOST ( " sortorder " , 'alpha' );
$page = GETPOST ( " page " , 'int' );
2005-04-02 12:38:47 +02:00
if ( ! $sortorder ) $sortorder = " ASC " ;
2010-07-28 01:36:24 +02:00
if ( ! $sortfield ) $sortfield = " s.nom " ;
2002-12-13 17:31:44 +01:00
if ( $page == - 1 ) { $page = 0 ; }
2016-02-10 23:37:34 +01:00
$offset = $limit * $page ;
2002-12-13 17:31:44 +01:00
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2015-06-22 15:48:48 +02:00
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
2015-10-14 18:48:03 +02:00
$contextpage = 'thirdpartylist' ;
2015-10-22 01:10:25 +02:00
/* if ( $search_type == '1,3' ) { $contextpage = 'customerlist' ; $type = 'c' ; }
if ( $search_type == '2,3' ) { $contextpage = 'prospectlist' ; $type = 'p' ; }
if ( $search_type == '4' ) { $contextpage = 'supplierlist' ; $type = 'f' ; }
*/
if ( $type == 'c' ) { $contextpage = 'customerlist' ; if ( $search_type == '' ) $search_type = '1,3' ; }
if ( $type == 'p' ) { $contextpage = 'prospectlist' ; if ( $search_type == '' ) $search_type = '2,3' ; }
if ( $type == 'f' ) { $contextpage = 'supplierlist' ; if ( $search_type == '' ) $search_type = '4' ; }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
2015-10-14 18:48:03 +02:00
$hookmanager -> initHooks ( array ( $contextpage ));
2015-06-22 15:48:48 +02:00
$extrafields = new ExtraFields ( $db );
2015-10-14 23:50:36 +02:00
// fetch optionals attributes and labels
2016-04-04 16:02:29 +02:00
$extralabels = $extrafields -> fetch_name_optionals_label ( 'societe' );
2015-10-14 23:50:36 +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"
2015-10-16 22:21:26 +02:00
$fieldstosearchall = array (
2015-10-17 00:14:36 +02:00
's.nom' => " ThirdPartyName " ,
's.name_alias' => " AliasNameShort " ,
's.code_client' => " CustomerCode " ,
" s.code_fournisseur " => " SupplierCode " ,
's.email' => " EMail " ,
's.url' => " URL " ,
's.tva_intra' => " VATIntra " ,
's.siren' => " ProfId1 " ,
's.siret' => " ProfId2 " ,
's.ape' => " ProfId3 " ,
2015-10-16 22:21:26 +02:00
);
2015-10-17 00:14:36 +02:00
if (( $tmp = $langs -> transnoentities ( " ProfId4 " . $mysoc -> country_code )) && $tmp != " ProfId4 " . $mysoc -> country_code && $tmp != '-' ) $fieldstosearchall [ 's.idprof4' ] = 'ProfId4' ;
if (( $tmp = $langs -> transnoentities ( " ProfId5 " . $mysoc -> country_code )) && $tmp != " ProfId5 " . $mysoc -> country_code && $tmp != '-' ) $fieldstosearchall [ 's.idprof5' ] = 'ProfId5' ;
if (( $tmp = $langs -> transnoentities ( " ProfId6 " . $mysoc -> country_code )) && $tmp != " ProfId6 " . $mysoc -> country_code && $tmp != '-' ) $fieldstosearchall [ 's.idprof6' ] = 'ProfId6' ;
if ( ! empty ( $conf -> barcode -> enabled )) $fieldstosearchall [ 's.barcode' ] = 'Gencod' ;
2015-10-16 22:21:26 +02:00
2015-11-11 17:05:18 +01:00
// Define list of fields to show into list
$checkedcustomercode = ( in_array ( $contextpage , array ( 'thirdpartylist' , 'customerlist' , 'prospectlist' )) ? 1 : 0 );
$checkedsuppliercode = ( in_array ( $contextpage , array ( 'supplierlist' )) ? 1 : 0 );
$checkedcustomeraccountcode = ( in_array ( $contextpage , array ( 'customerlist' )) ? 1 : 0 );
$checkedsupplieraccountcode = ( in_array ( $contextpage , array ( 'supplierlist' )) ? 1 : 0 );
$checkedtypetiers = 1 ;
$checkedprofid1 = 0 ;
$checkedprofid2 = 0 ;
$checkedprofid3 = 0 ;
$checkedprofid4 = 0 ;
$checkedprofid5 = 0 ;
$checkedprofid6 = 0 ;
//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
$checkprospectlevel = ( in_array ( $contextpage , array ( 'prospectlist' )) ? 1 : 0 );
$checkstcomm = ( in_array ( $contextpage , array ( 'prospectlist' )) ? 1 : 0 );
$arrayfields = array (
's.nom' => array ( 'label' => $langs -> trans ( " Company " ), 'checked' => 1 ),
's.barcode' => array ( 'label' => $langs -> trans ( " Gencod " ), 'checked' => 1 , 'enabled' => ( ! empty ( $conf -> barcode -> enabled ))),
's.code_client' => array ( 'label' => $langs -> trans ( " CustomerCodeShort " ), 'checked' => $checkedcustomercode ),
's.code_fournisseur' => array ( 'label' => $langs -> trans ( " SupplierCodeShort " ), 'checked' => $checkedsuppliercode , 'enabled' => ( ! empty ( $conf -> fournisseur -> enabled ))),
's.code_compta' => array ( 'label' => $langs -> trans ( " CustomerAccountancyCodeShort " ), 'checked' => $checkedcustomeraccountcode ),
's.code_compta_fournisseur' => array ( 'label' => $langs -> trans ( " SupplierAccountancyCodeShort " ), 'checked' => $checkedsupplieraccountcode , 'enabled' => ( ! empty ( $conf -> fournisseur -> enabled ))),
's.town' => array ( 'label' => $langs -> trans ( " Town " ), 'checked' => 1 ),
's.zip' => array ( 'label' => $langs -> trans ( " Zip " ), 'checked' => 1 ),
2016-02-10 19:28:10 +01:00
'state.nom' => array ( 'label' => $langs -> trans ( " State " ), 'checked' => 0 ),
2016-01-15 23:48:06 +01:00
'country.code_iso' => array ( 'label' => $langs -> trans ( " Country " ), 'checked' => 0 ),
2015-11-11 17:05:18 +01:00
'typent.code' => array ( 'label' => $langs -> trans ( " ThirdPartyType " ), 'checked' => $checkedtypetiers ),
's.siren' => array ( 'label' => $langs -> trans ( " ProfId1Short " ), 'checked' => $checkedprofid1 ),
's.siret' => array ( 'label' => $langs -> trans ( " ProfId2Short " ), 'checked' => $checkedprofid2 ),
's.ape' => array ( 'label' => $langs -> trans ( " ProfId3Short " ), 'checked' => $checkedprofid3 ),
's.idprof4' => array ( 'label' => $langs -> trans ( " ProfId4Short " ), 'checked' => $checkedprofid4 ),
's.idprof5' => array ( 'label' => $langs -> trans ( " ProfId5Short " ), 'checked' => $checkedprofid5 ),
's.idprof6' => array ( 'label' => $langs -> trans ( " ProfId6Short " ), 'checked' => $checkedprofid6 ),
2016-08-28 15:21:09 +02:00
'customerorsupplier' => array ( 'label' => 'Nature' , 'checked' => 1 ),
's.fk_prospectlevel' => array ( 'label' => $langs -> trans ( " ProspectLevelShort " ), 'checked' => $checkprospectlevel ),
2015-11-11 17:05:18 +01:00
's.fk_stcomm' => array ( 'label' => $langs -> trans ( " StatusProsp " ), 'checked' => $checkstcomm ),
's.datec' => array ( 'label' => $langs -> trans ( " DateCreation " ), 'checked' => 0 , 'position' => 500 ),
's.tms' => array ( 'label' => $langs -> trans ( " DateModificationShort " ), 'checked' => 0 , 'position' => 500 ),
's.status' => array ( 'label' => $langs -> trans ( " Status " ), 'checked' => 1 , 'position' => 1000 ),
);
// Extra fields
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label ))
{
2016-10-05 17:20:56 +02:00
foreach ( $extrafields -> attribute_label as $key => $val )
2015-11-11 17:05:18 +01:00
{
$arrayfields [ " ef. " . $key ] = array ( 'label' => $extrafields -> attribute_label [ $key ], 'checked' => $extrafields -> attribute_list [ $key ], 'position' => $extrafields -> attribute_pos [ $key ], 'enabled' => $extrafields -> attribute_perms [ $key ]);
}
}
2002-12-13 17:31:44 +01:00
2015-10-23 13:52:51 +02:00
2002-12-13 17:31:44 +01:00
/*
2005-10-25 21:45:59 +02:00
* Actions
2002-12-13 17:31:44 +01:00
*/
2008-08-29 23:15:34 +02:00
2016-11-02 12:16:46 +01:00
if ( GETPOST ( 'cancel' )) { $action = 'list' ; $massaction = '' ; }
if ( ! GETPOST ( 'confirmmassaction' ) && $massaction != 'presend' && $massaction != 'confirm_presend' ) { $massaction = '' ; }
2015-10-22 01:10:25 +02:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters ); // Note that $action and $object may have been modified by some hooks
if ( $reshook < 0 ) setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
2015-10-23 13:52:51 +02:00
if ( empty ( $reshook ))
{
2016-11-02 12:16:46 +01:00
// Selection of new fields
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php' ;
2015-10-23 13:52:51 +02:00
2016-11-02 12:16:46 +01:00
// Do we click on purge search criteria ?
if ( GETPOST ( " button_removefilter_x " ) || GETPOST ( " button_removefilter.x " ) || GETPOST ( " button_removefilter " )) // All tests are required to be compatible with all browsers
{
$search_nom = '' ;
$search_categ = 0 ;
$search_sale = '' ;
$search_barcode = " " ;
$search_customer_code = '' ;
$search_supplier_code = '' ;
$search_account_customer_code = '' ;
$search_account_supplier_code = '' ;
$search_town = " " ;
$search_zip = " " ;
$search_state = " " ;
$search_country = '' ;
$search_idprof1 = '' ;
$search_idprof2 = '' ;
$search_idprof3 = '' ;
$search_idprof4 = '' ;
$search_idprof5 = '' ;
$search_idprof6 = '' ;
$search_type = '' ;
$search_type_thirdparty = '' ;
$search_status = '' ;
$search_stcomm = '' ;
$search_level_from = '' ;
$search_level_to = '' ;
$search_array_options = array ();
}
2015-10-23 13:52:51 +02:00
2016-11-02 12:16:46 +01:00
if ( $action == 'setstcomm' )
{
$object = new Client ( $db );
$result = $object -> fetch ( GETPOST ( 'stcommsocid' ));
$object -> stcomm_id = dol_getIdFromCode ( $db , GETPOST ( 'stcomm' , 'alpha' ), 'c_stcomm' );
$result = $object -> update ( $object -> id , $user );
if ( $result < 0 ) setEventMessages ( $object -> error , $object -> errors , 'errors' );
$action = '' ;
}
2004-10-31 15:33:57 +01:00
}
2004-08-13 23:34:55 +02:00
2015-10-04 19:37:49 +02:00
if ( $search_status == '' ) $search_status = 1 ; // always display active thirdparty first
2005-04-02 12:38:47 +02:00
2015-10-23 13:52:51 +02:00
2002-12-13 17:39:23 +01:00
/*
2015-10-23 13:52:51 +02:00
* View
2002-12-13 17:39:23 +01:00
*/
2015-10-14 18:48:03 +02:00
2007-01-25 22:31:30 +01:00
/*
2015-10-14 18:48:03 +02:00
REM : Rules on permissions to see thirdparties
Internal or External user + No permission to see customers => See nothing
Internal user socid = 0 + Permission to see ALL customers => See all thirdparties
Internal user socid = 0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative
External user socid = x + Permission to see ALL customers => Can see only himself
External user socid = x + No permission to see ALL customers => Can see only himself
2008-08-29 23:15:34 +02:00
*/
2015-10-23 13:52:51 +02:00
$form = new Form ( $db );
$formother = new FormOther ( $db );
$companystatic = new Societe ( $db );
$formcompany = new FormCompany ( $db );
$prospectstatic = new Client ( $db );
$prospectstatic -> client = 2 ;
$prospectstatic -> loadCacheOfProspStatus ();
2006-12-22 22:07:49 +01:00
$title = $langs -> trans ( " ListOfThirdParties " );
2015-10-22 01:10:25 +02:00
if ( $type == 'c' && ( empty ( $search_type ) || ( $search_type == '1,3' ))) $title = $langs -> trans ( " ListOfCustomers " );
if ( $type == 'p' && ( empty ( $search_type ) || ( $search_type == '2,3' ))) $title = $langs -> trans ( " ListOfProspects " );
if ( $type == 'f' && ( empty ( $search_type ) || ( $search_type == '4' ))) $title = $langs -> trans ( " ListOfSuppliers " );
2004-07-30 09:57:13 +02:00
2015-10-23 13:52:51 +02:00
// If both parameters are set, search for everything BETWEEN them
if ( $search_level_from != '' && $search_level_to != '' )
{
// Ensure that these parameters are numbers
$search_level_from = ( int ) $search_level_from ;
$search_level_to = ( int ) $search_level_to ;
// If from is greater than to, reverse orders
if ( $search_level_from > $search_level_to )
{
$tmp = $search_level_to ;
$search_level_to = $search_level_from ;
$search_level_from = $tmp ;
}
// Generate the SQL request
$sortwhere = '(sortorder BETWEEN ' . $search_level_from . ' AND ' . $search_level_to . ') AS is_in_range' ;
}
// If only "from" parameter is set, search for everything GREATER THAN it
else if ( $search_level_from != '' )
{
// Ensure that this parameter is a number
$search_level_from = ( int ) $search_level_from ;
// Generate the SQL request
$sortwhere = '(sortorder >= ' . $search_level_from . ') AS is_in_range' ;
}
// If only "to" parameter is set, search for everything LOWER THAN it
else if ( $search_level_to != '' )
{
// Ensure that this parameter is a number
$search_level_to = ( int ) $search_level_to ;
// Generate the SQL request
$sortwhere = '(sortorder <= ' . $search_level_to . ') AS is_in_range' ;
}
// If no parameters are set, dont search for anything
else
{
$sortwhere = '0 as is_in_range' ;
}
// Select every potentiels, and note each potentiels which fit in search parameters
dol_syslog ( 'societe/list.php' , LOG_DEBUG );
$sql = " SELECT code, label, sortorder, " . $sortwhere ;
$sql .= " FROM " . MAIN_DB_PREFIX . " c_prospectlevel " ;
$sql .= " WHERE active > 0 " ;
$sql .= " ORDER BY sortorder " ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$tab_level = array ();
$search_levels = array ();
while ( $obj = $db -> fetch_object ( $resql ))
{
// Compute level text
$level = $langs -> trans ( $obj -> code );
if ( $level == $obj -> code ) $level = $langs -> trans ( $obj -> label );
// Put it in the array sorted by sortorder
$tab_level [ $obj -> sortorder ] = $level ;
// If this potentiel fit in parameters, add its code to the $search_levels array
if ( $obj -> is_in_range == 1 )
{
$search_levels [] = '"' . preg_replace ( '[^A-Za-z0-9_-]' , '' , $obj -> code ) . '"' ;
}
}
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
// If no paramters was set, $search_levels will be empty
$search_levels = implode ( ',' , $search_levels );
}
else dol_print_error ( $db );
$sql = " SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, " ;
$sql .= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status, " ;
2016-10-16 19:02:36 +02:00
$sql .= " s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays, " ;
2015-10-25 18:15:37 +01:00
$sql .= " s.tms as date_update, s.datec as date_creation, " ;
2016-10-16 19:02:36 +02:00
$sql .= " s.code_compta,s.code_compta_fournisseur, " ;
2016-01-15 23:48:06 +01:00
$sql .= " typent.code as typent_code, " ;
$sql .= " state.code_departement as state_code, state.nom as state_name " ;
2011-02-14 18:27:08 +01:00
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ( $search_sale ) $sql .= " , sc.fk_soc, sc.fk_user " ;
// We'll need these fields in order to filter by categ
2015-04-18 18:11:01 +02:00
if ( $search_categ ) $sql .= " , cs.fk_categorie, cs.fk_soc " ;
2015-10-14 23:50:36 +02:00
// Add fields from extrafields
2016-03-18 13:58:06 +01:00
foreach ( $extrafields -> attribute_label as $key => $val ) $sql .= ( $extrafields -> attribute_type [ $key ] != 'separate' ? " ,ef. " . $key . ' as options_' . $key : '' );
2015-06-22 15:48:48 +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 ;
2015-09-10 11:55:05 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe as s " ;
2015-10-29 22:12:11 +01:00
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label )) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe_extrafields as ef on (s.rowid = ef.fk_object) " ;
2016-01-15 23:48:06 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_country as country on (country.rowid = s.fk_pays) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_typent as typent on (typent.id = s.fk_typent) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_departements as state on (state.rowid = s.fk_departement) " ;
2016-05-18 19:27:57 +02:00
// We'll need this table joined to the select in order to filter by categ
2016-06-01 17:59:50 +02:00
if ( ! empty ( $search_categ )) $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . " categorie_ " . ( $type == 'f' ? " fournisseur " : " societe " ) . " as cs ON s.rowid = cs.fk_soc " ; // We'll need this table joined to the select in order to filter by categ
2015-09-10 11:55:05 +02:00
$sql .= " , " . MAIN_DB_PREFIX . " c_stcomm as st " ;
2011-02-14 18:27:08 +01:00
// We'll need this table joined to the select in order to filter by sale
2013-09-18 23:24:09 +02:00
if ( $search_sale || ( ! $user -> rights -> societe -> client -> voir && ! $socid )) $sql .= " , " . MAIN_DB_PREFIX . " societe_commerciaux as sc " ;
2005-10-25 21:45:59 +02:00
$sql .= " WHERE s.fk_stcomm = st.id " ;
2012-02-01 11:32:55 +01:00
$sql .= " AND s.entity IN ( " . getEntity ( 'societe' , 1 ) . " ) " ;
2009-04-27 22:37:50 +02:00
if ( ! $user -> rights -> societe -> client -> voir && ! $socid ) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user -> id ;
2015-06-22 16:34:25 +02:00
if ( $socid ) $sql .= " AND s.rowid = " . $socid ;
if ( $search_sale ) $sql .= " AND s.rowid = sc.fk_soc " ; // Join for the needed table to filter by sale
2012-01-17 23:49:25 +01:00
if ( ! $user -> rights -> fournisseur -> lire ) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0) " ; // client=0, fournisseur=0 must be visible
2015-10-14 23:50:36 +02:00
if ( $search_sale ) $sql .= " AND sc.fk_user = " . $db -> escape ( $search_sale );
2016-05-18 19:27:57 +02:00
if ( $search_categ > 0 ) $sql .= " AND cs.fk_categorie = " . $db -> escape ( $search_categ );
if ( $search_categ == - 2 ) $sql .= " AND cs.fk_categorie IS NULL " ;
2015-10-17 00:14:36 +02:00
if ( $search_all ) $sql .= natural_search ( array_keys ( $fieldstosearchall ), $search_all );
2015-10-16 22:21:26 +02:00
if ( $search_nom ) $sql .= natural_search ( " s.nom " , $search_nom );
2015-06-22 15:48:48 +02:00
if ( $search_nom_only ) $sql .= natural_search ( " s.nom " , $search_nom_only );
2015-10-16 23:03:20 +02:00
if ( $search_customer_code ) $sql .= natural_search ( " s.code_client " , $search_customer_code );
if ( $search_supplier_code ) $sql .= natural_search ( " s.code_fournisseur " , $search_supplier_code );
if ( $search_account_customer_code ) $sql .= natural_search ( " s.code_compta " , $search_account_customer_code );
if ( $search_account_supplier_code ) $sql .= natural_search ( " s.code_compta_fournisseur " , $search_account_supplier_code );
2015-10-14 23:50:36 +02:00
if ( $search_town ) $sql .= natural_search ( " s.town " , $search_town );
if ( $search_zip ) $sql .= natural_search ( " s.zip " , $search_zip );
2016-01-15 23:48:06 +01:00
if ( $search_state ) $sql .= natural_search ( " state.nom " , $search_state );
2016-05-07 18:50:05 +02:00
if ( $search_country ) $sql .= " AND s.fk_pays IN ( " . $search_country . ')' ;
2015-10-14 23:50:36 +02:00
if ( $search_idprof1 ) $sql .= natural_search ( " s.siren " , $search_idprof1 );
if ( $search_idprof2 ) $sql .= natural_search ( " s.siret " , $search_idprof2 );
if ( $search_idprof3 ) $sql .= natural_search ( " s.ape " , $search_idprof3 );
if ( $search_idprof4 ) $sql .= natural_search ( " s.idprof4 " , $search_idprof4 );
if ( $search_idprof5 ) $sql .= natural_search ( " s.idprof5 " , $search_idprof5 );
if ( $search_idprof6 ) $sql .= natural_search ( " s.idprof6 " , $search_idprof6 );
2013-01-10 08:27:12 +01:00
// Filter on type of thirdparty
2012-12-20 17:42:23 +01:00
if ( $search_type > 0 && in_array ( $search_type , array ( '1,3' , '2,3' ))) $sql .= " AND s.client IN ( " . $db -> escape ( $search_type ) . " ) " ;
if ( $search_type > 0 && in_array ( $search_type , array ( '4' ))) $sql .= " AND s.fournisseur = 1 " ;
if ( $search_type == '0' ) $sql .= " AND s.client = 0 AND s.fournisseur = 0 " ;
2015-10-04 19:37:49 +02:00
if ( $search_status != '' ) $sql .= " AND s.status = " . $db -> escape ( $search_status );
2015-10-16 23:03:20 +02:00
if ( ! empty ( $conf -> barcode -> enabled ) && $search_barcode ) $sql .= " AND s.barcode LIKE '% " . $db -> escape ( $search_barcode ) . " %' " ;
2015-09-10 11:55:05 +02:00
if ( $search_type_thirdparty ) $sql .= " AND s.fk_typent IN ( " . $search_type_thirdparty . ')' ;
2015-10-23 13:52:51 +02:00
if ( $search_levels ) $sql .= " AND s.fk_prospectlevel IN ( " . $search_levels . ')' ;
if ( $search_stcomm != '' && $search_stcomm != - 2 ) $sql .= natural_search ( " s.fk_stcomm " , $search_stcomm , 2 );
2015-10-14 23:50:36 +02:00
// Add where from extra fields
foreach ( $search_array_options as $key => $val )
{
$crit = $val ;
$tmpkey = preg_replace ( '/search_options_/' , '' , $key );
$typ = $extrafields -> attribute_type [ $tmpkey ];
$mode = 0 ;
2016-04-04 16:02:29 +02:00
if ( in_array ( $typ , array ( 'int' , 'double' ))) $mode = 1 ; // Search on a numeric
2016-10-05 17:20:56 +02:00
if ( $val && ( ( $crit != '' && ! in_array ( $typ , array ( 'select' ))) || ! empty ( $crit )))
2015-10-14 23:50:36 +02:00
{
$sql .= natural_search ( 'ef.' . $tmpkey , $crit , $mode );
}
}
2015-06-22 15:48:48 +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 ;
2005-02-10 15:35:23 +01:00
2016-02-13 10:51:42 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2008-03-06 19:12:07 +01:00
// Count total nb of records
$nbtotalofrecords = 0 ;
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST ))
{
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
}
2016-02-10 19:28:10 +01:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
2002-12-13 17:31:44 +01:00
2009-01-26 22:57:14 +01:00
$resql = $db -> query ( $sql );
2016-07-07 10:26:40 +02:00
if ( ! $resql )
2003-10-21 16:46:23 +02:00
{
2016-07-07 10:26:40 +02:00
dol_print_error ( $db );
exit ;
}
2011-08-24 01:50:15 +02:00
2016-07-07 10:26:40 +02:00
$num = $db -> num_rows ( $resql );
2016-11-02 12:16:46 +01:00
2016-11-02 12:48:50 +01:00
if ( $num == 1 && ! empty ( $conf -> global -> MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE ) && $search_all && $action != 'list' )
2016-07-07 10:26:40 +02:00
{
$obj = $db -> fetch_object ( $resql );
$id = $obj -> rowid ;
header ( " Location: " . DOL_URL_ROOT . '/societe/soc.php?socid=' . $id );
exit ;
}
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas' ;
llxHeader ( '' , $langs -> trans ( " ThirdParty " ), $help_url );
$param = '' ;
if ( ! empty ( $contextpage ) && $contextpage != $_SERVER [ " PHP_SELF " ]) $param .= '&contextpage=' . $contextpage ;
if ( $limit > 0 && $limit != $conf -> liste_limit ) $param .= '&limit=' . $limit ;
2016-09-12 01:50:38 +02:00
if ( $search_all != '' ) $param = " &sall= " . urlencode ( $search_all );
2016-07-07 10:26:40 +02:00
if ( $sall != '' ) $param .= " &sall= " . urlencode ( $sall );
if ( $search_categ > 0 ) $param .= '&search_categ=' . urlencode ( $search_categ );
if ( $search_sale > 0 ) $param .= '&search_sale=' . urlencode ( $search_sale );
if ( $search_nom != '' ) $param .= " &search_nom= " . urlencode ( $search_nom );
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_customer_code != '' ) $param .= " &search_customer_code= " . urlencode ( $search_customer_code );
if ( $search_supplier_code != '' ) $param .= " &search_supplier_code= " . urlencode ( $search_supplier_code );
if ( $search_account_customer_code != '' ) $param .= " &search_account_customer_code= " . urlencode ( $search_account_customer_code );
if ( $search_account_supplier_code != '' ) $param .= " &search_account_supplier_code= " . urlencode ( $search_account_supplier_code );
if ( $search_barcode != '' ) $param .= " &sbarcode= " . urlencode ( $search_barcode );
if ( $search_idprof1 != '' ) $param .= '&search_idprof1=' . urlencode ( $search_idprof1 );
if ( $search_idprof2 != '' ) $param .= '&search_idprof2=' . urlencode ( $search_idprof2 );
if ( $search_idprof3 != '' ) $param .= '&search_idprof3=' . urlencode ( $search_idprof3 );
if ( $search_idprof4 != '' ) $param .= '&search_idprof4=' . urlencode ( $search_idprof4 );
if ( $search_idprof5 != '' ) $param .= '&search_idprof5=' . urlencode ( $search_idprof5 );
if ( $search_idprof6 != '' ) $param .= '&search_idprof6=' . urlencode ( $search_idprof6 );
if ( $search_country != '' ) $param .= '&search_country=' . urlencode ( $search_country );
if ( $search_type_thirdparty != '' ) $param .= '&search_type_thirdparty=' . urlencode ( $search_type_thirdparty );
if ( $optioncss != '' ) $param .= '&optioncss=' . urlencode ( $optioncss );
if ( $search_status != '' ) $param .= '&search_status=' . urlencode ( $search_status );
if ( $search_stcomm != '' ) $param .= '&search_stcomm=' . $search_stcomm ;
if ( $search_level_from != '' ) $param .= '&search_level_from=' . $search_level_from ;
if ( $search_level_to != '' ) $param .= '&search_level_to=' . $search_level_to ;
if ( $type != '' ) $param .= '&type=' . urlencode ( $type );
// Add $param from extra fields
foreach ( $search_array_options as $key => $val )
{
$crit = $val ;
$tmpkey = preg_replace ( '/search_options_/' , '' , $key );
if ( $val != '' ) $param .= '&search_options_' . $tmpkey . '=' . urlencode ( $val );
}
// Show delete result message
if ( GETPOST ( 'delsoc' ))
{
setEventMessages ( $langs -> trans ( " CompanyDeleted " , GETPOST ( 'delsoc' )), null , 'mesgs' );
}
print '<form method="post" action="' . $_SERVER [ " PHP_SELF " ] . '" name="formfilter">' ;
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="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
print_barre_liste ( $title , $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , $num , $nbtotalofrecords , 'title_companies' , 0 , '' , '' , $limit );
$langs -> load ( " other " );
$textprofid = array ();
foreach ( array ( 1 , 2 , 3 , 4 , 5 , 6 ) as $key )
{
$label = $langs -> transnoentities ( " ProfId " . $key . $mysoc -> country_code );
$textprofid [ $key ] = '' ;
if ( $label != " ProfId " . $key . $mysoc -> country_code )
{ // Get only text between ()
if ( preg_match ( '/\((.*)\)/i' , $label , $reg )) $label = $reg [ 1 ];
$textprofid [ $key ] = $langs -> trans ( " ProfIdShortDesc " , $key , $mysoc -> country_code , $label );
2004-02-05 19:47:54 +01:00
}
2016-07-07 10:26:40 +02:00
}
2008-08-29 23:15:34 +02:00
2016-07-07 10:26:40 +02:00
if ( $search_all )
{
foreach ( $fieldstosearchall as $key => $val ) $fieldstosearchall [ $key ] = $langs -> trans ( $val );
print $langs -> trans ( " FilterOnInto " , $search_all ) . join ( ', ' , $fieldstosearchall );
}
// Filter on categories
$moreforfilter = '' ;
if ( $type == 'c' || $type == 'p' )
{
if ( ! empty ( $conf -> categorie -> enabled ))
2015-10-22 01:10:25 +02:00
{
2016-07-07 10:26:40 +02:00
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
$moreforfilter .= '<div class="divsearchfield">' ;
$moreforfilter .= $langs -> trans ( 'Categories' ) . ': ' ;
$moreforfilter .= $formother -> select_categories ( 'customer' , $search_categ , 'search_categ' , 1 );
$moreforfilter .= '</div>' ;
2016-05-04 14:43:40 +02:00
}
2016-07-07 10:26:40 +02:00
}
2016-09-18 15:57:53 +02:00
if ( $type == 'f' )
{
if ( ! empty ( $conf -> categorie -> enabled ))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
$moreforfilter .= '<div class="divsearchfield">' ;
$moreforfilter .= $langs -> trans ( 'Categories' ) . ': ' ;
$moreforfilter .= $formother -> select_categories ( 'supplier' , $search_categ , 'search_categ' , 1 );
$moreforfilter .= '</div>' ;
}
}
2016-07-07 10:26:40 +02:00
// If the user can view prospects other than his'
if ( $user -> rights -> societe -> client -> voir || $socid )
{
$moreforfilter .= '<div class="divsearchfield">' ;
$moreforfilter .= $langs -> trans ( 'SalesRepresentatives' ) . ': ' ;
$moreforfilter .= $formother -> select_salesrepresentatives ( $search_sale , 'search_sale' , $user , 0 , 1 , 'maxwidth300' );
$moreforfilter .= '</div>' ;
}
if ( ! empty ( $moreforfilter ))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">' ;
print $moreforfilter ;
$parameters = array ( 'type' => $type );
$reshook = $hookmanager -> executeHooks ( 'printFieldPreListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
print '</div>' ;
}
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
$selectedfields = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage ); // This also change content of $arrayfields
2016-08-28 15:21:09 +02:00
if ( empty ( $arrayfields [ 'customerorsupplier' ][ 'checked' ])) print '<input type="hidden" name="type" value="' . $type . '">' ;
2016-07-07 10:26:40 +02:00
print '<table class="liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '">' ;
print '<tr class="liste_titre">' ;
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Company " ), $_SERVER [ " PHP_SELF " ], " s.nom " , " " , $param , " " , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.barcode' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Gencod " ), $_SERVER [ " PHP_SELF " ], " s.barcode " , $param , '' , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.code_client' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.code_client' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.code_client " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.code_fournisseur' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.code_fournisseur' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.code_fournisseur " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.code_compta' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.code_compta' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.code_compta " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.code_compta_fournisseur' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.code_compta_fournisseur' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.code_compta_fournisseur " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.town' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Town " ), $_SERVER [ " PHP_SELF " ], " s.town " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.zip' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Zip " ), $_SERVER [ " PHP_SELF " ], " s.zip " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " StateShort " ), $_SERVER [ " PHP_SELF " ], " state.nom " , " " , $param , '' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Country " ), $_SERVER [ " PHP_SELF " ], " country.code_iso " , " " , $param , 'align="center"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " ThirdPartyType " ), $_SERVER [ " PHP_SELF " ], " typent.code " , " " , $param , 'align="center"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.siren' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId1Short " ), $textprofid [ 1 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.siren " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.siret' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId2Short " ), $textprofid [ 2 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.siret " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.ape' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId3Short " ), $textprofid [ 3 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.ape " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.idprof4' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId4Short " ), $textprofid [ 4 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.idprof4 " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.idprof5' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId5Short " ), $textprofid [ 4 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.idprof5 " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.idprof6' ][ 'checked' ])) print_liste_field_titre ( $form -> textwithpicto ( $langs -> trans ( " ProfId6Short " ), $textprofid [ 4 ], 1 , 0 ), $_SERVER [ " PHP_SELF " ], " s.idprof6 " , " " , $param , 'class="nowrap"' , $sortfield , $sortorder );
2016-08-28 15:21:09 +02:00
if ( ! empty ( $arrayfields [ 'customerorsupplier' ][ 'checked' ])) print_liste_field_titre ( '' ); // type of customer
2016-07-07 10:26:40 +02:00
if ( ! empty ( $arrayfields [ 's.fk_prospectlevel' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.fk_prospectlevel' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.fk_prospectlevel " , " " , $param , 'align="center"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.fk_stcomm' ][ 'checked' ])) print_liste_field_titre ( $arrayfields [ 's.fk_stcomm' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.fk_stcomm " , " " , $param , 'align="center"' , $sortfield , $sortorder );
// Extra fields
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label ))
{
foreach ( $extrafields -> attribute_label as $key => $val )
{
if ( ! empty ( $arrayfields [ " ef. " . $key ][ 'checked' ]))
{
$align = $extrafields -> getAlignFlag ( $key );
print_liste_field_titre ( $extralabels [ $key ], $_SERVER [ " PHP_SELF " ], " ef. " . $key , " " , $param ,( $align ? 'align="' . $align . '"' : '' ), $sortfield , $sortorder );
}
}
}
// Hook fields
$parameters = array ( 'arrayfields' => $arrayfields );
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
if ( ! empty ( $arrayfields [ 's.datec' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " DateCreationShort " ), $_SERVER [ " PHP_SELF " ], " s.datec " , " " , $param , 'align="center" class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.tms' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " DateModificationShort " ), $_SERVER [ " PHP_SELF " ], " s.tms " , " " , $param , 'align="center" class="nowrap"' , $sortfield , $sortorder );
if ( ! empty ( $arrayfields [ 's.status' ][ 'checked' ])) print_liste_field_titre ( $langs -> trans ( " Status " ), $_SERVER [ " PHP_SELF " ], " s.status " , " " , $param , 'align="center"' , $sortfield , $sortorder );
print_liste_field_titre ( $selectedfields , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="right"' , $sortfield , $sortorder , 'maxwidthsearch ' );
print " </tr> \n " ;
// Fields title search
print '<tr class="liste_titre">' ;
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
if ( ! empty ( $search_nom_only ) && empty ( $search_nom )) $search_nom = $search_nom_only ;
print '<input class="flat searchstring" type="text" name="search_nom" size="8" value="' . dol_escape_htmltag ( $search_nom ) . '">' ;
print '</td>' ;
}
// Barcode
if ( ! empty ( $arrayfields [ 's.barcode' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" type="text" name="sbarcode" size="6" value="' . dol_escape_htmltag ( $search_barcode ) . '">' ;
print '</td>' ;
}
// Customer code
if ( ! empty ( $arrayfields [ 's.code_client' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="8" type="text" name="search_customer_code" value="' . dol_escape_htmltag ( $search_customer_code ) . '">' ;
print '</td>' ;
}
// Supplier code
if ( ! empty ( $arrayfields [ 's.code_fournisseur' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="8" type="text" name="search_supplier_code" value="' . dol_escape_htmltag ( $search_supplier_code ) . '">' ;
print '</td>' ;
}
// Account Customer code
if ( ! empty ( $arrayfields [ 's.code_compta' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="8" type="text" name="search_account_customer_code" value="' . dol_escape_htmltag ( $search_account_customer_code ) . '">' ;
print '</td>' ;
}
// Account Supplier code
if ( ! empty ( $arrayfields [ 's.code_compta_fournisseur' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat" size="8" type="text" name="search_account_supplier_code" value="' . dol_escape_htmltag ( $search_account_supplier_code ) . '">' ;
print '</td>' ;
}
// Town
if ( ! empty ( $arrayfields [ 's.town' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="6" type="text" name="search_town" value="' . dol_escape_htmltag ( $search_town ) . '">' ;
print '</td>' ;
}
// Zip
if ( ! empty ( $arrayfields [ 's.zip' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_zip" value="' . dol_escape_htmltag ( $search_zip ) . '">' ;
print '</td>' ;
}
// State
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="' . dol_escape_htmltag ( $search_state ) . '">' ;
print '</td>' ;
}
// Country
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ]))
{
print '<td class="liste_titre" align="center">' ;
print $form -> select_country ( $search_country , 'search_country' , '' , 0 , 'maxwidth100' );
print '</td>' ;
}
// Company type
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ]))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">' ;
print $form -> selectarray ( " search_type_thirdparty " , $formcompany -> typent_array ( 0 ), $search_type_thirdparty , 0 , 0 , 0 , '' , 0 , 0 , 0 , ( empty ( $conf -> global -> SOCIETE_SORT_ON_TYPEENT ) ? 'ASC' : $conf -> global -> SOCIETE_SORT_ON_TYPEENT ));
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.siren' ][ 'checked' ]))
{
// IdProf1
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof1" value="' . dol_escape_htmltag ( $search_idprof1 ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.siret' ][ 'checked' ]))
{
// IdProf2
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof2" value="' . dol_escape_htmltag ( $search_idprof2 ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.ape' ][ 'checked' ]))
{
// IdProf3
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof3" value="' . dol_escape_htmltag ( $search_idprof3 ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.idprof4' ][ 'checked' ]))
{
// IdProf4
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof4" value="' . dol_escape_htmltag ( $search_idprof4 ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.idprof5' ][ 'checked' ]))
{
// IdProf5
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof5" value="' . dol_escape_htmltag ( $search_idprof5 ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.idprof6' ][ 'checked' ]))
{
// IdProf6
print '<td class="liste_titre">' ;
print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="' . dol_escape_htmltag ( $search_idprof6 ) . '">' ;
print '</td>' ;
}
// Type (customer/prospect/supplier)
2016-08-28 15:21:09 +02:00
if ( ! empty ( $arrayfields [ 'customerorsupplier' ][ 'checked' ]))
{
print '<td class="liste_titre maxwidthonsmartphone" align="middle">' ;
if ( $type != '' ) print '<input type="hidden" name="type" value="' . $type . '">' ;
print '<select class="flat" name="search_type">' ;
print '<option value="-1"' . ( $search_type == '' ? ' selected' : '' ) . '> </option>' ;
if ( empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS )) print '<option value="1,3"' . ( $search_type == '1,3' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
if ( empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS )) print '<option value="2,3"' . ( $search_type == '2,3' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Prospect' ) . '</option>' ;
//if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="3"'.($search_type=='3'?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>';
print '<option value="4"' . ( $search_type == '4' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Supplier' ) . '</option>' ;
print '<option value="0"' . ( $search_type == '0' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Others' ) . '</option>' ;
print '</select></td>' ;
}
2016-07-07 10:26:40 +02:00
if ( ! empty ( $arrayfields [ 's.fk_prospectlevel' ][ 'checked' ]))
{
// Prospect level
print '<td class="liste_titre" align="center">' ;
$options_from = '<option value=""> </option>' ; // Generate in $options_from the list of each option sorted
foreach ( $tab_level as $tab_level_sortorder => $tab_level_label )
{
$options_from .= '<option value="' . $tab_level_sortorder . '"' . ( $search_level_from == $tab_level_sortorder ? ' selected' : '' ) . '>' ;
$options_from .= $langs -> trans ( $tab_level_label );
$options_from .= '</option>' ;
}
array_reverse ( $tab_level , true ); // Reverse the list
$options_to = '<option value=""> </option>' ; // Generate in $options_to the list of each option sorted in the reversed order
foreach ( $tab_level as $tab_level_sortorder => $tab_level_label )
{
$options_to .= '<option value="' . $tab_level_sortorder . '"' . ( $search_level_to == $tab_level_sortorder ? ' selected' : '' ) . '>' ;
$options_to .= $langs -> trans ( $tab_level_label );
$options_to .= '</option>' ;
}
// Print these two select
print $langs -> trans ( " From " ) . ' <select class="flat" name="search_level_from">' . $options_from . '</select>' ;
print ' ' ;
print $langs -> trans ( " to " ) . ' <select class="flat" name="search_level_to">' . $options_to . '</select>' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.fk_stcomm' ][ 'checked' ]))
{
// Prospect status
print '<td class="liste_titre maxwidthonsmartphone" align="center">' ;
$arraystcomm = array ();
foreach ( $prospectstatic -> cacheprospectstatus as $key => $val )
2015-10-22 01:10:25 +02:00
{
2016-07-07 10:26:40 +02:00
$arraystcomm [ $val [ 'id' ]] = ( $langs -> trans ( " StatusProspect " . $val [ 'id' ]) != " StatusProspect " . $val [ 'id' ] ? $langs -> trans ( " StatusProspect " . $val [ 'id' ]) : $val [ 'label' ]);
}
print $form -> selectarray ( 'search_stcomm' , $arraystcomm , $search_stcomm , - 2 );
print '</td>' ;
}
// Extra fields
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label ))
{
foreach ( $extrafields -> attribute_label as $key => $val )
{
if ( ! empty ( $arrayfields [ " ef. " . $key ][ 'checked' ]))
2015-10-22 01:10:25 +02:00
{
2016-07-07 10:26:40 +02:00
$align = $extrafields -> getAlignFlag ( $key );
$typeofextrafield = $extrafields -> attribute_type [ $key ];
print '<td class="liste_titre' . ( $align ? ' ' . $align : '' ) . '">' ;
if ( in_array ( $typeofextrafield , array ( 'varchar' , 'int' , 'double' , 'select' )))
{
$crit = $val ;
$tmpkey = preg_replace ( '/search_options_/' , '' , $key );
$searchclass = '' ;
if ( in_array ( $typeofextrafield , array ( 'varchar' , 'select' ))) $searchclass = 'searchstring' ;
if ( in_array ( $typeofextrafield , array ( 'int' , 'double' ))) $searchclass = 'searchnum' ;
print '<input class="flat' . ( $searchclass ? ' ' . $searchclass : '' ) . '" size="4" type="text" name="search_options_' . $tmpkey . '" value="' . dol_escape_htmltag ( $search_array_options [ 'search_options_' . $tmpkey ]) . '">' ;
}
print '</td>' ;
2015-10-22 01:10:25 +02:00
}
2016-07-07 10:26:40 +02: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 [ 's.datec' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '</td>' ;
}
// Date modification
if ( ! empty ( $arrayfields [ 's.tms' ][ 'checked' ]))
{
print '<td class="liste_titre">' ;
print '</td>' ;
}
// Status
if ( ! empty ( $arrayfields [ 's.status' ][ 'checked' ]))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">' ;
print $form -> selectarray ( 'search_status' , array ( '0' => $langs -> trans ( 'ActivityCeased' ), '1' => $langs -> trans ( 'InActivity' )), $search_status );
print '</td>' ;
}
// Action column
print '<td class="liste_titre" align="right">' ;
$searchpitco = $form -> showFilterAndCheckAddButtons ( 0 );
print $searchpitco ;
print '</td>' ;
2015-06-22 15:48:48 +02:00
2016-07-07 10:26:40 +02:00
print " </tr> \n " ;
$var = True ;
2016-11-02 12:16:46 +01:00
$i = 0 ;
2016-07-07 10:26:40 +02:00
while ( $i < min ( $num , $limit ))
{
$obj = $db -> fetch_object ( $resql );
$var =! $var ;
2015-11-11 17:05:18 +01:00
2016-07-07 10:26:40 +02:00
$companystatic -> id = $obj -> rowid ;
$companystatic -> name = $obj -> name ;
$companystatic -> canvas = $obj -> canvas ;
$companystatic -> client = $obj -> client ;
$companystatic -> status = $obj -> status ;
$companystatic -> fournisseur = $obj -> fournisseur ;
$companystatic -> code_client = $obj -> code_client ;
$companystatic -> code_fournisseur = $obj -> code_fournisseur ;
$companystatic -> fk_prospectlevel = $obj -> fk_prospectlevel ;
$companystatic -> name_alias = $obj -> name_alias ;
print " <tr " . $bc [ $var ] . " > " ;
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ]))
2015-10-14 23:50:36 +02:00
{
2016-07-07 10:26:40 +02:00
print " <td> " ;
print $companystatic -> getNomUrl ( 1 , '' , 100 );
print " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
2013-09-16 17:10:49 +02:00
// Barcode
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 's.barcode' ][ 'checked' ]))
2016-07-07 10:26:40 +02:00
{
print '<td>' . $obj -> barcode . '</td>' ;
}
2015-10-16 23:03:20 +02:00
// Customer code
if ( ! empty ( $arrayfields [ 's.code_client' ][ 'checked' ]))
2016-07-07 10:26:40 +02:00
{
print '<td>' . $obj -> code_client . '</td>' ;
}
// Supplier code
2015-10-16 23:03:20 +02:00
if ( ! empty ( $arrayfields [ 's.code_fournisseur' ][ 'checked' ]))
2016-07-07 10:26:40 +02:00
{
print '<td>' . $obj -> code_fournisseur . '</td>' ;
}
// Account customer code
2015-10-16 23:03:20 +02:00
if ( ! empty ( $arrayfields [ 's.code_compta' ][ 'checked' ]))
2016-07-07 10:26:40 +02:00
{
print '<td>' . $obj -> code_compta . '</td>' ;
}
// Account supplier code
2015-10-16 23:03:20 +02:00
if ( ! empty ( $arrayfields [ 's.code_compta_fournisseur' ][ 'checked' ]))
2016-07-07 10:26:40 +02:00
{
print '<td>' . $obj -> code_compta_fournisseur . '</td>' ;
}
// Town
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 's.town' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> town . " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
2016-07-07 10:26:40 +02:00
// Zip
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 's.zip' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> zip . " </td> \n " ;
}
// State
2016-02-10 19:28:10 +01:00
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ]))
2016-01-15 23:48:06 +01:00
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> state_name . " </td> \n " ;
}
2015-10-14 23:50:36 +02:00
// Country
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print '<td align="center">' ;
$tmparray = getCountry ( $obj -> fk_pays , 'all' );
print $tmparray [ 'label' ];
print '</td>' ;
2015-10-14 23:50:36 +02:00
}
2016-07-07 10:26:40 +02:00
// Type ent
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print '<td align="center">' ;
if ( count ( $typenArray ) == 0 ) $typenArray = $formcompany -> typent_array ( 1 );
print $typenArray [ $obj -> typent_code ];
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 's.siren' ][ 'checked' ]))
{
print " <td> " . $obj -> idprof1 . " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
if ( ! empty ( $arrayfields [ 's.siret' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> idprof2 . " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
if ( ! empty ( $arrayfields [ 's.ape' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> idprof3 . " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
if ( ! empty ( $arrayfields [ 's.idprof4' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> idprof4 . " </td> \n " ;
2015-10-14 23:50:36 +02:00
}
2015-10-16 23:03:20 +02:00
if ( ! empty ( $arrayfields [ 's.idprof5' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> idprof5 . " </td> \n " ;
2015-10-16 23:03:20 +02:00
}
if ( ! empty ( $arrayfields [ 's.idprof6' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print " <td> " . $obj -> idprof6 . " </td> \n " ;
2015-10-16 23:03:20 +02:00
}
2016-07-07 10:26:40 +02:00
// Type
2016-08-28 15:21:09 +02:00
if ( ! empty ( $arrayfields [ 'customerorsupplier' ][ 'checked' ]))
{
print '<td align="center">' ;
$s = '' ;
if (( $obj -> client == 1 || $obj -> client == 3 ) && empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS ))
{
$companystatic -> name = $langs -> trans ( " Customer " );
$companystatic -> name_alias = '' ;
$s .= $companystatic -> getNomUrl ( 0 , 'customer' );
}
if (( $obj -> client == 2 || $obj -> client == 3 ) && empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS ))
{
if ( $s ) $s .= " / " ;
$companystatic -> name = $langs -> trans ( " Prospect " );
$companystatic -> name_alias = '' ;
$s .= $companystatic -> getNomUrl ( 0 , 'prospect' );
}
if ( ! empty ( $conf -> fournisseur -> enabled ) && $obj -> fournisseur )
{
if ( $s ) $s .= " / " ;
$companystatic -> name = $langs -> trans ( " Supplier " );
$companystatic -> name_alias = '' ;
$s .= $companystatic -> getNomUrl ( 0 , 'supplier' );
}
print $s ;
print '</td>' ;
}
2016-10-05 17:20:56 +02:00
2015-10-23 13:52:51 +02:00
if ( ! empty ( $arrayfields [ 's.fk_prospectlevel' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
// Prospect level
print '<td align="center">' ;
print $companystatic -> getLibProspLevel ();
print " </td> " ;
2015-10-23 13:52:51 +02:00
}
2016-10-05 17:20:56 +02:00
2015-10-23 13:52:51 +02:00
if ( ! empty ( $arrayfields [ 's.fk_stcomm' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
// Prospect status
print '<td align="center" class="nowrap"><div class="nowrap">' ;
print '<div class="inline-block">' . $companystatic -> LibProspCommStatut ( $obj -> stcomm_id , 2 , $prospectstatic -> cacheprospectstatus [ $obj -> stcomm_id ][ 'label' ]);
print '</div> - <div class="inline-block">' ;
2015-10-23 13:52:51 +02:00
foreach ( $prospectstatic -> cacheprospectstatus as $key => $val )
{
2016-07-07 10:26:40 +02:00
$titlealt = 'default' ;
if ( ! empty ( $val [ 'code' ]) && ! in_array ( $val [ 'code' ], array ( 'ST_NO' , 'ST_NEVER' , 'ST_TODO' , 'ST_PEND' , 'ST_DONE' ))) $titlealt = $val [ 'label' ];
if ( $obj -> stcomm_id != $val [ 'id' ]) print '<a class="pictosubstatus" href="' . $_SERVER [ " PHP_SELF " ] . '?stcommsocid=' . $obj -> rowid . '&stcomm=' . $val [ 'code' ] . '&action=setstcomm' . $param . ( $page ? '&page=' . urlencode ( $page ) : '' ) . '">' . img_action ( $titlealt , $val [ 'code' ]) . '</a>' ;
2015-10-23 13:52:51 +02:00
}
2016-07-07 10:26:40 +02:00
print '</div></div></td>' ;
2015-10-23 13:52:51 +02:00
}
2015-10-29 22:12:11 +01:00
// Extra fields
if ( is_array ( $extrafields -> attribute_label ) && count ( $extrafields -> attribute_label ))
{
2016-10-05 17:20:56 +02:00
foreach ( $extrafields -> attribute_label as $key => $val )
2015-10-29 22:12:11 +01:00
{
2016-10-05 17:20:56 +02:00
if ( ! empty ( $arrayfields [ " ef. " . $key ][ 'checked' ]))
2015-10-29 22:12:11 +01:00
{
2016-07-07 10:26:40 +02:00
print '<td' ;
$align = $extrafields -> getAlignFlag ( $key );
if ( $align ) print ' align="' . $align . '"' ;
print '>' ;
$tmpkey = 'options_' . $key ;
print $extrafields -> showOutputField ( $key , $obj -> $tmpkey , '' , 1 );
2015-10-29 22:12:11 +01:00
print '</td>' ;
}
}
}
2015-10-14 23:50:36 +02:00
// Fields from hook
2016-07-07 10:26:40 +02:00
$parameters = array ( 'arrayfields' => $arrayfields , 'obj' => $obj );
$reshook = $hookmanager -> executeHooks ( 'printFieldListValue' , $parameters ); // Note that $action and $object may have been modified by hook
2015-06-22 15:48:48 +02:00
print $hookmanager -> resPrint ;
2015-10-25 18:15:37 +01:00
// Date creation
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 's.datec' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print '<td align="center" class="nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_creation ), 'dayhour' );
2015-10-14 23:50:36 +02:00
print '</td>' ;
}
2015-10-25 18:15:37 +01:00
// Date modification
2015-10-14 23:50:36 +02:00
if ( ! empty ( $arrayfields [ 's.tms' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print '<td align="center" class="nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_update ), 'dayhour' );
2015-10-14 23:50:36 +02:00
print '</td>' ;
}
2015-10-25 18:15:37 +01:00
// Status
if ( ! empty ( $arrayfields [ 's.status' ][ 'checked' ]))
{
2016-07-07 10:26:40 +02:00
print '<td align="center" class="nowrap">' . $companystatic -> getLibStatut ( 3 ) . '</td>' ;
2015-10-25 18:15:37 +01:00
}
2015-10-14 23:50:36 +02:00
// Action column
2016-07-07 10:26:40 +02:00
print '<td></td>' ;
2015-06-30 13:14:19 +02:00
2016-07-07 10:26:40 +02:00
print '</tr>' . " \n " ;
$i ++ ;
}
2009-01-26 22:57:14 +01:00
2016-07-07 10:26:40 +02:00
$db -> free ( $resql );
2015-06-22 15:48:48 +02:00
2016-07-07 10:26:40 +02:00
$parameters = array ( 'arrayfields' => $arrayfields , 'sql' => $sql );
$reshook = $hookmanager -> executeHooks ( 'printFieldListFooter' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2009-01-26 22:57:14 +01:00
2016-07-07 10:26:40 +02:00
print " </table> " ;
2009-01-26 22:57:14 +01:00
2016-07-07 10:26:40 +02:00
print '</form>' ;
2002-12-13 17:31:44 +01:00
2012-02-01 11:32:55 +01:00
llxFooter ();
2002-12-13 17:31:44 +01:00
$db -> close ();