40require_once 
'../main.inc.php';
 
   41include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
 
   42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
 
   43require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   44require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
 
   45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   46require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
 
   50$langs->loadLangs(array(
"companies", 
"commercial", 
"customers", 
"suppliers", 
"bills", 
"compta", 
"categories", 
"cashdesk"));
 
   54$action   = 
GETPOST(
'action', 
'aZ09');
 
   55$massaction = 
GETPOST(
'massaction', 
'alpha');
 
   56$show_files = 
GETPOST(
'show_files', 
'int');
 
   57$confirm  = 
GETPOST(
'confirm', 
'alpha');
 
   58$toselect   = 
GETPOST(
'toselect', 
'array');
 
   59$contextpage = 
GETPOST(
'contextpage', 
'aZ') ? 
GETPOST(
'contextpage', 
'aZ') : 
'thirdpartylist';
 
   60$optioncss  = 
GETPOST(
'optioncss', 
'alpha');
 
   61if ($contextpage == 
'poslist') {
 
   64$mode = 
GETPOST(
"mode", 
'alpha');
 
   67$search_all = trim(
GETPOST(
'search_all', 
'alphanohtml') ? 
GETPOST(
'search_all', 
'alphanohtml') : 
GETPOST(
'sall', 
'alphanohtml'));
 
   68$search_cti = preg_replace(
'/^0+/', 
'', preg_replace(
'/[^0-9]/', 
'', 
GETPOST(
'search_cti', 
'alphanohtml'))); 
 
   70$search_id = trim(
GETPOST(
"search_id", 
"int"));
 
   71$search_nom = trim(
GETPOST(
"search_nom", 
'restricthtml'));
 
   72$search_alias = trim(
GETPOST(
"search_alias", 
'restricthtml'));
 
   73$search_nom_only = trim(
GETPOST(
"search_nom_only", 
'restricthtml'));
 
   74$search_barcode = trim(
GETPOST(
"search_barcode", 
'alpha'));
 
   75$search_customer_code = trim(
GETPOST(
'search_customer_code', 
'alpha'));
 
   76$search_supplier_code = trim(
GETPOST(
'search_supplier_code', 
'alpha'));
 
   77$search_account_customer_code = trim(
GETPOST(
'search_account_customer_code', 
'alpha'));
 
   78$search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code', 
'alpha'));
 
   79$search_address = trim(
GETPOST(
'search_address', 
'alpha'));
 
   80$search_zip = trim(
GETPOST(
"search_zip", 
'alpha'));
 
   81$search_town = trim(
GETPOST(
"search_town", 
'alpha'));
 
   82$search_state = trim(
GETPOST(
"search_state", 
'alpha'));
 
   83$search_region = trim(
GETPOST(
"search_region", 
'alpha'));
 
   84$search_email = trim(
GETPOST(
'search_email', 
'alpha'));
 
   85$search_phone = trim(
GETPOST(
'search_phone', 
'alpha'));
 
   86$search_fax = trim(
GETPOST(
'search_fax', 
'alpha'));
 
   87$search_url = trim(
GETPOST(
'search_url', 
'alpha'));
 
   88$search_idprof1 = trim(
GETPOST(
'search_idprof1', 
'alpha'));
 
   89$search_idprof2 = trim(
GETPOST(
'search_idprof2', 
'alpha'));
 
   90$search_idprof3 = trim(
GETPOST(
'search_idprof3', 
'alpha'));
 
   91$search_idprof4 = trim(
GETPOST(
'search_idprof4', 
'alpha'));
 
   92$search_idprof5 = trim(
GETPOST(
'search_idprof5', 
'alpha'));
 
   93$search_idprof6 = trim(
GETPOST(
'search_idprof6', 
'alpha'));
 
   94$search_vat = trim(
GETPOST(
'search_vat', 
'alpha'));
 
   95$search_sale = 
GETPOST(
"search_sale", 
'int');
 
   96$search_categ_cus = 
GETPOST(
"search_categ_cus", 
'int');
 
   97$search_categ_sup = 
GETPOST(
"search_categ_sup", 
'int');
 
   98$search_country = 
GETPOST(
"search_country", 
'intcomma');
 
   99$search_type_thirdparty = 
GETPOST(
"search_type_thirdparty", 
'int');
 
  100$search_price_level = 
GETPOST(
'search_price_level', 
'int');
 
  101$search_staff = 
GETPOST(
"search_staff", 
'int');
 
  102$search_status = 
GETPOST(
"search_status", 
'int');
 
  103$search_type = 
GETPOST(
'search_type', 
'alpha');
 
  104$search_level = 
GETPOST(
"search_level", 
"array:alpha");
 
  105$search_stcomm = 
GETPOST(
'search_stcomm', 
"array:int");
 
  106$search_import_key  = trim(
GETPOST(
"search_import_key", 
"alpha"));
 
  107$search_parent_name = trim(
GETPOST(
'search_parent_name', 
'alpha'));
 
  109$search_date_creation_startmonth = 
GETPOST(
'search_date_creation_startmonth', 
'int');
 
  110$search_date_creation_startyear = 
GETPOST(
'search_date_creation_startyear', 
'int');
 
  111$search_date_creation_startday = 
GETPOST(
'search_date_creation_startday', 
'int');
 
  112$search_date_creation_start = 
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); 
 
  113$search_date_creation_endmonth = 
GETPOST(
'search_date_creation_endmonth', 
'int');
 
  114$search_date_creation_endyear = 
GETPOST(
'search_date_creation_endyear', 
'int');
 
  115$search_date_creation_endday = 
GETPOST(
'search_date_creation_endday', 
'int');
 
  116$search_date_creation_end = 
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);  
 
  118$search_date_modif_startmonth = 
GETPOST(
'search_date_modif_startmonth', 
'int');
 
  119$search_date_modif_startyear = 
GETPOST(
'search_date_modif_startyear', 
'int');
 
  120$search_date_modif_startday = 
GETPOST(
'search_date_modif_startday', 
'int');
 
  121$search_date_modif_start = 
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); 
 
  122$search_date_modif_endmonth = 
GETPOST(
'search_date_modif_endmonth', 
'int');
 
  123$search_date_modif_endyear = 
GETPOST(
'search_date_modif_endyear', 
'int');
 
  124$search_date_modif_endday = 
GETPOST(
'search_date_modif_endday', 
'int');
 
  125$search_date_modif_end = 
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);  
 
  128$type = 
GETPOST(
'type', 
'alpha');
 
  129$place = 
GETPOST(
'place', 
'aZ09') ? 
GETPOST(
'place', 
'aZ09') : 
'0'; 
 
  131$diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
 
  134$limit = 
GETPOST(
'limit', 
'int') ? 
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
  135$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
  136$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
  137$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
  142  $sortfield = 
"s.nom";
 
  144if (empty($page) || $page < 0 || 
GETPOST(
'button_search', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) {
 
  148$offset = $limit * $page;
 
  149$pageprev = $page - 1;
 
  150$pagenext = $page + 1;
 
  153  if (empty($contextpage) || $contextpage == 
'thirdpartylist') {
 
  154    $contextpage = 
'customerlist';
 
  156  if ($search_type == 
'') {
 
  157    $search_type = 
'1,3';
 
  161  if (empty($contextpage) || $contextpage == 
'thirdpartylist') {
 
  162    $contextpage = 
'prospectlist';
 
  164  if ($search_type == 
'') {
 
  165    $search_type = 
'2,3';
 
  169  if (empty($contextpage) || $contextpage == 
'poslist') {
 
  170    $contextpage = 
'poslist';
 
  172  if ($search_type == 
'') {
 
  173    $search_type = 
'1,2,3';
 
  177  if (empty($contextpage) || $contextpage == 
'thirdpartylist') {
 
  178    $contextpage = 
'supplierlist';
 
  180  if ($search_type == 
'') {
 
  188$hookmanager->initHooks(array($contextpage));
 
  191$extrafields->fetch_name_optionals_label($object->table_element);
 
  193$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, 
'', 
'search_');
 
  196$fieldstosearchall = array(
 
  197  's.nom'=>
"ThirdPartyName",
 
  198  's.name_alias'=>
"AliasNameShort",
 
  199  's.code_client'=>
"CustomerCode",
 
  200  's.code_fournisseur'=>
"SupplierCode",
 
  201  's.code_compta'=>
"CustomerAccountancyCodeShort",
 
  202  's.code_compta_fournisseur'=>
"SupplierAccountancyCodeShort",
 
  207  's.tva_intra'=>
"VATIntra",
 
  208  's.siren'=>
"ProfId1",
 
  209  's.siret'=>
"ProfId2",
 
  214if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp != 
"ProfId4".$mysoc->country_code && $tmp != 
'-') {
 
  215  $fieldstosearchall[
's.idprof4'] = 
'ProfId4';
 
  217if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp != 
"ProfId5".$mysoc->country_code && $tmp != 
'-') {
 
  218  $fieldstosearchall[
's.idprof5'] = 
'ProfId5';
 
  220if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp != 
"ProfId6".$mysoc->country_code && $tmp != 
'-') {
 
  221  $fieldstosearchall[
's.idprof6'] = 
'ProfId6';
 
  223if (isModEnabled(
'barcode')) {
 
  224  $fieldstosearchall[
's.barcode'] = 
'Gencod';
 
  233$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist', 
'customerlist', 
'prospectlist', 
'poslist')) ? 1 : 0);
 
  234$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
 
  235$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
 
  236$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
 
  237$checkedtypetiers = 1;
 
  247$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
 
  248$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
 
  250  's.rowid'=>array(
'label'=>
"TechnicalID", 
'position'=>1, 
'checked'=>-1, 
'enabled'=>1),
 
  251  's.nom'=>array(
'label'=>
"ThirdPartyName", 
'position'=>2, 
'checked'=>1),
 
  252  's.name_alias'=>array(
'label'=>
"AliasNameShort", 
'position'=>3, 
'checked'=>1),
 
  253  's.barcode'=>array(
'label'=>
"Gencod", 
'position'=>5, 
'checked'=>1, 
'enabled'=>(isModEnabled(
'barcode'))),
 
  254  's.code_client'=>array(
'label'=>
"CustomerCodeShort", 
'position'=>10, 
'checked'=>$checkedcustomercode),
 
  255  's.code_fournisseur'=>array(
'label'=>
"SupplierCodeShort", 
'position'=>11, 
'checked'=>$checkedsuppliercode, 
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
 
  256  's.code_compta'=>array(
'label'=>
"CustomerAccountancyCodeShort", 
'position'=>13, 
'checked'=>$checkedcustomeraccountcode),
 
  257  's.code_compta_fournisseur'=>array(
'label'=>
"SupplierAccountancyCodeShort", 
'position'=>14, 
'checked'=>$checkedsupplieraccountcode, 
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
 
  258  's.address'=>array(
'label'=>
"Address", 
'position'=>19, 
'checked'=>0),
 
  259  's.zip'=>array(
'label'=>
"Zip", 
'position'=>20, 
'checked'=>1),
 
  260  's.town'=>array(
'label'=>
"Town", 
'position'=>21, 
'checked'=>0),
 
  261  'state.nom'=>array(
'label'=>
"State", 
'position'=>22, 
'checked'=>0),
 
  262  'region.nom'=>array(
'label'=>
"Region", 
'position'=>23, 
'checked'=>0),
 
  263  'country.code_iso'=>array(
'label'=>
"Country", 
'position'=>24, 
'checked'=>0),
 
  264  's.email'=>array(
'label'=>
"Email", 
'position'=>25, 
'checked'=>0),
 
  265  's.url'=>array(
'label'=>
"Url", 
'position'=>26, 
'checked'=>0),
 
  266  's.phone'=>array(
'label'=>
"Phone", 
'position'=>27, 
'checked'=>1),
 
  267  's.fax'=>array(
'label'=>
"Fax", 
'position'=>28, 
'checked'=>0),
 
  268  'typent.code'=>array(
'label'=>
"ThirdPartyType", 
'position'=>29, 
'checked'=>$checkedtypetiers),
 
  269  'staff.code'=>array(
'label'=>
"Workforce", 
'position'=>31, 
'checked'=>0),
 
  270  's.siren'=>array(
'label'=>
"ProfId1Short", 
'position'=>40, 
'checked'=>$checkedprofid1),
 
  271  's.siret'=>array(
'label'=>
"ProfId2Short", 
'position'=>41, 
'checked'=>$checkedprofid2),
 
  272  's.ape'=>array(
'label'=>
"ProfId3Short", 
'position'=>42, 
'checked'=>$checkedprofid3),
 
  273  's.idprof4'=>array(
'label'=>
"ProfId4Short", 
'position'=>43, 
'checked'=>$checkedprofid4),
 
  274  's.idprof5'=>array(
'label'=>
"ProfId5Short", 
'position'=>44, 
'checked'=>$checkedprofid5),
 
  275  's.idprof6'=>array(
'label'=>
"ProfId6Short", 
'position'=>45, 
'checked'=>$checkedprofid6),
 
  276  's.tva_intra'=>array(
'label'=>
"VATIntraShort", 
'position'=>50, 
'checked'=>0),
 
  277  'customerorsupplier'=>array(
'label'=>
'NatureOfThirdParty', 
'position'=>61, 
'checked'=>1),
 
  278  's.fk_prospectlevel'=>array(
'label'=>
"ProspectLevel", 
'position'=>62, 
'checked'=>$checkprospectlevel),
 
  279  's.fk_stcomm'=>array(
'label'=>
"StatusProsp", 
'position'=>63, 
'checked'=>$checkstcomm),
 
  280  's2.nom'=>array(
'label'=>
'ParentCompany', 
'position'=>64, 
'checked'=>0),
 
  281  's.datec'=>array(
'label'=>
"DateCreation", 
'checked'=>0, 
'position'=>500),
 
  282  's.tms'=>array(
'label'=>
"DateModificationShort", 
'checked'=>0, 
'position'=>500),
 
  283  's.status'=>array(
'label'=>
"Status", 
'checked'=>1, 
'position'=>1000),
 
  284  's.import_key'=>array(
'label'=>
"ImportId", 
'checked'=>0, 
'position'=>1100),
 
  287  $arrayfields[
's.price_level'] = array(
'label'=>
"PriceLevel", 
'position'=>30, 
'checked'=>0);
 
  291$arrayfields[
'sales.representative'] = array(
'label'=>$langs->trans(
"SalesRepresentatives"), 
'checked'=>1, 
'position'=>12);
 
  294include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  300$socid = 
GETPOST(
'socid', 
'int');
 
  302  $socid = $user->socid;
 
  312if ($action == 
"change" && $user->hasRight(
'takepos', 
'run')) { 
 
  313  $idcustomer = 
GETPOST(
'idcustomer', 
'int');
 
  316  $sql = 
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
 
  317  $result = $db->query($sql);
 
  318  $num_lines = $db->num_rows($result);
 
  319  if ($num_lines == 0) {
 
  320    require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
 
  322    $constforthirdpartyid = 
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
 
  325    $invoice->module_source = 
'takepos';
 
  326    $invoice->pos_source = $_SESSION[
"takeposterminal"];
 
  327    $placeid = $invoice->create($user);
 
  328    $sql = 
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
 
  332  $sql = 
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
 
  333  $resql = $db->query($sql); ?>
 
  335    console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
 
  336    parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>", 
function() {
 
  338      <?php 
if (!$resql) { ?>
 
  339        alert(
'Error failed to update customer on draft invoice.');
 
  341      parent.$.colorbox.close(); 
 
  348if (
GETPOST(
'cancel', 
'alpha')) {
 
  352if (!
GETPOST(
'confirmmassaction', 
'alpha') && $massaction != 
'presend' && $massaction != 
'confirm_presend') {
 
  356$parameters = array();
 
  357$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  362if (empty($reshook)) {
 
  364  include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
 
  367  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  371    $search_categ_cus = 0;
 
  372    $search_categ_sup = 0;
 
  374    $search_barcode = 
"";
 
  375    $search_customer_code = 
'';
 
  376    $search_supplier_code = 
'';
 
  377    $search_account_customer_code = 
'';
 
  378    $search_account_supplier_code = 
'';
 
  379    $search_address = 
'';
 
  384    $search_country = 
'';
 
  389    $search_idprof1 = 
'';
 
  390    $search_idprof2 = 
'';
 
  391    $search_idprof3 = 
'';
 
  392    $search_idprof4 = 
'';
 
  393    $search_idprof5 = 
'';
 
  394    $search_idprof6 = 
'';
 
  397    $search_price_level = 
'';
 
  398    $search_type_thirdparty = 
'';
 
  400    $search_date_creation_startmonth = 
"";
 
  401    $search_date_creation_startyear = 
"";
 
  402    $search_date_creation_startday = 
"";
 
  403    $search_date_creation_start = 
"";
 
  404    $search_date_creation_endmonth = 
"";
 
  405    $search_date_creation_endyear = 
"";
 
  406    $search_date_creation_endday = 
"";
 
  407    $search_date_creation_end = 
"";
 
  408    $search_date_modif_startmonth = 
"";
 
  409    $search_date_modif_startyear = 
"";
 
  410    $search_date_modif_startday = 
"";
 
  411    $search_date_modif_start = 
"";
 
  412    $search_date_modif_endmonth = 
"";
 
  413    $search_date_modif_endyear = 
"";
 
  414    $search_date_modif_endday = 
"";
 
  415    $search_date_modif_end = 
"";
 
  419    $search_parent_name = 
'';
 
  420    $search_import_key = 
'';
 
  422    $search_array_options = array();
 
  426  $objectclass = 
'Societe';
 
  427  $objectlabel = 
'ThirdParty';
 
  428  $permissiontoread = $user->hasRight(
'societe', 
'lire');
 
  429  $permissiontodelete = $user->hasRight(
'societe', 
'supprimer');
 
  430  $permissiontoadd = $user->hasRight(
"societe", 
"creer");
 
  431  $uploaddir = $conf->societe->dir_output;
 
  432  include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
 
  434  if ($action == 
'setstcomm') {
 
  435    $object = 
new Client($db);
 
  436    $result = $object->fetch(
GETPOST(
'stcommsocid'));
 
  438    $result = $object->update($object->id, $user);
 
  447if ($search_status == 
'') {
 
  466$form = 
new Form($db);
 
  468$companystatic = 
new Societe($db);
 
  469$companyparent = 
new Societe($db);
 
  471$prospectstatic = 
new Client($db);
 
  472$prospectstatic->client = 2;
 
  473$prospectstatic->loadCacheOfProspStatus();
 
  477$title = $langs->trans(
"ThirdParties");
 
  478if ($type == 
'c' && (empty($search_type) || ($search_type == 
'1,3'))) {
 
  479  $title = $langs->trans(
"Customers");
 
  481if ($type == 
'p' && (empty($search_type) || ($search_type == 
'2,3'))) {
 
  482  $title = $langs->trans(
"Prospects");
 
  484if ($type == 
'f' && (empty($search_type) || ($search_type == 
'4'))) {
 
  485  $title = $langs->trans(
"Suppliers");
 
  487$help_url = 
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
 
  492$sql = 
"SELECT code, label, sortorder";
 
  493$sql .= 
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
 
  494$sql .= 
" WHERE active > 0";
 
  495$sql .= 
" ORDER BY sortorder";
 
  496$resql = $db->query($sql);
 
  498  while ($obj = $db->fetch_object($resql)) {
 
  500    $level = $langs->trans($obj->code);
 
  501    if ($level == $obj->code) {
 
  502      $level = $langs->trans($obj->label);
 
  504    $tab_level[$obj->code] = $level;
 
  512$sql = 
"SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
 
  514$sql .= 
" st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
 
  515$sql .= 
" s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
 
  516$sql .= 
" s.tms as date_update, s.datec as date_creation, s.import_key,";
 
  517$sql .= 
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
 
  518$sql .= 
" s2.nom as name2,";
 
  519$sql .= 
" typent.code as typent_code,";
 
  520$sql .= 
" staff.code as staff_code,";
 
  521$sql .= 
" country.code as country_code, country.label as country_label,";
 
  522$sql .= 
" state.code_departement as state_code, state.nom as state_name,";
 
  523$sql .= 
" region.code_region as region_code, region.nom as region_name";
 
  525if ($search_sale && $search_sale != 
'-1') {
 
  526  $sql .= 
", sc.fk_soc, sc.fk_user";
 
  529if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  530  foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  531    $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef.".$key.
" as options_".$key : 
'');
 
  535$parameters = array();
 
  536$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action); 
 
  537$sql .= $hookmanager->resPrint;
 
  538$sql = preg_replace(
'/,\s*$/', 
'', $sql);
 
  543$sql .= 
" FROM ".MAIN_DB_PREFIX.
"societe as s";
 
  544$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
 
  545if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  546  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
 
  549$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
 
  550$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
 
  551$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
 
  552$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
 
  553$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
 
  554$sql .= 
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
 
  556if ($search_sale == -2) {
 
  557  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
 
  559} elseif (!empty($search_sale) && $search_sale != 
'-1' || (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid)) {
 
  560  $sql .= 
" INNER JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux AS sc ON s.rowid = sc.fk_soc";
 
  563$parameters = array();
 
  564$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action); 
 
  565$sql .= $hookmanager->resPrint;
 
  566$sql .= 
" WHERE s.entity IN (".getEntity(
'societe').
")";
 
  568if (!$user->hasRight(
'societe', 
'client', 
'voir') && !$socid) {
 
  569  $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
 
  571if (!$user->hasRight(
'fournisseur', 
'lire')) {
 
  572  $sql .= 
" AND (s.fournisseur <> 1 OR s.client <> 0)"; 
 
  574if ($search_sale == -2) {
 
  575  $sql .= 
" AND sc.fk_user IS NULL";
 
  576} elseif ($search_sale > 0) {
 
  577  $sql .= 
" AND sc.fk_user = ".((int) $search_sale);
 
  579$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
 
  580$searchCategoryCustomerOperator = 0;
 
  582if (!empty($searchCategoryCustomerList)) {
 
  583  $searchCategoryCustomerSqlList = array();
 
  584  $listofcategoryid = 
'';
 
  585  foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
 
  586    if (intval($searchCategoryCustomer) == -2) {
 
  587      $searchCategoryCustomerSqlList[] = 
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
 
  588    } elseif (intval($searchCategoryCustomer) > 0) {
 
  589      if ($searchCategoryCustomerOperator == 0) {
 
  590        $searchCategoryCustomerSqlList[] = 
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).
")";
 
  592        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategoryCustomer);
 
  596  if ($listofcategoryid) {
 
  597    $searchCategoryCustomerSqlList[] = 
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
 
  599  if ($searchCategoryCustomerOperator == 1) {
 
  600    if (!empty($searchCategoryCustomerSqlList)) {
 
  601      $sql .= 
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
 
  604    if (!empty($searchCategoryCustomerSqlList)) {
 
  605      $sql .= 
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
 
  610$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
 
  611$searchCategorySupplierOperator = 0;
 
  613if (!empty($searchCategorySupplierList)) {
 
  614  $searchCategorySupplierSqlList = array();
 
  615  $listofcategoryid = 
'';
 
  616  foreach ($searchCategorySupplierList as $searchCategorySupplier) {
 
  617    if (intval($searchCategorySupplier) == -2) {
 
  618      $searchCategorySupplierSqlList[] = 
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
 
  619    } elseif (intval($searchCategorySupplier) > 0) {
 
  620      if ($searchCategorySupplierOperator == 0) {
 
  621        $searchCategorySupplierSqlList[] = 
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).
")";
 
  623        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategorySupplier);
 
  627  if ($listofcategoryid) {
 
  628    $searchCategorySupplierSqlList[] = 
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
 
  630  if ($searchCategorySupplierOperator == 1) {
 
  631    if (!empty($searchCategorySupplierSqlList)) {
 
  632      $sql .= 
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
 
  635    if (!empty($searchCategorySupplierSqlList)) {
 
  636      $sql .= 
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
 
  641  $sql .= 
natural_search(array_keys($fieldstosearchall), $search_all);
 
  643if (strlen($search_cti)) {
 
  649if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
 
  650  $sql .= 
natural_search(array(
"s.nom", 
"s.name_alias"), $search_nom);
 
  660if ($search_nom_only) {
 
  663if ($search_customer_code) {
 
  666if ($search_supplier_code) {
 
  667  $sql .= 
natural_search(
"s.code_fournisseur", $search_supplier_code);
 
  669if ($search_account_customer_code) {
 
  670  $sql .= 
natural_search(
"s.code_compta", $search_account_customer_code);
 
  672if ($search_account_supplier_code) {
 
  673  $sql .= 
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
 
  675if ($search_address) {
 
  678if (strlen($search_zip)) {
 
  690if ($search_country && $search_country != 
'-1') {
 
  691  $sql .= 
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
 
  696if (strlen($search_phone)) {
 
  699if (strlen($search_fax)) {
 
  705if (strlen($search_idprof1)) {
 
  708if (strlen($search_idprof2)) {
 
  711if (strlen($search_idprof3)) {
 
  714if (strlen($search_idprof4)) {
 
  717if (strlen($search_idprof5)) {
 
  720if (strlen($search_idprof6)) {
 
  723if (strlen($search_vat)) {
 
  727if ($search_type > 0 && in_array($search_type, array(
'1,3', 
'1,2,3', 
'2,3'))) {
 
  728  $sql .= 
" AND s.client IN (".$db->sanitize($search_type).
")";
 
  730if ($search_type > 0 && in_array($search_type, array(
'4'))) {
 
  731  $sql .= 
" AND s.fournisseur = 1";
 
  733if ($search_type == 
'0') {
 
  734  $sql .= 
" AND s.client = 0 AND s.fournisseur = 0";
 
  736if ($search_status != 
'' && $search_status >= 0) {
 
  739if (isModEnabled(
'barcode') && $search_barcode) {
 
  742if ($search_price_level && $search_price_level != 
'-1') {
 
  745if ($search_type_thirdparty && $search_type_thirdparty > 0) {
 
  746  $sql .= 
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
 
  748if (!empty($search_staff) && $search_staff != 
'-1') {
 
  751if ($search_parent_name) {
 
  755  $sql .= 
natural_search(
"s.fk_prospectlevel", join(
',', $search_level), 3);
 
  758  $sql .= 
natural_search(
"s.fk_stcomm", join(
',', $search_stcomm), 2);
 
  760if ($search_import_key) {
 
  763if ($search_date_creation_start) {
 
  764  $sql .= 
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
 
  766if ($search_date_creation_end) {
 
  767  $sql .= 
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
 
  770if ($search_date_modif_start) {
 
  771  $sql .= 
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
 
  773if ($search_date_modif_end) {
 
  774  $sql .= 
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
 
  778include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  780$parameters = array(
'socid' => $socid);
 
  781$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action); 
 
  782if (empty($reshook)) {
 
  784    $sql .= 
" AND s.rowid = ".((int) $socid);
 
  787$sql .= $hookmanager->resPrint;
 
  790$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
 
  791$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action); 
 
  792$sql .= $hookmanager->resPrint;
 
  795$nbtotalofrecords = 
'';
 
  798  $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields, 
'/').
'/', 
'SELECT COUNT(*) as nbtotalofrecords', $sql);
 
  799  $sqlforcount = preg_replace(
'/GROUP BY .*$/', 
'', $sqlforcount);
 
  800  $resql = $db->query($sqlforcount);
 
  802    $objforcount = $db->fetch_object($resql);
 
  803    $nbtotalofrecords = $objforcount->nbtotalofrecords;
 
  808  if (($page * $limit) > $nbtotalofrecords) { 
 
  816$sql .= $db->order($sortfield, $sortorder);
 
  818  $sql .= $db->plimit($limit + 1, $offset);
 
  821$resql = $db->query($sql);
 
  827$num = $db->num_rows($resql);
 
  831if ($num == 1 && 
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all != 
'' || $search_cti != 
'') && $action != 
'list') {
 
  832  $obj = $db->fetch_object($resql);
 
  834  if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
 
  835    if ($obj->client > 0) {
 
  836      header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.$id);
 
  839    if ($obj->fournisseur > 0) {
 
  840      header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.$id);
 
  845  header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.$id);
 
  855$arrayofselected = is_array($toselect) ? $toselect : array();
 
  859  $param .= 
'&mode='.urlencode($mode);
 
  861if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  862  $param .= 
'&contextpage='.urlencode($contextpage);
 
  864if ($limit > 0 && $limit != $conf->liste_limit) {
 
  865  $param .= 
'&limit='.((int) $limit);
 
  867if ($optioncss != 
'') {
 
  868  $param .= 
'&optioncss='.urlencode($optioncss);
 
  870if ($search_all != 
'') {
 
  871  $param = 
"&search_all=".urlencode($search_all);
 
  873if ($search_categ_cus > 0) {
 
  874  $param .= 
'&search_categ_cus='.urlencode($search_categ_cus);
 
  876if ($search_categ_sup > 0) {
 
  877  $param .= 
'&search_categ_sup='.urlencode($search_categ_sup);
 
  879if ($search_sale > 0) {
 
  880  $param .= 
'&search_sale='.urlencode($search_sale);
 
  883  $param .= 
"&search_id=".urlencode($search_id);
 
  885if ($search_nom != 
'') {
 
  886  $param .= 
"&search_nom=".urlencode($search_nom);
 
  888if ($search_alias != 
'') {
 
  889  $param .= 
"&search_alias=".urlencode($search_alias);
 
  891if ($search_address != 
'') {
 
  892  $param .= 
'&search_address='.urlencode($search_address);
 
  894if ($search_zip != 
'') {
 
  895  $param .= 
"&search_zip=".urlencode($search_zip);
 
  897if ($search_town != 
'') {
 
  898  $param .= 
"&search_town=".urlencode($search_town);
 
  900if ($search_phone != 
'') {
 
  901  $param .= 
"&search_phone=".urlencode($search_phone);
 
  903if ($search_fax != 
'') {
 
  904  $param .= 
"&search_fax=".urlencode($search_fax);
 
  906if ($search_email != 
'') {
 
  907  $param .= 
"&search_email=".urlencode($search_email);
 
  909if ($search_url != 
'') {
 
  910  $param .= 
"&search_url=".urlencode($search_url);
 
  912if ($search_state != 
'') {
 
  913  $param .= 
"&search_state=".urlencode($search_state);
 
  915if ($search_region != 
'') {
 
  916  $param .= 
"&search_region=".urlencode($search_region);
 
  918if ($search_country != 
'') {
 
  919  $param .= 
"&search_country=".urlencode($search_country);
 
  921if ($search_customer_code != 
'') {
 
  922  $param .= 
"&search_customer_code=".urlencode($search_customer_code);
 
  924if ($search_supplier_code != 
'') {
 
  925  $param .= 
"&search_supplier_code=".urlencode($search_supplier_code);
 
  927if ($search_account_customer_code != 
'') {
 
  928  $param .= 
"&search_account_customer_code=".urlencode($search_account_customer_code);
 
  930if ($search_account_supplier_code != 
'') {
 
  931  $param .= 
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
 
  933if ($search_barcode != 
'') {
 
  934  $param .= 
"&search_barcode=".urlencode($search_barcode);
 
  936if ($search_idprof1 != 
'') {
 
  937  $param .= 
'&search_idprof1='.urlencode($search_idprof1);
 
  939if ($search_idprof2 != 
'') {
 
  940  $param .= 
'&search_idprof2='.urlencode($search_idprof2);
 
  942if ($search_idprof3 != 
'') {
 
  943  $param .= 
'&search_idprof3='.urlencode($search_idprof3);
 
  945if ($search_idprof4 != 
'') {
 
  946  $param .= 
'&search_idprof4='.urlencode($search_idprof4);
 
  948if ($search_idprof5 != 
'') {
 
  949  $param .= 
'&search_idprof5='.urlencode($search_idprof5);
 
  951if ($search_idprof6 != 
'') {
 
  952  $param .= 
'&search_idprof6='.urlencode($search_idprof6);
 
  954if ($search_vat != 
'') {
 
  955  $param .= 
'&search_vat='.urlencode($search_vat);
 
  957if ($search_price_level != 
'') {
 
  958  $param .= 
'&search_price_level='.urlencode($search_price_level);
 
  960if ($search_type_thirdparty != 
'' && $search_type_thirdparty > 0) {
 
  961  $param .= 
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
 
  963if ($search_type != 
'') {
 
  964  $param .= 
'&search_type='.urlencode($search_type);
 
  966if ($search_status != 
'') {
 
  967  $param .= 
'&search_status='.urlencode($search_status);
 
  969if (is_array($search_level) && count($search_level)) {
 
  970  foreach ($search_level as $slevel) {
 
  971    $param .= 
'&search_level[]='.urlencode($slevel);
 
  974if (is_array($search_stcomm) && count($search_stcomm)) {
 
  975  foreach ($search_stcomm as $slevel) {
 
  976    $param .= 
'&search_stcomm[]='.urlencode($slevel);
 
  979if ($search_parent_name != 
'') {
 
  980  $param .= 
'&search_parent_name='.urlencode($search_parent_name);
 
  982if ($search_import_key != 
'') {
 
  983  $param .= 
'&search_import_key='.urlencode($search_import_key);
 
  986  $param .= 
'&type='.urlencode($type);
 
  988if ($search_date_creation_startmonth) {
 
  989  $param .= 
'&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth);
 
  991if ($search_date_creation_startyear) {
 
  992  $param .= 
'&search_date_creation_startyear='.urlencode($search_date_creation_startyear);
 
  994if ($search_date_creation_startday) {
 
  995  $param .= 
'&search_date_creation_startday='.urlencode($search_date_creation_startday);
 
  997if ($search_date_creation_start) {
 
  998  $param .= 
'&search_date_creation_start='.urlencode($search_date_creation_start);
 
 1000if ($search_date_creation_endmonth) {
 
 1001  $param .= 
'&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth);
 
 1003if ($search_date_creation_endyear) {
 
 1004  $param .= 
'&search_date_creation_endyear='.urlencode($search_date_creation_endyear);
 
 1006if ($search_date_creation_endday) {
 
 1007  $param .= 
'&search_date_creation_endday='.urlencode($search_date_creation_endday);
 
 1009if ($search_date_creation_end) {
 
 1010  $param .= 
'&search_date_creation_end='.urlencode($search_date_creation_end);
 
 1012if ($search_date_modif_startmonth) {
 
 1013  $param .= 
'&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth);
 
 1015if ($search_date_modif_startyear) {
 
 1016  $param .= 
'&search_date_modif_startyear='.urlencode($search_date_modif_startyear);
 
 1018if ($search_date_modif_startday) {
 
 1019  $param .= 
'&search_date_modif_startday='.urlencode($search_date_modif_startday);
 
 1021if ($search_date_modif_start) {
 
 1022  $param .= 
'&search_date_modif_start='.urlencode($search_date_modif_start);
 
 1024if ($search_date_modif_endmonth) {
 
 1025  $param .= 
'&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth);
 
 1027if ($search_date_modif_endyear) {
 
 1028  $param .= 
'&search_date_modif_endyear='.urlencode($search_date_modif_endyear);
 
 1030if ($search_date_modif_endday) {
 
 1031  $param .= 
'&search_date_modif_endday='.urlencode($search_date_modif_endday);
 
 1033if ($search_date_modif_end) {
 
 1034  $param .= 
'&search_date_modif_end=' . urlencode($search_date_modif_end);
 
 1038include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
 
 1040$parameters = array(
'param' => &$param);
 
 1041$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action); 
 
 1042$param .= $hookmanager->resPrint;
 
 1050$arrayofmassactions = array(
 
 1051  'presend'=>
img_picto(
'', 
'email', 
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
 
 1055if (isModEnabled(
'category') && $user->hasRight(
"societe", 
"creer")) {
 
 1056  $arrayofmassactions[
'preaffecttag'] = 
img_picto(
'', 
'category', 
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
 
 1058if ($user->hasRight(
"societe", 
"creer")) {
 
 1059  $arrayofmassactions[
'preenable'] = 
img_picto(
'', 
'stop-circle', 
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
 
 1061if ($user->hasRight(
"societe", 
"creer")) {
 
 1062  $arrayofmassactions[
'predisable'] = 
img_picto(
'', 
'stop-circle', 
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_CEASED));
 
 1064if ($user->hasRight(
"societe", 
"creer")) {
 
 1065  $arrayofmassactions[
'presetcommercial'] = 
img_picto(
'', 
'user', 
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
 
 1067if ($user->hasRight(
'societe', 
'supprimer')) {
 
 1068  $arrayofmassactions[
'predelete'] = 
img_picto(
'', 
'delete', 
'class="pictofixedwidth"').$langs->trans(
"Delete");
 
 1070if (
GETPOST(
'nomassaction', 
'int') || in_array($massaction, array(
'presend', 
'predelete', 
'preaffecttag', 
'preenable', 
'preclose'))) {
 
 1071  $arrayofmassactions = array();
 
 1073$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
 1076$label = 
'MenuNewThirdParty';
 
 1079  $typefilter = 
'&type='.$type;
 
 1081    $label = 
'MenuNewProspect';
 
 1084    $label = 
'MenuNewCustomer';
 
 1087    $label = 
'NewSupplier';
 
 1097if ($contextpage != 
'poslist') {
 
 1098  $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
 
 1099  if (!empty($socid)) {
 
 1100    $url .= 
'&socid='.$socid;
 
 1102  $newcardbutton   = 
'';
 
 1103  $newcardbutton .= 
dolGetButtonTitle($langs->trans(
'ViewList'), 
'', 
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/', 
'', $param), 
'', ((empty($mode) || $mode == 
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
 
 1104  $newcardbutton .= 
dolGetButtonTitle($langs->trans(
'ViewKanban'), 
'', 
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/', 
'', $param), 
'', ($mode == 
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
 
 1105  $newcardbutton .= 
dolGetButtonTitle($langs->trans($label), 
'', 
'fa fa-plus-circle', $url, 
'', $user->hasRight(
'societe', 
'creer'));
 
 1106} elseif ($user->hasRight(
'societe', 
'creer')) {
 
 1107  $url = DOL_URL_ROOT.
'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
 
 1108  $label = 
'MenuNewCustomer';
 
 1109  $newcardbutton = 
dolGetButtonTitle($langs->trans($label), 
'', 
'fa fa-plus-circle', $url);
 
 1112print 
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
 
 1113if ($optioncss != 
'') {
 
 1114  print 
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
 
 1116print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
 1117print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
 1118print 
'<input type="hidden" name="action" value="list">';
 
 1119print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
 1120print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
 1122print 
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
 
 1123if (!empty($place)) {
 
 1124  print 
'<input type="hidden" name="place" value="'.$place.
'">';
 
 1126print 
'<input type="hidden" name="page_y" value="">';
 
 1127print 
'<input type="hidden" name="mode" value="'.$mode.
'">';
 
 1128if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
 
 1129  print 
'<input type="hidden" name="type" value="'.$type.
'">';
 
 1131if (!empty($place)) {
 
 1132  print 
'<input type="hidden" name="place" value="'.$place.
'">';
 
 1135print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'building', 0, $newcardbutton, 
'', $limit, 0, 0, 1);
 
 1137$langs->load(
"other");
 
 1138$textprofid = array();
 
 1139foreach (array(1, 2, 3, 4, 5, 6) as $key) {
 
 1140  $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
 
 1141  $textprofid[$key] = 
'';
 
 1142  if ($label != 
"ProfId".$key.$mysoc->country_code) { 
 
 1143    if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
 
 1146    $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
 
 1151$topicmail = 
"Information";
 
 1152$modelmail = 
"thirdparty";
 
 1154$trackid = 
'thi'.$object->id;
 
 1155include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
 
 1159  foreach ($fieldstosearchall as $key => $val) {
 
 1160    $fieldstosearchall[$key] = $langs->trans($val);
 
 1161    $setupstring .= $key.
"=".$val.
";";
 
 1163  print 
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
 
 1164  print 
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
 
 1168if (empty($type) || $type == 
'c' || $type == 
'p') {
 
 1169  if (isModEnabled(
'categorie') && $user->hasRight(
"categorie", 
"lire")) {
 
 1170    require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
 1171    $moreforfilter .= 
'<div class="divsearchfield">';
 
 1172    $tmptitle = $langs->trans(
'Categories');
 
 1173    $moreforfilter .= 
img_picto($tmptitle, 
'category', 
'class="pictofixedwidth"');
 
 1174    $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus, 
'search_categ_cus', 1, $langs->trans(
'CustomersProspectsCategoriesShort'));
 
 1175    $moreforfilter .= 
'</div>';
 
 1179if (empty($type) || $type == 
'f') {
 
 1180  if (isModEnabled(
"fournisseur") && isModEnabled(
'categorie') && $user->hasRight(
"categorie", 
"lire")) {
 
 1181    require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
 1182    $moreforfilter .= 
'<div class="divsearchfield">';
 
 1183    $tmptitle = $langs->trans(
'Categories');
 
 1184    $moreforfilter .= 
img_picto($tmptitle, 
'category', 
'class="pictofixedwidth"');
 
 1185    $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup, 
'search_categ_sup', 1, $langs->trans(
'SuppliersCategoriesShort'));
 
 1186    $moreforfilter .= 
'</div>';
 
 1191if ($user->hasRight(
"societe", 
"client", 
"voir") || $socid) {
 
 1192  $moreforfilter .= 
'<div class="divsearchfield">';
 
 1193  $tmptitle = $langs->trans(
'SalesRepresentatives');
 
 1194  $moreforfilter .= 
img_picto($tmptitle, 
'user', 
'class="pictofixedwidth"');
 
 1195  $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 
'search_sale', $user, 0, $langs->trans(
'SalesRepresentatives'), ($conf->dol_optimize_smallscreen ? 
'maxwidth200' : 
'maxwidth300'), 1);
 
 1196  $moreforfilter .= 
'</div>';
 
 1198if (!empty($moreforfilter)) {
 
 1199  print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
 1200  print $moreforfilter;
 
 1201  $parameters = array(
'type'=>$type);
 
 1202  $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action); 
 
 1203  print $hookmanager->resPrint;
 
 1207$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
 1208$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, 
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN', 
'')); 
 
 1210$selectedfields .= ((count($arrayofmassactions) && $contextpage != 
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) : 
'');
 
 1212print 
'<div class="div-table-responsive">'; 
 
 1213print 
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ? 
" listwithfilterbefore" : 
"").
'">'.
"\n";
 
 1217print 
'<tr class="liste_titre_filter">';
 
 1220  print 
'<td class="liste_titre maxwidthsearch center actioncolumn">';
 
 1221  $searchpicto = $form->showFilterButtons(
'left');
 
 1225if (!empty($arrayfields[
's.rowid'][
'checked'])) {
 
 1226  print 
'<td class="liste_titre" data-key="id">';
 
 1227  print 
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
 
 1230if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
 1231  print 
'<td class="liste_titre" data-key="ref">';
 
 1232  if (!empty($search_nom_only) && empty($search_nom)) {
 
 1233    $search_nom = $search_nom_only;
 
 1235  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
 
 1238if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
 
 1239  print 
'<td class="liste_titre">';
 
 1240  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
 
 1244if (!empty($arrayfields[
's.barcode'][
'checked'])) {
 
 1245  print 
'<td class="liste_titre">';
 
 1246  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
 
 1250if (!empty($arrayfields[
's.code_client'][
'checked'])) {
 
 1251  print 
'<td class="liste_titre">';
 
 1252  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
 
 1256if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
 
 1257  print 
'<td class="liste_titre">';
 
 1258  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
 
 1262if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
 
 1263  print 
'<td class="liste_titre">';
 
 1264  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
 
 1268if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
 
 1269  print 
'<td class="liste_titre">';
 
 1270  print 
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
 
 1274if (!empty($arrayfields[
's.address'][
'checked'])) {
 
 1275  print 
'<td class="liste_titre">';
 
 1276  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
 
 1280if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
 
 1281  print 
'<td class="liste_titre">';
 
 1285if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
 1286  print 
'<td class="liste_titre">';
 
 1287  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
 
 1291if (!empty($arrayfields[
's.town'][
'checked'])) {
 
 1292  print 
'<td class="liste_titre">';
 
 1293  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
 
 1297if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
 1298  print 
'<td class="liste_titre">';
 
 1299  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
 
 1303if (!empty($arrayfields[
'region.nom'][
'checked'])) {
 
 1304  print 
'<td class="liste_titre">';
 
 1305  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
 
 1309if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1310  print 
'<td class="liste_titre center">';
 
 1311  print $form->select_country($search_country, 
'search_country', 
'', 0, 
'minwidth100imp maxwidth100');
 
 1315if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
 1316  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1318  print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, 
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ? 
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 
'minwidth50 maxwidth125', 1);
 
 1322if (!empty($arrayfields[
's.price_level'][
'checked'])) {
 
 1323  print 
'<td class="liste_titre">';
 
 1324  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
 
 1328if (!empty($arrayfields[
'staff.code'][
'checked'])) {
 
 1329  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1330  print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, 
'', 0, 0, 0, 
'ASC', 
'maxwidth100', 1);
 
 1333if (!empty($arrayfields[
's.email'][
'checked'])) {
 
 1335  print 
'<td class="liste_titre">';
 
 1336  print 
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
 
 1339if (!empty($arrayfields[
's.phone'][
'checked'])) {
 
 1341  print 
'<td class="liste_titre">';
 
 1342  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
 
 1345if (!empty($arrayfields[
's.fax'][
'checked'])) {
 
 1347  print 
'<td class="liste_titre">';
 
 1348  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
 
 1351if (!empty($arrayfields[
's.url'][
'checked'])) {
 
 1353  print 
'<td class="liste_titre">';
 
 1354  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
 
 1357if (!empty($arrayfields[
's.siren'][
'checked'])) {
 
 1359  print 
'<td class="liste_titre">';
 
 1360  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
 
 1363if (!empty($arrayfields[
's.siret'][
'checked'])) {
 
 1365  print 
'<td class="liste_titre">';
 
 1366  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
 
 1369if (!empty($arrayfields[
's.ape'][
'checked'])) {
 
 1371  print 
'<td class="liste_titre">';
 
 1372  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
 
 1375if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
 
 1377  print 
'<td class="liste_titre">';
 
 1378  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
 
 1381if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
 
 1383  print 
'<td class="liste_titre">';
 
 1384  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
 
 1387if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
 
 1389  print 
'<td class="liste_titre">';
 
 1390  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
 
 1393if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
 
 1395  print 
'<td class="liste_titre">';
 
 1396  print 
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
 
 1401if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
 
 1402  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1404    print 
'<input type="hidden" name="type" value="'.$type.
'">';
 
 1406  print $formcompany->selectProspectCustomerType($search_type, 
'search_type', 
'search_type', 
'list');
 
 1410if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
 
 1411  print 
'<td class="liste_titre center">';
 
 1412  print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0, 
'width75', 0, 0, 
'', 
'', 
'', 2);
 
 1416if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
 
 1417  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
 1418  $arraystcomm = array();
 
 1419  foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
 
 1420    $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) != 
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
 
 1423  print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0, 
'width100', 0, 0, 
'', 
'', 
'', 2);
 
 1426if (!empty($arrayfields[
's2.nom'][
'checked'])) {
 
 1427  print 
'<td class="liste_titre center">';
 
 1428  print 
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
 
 1432include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
 
 1435$parameters = array(
'arrayfields'=>$arrayfields);
 
 1436$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action); 
 
 1437print $hookmanager->resPrint;
 
 1439if (!empty($arrayfields[
's.datec'][
'checked'])) {
 
 1440  print 
'<td class="liste_titre center nowraponall">';
 
 1441  print 
'<div class="nowrapfordate">';
 
 1442  print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1, 
'search_date_creation_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
 1444  print 
'<div class="nowrapfordate">';
 
 1445  print $form->selectDate($search_date_creation_end ? $search_date_creation_end : -1, 
'search_date_creation_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
 1450if (!empty($arrayfields[
's.tms'][
'checked'])) {
 
 1451  print 
'<td class="liste_titre center nowraponall">';
 
 1452  print 
'<div class="nowrapfordate">';
 
 1453  print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1, 
'search_date_modif_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
 1455  print 
'<div class="nowrapfordate">';
 
 1456  print $form->selectDate($search_date_modif_end ? $search_date_modif_end : -1, 
'search_date_modif_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
 1461if (!empty($arrayfields[
's.status'][
'checked'])) {
 
 1462  print 
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
 
 1463  print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'ActivityCeased'), 
'1'=>$langs->trans(
'InActivity')), $search_status, 1, 0, 0, 
'', 0, 0, 0, 
'', 
'search_status width100 onrightofpage', 1);
 
 1466if (!empty($arrayfields[
's.import_key'][
'checked'])) {
 
 1467  print 
'<td class="liste_titre center">';
 
 1468  print 
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
 
 1473  print 
'<td class="liste_titre center maxwidthsearch actioncolumn">';
 
 1474  $searchpicto = $form->showFilterButtons();
 
 1481$totalarray = array();
 
 1482$totalarray[
'nbfield'] = 0;
 
 1486print 
'<tr class="liste_titre">';
 
 1489  print 
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"], 
'', 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ').
"\n";
 
 1490  $totalarray[
'nbfield']++;
 
 1492if (!empty($arrayfields[
's.rowid'][
'checked'])) {
 
 1493  print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.rowid", 
"", $param, 
' data-key="id"', $sortfield, $sortorder, 
'');
 
 1494  $totalarray[
'nbfield']++;
 
 1496if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
 1497  print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.nom", 
"", $param, 
' data-key="ref"', $sortfield, $sortorder, 
' ');
 
 1498  $totalarray[
'nbfield']++;
 
 1500if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
 
 1501  print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.name_alias", 
"", $param, 
"", $sortfield, $sortorder);
 
 1502  $totalarray[
'nbfield']++;
 
 1504if (!empty($arrayfields[
's.barcode'][
'checked'])) {
 
 1505  print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.barcode", $param, 
'', 
'', $sortfield, $sortorder);
 
 1506  $totalarray[
'nbfield']++;
 
 1508if (!empty($arrayfields[
's.code_client'][
'checked'])) {
 
 1509  print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.code_client", 
"", $param, 
'', $sortfield, $sortorder);
 
 1510  $totalarray[
'nbfield']++;
 
 1512if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
 
 1513  print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.code_fournisseur", 
"", $param, 
'', $sortfield, $sortorder);
 
 1514  $totalarray[
'nbfield']++;
 
 1516if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
 
 1517  print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.code_compta", 
"", $param, 
'', $sortfield, $sortorder);
 
 1518  $totalarray[
'nbfield']++;
 
 1520if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
 
 1521  print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.code_compta_fournisseur", 
"", $param, 
'', $sortfield, $sortorder);
 
 1522  $totalarray[
'nbfield']++;
 
 1524if (!empty($arrayfields[
's.address'][
'checked'])) {
 
 1525  print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'], 
's.address', 
'', $param, 
'', $sortfield, $sortorder);
 
 1526  $totalarray[
'nbfield']++;
 
 1528if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
 
 1529  print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'], 
'', 
'', $param, 
'', $sortfield, $sortorder);
 
 1530  $totalarray[
'nbfield']++;
 
 1532if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
 1533  print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.zip", 
"", $param, 
'', $sortfield, $sortorder);
 
 1534  $totalarray[
'nbfield']++;
 
 1536if (!empty($arrayfields[
's.town'][
'checked'])) {
 
 1537  print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.town", 
"", $param, 
'', $sortfield, $sortorder);
 
 1538  $totalarray[
'nbfield']++;
 
 1540if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
 1541  print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"state.nom", 
"", $param, 
'', $sortfield, $sortorder);
 
 1542  $totalarray[
'nbfield']++;
 
 1544if (!empty($arrayfields[
'region.nom'][
'checked'])) {
 
 1545  print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"region.nom", 
"", $param, 
'', $sortfield, $sortorder);
 
 1546  $totalarray[
'nbfield']++;
 
 1548if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
 1549  print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"], 
"country.code_iso", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1550  $totalarray[
'nbfield']++;
 
 1552if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
 1553  print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"], 
"typent.code", 
"", $param, 
"", $sortfield, $sortorder, 
'center ');
 
 1554  $totalarray[
'nbfield']++;
 
 1556if (!empty($arrayfields[
'staff.code'][
'checked'])) {
 
 1557  print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"], 
"staff.code", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1558  $totalarray[
'nbfield']++;
 
 1560if (!empty($arrayfields[
's.price_level'][
'checked'])) {
 
 1561  print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.price_level", 
"", $param, 
'', $sortfield, $sortorder);
 
 1562  $totalarray[
'nbfield']++;
 
 1564if (!empty($arrayfields[
's.email'][
'checked'])) {
 
 1565  print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.email", 
"", $param, 
'', $sortfield, $sortorder);
 
 1566  $totalarray[
'nbfield']++;
 
 1568if (!empty($arrayfields[
's.phone'][
'checked'])) {
 
 1569  print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.phone", 
"", $param, 
'', $sortfield, $sortorder);
 
 1570  $totalarray[
'nbfield']++;
 
 1572if (!empty($arrayfields[
's.fax'][
'checked'])) {
 
 1573  print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.fax", 
"", $param, 
'', $sortfield, $sortorder);
 
 1574  $totalarray[
'nbfield']++;
 
 1576if (!empty($arrayfields[
's.url'][
'checked'])) {
 
 1577  print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.url", 
"", $param, 
'', $sortfield, $sortorder);
 
 1578  $totalarray[
'nbfield']++;
 
 1580if (!empty($arrayfields[
's.siren'][
'checked'])) {
 
 1581  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.siren", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1582  $totalarray[
'nbfield']++;
 
 1584if (!empty($arrayfields[
's.siret'][
'checked'])) {
 
 1585  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.siret", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1586  $totalarray[
'nbfield']++;
 
 1588if (!empty($arrayfields[
's.ape'][
'checked'])) {
 
 1589  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.ape", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1590  $totalarray[
'nbfield']++;
 
 1592if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
 
 1593  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.idprof4", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1594  $totalarray[
'nbfield']++;
 
 1596if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
 
 1597  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.idprof5", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1598  $totalarray[
'nbfield']++;
 
 1600if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
 
 1601  print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"], 
"s.idprof6", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1602  $totalarray[
'nbfield']++;
 
 1604if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
 
 1605  print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.tva_intra", 
"", $param, 
'', $sortfield, $sortorder, 
'nowrap ');
 
 1606  $totalarray[
'nbfield']++;
 
 1608if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
 
 1609  print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'], 
'', 
'', $param, 
'', $sortfield, $sortorder, 
'center '); 
 
 1610  $totalarray[
'nbfield']++;
 
 1612if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
 
 1613  print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.fk_prospectlevel", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1614  $totalarray[
'nbfield']++;
 
 1616if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
 
 1617  print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.fk_stcomm", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1618  $totalarray[
'nbfield']++;
 
 1620if (!empty($arrayfields[
's2.nom'][
'checked'])) {
 
 1621  print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"s2.nom", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1622  $totalarray[
'nbfield']++;
 
 1625include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
 
 1627$parameters = array(
'arrayfields'=>$arrayfields, 
'param'=>$param, 
'sortfield'=>$sortfield, 
'sortorder'=>$sortorder);
 
 1628$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action); 
 
 1629print $hookmanager->resPrint;
 
 1630if (!empty($arrayfields[
's.datec'][
'checked'])) {
 
 1631  print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.datec", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1632  $totalarray[
'nbfield']++; 
 
 1634if (!empty($arrayfields[
's.tms'][
'checked'])) {
 
 1635  print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.tms", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
 1636  $totalarray[
'nbfield']++; 
 
 1638if (!empty($arrayfields[
's.status'][
'checked'])) {
 
 1639  print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.status", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1640  $totalarray[
'nbfield']++; 
 
 1642if (!empty($arrayfields[
's.import_key'][
'checked'])) {
 
 1643  print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.import_key", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
 1644  $totalarray[
'nbfield']++; 
 
 1648  print 
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"], 
'', 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ').
"\n";
 
 1649  $totalarray[
'nbfield']++;
 
 1657$savnbfield = $totalarray[
'nbfield'];
 
 1658$totalarray = array();
 
 1659$totalarray[
'nbfield'] = 0;
 
 1660$imaxinloop = ($limit ? min($num, $limit) : $num);
 
 1661while ($i < $imaxinloop) {
 
 1662  $obj = $db->fetch_object($resql);
 
 1667  $parameters = array(
'staticdata' => $obj);
 
 1670  $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
 
 1671  if (empty($reshook)) {
 
 1672    $companystatic->id = $obj->rowid;
 
 1673    $companystatic->name = $obj->name;
 
 1674    $companystatic->name_alias = $obj->name_alias;
 
 1675    $companystatic->logo = $obj->logo;
 
 1676    $companystatic->barcode = $obj->barcode;
 
 1677    $companystatic->canvas = $obj->canvas;
 
 1678    $companystatic->client = $obj->client;
 
 1679    $companystatic->status = $obj->status;
 
 1680    $companystatic->email = $obj->email;
 
 1681    $companystatic->address = $obj->address;
 
 1682    $companystatic->zip = $obj->zip;
 
 1683    $companystatic->town = $obj->town;
 
 1684    $companystatic->fournisseur = $obj->fournisseur;
 
 1685    $companystatic->code_client = $obj->code_client;
 
 1686    $companystatic->code_fournisseur = $obj->code_fournisseur;
 
 1687    $companystatic->tva_intra = $obj->tva_intra;
 
 1688    $companystatic->country_code = $obj->country_code;
 
 1690    $companystatic->code_compta_client = $obj->code_compta;
 
 1691    $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
 
 1693    $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
 
 1694    $companystatic->parent = $obj->fk_parent;
 
 1695    $companystatic->entity = $obj->entity;
 
 1698  if ($mode == 
'kanban') {
 
 1700      print 
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
 
 1701      print 
'<div class="box-flex-container kanban">';
 
 1704    print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
 
 1705    if ($i == ($imaxinloop - 1)) {
 
 1712    print 
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
 
 1713    if ($contextpage == 
'poslist') {
 
 1714      print 
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"'; 
 1718    // Action column (Show the massaction button only when this page is not opend from the Extended POS) 
 1719    if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { 
 1720      print '<td class="nowrap center actioncolumn
">'; 
 1721      if (($massactionbutton || $massaction) && $contextpage != 'poslist') {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 
 1723        if (in_array($obj->rowid, $arrayofselected)) { 
 1726        print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>'; 
 1730        $totalarray['nbfield']++; 
 1733    if (!empty($arrayfields['s.rowid']['checked'])) { 
 1734      print '<td class="tdoverflowmax50
" data-key="id">'; 
 1738        $totalarray['nbfield']++; 
 1741    if (!empty($arrayfields['s.nom']['checked'])) { 
 1742      print '<td'.(!getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? ' class="tdoverflowmax200
"' : '').' data-key="ref">'; 
 1743      if ($contextpage == 'poslist') { 
 1744        print dol_escape_htmltag($companystatic->name); 
 1746        print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); 
 1750        $totalarray['nbfield']++; 
 1753    if (!empty($arrayfields['s.name_alias']['checked'])) { 
 1754      print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">'; 
 1755      print dol_escape_htmltag($companystatic->name_alias); 
 1758        $totalarray['nbfield']++; 
 1762    if (!empty($arrayfields['s.barcode']['checked'])) { 
 1763      print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>'; 
 1765        $totalarray['nbfield']++; 
 1769    if (!empty($arrayfields['s.code_client']['checked'])) { 
 1770      print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>'; 
 1772        $totalarray['nbfield']++; 
 1776    if (!empty($arrayfields['s.code_fournisseur']['checked'])) { 
 1777      print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>'; 
 1779        $totalarray['nbfield']++; 
 1782    // Account customer code 
 1783    if (!empty($arrayfields['s.code_compta']['checked'])) { 
 1784      print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>'; 
 1786        $totalarray['nbfield']++; 
 1789    // Account supplier code 
 1790    if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { 
 1791      print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>'; 
 1793        $totalarray['nbfield']++; 
 1797    if (!empty($arrayfields['s.address']['checked'])) { 
 1798      print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>'; 
 1800        $totalarray['nbfield']++; 
 1803    // Sales Representative 
 1804    if (!empty($arrayfields['sales.representative']['checked'])) { 
 1805      print '<td class="nowraponall tdoverflowmax200
">'; 
 1806      $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); 
 1807      $nbofsalesrepresentative = count($listsalesrepresentatives); 
 1808      if ($nbofsalesrepresentative > 6) { 
 1809        // We print only number 
 1810        print $nbofsalesrepresentative; 
 1811      } elseif ($nbofsalesrepresentative > 0) { 
 1812        $userstatic = new User($db); 
 1814        foreach ($listsalesrepresentatives as $val) { 
 1815          $userstatic->id = $val['id']; 
 1816          $userstatic->lastname = $val['lastname']; 
 1817          $userstatic->firstname = $val['firstname']; 
 1818          $userstatic->email = $val['email']; 
 1819          $userstatic->entity = $val['entity']; 
 1820          $userstatic->photo = $val['photo']; 
 1821          $userstatic->login = $val['login']; 
 1822          $userstatic->office_phone = $val['office_phone']; 
 1823          $userstatic->office_fax = $val['office_fax']; 
 1824          $userstatic->user_mobile = $val['user_mobile']; 
 1825          $userstatic->job = $val['job']; 
 1826          $userstatic->gender = $val['gender']; 
 1827          $userstatic->statut = $val['statut']; 
 1828          print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); 
 1830          if ($j < $nbofsalesrepresentative) { 
 1839        $totalarray['nbfield']++; 
 1843    if (!empty($arrayfields['s.zip']['checked'])) { 
 1844      print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
"; 
 1846        $totalarray['nbfield']++; 
 1850    if (!empty($arrayfields['s.town']['checked'])) { 
 1851      print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
"; 
 1853        $totalarray['nbfield']++; 
 1857    if (!empty($arrayfields['state.nom']['checked'])) { 
 1858      print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
"; 
 1860        $totalarray['nbfield']++; 
 1864    if (!empty($arrayfields['region.nom']['checked'])) { 
 1865      print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
"; 
 1867        $totalarray['nbfield']++; 
 1871    if (!empty($arrayfields['country.code_iso']['checked'])) { 
 1872      print '<td class="center tdoverflowmax100
">'; 
 1873      $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label; 
 1874      print $labelcountry; 
 1877        $totalarray['nbfield']++; 
 1881    if (!empty($arrayfields['typent.code']['checked'])) { 
 1882      if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { 
 1883        $typenArray = $formcompany->typent_array(1); 
 1885      $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code]; 
 1887      print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">'; 
 1888      print dol_escape_htmltag($labeltypeofcompany); 
 1891        $totalarray['nbfield']++; 
 1895    if (!empty($arrayfields['s.price_level']['checked'])) { 
 1896      print '<td class="center
">'.$obj->price_level."</td>\n
"; 
 1898        $totalarray['nbfield']++; 
 1902    if (!empty($arrayfields['staff.code']['checked'])) { 
 1903      print '<td class="center
">'; 
 1904      if (!empty($obj->staff_code)) { 
 1905        if (empty($conf->cache['staffArray'])) { 
 1906          $conf->cache['staffArray'] = $formcompany->effectif_array(1); 
 1908        print $conf->cache['staffArray'][$obj->staff_code]; 
 1912        $totalarray['nbfield']++; 
 1915    if (!empty($arrayfields['s.email']['checked'])) { 
 1916      print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n
"; 
 1918        $totalarray['nbfield']++; 
 1921    if (!empty($arrayfields['s.phone']['checked'])) { 
 1922      print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
"; 
 1924        $totalarray['nbfield']++; 
 1927    if (!empty($arrayfields['s.fax']['checked'])) { 
 1928      print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
"; 
 1930        $totalarray['nbfield']++; 
 1933    if (!empty($arrayfields['s.url']['checked'])) { 
 1934      print "<td>
".dol_print_url($obj->url, '', '', 1)."</td>\n
"; 
 1936        $totalarray['nbfield']++; 
 1939    if (!empty($arrayfields['s.siren']['checked'])) { 
 1940      print "<td>
".$obj->idprof1."</td>\n
"; 
 1942        $totalarray['nbfield']++; 
 1945    if (!empty($arrayfields['s.siret']['checked'])) { 
 1946      print "<td>
".$obj->idprof2."</td>\n
"; 
 1948        $totalarray['nbfield']++; 
 1951    if (!empty($arrayfields['s.ape']['checked'])) { 
 1952      print "<td>
".$obj->idprof3."</td>\n
"; 
 1954        $totalarray['nbfield']++; 
 1957    if (!empty($arrayfields['s.idprof4']['checked'])) { 
 1958      print "<td>
".$obj->idprof4."</td>\n
"; 
 1960        $totalarray['nbfield']++; 
 1963    if (!empty($arrayfields['s.idprof5']['checked'])) { 
 1964      print "<td>
".$obj->idprof5."</td>\n
"; 
 1966        $totalarray['nbfield']++; 
 1969    if (!empty($arrayfields['s.idprof6']['checked'])) { 
 1970      print "<td>
".$obj->idprof6."</td>\n
"; 
 1972        $totalarray['nbfield']++; 
 1976    if (!empty($arrayfields['s.tva_intra']['checked'])) { 
 1977      print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">'; 
 1978      if ($companystatic->tva_intra && !isValidVATID($companystatic)) { 
 1979        print img_warning("BadVATNumber
", '', 'pictofixedwidth'); 
 1981      print $companystatic->tva_intra; 
 1984        $totalarray['nbfield']++; 
 1988    if (!empty($arrayfields['customerorsupplier']['checked'])) { 
 1989      print '<td class="center
">'; 
 1990      print $companystatic->getTypeUrl(1); 
 1993        $totalarray['nbfield']++; 
 1997    if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { 
 1998      print '<td class="center nowraponall
">'; 
 1999      print $companystatic->getLibProspLevel(); 
 2002        $totalarray['nbfield']++; 
 2006    if (!empty($arrayfields['s.fk_stcomm']['checked'])) { 
 2007      print '<td class="center nowraponall
">'; 
 2009      $prospectid = $obj->rowid; 
 2010      $statusprospect = $obj->stcomm_id; 
 2012      $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid); 
 2016        $totalarray['nbfield']++; 
 2020    if (!empty($arrayfields['s2.nom']['checked'])) { 
 2021      print '<td class="center tdoverflowmax100
">'; 
 2022      if ($companystatic->parent > 0) { 
 2023        $companyparent->fetch($companystatic->parent); 
 2024        print $companyparent->getNomUrl(1); 
 2028        $totalarray['nbfield']++; 
 2032    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; 
 2034    $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); 
 2035    $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook 
 2036    print $hookmanager->resPrint; 
 2038    if (!empty($arrayfields['s.datec']['checked'])) { 
 2039      print '<td class="center nowraponall
">'; 
 2040      print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); 
 2043        $totalarray['nbfield']++; 
 2046    // Date modification 
 2047    if (!empty($arrayfields['s.tms']['checked'])) { 
 2048      print '<td class="center nowraponall
">'; 
 2049      print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); 
 2052        $totalarray['nbfield']++; 
 2056    if (!empty($arrayfields['s.status']['checked'])) { 
 2057      print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>'; 
 2059        $totalarray['nbfield']++; 
 2063    if (!empty($arrayfields['s.import_key']['checked'])) { 
 2064      print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->import_key).'">'; 
 2065      print dol_escape_htmltag($obj->import_key); 
 2068        $totalarray['nbfield']++; 
 2071    // Action column (Show the massaction button only when this page is not opend from the Extended POS) 
 2072    if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { 
 2073      print '<td class="nowrap center actioncolumn
">'; 
 2074      if (($massactionbutton || $massaction) && $contextpage != 'poslist') {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 
 2076        if (in_array($obj->rowid, $arrayofselected)) { 
 2079        print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>'; 
 2083        $totalarray['nbfield']++; 
 2093include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; 
 2095// If no record found 
 2098  foreach ($arrayfields as $key => $val) { 
 2099    if (!empty($val['checked'])) { 
 2103  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>'; 
 2108$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); 
 2109$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook 
 2110print $hookmanager->resPrint; 
 2112print '</table>'."\n
"; 
 2115// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script 
 2116$formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js
"); 
 2118print '</form>'."\n
"; 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers or prospects.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
get_htmloutput_mesg($mesgstring='', $mesgarray='', $style='ok', $keepembedded=0)
Get formated messages to output (Used to show messages on html output).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.