39require_once
'../main.inc.php';
40include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
49$langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
53$action =
GETPOST(
'action',
'aZ09');
54$massaction =
GETPOST(
'massaction',
'alpha');
55$show_files =
GETPOST(
'show_files',
'int');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$toselect =
GETPOST(
'toselect',
'array');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
59$optioncss =
GETPOST(
'optioncss',
'alpha');
60if ($contextpage ==
'poslist') {
63$mode =
GETPOST(
"mode",
'alpha');
66$search_all = trim(
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
67$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
69$search_id = trim(
GETPOST(
"search_id",
"int"));
70$search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
71$search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
72$search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
73$search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
74$search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
75$search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
76$search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
77$search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
78$search_address = trim(
GETPOST(
'search_address',
'alpha'));
79$search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
80$search_town = trim(
GETPOST(
"search_town",
'alpha'));
81$search_state = trim(
GETPOST(
"search_state",
'alpha'));
82$search_region = trim(
GETPOST(
"search_region",
'alpha'));
83$search_email = trim(
GETPOST(
'search_email',
'alpha'));
84$search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
85$search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
86$search_url = trim(
GETPOST(
'search_url',
'alpha'));
87$search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
88$search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
89$search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
90$search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
91$search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
92$search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
93$search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
94$search_sale =
GETPOST(
"search_sale",
'int');
95$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
96$search_categ_sup =
GETPOST(
"search_categ_sup",
'int');
97$search_country =
GETPOST(
"search_country",
'intcomma');
98$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
99$search_price_level =
GETPOST(
'search_price_level',
'int');
100$search_staff =
GETPOST(
"search_staff",
'int');
101$search_status =
GETPOST(
"search_status",
'int');
102$search_type =
GETPOST(
'search_type',
'alpha');
103$search_level =
GETPOST(
"search_level",
"array:alpha");
104$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
105$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
106$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
109$type =
GETPOST(
'type',
'alpha');
110$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
112$diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
115$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
116$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
117$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
118$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
123 $sortfield =
"s.nom";
125if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
129$offset = $limit * $page;
130$pageprev = $page - 1;
131$pagenext = $page + 1;
134 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
135 $contextpage =
'customerlist';
136 }
if ($search_type ==
'') {
137 $search_type =
'1,3';
141 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
142 $contextpage =
'prospectlist';
143 }
if ($search_type ==
'') {
144 $search_type =
'2,3';
148 if (empty($contextpage) || $contextpage ==
'poslist') {
149 $contextpage =
'poslist';
150 }
if ($search_type ==
'') {
151 $search_type =
'1,2,3';
155 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
156 $contextpage =
'supplierlist';
157 }
if ($search_type ==
'') {
165$hookmanager->initHooks(array($contextpage));
168$extrafields->fetch_name_optionals_label($object->table_element);
170$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
173$fieldstosearchall = array(
174 's.nom'=>
"ThirdPartyName",
175 's.name_alias'=>
"AliasNameShort",
176 's.code_client'=>
"CustomerCode",
177 's.code_fournisseur'=>
"SupplierCode",
178 's.code_compta'=>
"CustomerAccountancyCodeShort",
179 's.code_compta_fournisseur'=>
"SupplierAccountancyCodeShort",
184 's.tva_intra'=>
"VATIntra",
185 's.siren'=>
"ProfId1",
186 's.siret'=>
"ProfId2",
191if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
192 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
194if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
195 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
197if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
198 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
200if (isModEnabled(
'barcode')) {
201 $fieldstosearchall[
's.barcode'] =
'Gencod';
204if (!empty($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS)) {
210$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ? 1 : 0);
211$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
212$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
213$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
214$checkedtypetiers = 1;
224$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
225$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
227 's.rowid'=>array(
'label'=>
"TechnicalID",
'position'=>1,
'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)),
'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))),
228 's.nom'=>array(
'label'=>
"ThirdPartyName",
'position'=>2,
'checked'=>1),
229 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'position'=>3,
'checked'=>1),
230 's.barcode'=>array(
'label'=>
"Gencod",
'position'=>5,
'checked'=>1,
'enabled'=>(isModEnabled(
'barcode'))),
231 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'position'=>10,
'checked'=>$checkedcustomercode),
232 's.code_fournisseur'=>array(
'label'=>
"SupplierCodeShort",
'position'=>11,
'checked'=>$checkedsuppliercode,
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
233 's.code_compta'=>array(
'label'=>
"CustomerAccountancyCodeShort",
'position'=>13,
'checked'=>$checkedcustomeraccountcode),
234 's.code_compta_fournisseur'=>array(
'label'=>
"SupplierAccountancyCodeShort",
'position'=>14,
'checked'=>$checkedsupplieraccountcode,
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
235 's.address'=>array(
'label'=>
"Address",
'position'=>19,
'checked'=>0),
236 's.zip'=>array(
'label'=>
"Zip",
'position'=>20,
'checked'=>1),
237 's.town'=>array(
'label'=>
"Town",
'position'=>21,
'checked'=>0),
238 'state.nom'=>array(
'label'=>
"State",
'position'=>22,
'checked'=>0),
239 'region.nom'=>array(
'label'=>
"Region",
'position'=>23,
'checked'=>0),
240 'country.code_iso'=>array(
'label'=>
"Country",
'position'=>24,
'checked'=>0),
241 's.email'=>array(
'label'=>
"Email",
'position'=>25,
'checked'=>0),
242 's.url'=>array(
'label'=>
"Url",
'position'=>26,
'checked'=>0),
243 's.phone'=>array(
'label'=>
"Phone",
'position'=>27,
'checked'=>1),
244 's.fax'=>array(
'label'=>
"Fax",
'position'=>28,
'checked'=>0),
245 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'position'=>29,
'checked'=>$checkedtypetiers),
246 'staff.code'=>array(
'label'=>
"Workforce",
'position'=>31,
'checked'=>0),
247 's.siren'=>array(
'label'=>
"ProfId1Short",
'position'=>40,
'checked'=>$checkedprofid1),
248 's.siret'=>array(
'label'=>
"ProfId2Short",
'position'=>41,
'checked'=>$checkedprofid2),
249 's.ape'=>array(
'label'=>
"ProfId3Short",
'position'=>42,
'checked'=>$checkedprofid3),
250 's.idprof4'=>array(
'label'=>
"ProfId4Short",
'position'=>43,
'checked'=>$checkedprofid4),
251 's.idprof5'=>array(
'label'=>
"ProfId5Short",
'position'=>44,
'checked'=>$checkedprofid5),
252 's.idprof6'=>array(
'label'=>
"ProfId6Short",
'position'=>45,
'checked'=>$checkedprofid6),
253 's.tva_intra'=>array(
'label'=>
"VATIntraShort",
'position'=>50,
'checked'=>0),
254 'customerorsupplier'=>array(
'label'=>
'NatureOfThirdParty',
'position'=>61,
'checked'=>1),
255 's.fk_prospectlevel'=>array(
'label'=>
"ProspectLevel",
'position'=>62,
'checked'=>$checkprospectlevel),
256 's.fk_stcomm'=>array(
'label'=>
"StatusProsp",
'position'=>63,
'checked'=>$checkstcomm),
257 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>64,
'checked'=>0),
258 's.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
259 's.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
260 's.status'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
261 's.import_key'=>array(
'label'=>
"ImportId",
'checked'=>0,
'position'=>1100),
263if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
264 $arrayfields[
's.price_level'] = array(
'label'=>
"PriceLevel",
'position'=>30,
'checked'=>0);
268include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
274$socid =
GETPOST(
'socid',
'int');
276 $socid = $user->socid;
286if ($action ==
"change") {
287 $idcustomer =
GETPOST(
'idcustomer',
'int');
290 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
291 $result = $db->query($sql);
292 $num_lines = $db->num_rows($result);
293 if ($num_lines == 0) {
294 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
296 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
297 $invoice->socid = $conf->global->$constforthirdpartyid;
299 $invoice->module_source =
'takepos';
300 $invoice->pos_source = $_SESSION[
"takeposterminal"];
301 $placeid = $invoice->create($user);
302 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
306 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
307 $resql = $db->query($sql);
310 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
311 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
313 <?php
if (!$resql) { ?>
314 alert(
'Error failed to update customer on draft invoice.');
316 parent.$.colorbox.close();
323if (
GETPOST(
'cancel',
'alpha')) {
327if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
331$parameters = array();
332$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
337if (empty($reshook)) {
339 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
342 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
346 $search_categ_cus = 0;
347 $search_categ_sup = 0;
349 $search_barcode =
"";
350 $search_customer_code =
'';
351 $search_supplier_code =
'';
352 $search_account_customer_code =
'';
353 $search_account_supplier_code =
'';
354 $search_address =
'';
359 $search_country =
'';
364 $search_idprof1 =
'';
365 $search_idprof2 =
'';
366 $search_idprof3 =
'';
367 $search_idprof4 =
'';
368 $search_idprof5 =
'';
369 $search_idprof6 =
'';
372 $search_price_level =
'';
373 $search_type_thirdparty =
'';
378 $search_parent_name =
'';
379 $search_import_key =
'';
381 $search_array_options = array();
385 $objectclass =
'Societe';
386 $objectlabel =
'ThirdParty';
387 $permissiontoread = $user->hasRight(
'societe',
'lire');
388 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
389 $permissiontoadd = $user->hasRight(
"societe",
"creer");
390 $uploaddir = $conf->societe->dir_output;
391 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
393 if ($action ==
'setstcomm') {
394 $object =
new Client($db);
395 $result = $object->fetch(
GETPOST(
'stcommsocid'));
397 $result = $object->update($object->id, $user);
406if ($search_status ==
'') {
425$form =
new Form($db);
427$companystatic =
new Societe($db);
428$companyparent =
new Societe($db);
430$prospectstatic =
new Client($db);
431$prospectstatic->client = 2;
432$prospectstatic->loadCacheOfProspStatus();
436$title = $langs->trans(
"ThirdParties");
437if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
438 $title = $langs->trans(
"Customers");
440if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
441 $title = $langs->trans(
"Prospects");
443if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
444 $title = $langs->trans(
"Suppliers");
446$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
451$sql =
"SELECT code, label, sortorder";
452$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
453$sql .=
" WHERE active > 0";
454$sql .=
" ORDER BY sortorder";
455$resql = $db->query($sql);
457 while ($obj = $db->fetch_object($resql)) {
459 $level = $langs->trans($obj->code);
460 if ($level == $obj->code) {
461 $level = $langs->trans($obj->label);
463 $tab_level[$obj->code] = $level;
471$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,";
473$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,";
474$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,";
475$sql .=
" s.tms as date_update, s.datec as date_creation, s.import_key,";
476$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
477$sql .=
" s2.nom as name2,";
478$sql .=
" typent.code as typent_code,";
479$sql .=
" staff.code as staff_code,";
480$sql .=
" country.code as country_code, country.label as country_label,";
481$sql .=
" state.code_departement as state_code, state.nom as state_name,";
482$sql .=
" region.code_region as region_code, region.nom as region_name";
484if ($search_sale && $search_sale !=
'-1') {
485 $sql .=
", sc.fk_soc, sc.fk_user";
488if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
489 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
490 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
494$parameters = array();
495$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
496$sql .= $hookmanager->resPrint;
497$sql = preg_replace(
'/,\s*$/',
'', $sql);
502$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
503$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
504if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
505 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
508$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
509$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
510$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
511$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
512$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
513$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
515if ($search_sale == -2) {
516 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
518} elseif (!empty($search_sale) && $search_sale !=
'-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
519 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
522$parameters = array();
523$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
524$sql .= $hookmanager->resPrint;
525$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
527if (empty($user->rights->societe->client->voir) && !$socid) {
528 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
530if ($search_sale && $search_sale !=
'-1' && $search_sale !=
'-2') {
531 $sql .=
" AND s.rowid = sc.fk_soc";
533if (empty($user->rights->fournisseur->lire)) {
534 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
536if ($search_sale == -2) {
537 $sql .=
" AND sc.fk_user IS NULL";
538} elseif ($search_sale > 0) {
539 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
541$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
542$searchCategoryCustomerOperator = 0;
544if (!empty($searchCategoryCustomerList)) {
545 $searchCategoryCustomerSqlList = array();
546 $listofcategoryid =
'';
547 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
548 if (intval($searchCategoryCustomer) == -2) {
549 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
550 } elseif (intval($searchCategoryCustomer) > 0) {
551 if ($searchCategoryCustomerOperator == 0) {
552 $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).
")";
554 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
558 if ($listofcategoryid) {
559 $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).
"))";
561 if ($searchCategoryCustomerOperator == 1) {
562 if (!empty($searchCategoryCustomerSqlList)) {
563 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
566 if (!empty($searchCategoryCustomerSqlList)) {
567 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
571$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
572$searchCategorySupplierOperator = 0;
574if (!empty($searchCategorySupplierList)) {
575 $searchCategorySupplierSqlList = array();
576 $listofcategoryid =
'';
577 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
578 if (intval($searchCategorySupplier) == -2) {
579 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
580 } elseif (intval($searchCategorySupplier) > 0) {
581 if ($searchCategorySupplierOperator == 0) {
582 $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).
")";
584 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
588 if ($listofcategoryid) {
589 $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).
"))";
591 if ($searchCategorySupplierOperator == 1) {
592 if (!empty($searchCategorySupplierSqlList)) {
593 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
596 if (!empty($searchCategorySupplierSqlList)) {
597 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
602 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
604if (strlen($search_cti)) {
610if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
611 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
621if ($search_nom_only) {
624if ($search_customer_code) {
627if ($search_supplier_code) {
628 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
630if ($search_account_customer_code) {
631 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
633if ($search_account_supplier_code) {
634 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
636if ($search_address) {
639if (strlen($search_zip)) {
651if ($search_country && $search_country !=
'-1') {
652 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
657if (strlen($search_phone)) {
660if (strlen($search_fax)) {
666if (strlen($search_idprof1)) {
669if (strlen($search_idprof2)) {
672if (strlen($search_idprof3)) {
675if (strlen($search_idprof4)) {
678if (strlen($search_idprof5)) {
681if (strlen($search_idprof6)) {
684if (strlen($search_vat)) {
688if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
689 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
691if ($search_type > 0 && in_array($search_type, array(
'4'))) {
692 $sql .=
" AND s.fournisseur = 1";
694if ($search_type ==
'0') {
695 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
697if ($search_status !=
'' && $search_status >= 0) {
700if (isModEnabled(
'barcode') && $search_barcode) {
703if ($search_price_level && $search_price_level !=
'-1') {
706if ($search_type_thirdparty && $search_type_thirdparty > 0) {
707 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
709if (!empty($search_staff) && $search_staff !=
'-1') {
712if ($search_parent_name) {
716 $sql .=
natural_search(
"s.fk_prospectlevel", join(
',', $search_level), 3);
719 $sql .=
natural_search(
"s.fk_stcomm", join(
',', $search_stcomm), 2);
721if ($search_import_key) {
725include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
727$parameters = array(
'socid' => $socid);
728$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
729if (empty($reshook)) {
731 $sql .=
" AND s.rowid = ".((int) $socid);
734$sql .= $hookmanager->resPrint;
737$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
738$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
739$sql .= $hookmanager->resPrint;
742$nbtotalofrecords =
'';
745 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
746 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
747 $resql = $db->query($sqlforcount);
749 $objforcount = $db->fetch_object($resql);
750 $nbtotalofrecords = $objforcount->nbtotalofrecords;
755 if (($page * $limit) > $nbtotalofrecords) {
763$sql .= $db->order($sortfield, $sortorder);
765 $sql .= $db->plimit($limit + 1, $offset);
768$resql = $db->query($sql);
774$num = $db->num_rows($resql);
778if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
779 $obj = $db->fetch_object($resql);
781 if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
782 if ($obj->client > 0) {
783 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.$id);
786 if ($obj->fournisseur > 0) {
787 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.$id);
792 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.$id);
802$arrayofselected = is_array($toselect) ? $toselect : array();
806 $param .=
'&mode='.urlencode($mode);
808if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
809 $param .=
'&contextpage='.urlencode($contextpage);
811if ($limit > 0 && $limit != $conf->liste_limit) {
812 $param .=
'&limit='.((int) $limit);
814if ($optioncss !=
'') {
815 $param .=
'&optioncss='.urlencode($optioncss);
817if ($search_all !=
'') {
818 $param =
"&search_all=".urlencode($search_all);
820if ($search_categ_cus > 0) {
821 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
823if ($search_categ_sup > 0) {
824 $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
826if ($search_sale > 0) {
827 $param .=
'&search_sale='.urlencode($search_sale);
830 $param .=
"&search_id=".urlencode($search_id);
832if ($search_nom !=
'') {
833 $param .=
"&search_nom=".urlencode($search_nom);
835if ($search_alias !=
'') {
836 $param .=
"&search_alias=".urlencode($search_alias);
838if ($search_address !=
'') {
839 $param .=
'&search_address='.urlencode($search_address);
841if ($search_zip !=
'') {
842 $param .=
"&search_zip=".urlencode($search_zip);
844if ($search_town !=
'') {
845 $param .=
"&search_town=".urlencode($search_town);
847if ($search_phone !=
'') {
848 $param .=
"&search_phone=".urlencode($search_phone);
850if ($search_fax !=
'') {
851 $param .=
"&search_fax=".urlencode($search_fax);
853if ($search_email !=
'') {
854 $param .=
"&search_email=".urlencode($search_email);
856if ($search_url !=
'') {
857 $param .=
"&search_url=".urlencode($search_url);
859if ($search_state !=
'') {
860 $param .=
"&search_state=".urlencode($search_state);
862if ($search_region !=
'') {
863 $param .=
"&search_region=".urlencode($search_region);
865if ($search_country !=
'') {
866 $param .=
"&search_country=".urlencode($search_country);
868if ($search_customer_code !=
'') {
869 $param .=
"&search_customer_code=".urlencode($search_customer_code);
871if ($search_supplier_code !=
'') {
872 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
874if ($search_account_customer_code !=
'') {
875 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
877if ($search_account_supplier_code !=
'') {
878 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
880if ($search_barcode !=
'') {
881 $param .=
"&search_barcode=".urlencode($search_barcode);
883if ($search_idprof1 !=
'') {
884 $param .=
'&search_idprof1='.urlencode($search_idprof1);
886if ($search_idprof2 !=
'') {
887 $param .=
'&search_idprof2='.urlencode($search_idprof2);
889if ($search_idprof3 !=
'') {
890 $param .=
'&search_idprof3='.urlencode($search_idprof3);
892if ($search_idprof4 !=
'') {
893 $param .=
'&search_idprof4='.urlencode($search_idprof4);
895if ($search_idprof5 !=
'') {
896 $param .=
'&search_idprof5='.urlencode($search_idprof5);
898if ($search_idprof6 !=
'') {
899 $param .=
'&search_idprof6='.urlencode($search_idprof6);
901if ($search_vat !=
'') {
902 $param .=
'&search_vat='.urlencode($search_vat);
904if ($search_price_level !=
'') {
905 $param .=
'&search_price_level='.urlencode($search_price_level);
907if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
908 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
910if ($search_type !=
'') {
911 $param .=
'&search_type='.urlencode($search_type);
913if ($search_status !=
'') {
914 $param .=
'&search_status='.urlencode($search_status);
916if (is_array($search_level) && count($search_level)) {
917 foreach ($search_level as $slevel) {
918 $param .=
'&search_level[]='.urlencode($slevel);
921if (is_array($search_stcomm) && count($search_stcomm)) {
922 foreach ($search_stcomm as $slevel) {
923 $param .=
'&search_stcomm[]='.urlencode($slevel);
926if ($search_parent_name !=
'') {
927 $param .=
'&search_parent_name='.urlencode($search_parent_name);
929if ($search_import_key !=
'') {
930 $param .=
'&search_import_key='.urlencode($search_import_key);
933 $param .=
'&type='.urlencode($type);
936include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
938$parameters = array();
939$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
940$param .= $hookmanager->resPrint;
948$arrayofmassactions = array(
949 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
953if (isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
954 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
956if ($user->hasRight(
"societe",
"creer")) {
957 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
959if ($user->hasRight(
"societe",
"creer")) {
960 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_CEASED));
962if ($user->hasRight(
"societe",
"creer")) {
963 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
965if ($user->hasRight(
'societe',
'supprimer')) {
966 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
968if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
969 $arrayofmassactions = array();
971$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
974$label =
'MenuNewThirdParty';
977 $typefilter =
'&type='.$type;
979 $label =
'MenuNewProspect';
982 $label =
'MenuNewCustomer';
985 $label =
'NewSupplier';
989if ($contextpage ==
'poslist' && $type ==
't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
995if ($contextpage !=
'poslist') {
996 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
997 if (!empty($socid)) {
998 $url .=
'&socid='.$socid;
1000 $newcardbutton =
'';
1001 $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'));
1002 $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'));
1003 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1004} elseif ($user->hasRight(
'societe',
'creer')) {
1005 $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);
1006 $label =
'MenuNewCustomer';
1007 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1010print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1011if ($optioncss !=
'') {
1012 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1014print
'<input type="hidden" name="token" value="'.newToken().
'">';
1015print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1016print
'<input type="hidden" name="action" value="list">';
1017print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1018print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1020print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1021print
'<input type="hidden" name="page_y" value="">';
1022print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1023if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1024 print
'<input type="hidden" name="type" value="'.$type.
'">';
1026if (!empty($place)) {
1027 print
'<input type="hidden" name="place" value="'.$place.
'">';
1030print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1032$langs->load(
"other");
1033$textprofid = array();
1034foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1035 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1036 $textprofid[$key] =
'';
1037 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1038 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1041 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
1046$topicmail =
"Information";
1047$modelmail =
"thirdparty";
1049$trackid =
'thi'.$object->id;
1050include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1054 foreach ($fieldstosearchall as $key => $val) {
1055 $fieldstosearchall[$key] = $langs->trans($val);
1056 $setupstring .= $key.
"=".$val.
";";
1058 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1059 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
1063if (empty($type) || $type ==
'c' || $type ==
'p') {
1064 if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1065 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1066 $moreforfilter .=
'<div class="divsearchfield">';
1067 $tmptitle = $langs->trans(
'Categories');
1068 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1069 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'CustomersProspectsCategoriesShort'));
1070 $moreforfilter .=
'</div>';
1074if (empty($type) || $type ==
'f') {
1075 if (isModEnabled(
"fournisseur") && isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1076 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1077 $moreforfilter .=
'<div class="divsearchfield">';
1078 $tmptitle = $langs->trans(
'Categories');
1079 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1080 $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $langs->trans(
'SuppliersCategoriesShort'));
1081 $moreforfilter .=
'</div>';
1086if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1087 $moreforfilter .=
'<div class="divsearchfield">';
1088 $tmptitle = $langs->trans(
'SalesRepresentatives');
1089 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1090 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $langs->trans(
'SalesRepresentatives'), ($conf->dol_optimize_smallscreen ?
'maxwidth200' :
'maxwidth300'), 1);
1091 $moreforfilter .=
'</div>';
1093if (!empty($moreforfilter)) {
1094 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1095 print $moreforfilter;
1096 $parameters = array(
'type'=>$type);
1097 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1098 print $hookmanager->resPrint;
1102$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1103$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1105$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1107print
'<div class="div-table-responsive">';
1108print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1112print
'<tr class="liste_titre_filter">';
1115 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1116 $searchpicto = $form->showFilterButtons(
'left');
1120if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1121 print
'<td class="liste_titre" data-key="id">';
1122 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1125if (!empty($arrayfields[
's.nom'][
'checked'])) {
1126 print
'<td class="liste_titre" data-key="ref">';
1127 if (!empty($search_nom_only) && empty($search_nom)) {
1128 $search_nom = $search_nom_only;
1130 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1133if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1134 print
'<td class="liste_titre">';
1135 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1139if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1140 print
'<td class="liste_titre">';
1141 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1145if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1146 print
'<td class="liste_titre">';
1147 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1151if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1152 print
'<td class="liste_titre">';
1153 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1157if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1158 print
'<td class="liste_titre">';
1159 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1163if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1164 print
'<td class="liste_titre">';
1165 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1169if (!empty($arrayfields[
's.address'][
'checked'])) {
1170 print
'<td class="liste_titre">';
1171 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1175if (!empty($arrayfields[
's.zip'][
'checked'])) {
1176 print
'<td class="liste_titre">';
1177 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1181if (!empty($arrayfields[
's.town'][
'checked'])) {
1182 print
'<td class="liste_titre">';
1183 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1187if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1188 print
'<td class="liste_titre">';
1189 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1193if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1194 print
'<td class="liste_titre">';
1195 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1199if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1200 print
'<td class="liste_titre center">';
1201 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1205if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1206 print
'<td class="liste_titre maxwidthonsmartphone center">';
1208 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'minwidth50 maxwidth125', 1);
1212if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1213 print
'<td class="liste_titre">';
1214 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1218if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1219 print
'<td class="liste_titre maxwidthonsmartphone center">';
1220 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1223if (!empty($arrayfields[
's.email'][
'checked'])) {
1225 print
'<td class="liste_titre">';
1226 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1229if (!empty($arrayfields[
's.phone'][
'checked'])) {
1231 print
'<td class="liste_titre">';
1232 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1235if (!empty($arrayfields[
's.fax'][
'checked'])) {
1237 print
'<td class="liste_titre">';
1238 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1241if (!empty($arrayfields[
's.url'][
'checked'])) {
1243 print
'<td class="liste_titre">';
1244 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1247if (!empty($arrayfields[
's.siren'][
'checked'])) {
1249 print
'<td class="liste_titre">';
1250 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1253if (!empty($arrayfields[
's.siret'][
'checked'])) {
1255 print
'<td class="liste_titre">';
1256 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1259if (!empty($arrayfields[
's.ape'][
'checked'])) {
1261 print
'<td class="liste_titre">';
1262 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1265if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1267 print
'<td class="liste_titre">';
1268 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1271if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1273 print
'<td class="liste_titre">';
1274 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1277if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1279 print
'<td class="liste_titre">';
1280 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1283if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1285 print
'<td class="liste_titre">';
1286 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1291if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1292 print
'<td class="liste_titre maxwidthonsmartphone center">';
1294 print
'<input type="hidden" name="type" value="'.$type.
'">';
1296 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1300if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1301 print
'<td class="liste_titre center">';
1302 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1306if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1307 print
'<td class="liste_titre maxwidthonsmartphone center">';
1308 $arraystcomm = array();
1309 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1310 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1313 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1316if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1317 print
'<td class="liste_titre center">';
1318 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1322include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1325$parameters = array(
'arrayfields'=>$arrayfields);
1326$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1327print $hookmanager->resPrint;
1329if (!empty($arrayfields[
's.datec'][
'checked'])) {
1330 print
'<td class="liste_titre">';
1334if (!empty($arrayfields[
's.tms'][
'checked'])) {
1335 print
'<td class="liste_titre">';
1339if (!empty($arrayfields[
's.status'][
'checked'])) {
1340 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1341 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);
1344if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1345 print
'<td class="liste_titre center">';
1346 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1351 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1352 $searchpicto = $form->showFilterButtons();
1359$totalarray = array();
1360$totalarray[
'nbfield'] = 0;
1364print
'<tr class="liste_titre">';
1367 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1368 $totalarray[
'nbfield']++;
1370if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1371 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1372 $totalarray[
'nbfield']++;
1374if (!empty($arrayfields[
's.nom'][
'checked'])) {
1375 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1376 $totalarray[
'nbfield']++;
1378if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1379 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1380 $totalarray[
'nbfield']++;
1382if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1383 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode", $param,
'',
'', $sortfield, $sortorder);
1384 $totalarray[
'nbfield']++;
1386if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1388 $totalarray[
'nbfield']++;
1390if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1391 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1392 $totalarray[
'nbfield']++;
1394if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1395 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1396 $totalarray[
'nbfield']++;
1398if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1399 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1400 $totalarray[
'nbfield']++;
1402if (!empty($arrayfields[
's.address'][
'checked'])) {
1403 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1404 $totalarray[
'nbfield']++;
1406if (!empty($arrayfields[
's.zip'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1408 $totalarray[
'nbfield']++;
1410if (!empty($arrayfields[
's.town'][
'checked'])) {
1411 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1412 $totalarray[
'nbfield']++;
1414if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1415 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1416 $totalarray[
'nbfield']++;
1418if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1419 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1420 $totalarray[
'nbfield']++;
1422if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1424 $totalarray[
'nbfield']++;
1426if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1427 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1428 $totalarray[
'nbfield']++;
1430if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1431 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1432 $totalarray[
'nbfield']++;
1434if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1435 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1436 $totalarray[
'nbfield']++;
1438if (!empty($arrayfields[
's.email'][
'checked'])) {
1439 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1440 $totalarray[
'nbfield']++;
1442if (!empty($arrayfields[
's.phone'][
'checked'])) {
1443 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1444 $totalarray[
'nbfield']++;
1446if (!empty($arrayfields[
's.fax'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1448 $totalarray[
'nbfield']++;
1450if (!empty($arrayfields[
's.url'][
'checked'])) {
1451 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1452 $totalarray[
'nbfield']++;
1454if (!empty($arrayfields[
's.siren'][
'checked'])) {
1455 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1456 $totalarray[
'nbfield']++;
1458if (!empty($arrayfields[
's.siret'][
'checked'])) {
1459 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1460 $totalarray[
'nbfield']++;
1462if (!empty($arrayfields[
's.ape'][
'checked'])) {
1463 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1464 $totalarray[
'nbfield']++;
1466if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1467 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1468 $totalarray[
'nbfield']++;
1470if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1471 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1472 $totalarray[
'nbfield']++;
1474if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1475 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1476 $totalarray[
'nbfield']++;
1478if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1479 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1480 $totalarray[
'nbfield']++;
1482if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1483 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1484 $totalarray[
'nbfield']++;
1486if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1487 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1488 $totalarray[
'nbfield']++;
1490if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1491 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1492 $totalarray[
'nbfield']++;
1494if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1495 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1496 $totalarray[
'nbfield']++;
1499include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1501$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1502$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1503print $hookmanager->resPrint;
1504if (!empty($arrayfields[
's.datec'][
'checked'])) {
1505 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1506 $totalarray[
'nbfield']++;
1508if (!empty($arrayfields[
's.tms'][
'checked'])) {
1509 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1510 $totalarray[
'nbfield']++;
1512if (!empty($arrayfields[
's.status'][
'checked'])) {
1513 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1514 $totalarray[
'nbfield']++;
1516if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1517 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1518 $totalarray[
'nbfield']++;
1522 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1523 $totalarray[
'nbfield']++;
1531$savnbfield = $totalarray[
'nbfield'];
1532$totalarray = array();
1533$totalarray[
'nbfield'] = 0;
1534$imaxinloop = ($limit ? min($num, $limit) : $num);
1535while ($i < $imaxinloop) {
1536 $obj = $db->fetch_object($resql);
1541 $parameters = array(
'staticdata' => $obj);
1544 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1545 if (empty($reshook)) {
1546 $companystatic->id = $obj->rowid;
1547 $companystatic->name = $obj->name;
1548 $companystatic->name_alias = $obj->name_alias;
1549 $companystatic->logo = $obj->logo;
1550 $companystatic->barcode = $obj->barcode;
1551 $companystatic->canvas = $obj->canvas;
1552 $companystatic->client = $obj->client;
1553 $companystatic->status = $obj->status;
1554 $companystatic->email = $obj->email;
1555 $companystatic->address = $obj->address;
1556 $companystatic->zip = $obj->zip;
1557 $companystatic->town = $obj->town;
1558 $companystatic->fournisseur = $obj->fournisseur;
1559 $companystatic->code_client = $obj->code_client;
1560 $companystatic->code_fournisseur = $obj->code_fournisseur;
1561 $companystatic->tva_intra = $obj->tva_intra;
1562 $companystatic->country_code = $obj->country_code;
1564 $companystatic->code_compta_client = $obj->code_compta;
1565 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1567 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1568 $companystatic->parent = $obj->fk_parent;
1569 $companystatic->entity = $obj->entity;
1572 if ($mode ==
'kanban') {
1574 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1575 print
'<div class="box-flex-container kanban">';
1578 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1579 if ($i == ($imaxinloop - 1)) {
1586 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
1587 if ($contextpage ==
'poslist') {
1588 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1592 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1593 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1594 print '<td class="nowrap center actioncolumn
">';
1595 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
1597 if (in_array($obj->rowid, $arrayofselected)) {
1600 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1604 $totalarray['nbfield']++;
1607 if (!empty($arrayfields['s.rowid']['checked'])) {
1608 print '<td class="tdoverflowmax50
" data-key="id">';
1612 $totalarray['nbfield']++;
1615 if (!empty($arrayfields['s.nom']['checked'])) {
1616 print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200
"' : '').' data-key="ref">';
1617 if ($contextpage == 'poslist') {
1618 print dol_escape_htmltag($companystatic->name);
1620 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1624 $totalarray['nbfield']++;
1627 if (!empty($arrayfields['s.name_alias']['checked'])) {
1628 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1629 print dol_escape_htmltag($companystatic->name_alias);
1632 $totalarray['nbfield']++;
1636 if (!empty($arrayfields['s.barcode']['checked'])) {
1637 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
1639 $totalarray['nbfield']++;
1643 if (!empty($arrayfields['s.code_client']['checked'])) {
1644 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
1646 $totalarray['nbfield']++;
1650 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1651 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
1653 $totalarray['nbfield']++;
1656 // Account customer code
1657 if (!empty($arrayfields['s.code_compta']['checked'])) {
1658 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
1660 $totalarray['nbfield']++;
1663 // Account supplier code
1664 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1665 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
1667 $totalarray['nbfield']++;
1671 if (!empty($arrayfields['s.address']['checked'])) {
1672 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
1674 $totalarray['nbfield']++;
1678 if (!empty($arrayfields['s.zip']['checked'])) {
1679 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
1681 $totalarray['nbfield']++;
1685 if (!empty($arrayfields['s.town']['checked'])) {
1686 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
1688 $totalarray['nbfield']++;
1692 if (!empty($arrayfields['state.nom']['checked'])) {
1693 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
1695 $totalarray['nbfield']++;
1699 if (!empty($arrayfields['region.nom']['checked'])) {
1700 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
1702 $totalarray['nbfield']++;
1706 if (!empty($arrayfields['country.code_iso']['checked'])) {
1707 print '<td class="center tdoverflowmax100
">';
1708 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
1709 print $labelcountry;
1712 $totalarray['nbfield']++;
1716 if (!empty($arrayfields['typent.code']['checked'])) {
1717 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1718 $typenArray = $formcompany->typent_array(1);
1720 $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1722 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1723 print dol_escape_htmltag($labeltypeofcompany);
1726 $totalarray['nbfield']++;
1730 if (!empty($arrayfields['s.price_level']['checked'])) {
1731 print '<td class="center
">'.$obj->price_level."</td>\n
";
1733 $totalarray['nbfield']++;
1737 if (!empty($arrayfields['staff.code']['checked'])) {
1738 print '<td class="center
">';
1739 if (!empty($obj->staff_code)) {
1740 if (empty($conf->cache['staffArray'])) {
1741 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
1743 print $conf->cache['staffArray'][$obj->staff_code];
1747 $totalarray['nbfield']++;
1750 if (!empty($arrayfields['s.email']['checked'])) {
1751 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n
";
1753 $totalarray['nbfield']++;
1756 if (!empty($arrayfields['s.phone']['checked'])) {
1757 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
1759 $totalarray['nbfield']++;
1762 if (!empty($arrayfields['s.fax']['checked'])) {
1763 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
1765 $totalarray['nbfield']++;
1768 if (!empty($arrayfields['s.url']['checked'])) {
1769 print "<td>
".dol_print_url($obj->url, '', '', 1)."</td>\n
";
1771 $totalarray['nbfield']++;
1774 if (!empty($arrayfields['s.siren']['checked'])) {
1775 print "<td>
".$obj->idprof1."</td>\n
";
1777 $totalarray['nbfield']++;
1780 if (!empty($arrayfields['s.siret']['checked'])) {
1781 print "<td>
".$obj->idprof2."</td>\n
";
1783 $totalarray['nbfield']++;
1786 if (!empty($arrayfields['s.ape']['checked'])) {
1787 print "<td>
".$obj->idprof3."</td>\n
";
1789 $totalarray['nbfield']++;
1792 if (!empty($arrayfields['s.idprof4']['checked'])) {
1793 print "<td>
".$obj->idprof4."</td>\n
";
1795 $totalarray['nbfield']++;
1798 if (!empty($arrayfields['s.idprof5']['checked'])) {
1799 print "<td>
".$obj->idprof5."</td>\n
";
1801 $totalarray['nbfield']++;
1804 if (!empty($arrayfields['s.idprof6']['checked'])) {
1805 print "<td>
".$obj->idprof6."</td>\n
";
1807 $totalarray['nbfield']++;
1811 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1812 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
1813 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
1814 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
1816 print $companystatic->tva_intra;
1819 $totalarray['nbfield']++;
1823 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1824 print '<td class="center
">';
1825 print $companystatic->getTypeUrl(1);
1828 $totalarray['nbfield']++;
1832 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1834 print '<td class="center nowraponall
">';
1835 print $companystatic->getLibProspLevel();
1838 $totalarray['nbfield']++;
1842 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1844 print '<td class="center nowraponall
">';
1846 $prospectid = $obj->rowid;
1847 $statusprospect = $obj->stcomm_id;
1849 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
1853 $totalarray['nbfield']++;
1857 if (!empty($arrayfields['s2.nom']['checked'])) {
1858 print '<td class="center tdoverflowmax100
">';
1859 if ($companystatic->parent > 0) {
1860 $companyparent->fetch($companystatic->parent);
1861 print $companyparent->getNomUrl(1);
1865 $totalarray['nbfield']++;
1869 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1871 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1872 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1873 print $hookmanager->resPrint;
1875 if (!empty($arrayfields['s.datec']['checked'])) {
1876 print '<td class="center nowraponall
">';
1877 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1880 $totalarray['nbfield']++;
1883 // Date modification
1884 if (!empty($arrayfields['s.tms']['checked'])) {
1885 print '<td class="center nowraponall
">';
1886 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1889 $totalarray['nbfield']++;
1893 if (!empty($arrayfields['s.status']['checked'])) {
1894 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
1896 $totalarray['nbfield']++;
1900 if (!empty($arrayfields['s.import_key']['checked'])) {
1901 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->import_key).'">';
1902 print dol_escape_htmltag($obj->import_key);
1905 $totalarray['nbfield']++;
1908 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1909 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1910 print '<td class="nowrap center actioncolumn
">';
1911 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
1913 if (in_array($obj->rowid, $arrayofselected)) {
1916 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1920 $totalarray['nbfield']++;
1929// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
1930$formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js
");
1932// If no record found
1935 foreach ($arrayfields as $key => $val) {
1936 if (!empty($val['checked'])) {
1940 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
1945$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1946$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1947print $hookmanager->resPrint;
1949print '</table>'."\n
";
1952print '</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...)
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 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_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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.