42require_once
'../main.inc.php';
43include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
49if (isModEnabled(
'category')) {
50 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
64$langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
68$action =
GETPOST(
'action',
'aZ09');
69$massaction =
GETPOST(
'massaction',
'alpha');
71$confirm =
GETPOST(
'confirm',
'alpha');
72$toselect =
GETPOST(
'toselect',
'array');
73$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
74$optioncss =
GETPOST(
'optioncss',
'alpha');
75if ($contextpage ==
'poslist') {
78$mode =
GETPOST(
"mode",
'alpha');
81$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
82$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
84$search_id =
GETPOST(
"search_id",
'int');
85$search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
86$search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
87$search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
88$search_ref_ext = trim(
GETPOST(
"search_ref_ext",
'restricthtml'));
89$search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
90$search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
91$search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
92$search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
93$search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
94$search_address = trim(
GETPOST(
'search_address',
'alpha'));
95$search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
96$search_town = trim(
GETPOST(
"search_town",
'alpha'));
97$search_state = trim(
GETPOST(
"search_state",
'alpha'));
98$search_region = trim(
GETPOST(
"search_region",
'alpha'));
99$search_email = trim(
GETPOST(
'search_email',
'alpha'));
100$search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
101$search_phone_mobile = trim(
GETPOST(
'search_phone_mobile',
'alpha'));
102$search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
103$search_url = trim(
GETPOST(
'search_url',
'alpha'));
104$search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
105$search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
106$search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
107$search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
108$search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
109$search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
110$search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
113 $search_sale =
GETPOST(
'search_sale',
'array:int');
114} elseif (GETPOSTISSET(
'search_sale')) {
115 $search_sale = array(
GETPOSTINT(
'search_sale'));
117$search_categ_cus =
GETPOSTINT(
"search_categ_cus");
118$search_categ_sup =
GETPOSTINT(
"search_categ_sup");
119$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
120$searchCategorySupplierOperator =
GETPOSTINT(
'search_category_supplier_operator');
121if (GETPOSTISSET(
'formfilteraction')) {
122 $searchCategoryCustomerOperator =
GETPOST(
'search_category_customer_operator');
123 $searchCategorySupplierOperator =
GETPOST(
'search_category_supplier_operator');
125 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
126 $searchCategorySupplierOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
128$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
129if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) {
130 $searchCategoryCustomerList = array($search_categ_cus);
132$searchCategorySupplierList =
GETPOST(
'search_category_supplier_list',
'array');
133if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) {
134 $searchCategorySupplierList = array($search_categ_sup);
136$search_country =
GETPOST(
"search_country",
'aZ09');
137$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
138$search_price_level =
GETPOST(
'search_price_level',
'int');
139$search_staff =
GETPOST(
"search_staff",
'int');
140$search_legalform =
GETPOST(
"search_legalform",
'int');
141$search_status =
GETPOST(
"search_status",
'intcomma');
142$search_type =
GETPOST(
'search_type',
'alpha');
143$search_level =
GETPOST(
"search_level",
"array:alpha");
144$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
145$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
146$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
148$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
149$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
150$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
151$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
152$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
153$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
154$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
155$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
157$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
158$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
159$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
160$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
161$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
162$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
163$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
164$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
166$type =
GETPOST(
'type',
'alpha');
167$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
169$diroutputmassaction =
$conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
173$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
174$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
180 $sortfield =
"s.nom";
182if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
186$offset = $limit * $page;
187$pageprev = $page - 1;
188$pagenext = $page + 1;
191 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
192 $contextpage =
'customerlist';
194 if ($search_type ==
'') {
195 $search_type =
'1,3';
199 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
200 $contextpage =
'prospectlist';
202 if ($search_type ==
'') {
203 $search_type =
'2,3';
207 if (empty($contextpage) || $contextpage ==
'poslist') {
208 $contextpage =
'poslist';
210 if ($search_type ==
'') {
211 $search_type =
'1,2,3';
215 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
216 $contextpage =
'supplierlist';
218 if ($search_type ==
'') {
225$hookmanager->initHooks(array($contextpage,
'thirdpartylist'));
228$extrafields->fetch_name_optionals_label(
$object->table_element);
230$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
233$fieldstosearchall = array(
234 's.nom' =>
"ThirdPartyName",
235 's.name_alias' =>
"AliasNameShort",
236 's.code_client' =>
"CustomerCode",
237 's.code_fournisseur' =>
"SupplierCode",
238 's.code_compta' =>
"CustomerAccountancyCodeShort",
239 's.code_compta_fournisseur' =>
"SupplierAccountancyCodeShort",
242 's.email' =>
"EMail",
244 's.tva_intra' =>
"VATIntra",
245 's.siren' =>
"ProfId1",
246 's.siret' =>
"ProfId2",
247 's.ape' =>
"ProfId3",
248 's.phone' =>
"Phone",
249 's.phone_mobile' =>
"PhoneMobile",
252if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
253 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
255if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
256 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
258if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
259 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
261if (isModEnabled(
'barcode')) {
262 $fieldstosearchall[
's.barcode'] =
'Gencod';
271$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ? 1 : 0);
272$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
273$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
274$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
275$checkedtypetiers = 1;
285$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
286$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
288 's.rowid' => array(
'label' =>
"TechnicalID",
'position' => 1,
'checked' => -1,
'enabled' => 1),
289 's.nom' => array(
'label' =>
"ThirdPartyName",
'position' => 2,
'checked' => 1),
290 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 3,
'checked' => 1),
291 's.ref_ext' => array(
'label' =>
"RefExt",
'position' => 4,
'checked' => -1,
'enabled' =>
getDolGlobalInt(
'MAIN_LIST_SHOW_REF_EXT')),
292 's.barcode' => array(
'label' =>
"Gencod",
'position' => 5,
'checked' => 1,
'enabled' => isModEnabled(
'barcode')),
293 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'position' => 10,
'checked' => $checkedcustomercode),
294 's.code_fournisseur' => array(
'label' =>
"SupplierCodeShort",
'position' => 11,
'checked' => $checkedsuppliercode,
'enabled' => (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
295 's.code_compta' => array(
'label' =>
"CustomerAccountancyCodeShort",
'position' => 13,
'checked' => $checkedcustomeraccountcode),
296 's.code_compta_fournisseur' => array(
'label' =>
"SupplierAccountancyCodeShort",
'position' => 14,
'checked' => $checkedsupplieraccountcode,
'enabled' => (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
297 's.address' => array(
'label' =>
"Address",
'position' => 19,
'checked' => 0),
298 's.zip' => array(
'label' =>
"Zip",
'position' => 20,
'checked' => 1),
299 's.town' => array(
'label' =>
"Town",
'position' => 21,
'checked' => 0),
300 'state.nom' => array(
'label' =>
"State",
'position' => 22,
'checked' => 0),
301 'region.nom' => array(
'label' =>
"Region",
'position' => 23,
'checked' => 0),
302 'country.code_iso' => array(
'label' =>
"Country",
'position' => 24,
'checked' => 0),
303 's.email' => array(
'label' =>
"Email",
'position' => 25,
'checked' => 0),
304 's.url' => array(
'label' =>
"Url",
'position' => 26,
'checked' => 0),
305 's.phone' => array(
'label' =>
"Phone",
'position' => 27,
'checked' => 1),
306 's.fax' => array(
'label' =>
"Fax",
'position' => 28,
'checked' => 0),
307 'typent.code' => array(
'label' =>
"ThirdPartyType",
'position' => 29,
'checked' => $checkedtypetiers),
308 'staff.code' => array(
'label' =>
"Workforce",
'position' => 31,
'checked' => 0),
309 'legalform.code' => array(
'label' =>
'JuridicalStatus',
'position' => 32,
'checked' => 0),
310 's.phone_mobile' => array(
'label' =>
"PhoneMobile",
'position' => 35,
'checked' => 0),
311 's.siren' => array(
'label' =>
"ProfId1Short",
'position' => 40,
'checked' => $checkedprofid1),
312 's.siret' => array(
'label' =>
"ProfId2Short",
'position' => 41,
'checked' => $checkedprofid2),
313 's.ape' => array(
'label' =>
"ProfId3Short",
'position' => 42,
'checked' => $checkedprofid3),
314 's.idprof4' => array(
'label' =>
"ProfId4Short",
'position' => 43,
'checked' => $checkedprofid4),
315 's.idprof5' => array(
'label' =>
"ProfId5Short",
'position' => 44,
'checked' => $checkedprofid5),
316 's.idprof6' => array(
'label' =>
"ProfId6Short",
'position' => 45,
'checked' => $checkedprofid6),
317 's.tva_intra' => array(
'label' =>
"VATIntraShort",
'position' => 50,
'checked' => 0),
318 'customerorsupplier' => array(
'label' =>
'NatureOfThirdParty',
'position' => 61,
'checked' => 1),
319 's.fk_prospectlevel' => array(
'label' =>
"ProspectLevel",
'position' => 62,
'checked' => $checkprospectlevel),
320 's.fk_stcomm' => array(
'label' =>
"StatusProsp",
'position' => 63,
'checked' => $checkstcomm),
321 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 64,
'checked' => 0),
322 's.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
323 's.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
324 's.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 520,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
325 's.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 521,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
326 's.status' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
327 's.import_key' => array(
'label' =>
"ImportId",
'checked' => 0,
'position' => 1100),
330 $arrayfields[
's.price_level'] = array(
'label' =>
"PriceLevel",
'position' => 30,
'checked' => 0);
334$arrayfields[
'sales.representative'] = array(
'label' => $langs->trans(
"SalesRepresentatives"),
'checked' => 1,
'position' => 12);
337include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
341'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
346 $socid = $user->socid;
350$permissiontoadd = $user->hasRight(
'societe',
'lire');
357if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
361 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
362 $result = $db->query($sql);
363 $num_lines = $db->num_rows($result);
364 if ($num_lines == 0) {
365 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
367 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
370 $invoice->module_source =
'takepos';
371 $invoice->pos_source = $_SESSION[
"takeposterminal"];
372 $placeid = $invoice->create($user);
373 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
377 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
378 $resql = $db->query($sql); ?>
380 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
381 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
383 <?php
if (!$resql) { ?>
384 alert(
'Error failed to update customer on draft invoice.');
386 parent.$.colorbox.close();
393if (
GETPOST(
'cancel',
'alpha')) {
397if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
401$parameters = array(
'arrayfields' => &$arrayfields);
402$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
407if (empty($reshook)) {
409 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
412 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
416 $search_ref_ext =
'';
417 $search_categ_cus = 0;
418 $search_categ_sup = 0;
419 $searchCategoryCustomerOperator = 0;
420 $searchCategorySupplierOperator = 0;
421 $searchCategoryCustomerList = array();
422 $searchCategorySupplierList = array();
423 $search_sale = array();
424 $search_barcode =
"";
425 $search_customer_code =
'';
426 $search_supplier_code =
'';
427 $search_account_customer_code =
'';
428 $search_account_supplier_code =
'';
429 $search_address =
'';
434 $search_country =
'';
437 $search_phone_mobile =
'';
440 $search_idprof1 =
'';
441 $search_idprof2 =
'';
442 $search_idprof3 =
'';
443 $search_idprof4 =
'';
444 $search_idprof5 =
'';
445 $search_idprof6 =
'';
448 $search_price_level =
'';
449 $search_type_thirdparty =
'';
451 $search_legalform =
'';
452 $search_date_creation_startmonth =
"";
453 $search_date_creation_startyear =
"";
454 $search_date_creation_startday =
"";
455 $search_date_creation_start =
"";
456 $search_date_creation_endmonth =
"";
457 $search_date_creation_endyear =
"";
458 $search_date_creation_endday =
"";
459 $search_date_creation_end =
"";
460 $search_date_modif_startmonth =
"";
461 $search_date_modif_startyear =
"";
462 $search_date_modif_startday =
"";
463 $search_date_modif_start =
"";
464 $search_date_modif_endmonth =
"";
465 $search_date_modif_endyear =
"";
466 $search_date_modif_endday =
"";
467 $search_date_modif_end =
"";
471 $search_parent_name =
'';
472 $search_import_key =
'';
476 $search_array_options = array();
480 $objectclass =
'Societe';
481 $objectlabel =
'ThirdParty';
482 $permissiontoread = $user->hasRight(
'societe',
'lire');
483 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
484 $permissiontoadd = $user->hasRight(
"societe",
"creer");
485 $uploaddir =
$conf->societe->dir_output;
488 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
490 if (!$error && $action ==
'setstcomm' && $permissiontoadd) {
503if ($search_status ==
'' && empty($search_all)) {
522$form =
new Form($db);
524$companystatic =
new Societe($db);
525$companyparent =
new Societe($db);
527$prospectstatic =
new Client($db);
528$prospectstatic->client = 2;
529$prospectstatic->loadCacheOfProspStatus();
533$title = $langs->trans(
"ThirdParties");
534if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
535 $title = $langs->trans(
"Customers");
537if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
538 $title = $langs->trans(
"Prospects");
540if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
541 $title = $langs->trans(
"Suppliers");
543$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
548$sql =
"SELECT code, label, sortorder";
549$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
550$sql .=
" WHERE active > 0";
551$sql .=
" ORDER BY sortorder";
552$resql = $db->query($sql);
554 while ($obj = $db->fetch_object($resql)) {
556 $level = $langs->trans($obj->code);
557 if ($level == $obj->code) {
558 $level = $langs->trans($obj->label);
560 $tab_level[$obj->code] = $level;
568$sql =
"SELECT s.rowid, s.nom as name, s.name_alias, s.ref_ext, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
570$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, s.note_private, s.note_public,";
571$sql .=
" s.email, s.phone, s.phone_mobile, 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,";
572$sql .=
" s.tms as date_modification, s.datec as date_creation, s.import_key,";
573$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
574$sql .=
" s2.nom as name2,";
575$sql .=
" typent.code as typent_code,";
576$sql .=
" staff.code as staff_code,";
577$sql .=
" s.fk_forme_juridique as legalform_code,";
578$sql .=
" country.code as country_code, country.label as country_label,";
579$sql .=
" state.code_departement as state_code, state.nom as state_name,";
580$sql .=
" region.code_region as region_code, region.nom as region_name";
582if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
583 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
584 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
588$parameters = array();
589$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
590$sql .= $hookmanager->resPrint;
591$sql = preg_replace(
'/,\s*$/',
'', $sql);
596$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
597$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
598if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
599 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
602$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
603$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
604$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
606$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
607$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
608$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
610$parameters = array();
611$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
612$sql .= $hookmanager->resPrint;
613$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
614if (!$user->hasRight(
'fournisseur',
'lire')) {
615 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
619if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
620 $search_sale = array($user->id);
623if (!empty($search_sale) && $search_sale !=
'-1') {
624 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
625 $value = intval($value);
629 $search_sale_req = implode(
',', $search_sale_req);
631 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
632 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
633 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
634 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req).
"))";
635 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
636 $sql .=
" AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req).
"))";
637 $sql .=
" OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
642if (!empty($searchCategoryCustomerList)) {
643 $searchCategoryCustomerSqlList = array();
644 $listofcategoryid =
'';
645 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
646 if (intval($searchCategoryCustomer) == -2) {
647 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
648 } elseif (intval($searchCategoryCustomer) > 0) {
649 if ($searchCategoryCustomerOperator == 0) {
650 $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).
")";
652 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
656 if ($listofcategoryid) {
657 $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).
"))";
659 if ($searchCategoryCustomerOperator == 1) {
660 if (!empty($searchCategoryCustomerSqlList)) {
661 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
664 if (!empty($searchCategoryCustomerSqlList)) {
665 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
671if (!empty($searchCategorySupplierList)) {
672 $searchCategorySupplierSqlList = array();
673 $listofcategoryid =
'';
674 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
675 if (intval($searchCategorySupplier) == -2) {
676 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
677 } elseif (intval($searchCategorySupplier) > 0) {
678 if ($searchCategorySupplierOperator == 0) {
679 $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).
")";
681 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
685 if ($listofcategoryid) {
686 $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).
"))";
688 if ($searchCategorySupplierOperator == 1) {
689 if (!empty($searchCategorySupplierSqlList)) {
690 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
693 if (!empty($searchCategorySupplierSqlList)) {
694 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
699 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
701if (strlen($search_cti)) {
707if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
708 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
718if ($search_nom_only) {
721if ($search_ref_ext) {
724if ($search_customer_code) {
727if ($search_supplier_code) {
728 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
730if ($search_account_customer_code) {
731 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
733if ($search_account_supplier_code) {
734 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
736if ($search_address) {
739if (strlen($search_zip)) {
751if ($search_country && $search_country !=
'-1') {
752 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
757if (strlen($search_phone)) {
760if (strlen($search_phone_mobile)) {
763if (strlen($search_fax)) {
769if (strlen($search_idprof1)) {
772if (strlen($search_idprof2)) {
775if (strlen($search_idprof3)) {
778if (strlen($search_idprof4)) {
781if (strlen($search_idprof5)) {
784if (strlen($search_idprof6)) {
787if (strlen($search_vat)) {
791if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
792 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
794if ($search_type > 0 && in_array($search_type, array(
'4'))) {
795 $sql .=
" AND s.fournisseur = 1";
797if ($search_type ==
'0') {
798 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
800if ($search_status !=
'' && $search_status >= 0) {
803if (isModEnabled(
'barcode') && $search_barcode) {
806if ($search_price_level && $search_price_level !=
'-1') {
809if ($search_type_thirdparty && $search_type_thirdparty > 0) {
810 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
812if (!empty($search_staff) && $search_staff !=
'-1') {
815if (!empty($search_legalform) && $search_legalform !=
'-1') {
816 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
818if ($search_parent_name) {
822 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
825 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
827if ($search_import_key) {
830if ($search_date_creation_start) {
831 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
833if ($search_date_creation_end) {
834 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
837if ($search_date_modif_start) {
838 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
840if ($search_date_modif_end) {
841 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
845include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
847$parameters = array(
'socid' => $socid);
848$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
849if (empty($reshook)) {
851 $sql .=
" AND s.rowid = ".((int) $socid);
854$sql .= $hookmanager->resPrint;
857$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
858$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
859$sql .= $hookmanager->resPrint;
862$nbtotalofrecords =
'';
865 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
866 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
867 $resql = $db->query($sqlforcount);
869 $objforcount = $db->fetch_object($resql);
870 $nbtotalofrecords = $objforcount->nbtotalofrecords;
875 if (($page * $limit) > $nbtotalofrecords) {
883$sql .= $db->order($sortfield, $sortorder);
885 $sql .= $db->plimit($limit + 1, $offset);
887$resql = $db->query($sql);
893$num = $db->num_rows($resql);
897if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
898 $obj = $db->fetch_object($resql);
900 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
901 if ($obj->client > 0) {
902 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
905 if ($obj->fournisseur > 0) {
906 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
911 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
919foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
920 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
922foreach ($searchCategorySupplierList as $searchCategorySupplier) {
923 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
926llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
929$arrayofselected = is_array($toselect) ? $toselect : array();
933 $param .=
'&mode='.urlencode($mode);
935if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
936 $param .=
'&contextpage='.urlencode($contextpage);
938if ($limit > 0 && $limit !=
$conf->liste_limit) {
939 $param .=
'&limit='.((int) $limit);
941if ($optioncss !=
'') {
942 $param .=
'&optioncss='.urlencode($optioncss);
944if ($search_all !=
'') {
945 $param =
"&search_all=".urlencode($search_all);
947if ($search_categ_cus > 0) {
948 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
950if ($search_categ_sup > 0) {
951 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
953if ($searchCategoryCustomerOperator == 1) {
954 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
956if ($searchCategorySupplierOperator == 1) {
957 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
959foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
960 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
962foreach ($searchCategorySupplierList as $searchCategorySupplier) {
963 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
965if (is_array($search_sale)) {
966 foreach ($search_sale as $sale_id) {
967 $param .=
'&search_sale[]=' . urlencode($sale_id);
971 $param .=
"&search_id=".((int) $search_id);
973if ($search_nom !=
'') {
974 $param .=
"&search_nom=".urlencode($search_nom);
976if ($search_alias !=
'') {
977 $param .=
"&search_alias=".urlencode($search_alias);
979if ($search_ref_ext !=
'') {
980 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
982if ($search_address !=
'') {
983 $param .=
'&search_address='.urlencode($search_address);
985if ($search_zip !=
'') {
986 $param .=
"&search_zip=".urlencode($search_zip);
988if ($search_town !=
'') {
989 $param .=
"&search_town=".urlencode($search_town);
991if ($search_phone !=
'') {
992 $param .=
"&search_phone=".urlencode($search_phone);
994if ($search_phone_mobile !=
'') {
995 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
997if ($search_fax !=
'') {
998 $param .=
"&search_fax=".urlencode($search_fax);
1000if ($search_email !=
'') {
1001 $param .=
"&search_email=".urlencode($search_email);
1003if ($search_url !=
'') {
1004 $param .=
"&search_url=".urlencode($search_url);
1006if ($search_state !=
'') {
1007 $param .=
"&search_state=".urlencode($search_state);
1009if ($search_region !=
'') {
1010 $param .=
"&search_region=".urlencode($search_region);
1012if ($search_country !=
'') {
1013 $param .=
"&search_country=".urlencode($search_country);
1015if ($search_customer_code !=
'') {
1016 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1018if ($search_supplier_code !=
'') {
1019 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1021if ($search_account_customer_code !=
'') {
1022 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1024if ($search_account_supplier_code !=
'') {
1025 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1027if ($search_barcode !=
'') {
1028 $param .=
"&search_barcode=".urlencode($search_barcode);
1030if ($search_idprof1 !=
'') {
1031 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1033if ($search_idprof2 !=
'') {
1034 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1036if ($search_idprof3 !=
'') {
1037 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1039if ($search_idprof4 !=
'') {
1040 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1042if ($search_idprof5 !=
'') {
1043 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1045if ($search_idprof6 !=
'') {
1046 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1048if ($search_vat !=
'') {
1049 $param .=
'&search_vat='.urlencode($search_vat);
1051if ($search_price_level !=
'') {
1052 $param .=
'&search_price_level='.urlencode($search_price_level);
1054if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1055 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1057if ($search_type !=
'') {
1058 $param .=
'&search_type='.urlencode($search_type);
1060if ($search_status !=
'') {
1061 $param .=
'&search_status='.urlencode((
string) ($search_status));
1063if (is_array($search_level) && count($search_level)) {
1064 foreach ($search_level as $slevel) {
1065 $param .=
'&search_level[]='.urlencode($slevel);
1068if (is_array($search_stcomm) && count($search_stcomm)) {
1069 foreach ($search_stcomm as $slevel) {
1070 $param .=
'&search_stcomm[]='.urlencode($slevel);
1073if ($search_parent_name !=
'') {
1074 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1076if ($search_import_key !=
'') {
1077 $param .=
'&search_import_key='.urlencode($search_import_key);
1080 $param .=
'&type='.urlencode($type);
1082if ($search_date_creation_startmonth) {
1083 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1085if ($search_date_creation_startyear) {
1086 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1088if ($search_date_creation_startday) {
1089 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1091if ($search_date_creation_start) {
1092 $param .=
'&search_date_creation_start='.urlencode($search_date_creation_start);
1094if ($search_date_creation_endmonth) {
1095 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1097if ($search_date_creation_endyear) {
1098 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1100if ($search_date_creation_endday) {
1101 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1103if ($search_date_creation_end) {
1104 $param .=
'&search_date_creation_end='.urlencode($search_date_creation_end);
1106if ($search_date_modif_startmonth) {
1107 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1109if ($search_date_modif_startyear) {
1110 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1112if ($search_date_modif_startday) {
1113 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1115if ($search_date_modif_start) {
1116 $param .=
'&search_date_modif_start='.urlencode($search_date_modif_start);
1118if ($search_date_modif_endmonth) {
1119 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1121if ($search_date_modif_endyear) {
1122 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1124if ($search_date_modif_endday) {
1125 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1127if ($search_date_modif_end) {
1128 $param .=
'&search_date_modif_end=' . urlencode($search_date_modif_end);
1132include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1134$parameters = array(
'param' => &$param);
1135$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1136$param .= $hookmanager->resPrint;
1144$arrayofmassactions = array(
1145 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1149if (isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1150 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1152if ($user->hasRight(
"societe",
"creer")) {
1153 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1155if ($user->hasRight(
"societe",
"creer")) {
1156 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1158if ($user->hasRight(
"societe",
"creer")) {
1159 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1160 $arrayofmassactions[
'unsetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1163if ($user->hasRight(
'societe',
'supprimer')) {
1164 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1166if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1167 $arrayofmassactions = array();
1169$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1172$label =
'MenuNewThirdParty';
1175 $typefilter =
'&type='.$type;
1177 $label =
'MenuNewProspect';
1180 $label =
'MenuNewCustomer';
1183 $label =
'NewSupplier';
1193if ($contextpage !=
'poslist') {
1194 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1195 if (!empty($socid)) {
1196 $url .=
'&socid='.$socid;
1198 $newcardbutton =
'';
1199 $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'));
1200 $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'));
1201 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1202} elseif ($user->hasRight(
'societe',
'creer')) {
1203 $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);
1204 $label =
'MenuNewCustomer';
1205 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1208print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1209if ($optioncss !=
'') {
1210 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1212print
'<input type="hidden" name="token" value="'.newToken().
'">';
1213print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1214print
'<input type="hidden" name="action" value="list">';
1215print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1216print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1218print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1219if (!empty($place)) {
1220 print
'<input type="hidden" name="place" value="'.$place.
'">';
1222print
'<input type="hidden" name="page_y" value="">';
1223print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1224if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1225 print
'<input type="hidden" name="type" value="'.$type.
'">';
1227if (!empty($place)) {
1228 print
'<input type="hidden" name="place" value="'.$place.
'">';
1231print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1233$langs->load(
"other");
1234$textprofid = array();
1235foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1236 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1237 $textprofid[$key] =
'';
1238 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1239 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1243 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
1248$topicmail =
"Information";
1249$modelmail =
"thirdparty";
1251$trackid =
'thi'.$object->id;
1252include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1266 foreach ($fieldstosearchall as $key => $val) {
1267 $fieldstosearchall[$key] = $langs->trans($val);
1268 $setupstring .= $key.
"=".$val.
";";
1270 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1271 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1277if (empty($type) || $type ==
'c' || $type ==
'p') {
1278 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1280 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1285if (empty($type) || $type ==
'f') {
1286 if (isModEnabled(
"fournisseur") && isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1288 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1293$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1294$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1295if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1296 $moreforfilter .=
'<div class="divsearchfield">';
1297 $tmptitle = $langs->trans(
'SalesRepresentatives');
1298 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1299 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->trans(
'SalesRepresentatives'), 1);
1300 $moreforfilter .=
'</div>';
1302if (!empty($moreforfilter)) {
1303 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1304 print $moreforfilter;
1305 $parameters = array(
'type' => $type);
1306 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1307 print $hookmanager->resPrint;
1311$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1312$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1313$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1314$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1316print
'<div class="div-table-responsive">';
1317print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1321print
'<tr class="liste_titre_filter">';
1324 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1325 $searchpicto = $form->showFilterButtons(
'left');
1329if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1330 print
'<td class="liste_titre" data-key="id">';
1331 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1334if (!empty($arrayfields[
's.nom'][
'checked'])) {
1335 print
'<td class="liste_titre" data-key="ref">';
1336 if (!empty($search_nom_only) && empty($search_nom)) {
1337 $search_nom = $search_nom_only;
1339 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1342if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1343 print
'<td class="liste_titre">';
1344 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1347if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1348 print
'<td class="liste_titre">';
1349 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1353if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1354 print
'<td class="liste_titre">';
1355 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1359if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1360 print
'<td class="liste_titre">';
1361 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1365if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1366 print
'<td class="liste_titre">';
1367 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1371if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1372 print
'<td class="liste_titre">';
1373 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1377if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1378 print
'<td class="liste_titre">';
1379 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1383if (!empty($arrayfields[
's.address'][
'checked'])) {
1384 print
'<td class="liste_titre">';
1385 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1389if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1390 print
'<td class="liste_titre">';
1394if (!empty($arrayfields[
's.zip'][
'checked'])) {
1395 print
'<td class="liste_titre">';
1396 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1400if (!empty($arrayfields[
's.town'][
'checked'])) {
1401 print
'<td class="liste_titre">';
1402 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1406if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1407 print
'<td class="liste_titre">';
1408 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1412if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1413 print
'<td class="liste_titre">';
1414 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1418if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1419 print
'<td class="liste_titre center">';
1420 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1424if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1425 print
'<td class="liste_titre maxwidthonsmartphone center">';
1427 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);
1431if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1432 print
'<td class="liste_titre">';
1433 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1437if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1438 print
'<td class="liste_titre maxwidthonsmartphone center">';
1439 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1443if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1444 print
'<td class="liste_titre maxwidthonsmartphone center">';
1448if (!empty($arrayfields[
's.email'][
'checked'])) {
1450 print
'<td class="liste_titre">';
1451 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1454if (!empty($arrayfields[
's.phone'][
'checked'])) {
1456 print
'<td class="liste_titre">';
1457 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1460if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1462 print
'<td class="liste_titre">';
1463 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1466if (!empty($arrayfields[
's.fax'][
'checked'])) {
1468 print
'<td class="liste_titre">';
1469 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1472if (!empty($arrayfields[
's.url'][
'checked'])) {
1474 print
'<td class="liste_titre">';
1475 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1478if (!empty($arrayfields[
's.siren'][
'checked'])) {
1480 print
'<td class="liste_titre">';
1481 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1484if (!empty($arrayfields[
's.siret'][
'checked'])) {
1486 print
'<td class="liste_titre">';
1487 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1490if (!empty($arrayfields[
's.ape'][
'checked'])) {
1492 print
'<td class="liste_titre">';
1493 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1496if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1498 print
'<td class="liste_titre">';
1499 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1502if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1504 print
'<td class="liste_titre">';
1505 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1508if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1510 print
'<td class="liste_titre">';
1511 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1514if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1516 print
'<td class="liste_titre">';
1517 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1522if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1523 print
'<td class="liste_titre maxwidthonsmartphone center">';
1525 print
'<input type="hidden" name="type" value="'.$type.
'">';
1527 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1531if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1532 print
'<td class="liste_titre center">';
1533 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1537if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1538 print
'<td class="liste_titre maxwidthonsmartphone center">';
1539 $arraystcomm = array();
1540 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1541 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1544 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1547if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1548 print
'<td class="liste_titre center">';
1549 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1553include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1556$parameters = array(
'arrayfields' => $arrayfields);
1557$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1558print $hookmanager->resPrint;
1560if (!empty($arrayfields[
's.datec'][
'checked'])) {
1561 print
'<td class="liste_titre center nowraponall">';
1562 print
'<div class="nowrapfordate">';
1563 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'));
1565 print
'<div class="nowrapfordate">';
1566 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'));
1571if (!empty($arrayfields[
's.tms'][
'checked'])) {
1572 print
'<td class="liste_titre center nowraponall">';
1573 print
'<div class="nowrapfordate">';
1574 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'));
1576 print
'<div class="nowrapfordate">';
1577 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'));
1581if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1583 print
'<td class="liste_titre">';
1586if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1588 print
'<td class="liste_titre">';
1592if (!empty($arrayfields[
's.status'][
'checked'])) {
1593 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1594 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);
1597if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1598 print
'<td class="liste_titre center">';
1599 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1604 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1605 $searchpicto = $form->showFilterButtons();
1612$totalarray = array();
1613$totalarray[
'nbfield'] = 0;
1617print
'<tr class="liste_titre">';
1620 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1621 $totalarray[
'nbfield']++;
1623if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1624 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1625 $totalarray[
'nbfield']++;
1627if (!empty($arrayfields[
's.nom'][
'checked'])) {
1628 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1629 $totalarray[
'nbfield']++;
1631if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1633 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1634 $totalarray[
'nbfield']++;
1636if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1638 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1639 $totalarray[
'nbfield']++;
1641if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1642 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode", $param,
'',
'', $sortfield, $sortorder);
1643 $totalarray[
'nbfield']++;
1645if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1646 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1647 $totalarray[
'nbfield']++;
1649if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1650 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1651 $totalarray[
'nbfield']++;
1653if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1654 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1655 $totalarray[
'nbfield']++;
1657if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1658 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1659 $totalarray[
'nbfield']++;
1661if (!empty($arrayfields[
's.address'][
'checked'])) {
1662 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1663 $totalarray[
'nbfield']++;
1665if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1666 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1667 $totalarray[
'nbfield']++;
1669if (!empty($arrayfields[
's.zip'][
'checked'])) {
1670 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1671 $totalarray[
'nbfield']++;
1673if (!empty($arrayfields[
's.town'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1675 $totalarray[
'nbfield']++;
1677if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1678 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1679 $totalarray[
'nbfield']++;
1681if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1682 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1683 $totalarray[
'nbfield']++;
1685if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1686 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1687 $totalarray[
'nbfield']++;
1689if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1690 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1691 $totalarray[
'nbfield']++;
1693if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1694 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1695 $totalarray[
'nbfield']++;
1697if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1700 $totalarray[
'nbfield']++;
1702if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1704 $totalarray[
'nbfield']++;
1706if (!empty($arrayfields[
's.email'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
's.phone'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1712 $totalarray[
'nbfield']++;
1714if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1716 $totalarray[
'nbfield']++;
1718if (!empty($arrayfields[
's.fax'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1720 $totalarray[
'nbfield']++;
1722if (!empty($arrayfields[
's.url'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1724 $totalarray[
'nbfield']++;
1726if (!empty($arrayfields[
's.siren'][
'checked'])) {
1727 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1728 $totalarray[
'nbfield']++;
1730if (!empty($arrayfields[
's.siret'][
'checked'])) {
1731 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1732 $totalarray[
'nbfield']++;
1734if (!empty($arrayfields[
's.ape'][
'checked'])) {
1735 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1736 $totalarray[
'nbfield']++;
1738if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1739 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1740 $totalarray[
'nbfield']++;
1742if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1743 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1744 $totalarray[
'nbfield']++;
1746if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1747 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1748 $totalarray[
'nbfield']++;
1750if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1752 $totalarray[
'nbfield']++;
1754if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1756 $totalarray[
'nbfield']++;
1758if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1760 $totalarray[
'nbfield']++;
1762if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1764 $totalarray[
'nbfield']++;
1766if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1768 $totalarray[
'nbfield']++;
1771include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1773$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1774$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1775print $hookmanager->resPrint;
1776if (!empty($arrayfields[
's.datec'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1778 $totalarray[
'nbfield']++;
1780if (!empty($arrayfields[
's.tms'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1782 $totalarray[
'nbfield']++;
1784if (!empty($arrayfields[
's.status'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1786 $totalarray[
'nbfield']++;
1788if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1790 $totalarray[
'nbfield']++;
1792if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1794 $totalarray[
'nbfield']++;
1796if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1798 $totalarray[
'nbfield']++;
1802 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1803 $totalarray[
'nbfield']++;
1811$savnbfield = $totalarray[
'nbfield'];
1812$totalarray = array();
1813$totalarray[
'nbfield'] = 0;
1814$imaxinloop = ($limit ? min($num, $limit) : $num);
1815while ($i < $imaxinloop) {
1816 $obj = $db->fetch_object($resql);
1821 $parameters = array(
'staticdata' => $obj);
1824 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1825 if (empty($reshook)) {
1826 $companystatic->id = $obj->rowid;
1827 $companystatic->name = $obj->name;
1828 $companystatic->name_alias = $obj->name_alias;
1829 $companystatic->ref_ext = $obj->ref_ext;
1830 $companystatic->logo = $obj->logo;
1831 $companystatic->barcode = $obj->barcode;
1832 $companystatic->canvas = $obj->canvas;
1833 $companystatic->client = $obj->client;
1834 $companystatic->status = $obj->status;
1835 $companystatic->email = $obj->email;
1836 $companystatic->phone = $obj->phone;
1837 $companystatic->phone_mobile = $obj->phone_mobile;
1838 $companystatic->fax = $obj->fax;
1839 $companystatic->address = $obj->address;
1840 $companystatic->zip = $obj->zip;
1841 $companystatic->town = $obj->town;
1842 $companystatic->fournisseur = $obj->fournisseur;
1843 $companystatic->code_client = $obj->code_client;
1844 $companystatic->code_fournisseur = $obj->code_fournisseur;
1845 $companystatic->tva_intra = $obj->tva_intra;
1846 $companystatic->country_code = $obj->country_code;
1848 $companystatic->code_compta_client = $obj->code_compta;
1849 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1850 $companystatic->note_public = $obj->note_public;
1851 $companystatic->note_private = $obj->note_private;
1852 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1853 $companystatic->parent = $obj->fk_parent;
1854 $companystatic->entity = $obj->entity;
1859 if ($mode ==
'kanban') {
1861 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1862 print
'<div class="box-flex-container kanban">';
1865 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1866 if ($i == ($imaxinloop - 1)) {
1873 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven"';
1874 if ($contextpage ==
'poslist') {
1875 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1879 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1880 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1881 print '<td class="nowrap center actioncolumn
">';
1882 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
1884 if (in_array($obj->rowid, $arrayofselected)) {
1887 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1891 $totalarray['nbfield']++;
1894 if (!empty($arrayfields['s.rowid']['checked'])) {
1895 print '<td class="tdoverflowmax50
" data-key="id">';
1896 print dol_escape_htmltag($obj->rowid);
1899 $totalarray['nbfield']++;
1902 if (!empty($arrayfields['s.nom']['checked'])) {
1903 print '<td'.(getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? '' : ' class="tdoverflowmax200
"').' data-key="ref">';
1904 if ($contextpage == 'poslist') {
1905 print dol_escape_htmltag($companystatic->name);
1907 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1911 $totalarray['nbfield']++;
1914 if (!empty($arrayfields['s.name_alias']['checked'])) {
1915 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1916 print dol_escape_htmltag($companystatic->name_alias);
1919 $totalarray['nbfield']++;
1923 if (!empty($arrayfields['s.ref_ext']['checked'])) {
1924 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->ref_ext).'">';
1925 print dol_escape_htmltag($companystatic->ref_ext);
1928 $totalarray['nbfield']++;
1932 if (!empty($arrayfields['s.barcode']['checked'])) {
1933 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
1935 $totalarray['nbfield']++;
1939 if (!empty($arrayfields['s.code_client']['checked'])) {
1940 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
1942 $totalarray['nbfield']++;
1946 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1947 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
1949 $totalarray['nbfield']++;
1952 // Account customer code
1953 if (!empty($arrayfields['s.code_compta']['checked'])) {
1954 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
1956 $totalarray['nbfield']++;
1959 // Account supplier code
1960 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1961 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
1963 $totalarray['nbfield']++;
1967 if (!empty($arrayfields['s.address']['checked'])) {
1968 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
1970 $totalarray['nbfield']++;
1973 // Sales Representative
1974 if (!empty($arrayfields['sales.representative']['checked'])) {
1975 print '<td class="nowraponall tdoverflowmax200
">';
1976 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1977 $nbofsalesrepresentative = count($listsalesrepresentatives);
1978 if ($nbofsalesrepresentative > 6) {
1979 // We print only number
1980 print $nbofsalesrepresentative;
1981 } elseif ($nbofsalesrepresentative > 0) {
1982 $userstatic = new User($db);
1984 foreach ($listsalesrepresentatives as $val) {
1985 $userstatic->id = $val['id'];
1986 $userstatic->lastname = $val['lastname'];
1987 $userstatic->firstname = $val['firstname'];
1988 $userstatic->email = $val['email'];
1989 $userstatic->entity = $val['entity'];
1990 $userstatic->photo = $val['photo'];
1991 $userstatic->login = $val['login'];
1992 $userstatic->office_phone = $val['office_phone'];
1993 $userstatic->office_fax = $val['office_fax'];
1994 $userstatic->user_mobile = $val['user_mobile'];
1995 $userstatic->job = $val['job'];
1996 $userstatic->gender = $val['gender'];
1997 $userstatic->statut = $val['statut'];
1998 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2000 if ($j < $nbofsalesrepresentative) {
2009 $totalarray['nbfield']++;
2013 if (!empty($arrayfields['s.zip']['checked'])) {
2014 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
2016 $totalarray['nbfield']++;
2020 if (!empty($arrayfields['s.town']['checked'])) {
2021 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
2023 $totalarray['nbfield']++;
2027 if (!empty($arrayfields['state.nom']['checked'])) {
2028 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
2030 $totalarray['nbfield']++;
2034 if (!empty($arrayfields['region.nom']['checked'])) {
2035 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
2037 $totalarray['nbfield']++;
2041 if (!empty($arrayfields['country.code_iso']['checked'])) {
2042 print '<td class="center tdoverflowmax100
">';
2043 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2044 print $labelcountry;
2047 $totalarray['nbfield']++;
2051 if (!empty($arrayfields['typent.code']['checked'])) {
2052 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
2053 $typenArray = $formcompany->typent_array(1);
2055 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2057 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
2058 print dol_escape_htmltag($labeltypeofcompany);
2061 $totalarray['nbfield']++;
2065 if (!empty($arrayfields['s.price_level']['checked'])) {
2066 print '<td class="center
">'.$obj->price_level."</td>\n
";
2068 $totalarray['nbfield']++;
2072 if (!empty($arrayfields['staff.code']['checked'])) {
2073 print '<td class="center
">';
2074 if (!empty($obj->staff_code)) {
2075 if (empty($conf->cache['staffArray'])) {
2076 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2078 print $conf->cache['staffArray'][$obj->staff_code];
2082 $totalarray['nbfield']++;
2086 if (!empty($arrayfields['legalform.code']['checked'])) {
2088 if (!empty($obj->legalform_code)) {
2089 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2090 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2092 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2094 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2095 print dol_escape_htmltag($labeltoshow);
2098 $totalarray['nbfield']++;
2102 if (!empty($arrayfields['s.email']['checked'])) {
2103 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."</td>\n
";
2105 $totalarray['nbfield']++;
2108 if (!empty($arrayfields['s.phone']['checked'])) {
2109 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2111 $totalarray['nbfield']++;
2114 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2115 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone_mobile')."</td>\n
";
2117 $totalarray['nbfield']++;
2120 if (!empty($arrayfields['s.fax']['checked'])) {
2121 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2123 $totalarray['nbfield']++;
2126 if (!empty($arrayfields['s.url']['checked'])) {
2127 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2129 $totalarray['nbfield']++;
2132 if (!empty($arrayfields['s.siren']['checked'])) {
2133 print "<td>
".$obj->idprof1."</td>\n
";
2135 $totalarray['nbfield']++;
2138 if (!empty($arrayfields['s.siret']['checked'])) {
2139 print "<td>
".$obj->idprof2."</td>\n
";
2141 $totalarray['nbfield']++;
2144 if (!empty($arrayfields['s.ape']['checked'])) {
2145 print "<td>
".$obj->idprof3."</td>\n
";
2147 $totalarray['nbfield']++;
2150 if (!empty($arrayfields['s.idprof4']['checked'])) {
2151 print "<td>
".$obj->idprof4."</td>\n
";
2153 $totalarray['nbfield']++;
2156 if (!empty($arrayfields['s.idprof5']['checked'])) {
2157 print "<td>
".$obj->idprof5."</td>\n
";
2159 $totalarray['nbfield']++;
2162 if (!empty($arrayfields['s.idprof6']['checked'])) {
2163 print "<td>
".$obj->idprof6."</td>\n
";
2165 $totalarray['nbfield']++;
2169 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2170 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2171 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2172 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2174 print $companystatic->tva_intra;
2177 $totalarray['nbfield']++;
2181 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2182 print '<td class="center
">';
2183 print $companystatic->getTypeUrl(1);
2186 $totalarray['nbfield']++;
2190 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2191 print '<td class="center nowraponall
">';
2192 print $companystatic->getLibProspLevel();
2195 $totalarray['nbfield']++;
2199 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2200 print '<td class="center nowraponall
">';
2202 $prospectid = $obj->rowid;
2203 $statusprospect = $obj->stcomm_id;
2205 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2209 $totalarray['nbfield']++;
2213 if (!empty($arrayfields['s2.nom']['checked'])) {
2214 print '<td class="center tdoverflowmax100
">';
2215 if ($companystatic->parent > 0) {
2216 $companyparent->fetch($companystatic->parent);
2217 print $companyparent->getNomUrl(1);
2221 $totalarray['nbfield']++;
2225 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2227 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2228 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2229 print $hookmanager->resPrint;
2231 if (!empty($arrayfields['s.datec']['checked'])) {
2232 print '<td class="center nowraponall
">';
2233 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2236 $totalarray['nbfield']++;
2239 // Date modification
2240 if (!empty($arrayfields['s.tms']['checked'])) {
2241 print '<td class="center nowraponall
">';
2242 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2245 $totalarray['nbfield']++;
2249 if (!empty($arrayfields['s.note_public']['checked'])) {
2250 print '<td class="flat maxwidth250imp
">';
2251 print dolPrintHTML(dolGetFirstLineOfText($obj->note_public), 5);
2254 $totalarray['nbfield']++;
2258 if (!empty($arrayfields['s.note_private']['checked'])) {
2259 print '<td class="flat maxwidth250imp
">';
2260 print dolPrintHTML(dolGetFirstLineOfText($obj->note_private), 5);
2263 $totalarray['nbfield']++;
2267 if (!empty($arrayfields['s.status']['checked'])) {
2268 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2270 $totalarray['nbfield']++;
2274 if (!empty($arrayfields['s.import_key']['checked'])) {
2275 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2276 print dol_escape_htmltag($obj->import_key);
2279 $totalarray['nbfield']++;
2282 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
2283 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2284 print '<td class="nowrap center actioncolumn
">';
2285 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
2287 if (in_array($obj->rowid, $arrayofselected)) {
2290 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2294 $totalarray['nbfield']++;
2304include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2306// If no record found
2309 foreach ($arrayfields as $key => $val) {
2310 if (!empty($val['checked'])) {
2314 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2319$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2320$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2321print $hookmanager->resPrint;
2323print '</table>'."\n
";
2326// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2327$formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js
");
2329print '</form>'."\n
";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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 information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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 the value of a given key, which produces ascending (default) or descending out...
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
get_htmloutput_mesg($mesgstring='', $mesgarray=[], $style='ok', $keepembedded=0)
Get formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.