42require_once
'../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/phone.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
59 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
65$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:int');
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_noemail = trim(
GETPOST(
'search_noemail',
'alpha'));
101$search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
102$search_phone_mobile = trim(
GETPOST(
'search_phone_mobile',
'alpha'));
103$search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
104$search_url = trim(
GETPOST(
'search_url',
'alpha'));
105$search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
106$search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
107$search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
108$search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
109$search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
110$search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
111$search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
114 $search_sale =
GETPOST(
'search_sale',
'array:int');
116 $search_sale = array(
GETPOSTINT(
'search_sale'));
118$search_categ_cus =
GETPOSTINT(
"search_categ_cus");
119$search_categ_sup =
GETPOSTINT(
"search_categ_sup");
120$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
121$searchCategorySupplierOperator =
GETPOSTINT(
'search_category_supplier_operator');
123 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
124 $searchCategorySupplierOperator =
GETPOSTINT(
'search_category_supplier_operator');
126 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
127 $searchCategorySupplierOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
129$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array:int');
130if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) {
131 $searchCategoryCustomerList = array($search_categ_cus);
133$searchCategorySupplierList =
GETPOST(
'search_category_supplier_list',
'array:int');
134if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) {
135 $searchCategorySupplierList = array($search_categ_sup);
137$search_country =
GETPOST(
"search_country",
'aZ09');
138$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
139$search_price_level =
GETPOST(
'search_price_level',
'int');
140$search_staff =
GETPOST(
"search_staff",
'int');
141$search_legalform =
GETPOST(
"search_legalform",
'int');
142$search_status =
GETPOST(
"search_status",
'intcomma');
143$search_type =
GETPOST(
'search_type',
'alpha');
144$search_level =
GETPOST(
"search_level",
"array:alpha");
145$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
146$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
147$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
148$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
149$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
151$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
152$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
153$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
154$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
155$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
156$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
157$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
158$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
160$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
161$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
162$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
163$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
164$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
165$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
166$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
167$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
169$type =
GETPOST(
'type',
'alpha');
170$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
172$diroutputmassaction =
$conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
177$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
178$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
184 $sortfield =
"s.nom";
186if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
190$offset = $limit * $page;
191$pageprev = $page - 1;
192$pagenext = $page + 1;
195 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
196 $contextpage =
'customerlist';
198 if ($search_type ==
'') {
199 $search_type =
'1,3';
203 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
204 $contextpage =
'prospectlist';
206 if ($search_type ==
'') {
207 $search_type =
'2,3';
211 if (empty($contextpage) || $contextpage ==
'poslist') {
212 $contextpage =
'poslist';
214 if ($search_type ==
'') {
216 $search_type =
'1,2,3';
220 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
221 $contextpage =
'supplierlist';
223 if ($search_type ==
'') {
230$hookmanager->initHooks(array($contextpage,
'thirdpartylist'));
233$extrafields->fetch_name_optionals_label(
$object->table_element);
235$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
238$fieldstosearchall = array(
239 's.nom' =>
"ThirdPartyName",
240 's.name_alias' =>
"AliasNameShort",
241 's.code_client' =>
"CustomerCode",
242 's.code_fournisseur' =>
"SupplierCode",
243 's.code_compta' =>
"CustomerAccountancyCodeShort",
244 's.code_compta_fournisseur' =>
"SupplierAccountancyCodeShort",
247 's.email' =>
"EMail",
249 's.tva_intra' =>
"VATIntra",
250 's.siren' =>
"ProfId1",
251 's.siret' =>
"ProfId2",
252 's.ape' =>
"ProfId3",
253 's.phone' =>
"Phone",
254 's.phone_mobile' =>
"PhoneMobile",
257if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
258 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
260if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
261 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
263if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
264 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
267 $fieldstosearchall[
's.barcode'] =
'Gencod';
274$parameters = array(
'fieldstosearchall'=>$fieldstosearchall);
275$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
277 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
278} elseif ($reshook == 0) {
279 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
283$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ?
'1' :
'0');
284$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
285$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ?
'1' :
'0');
286$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
287$checkedtypetiers =
'1';
288$checkedprofid1 =
'0';
289$checkedprofid2 =
'0';
290$checkedprofid3 =
'0';
291$checkedprofid4 =
'0';
292$checkedprofid5 =
'0';
293$checkedprofid6 =
'0';
297$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
298$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
300 's.rowid' => array(
'label' =>
"TechnicalID",
'position' => 1,
'checked' =>
'-1',
'enabled' =>
'1'),
301 's.nom' => array(
'label' =>
"ThirdPartyName",
'position' => 2,
'checked' =>
'1'),
302 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 3,
'checked' =>
'0'),
303 's.ref_ext' => array(
'label' =>
"RefExt",
'position' => 4,
'checked' =>
'-1',
'enabled' => (
string)
getDolGlobalInt(
'MAIN_LIST_SHOW_REF_EXT')),
304 's.barcode' => array(
'label' =>
"Gencod",
'position' => 5,
'checked' =>
'1',
'enabled' => (
string) (
int)
isModEnabled(
'barcode')),
305 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'position' => 10,
'checked' => $checkedcustomercode),
306 's.code_fournisseur' => array(
'label' =>
"SupplierCodeShort",
'position' => 11,
'checked' => $checkedsuppliercode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
307 's.code_compta' => array(
'label' =>
"CustomerAccountancyCodeShort",
'position' => 13,
'checked' => $checkedcustomeraccountcode),
308 's.code_compta_fournisseur' => array(
'label' =>
"SupplierAccountancyCodeShort",
'position' => 14,
'checked' => $checkedsupplieraccountcode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
309 's.address' => array(
'label' =>
"Address",
'position' => 19,
'checked' =>
'0'),
310 's.zip' => array(
'label' =>
"Zip",
'position' => 20,
'checked' =>
'1'),
311 's.town' => array(
'label' =>
"Town",
'position' => 21,
'checked' =>
'0'),
312 'state.nom' => array(
'label' =>
"State",
'position' => 22,
'checked' =>
'0'),
313 'region.nom' => array(
'label' =>
"Region",
'position' => 23,
'checked' =>
'0'),
314 'country.code_iso' => array(
'label' =>
"Country",
'position' => 24,
'checked' =>
'0'),
315 's.email' => array(
'label' =>
"Email",
'position' => 25,
'checked' =>
'0'),
316 'su.noemail' => array(
'label' =>
"No_Email",
'position' => 26,
'checked' =>
'0'),
317 's.url' => array(
'label' =>
"Url",
'position' => 26,
'checked' =>
'0'),
318 's.phone' => array(
'label' =>
"Phone",
'position' => 27,
'checked' =>
'1'),
319 's.fax' => array(
'label' =>
"Fax",
'position' => 28,
'checked' =>
'0'),
320 'typent.code' => array(
'label' =>
"ThirdPartyType",
'position' => 29,
'checked' => $checkedtypetiers),
321 'staff.code' => array(
'label' =>
"Workforce",
'position' => 31,
'checked' =>
'0'),
322 'legalform.code' => array(
'label' =>
'JuridicalStatus',
'position' => 32,
'checked' =>
'0'),
323 's.phone_mobile' => array(
'label' =>
"PhoneMobile",
'position' => 35,
'checked' =>
'0'),
324 's.siren' => array(
'label' =>
"ProfId1Short",
'position' => 40,
'checked' => $checkedprofid1),
325 's.siret' => array(
'label' =>
"ProfId2Short",
'position' => 41,
'checked' => $checkedprofid2),
326 's.ape' => array(
'label' =>
"ProfId3Short",
'position' => 42,
'checked' => $checkedprofid3),
327 's.idprof4' => array(
'label' =>
"ProfId4Short",
'position' => 43,
'checked' => $checkedprofid4),
328 's.idprof5' => array(
'label' =>
"ProfId5Short",
'position' => 44,
'checked' => $checkedprofid5),
329 's.idprof6' => array(
'label' =>
"ProfId6Short",
'position' => 45,
'checked' => $checkedprofid6),
330 's.tva_intra' => array(
'label' =>
"VATIntraShort",
'position' => 50,
'checked' =>
'0'),
331 'customerorsupplier' => array(
'label' =>
'NatureOfThirdParty',
'position' => 61,
'checked' =>
'1'),
332 's.fk_prospectlevel' => array(
'label' =>
"ProspectLevel",
'position' => 62,
'checked' => $checkprospectlevel),
333 's.fk_stcomm' => array(
'label' =>
"StatusProsp",
'position' => 63,
'checked' => $checkstcomm),
334 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 64,
'checked' =>
'0'),
335 's.ip' => array(
'type' =>
'ip',
'label' =>
"IPAddress",
'checked' =>
'-2',
'position' => 500),
336 's.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
337 's.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 505),
338 's.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
339 's.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
340 's.status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
341 's.import_key' => array(
'label' =>
"ImportId",
'checked' =>
'0',
'position' => 1100),
344 $arrayfields[
's.price_level'] = array(
'label' =>
"PriceLevel",
'position' => 30,
'checked' =>
'0');
348$arrayfields[
'sales.representative'] = array(
'label' => $langs->trans(
"SalesRepresentatives"),
'checked' =>
'1',
'position' => 12);
351include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
353$parameters = array(
'arrayfields' => &$arrayfields);
354$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
364 $socid = $user->socid;
368$permissiontoadd = $user->hasRight(
'societe',
'lire');
375if (
GETPOST(
'cancel',
'alpha')) {
379if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
383$parameters = array(
'arrayfields' => &$arrayfields);
384$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
386 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
389if (empty($reshook)) {
390 if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
394 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$db->escape($place).
")' AND entity IN (".
getEntity(
'invoice').
")";
395 $result = $db->query($sql);
396 $num_lines = $db->num_rows($result);
397 if ($num_lines == 0) {
398 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
400 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
403 $invoice->module_source =
'takepos';
404 $invoice->pos_source = $_SESSION[
"takeposterminal"];
405 $placeid = $invoice->create($user);
406 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
410 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$db->escape($place).
")'";
411 $resql = $db->query($sql); ?>
413 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
414 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
416 <?php
if (!$resql) { ?>
417 alert(
'Error failed to update customer on draft invoice.');
419 parent.$.colorbox.close();
427 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
430 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
434 $search_ref_ext =
'';
435 $search_categ_cus = 0;
436 $search_categ_sup = 0;
437 $searchCategoryCustomerOperator = 0;
438 $searchCategorySupplierOperator = 0;
439 $searchCategoryCustomerList = array();
440 $searchCategorySupplierList = array();
441 $search_sale = array();
442 $search_barcode =
"";
443 $search_customer_code =
'';
444 $search_supplier_code =
'';
445 $search_account_customer_code =
'';
446 $search_account_supplier_code =
'';
447 $search_address =
'';
452 $search_country =
'';
454 $search_noemail =
'';
456 $search_phone_mobile =
'';
459 $search_idprof1 =
'';
460 $search_idprof2 =
'';
461 $search_idprof3 =
'';
462 $search_idprof4 =
'';
463 $search_idprof5 =
'';
464 $search_idprof6 =
'';
467 $search_price_level =
'';
468 $search_type_thirdparty =
'';
470 $search_legalform =
'';
471 $search_date_creation_startmonth =
"";
472 $search_date_creation_startyear =
"";
473 $search_date_creation_startday =
"";
474 $search_date_creation_start =
"";
475 $search_date_creation_endmonth =
"";
476 $search_date_creation_endyear =
"";
477 $search_date_creation_endday =
"";
478 $search_date_creation_end =
"";
479 $search_date_modif_startmonth =
"";
480 $search_date_modif_startyear =
"";
481 $search_date_modif_startday =
"";
482 $search_date_modif_start =
"";
483 $search_date_modif_endmonth =
"";
484 $search_date_modif_endyear =
"";
485 $search_date_modif_endday =
"";
486 $search_date_modif_end =
"";
487 $search_note_public =
"";
488 $search_note_private =
"";
492 $search_parent_name =
'';
493 $search_import_key =
'';
497 $search_array_options = array();
501 $objectclass =
'Societe';
502 $objectlabel =
'ThirdParty';
503 $permissiontoread = $user->hasRight(
'societe',
'lire');
504 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
505 $permissiontoadd = $user->hasRight(
"societe",
"creer");
506 $uploaddir =
$conf->societe->dir_output;
509 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
511 if (!$error && $action ==
'setstcomm' && $permissiontoadd) {
524if ($search_status ==
'' && empty($search_all)) {
543$form =
new Form($db);
545$companystatic =
new Societe($db);
546$companyparent =
new Societe($db);
548$prospectstatic =
new Client($db);
549$prospectstatic->client = 2;
550$prospectstatic->loadCacheOfProspStatus();
554$title = $langs->trans(
"ThirdParties");
555if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
556 $title = $langs->trans(
"Customers");
558if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
559 $title = $langs->trans(
"Prospects");
561if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
562 $title = $langs->trans(
"Suppliers");
564$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
567$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
568$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
573$sql =
"SELECT code, label, sortorder";
574$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
575$sql .=
" WHERE active > 0";
576$sql .=
" ORDER BY sortorder";
577$resql = $db->query($sql);
579 while ($obj = $db->fetch_object($resql)) {
581 $level = $langs->trans($obj->code);
582 if ($level == $obj->code) {
583 $level = $langs->trans($obj->label);
585 $tab_level[$obj->code] = $level;
588 dol_print_error($db);
593$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,";
595$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,";
596$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,";
597$sql .=
" s.ip, s.tms as date_modification, s.datec as date_creation, s.import_key,";
598$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
599$sql .=
" s2.nom as name2,";
600$sql .=
" typent.code as typent_code,";
601$sql .=
" staff.code as staff_code,";
602$sql .=
" s.fk_forme_juridique as legalform_code,";
603$sql .=
" country.code as country_code, country.label as country_label,";
604$sql .=
" state.code_departement as state_code, state.nom as state_name,";
605$sql .=
" region.code_region as region_code, region.nom as region_name";
607if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
608 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
609 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
613$parameters = array();
614$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
615$sql .= $hookmanager->resPrint;
616$sql = preg_replace(
'/,\s*$/',
'', $sql);
621$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
623if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
624 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
627$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
628$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
629$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
631$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
632$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
633$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
635$parameters = array();
636$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
637$sql .= $hookmanager->resPrint;
638$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
639if (!$user->hasRight(
'fournisseur',
'lire')) {
640 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
644if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
645 $search_sale = array($user->id);
648if (!empty($search_sale) && $search_sale !=
'-1') {
649 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
650 $value = intval($value);
654 $search_sale_req = implode(
',', $search_sale_req);
656 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
657 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
's.rowid', 0, 1);
658 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
659 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
's.rowid', $db->sanitize($search_sale_req));
660 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
661 $sql .=
" AND (".getSalesRepresentativeSqlFilter(
's.rowid', $db->sanitize($search_sale_req));
662 $sql .=
" OR ".getSalesRepresentativeSqlFilter(
's.rowid', 0, 1).
")";
667if (!empty($searchCategoryCustomerList)) {
668 $searchCategoryCustomerSqlList = array();
669 $listofcategoryid =
'';
670 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
671 if (intval($searchCategoryCustomer) == -2) {
672 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
673 } elseif (intval($searchCategoryCustomer) > 0) {
674 if ($searchCategoryCustomerOperator == 0) {
675 $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).
")";
677 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
681 if ($listofcategoryid) {
682 $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).
"))";
684 if ($searchCategoryCustomerOperator == 1) {
685 if (!empty($searchCategoryCustomerSqlList)) {
686 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
689 if (!empty($searchCategoryCustomerSqlList)) {
690 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
696if (!empty($searchCategorySupplierList)) {
697 $searchCategorySupplierSqlList = array();
698 $listofcategoryid =
'';
699 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
700 if (intval($searchCategorySupplier) == -2) {
701 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
702 } elseif (intval($searchCategorySupplier) > 0) {
703 if ($searchCategorySupplierOperator == 0) {
704 $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).
")";
706 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
710 if ($listofcategoryid) {
711 $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).
"))";
713 if ($searchCategorySupplierOperator == 1) {
714 if (!empty($searchCategorySupplierSqlList)) {
715 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
718 if (!empty($searchCategorySupplierSqlList)) {
719 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
724 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
726if (strlen($search_cti)) {
732if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
733 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
742if ($search_nom_only) {
745if ($search_ref_ext) {
748if ($search_customer_code) {
751if ($search_supplier_code) {
752 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
754if ($search_account_customer_code) {
755 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
757if ($search_account_supplier_code) {
758 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
760if ($search_address) {
763if (strlen($search_zip)) {
775if ($search_country && $search_country !=
'-1') {
776 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
781if ($search_noemail) {
782 $sql .=
" AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.
"mailing_unsubscribe as mu WHERE mu.email = '".$db->escape($search_email).
"' AND unsubscribegroup = '' AND entity IN (".
getEntity(
'societe').
"))";
784if (strlen($search_phone)) {
787if (strlen($search_phone_mobile)) {
790if (strlen($search_fax)) {
796if (strlen($search_idprof1)) {
799if (strlen($search_idprof2)) {
802if (strlen($search_idprof3)) {
805if (strlen($search_idprof4)) {
808if (strlen($search_idprof5)) {
811if (strlen($search_idprof6)) {
814if (strlen($search_vat)) {
818$reshook = $hookmanager->executeHooks(
'filterType', array(
'search_type' => $search_type), $sql);
819if (empty($reshook)) {
820 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
821 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
824if ($search_type > 0 && in_array($search_type, array(
'4'))) {
825 $sql .=
" AND s.fournisseur = 1";
827if ($search_type ==
'0') {
828 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
830if ($search_status !=
'' && $search_status >= 0) {
836if ($search_price_level && $search_price_level !=
'-1') {
839if ($search_type_thirdparty && $search_type_thirdparty > 0) {
840 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
842if (!empty($search_staff) && $search_staff !=
'-1') {
845if (!empty($search_legalform) && $search_legalform !=
'-1') {
846 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
848if ($search_parent_name) {
852 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
855 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
857if ($search_import_key) {
860if ($search_note_public !=
'') {
863if ($search_note_private !=
'') {
866if ($search_date_creation_start) {
867 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
869if ($search_date_creation_end) {
870 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
873if ($search_date_modif_start) {
874 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
876if ($search_date_modif_end) {
877 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
880 $sql .=
" AND s.rowid = ".((int) $socid);
884include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
886$parameters = array(
'socid' => $socid,
'sql' => $sql);
887$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
888if (empty($reshook)) {
889 $sql .= $hookmanager->resPrint;
891 $sql = $hookmanager->resPrint;
895$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
896$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
897if (empty($reshook)) {
898 $sql .= $hookmanager->resPrint;
900 $sql = $hookmanager->resPrint;
904$nbtotalofrecords =
'';
907 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
908 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
909 $resql = $db->query($sqlforcount);
911 $objforcount = $db->fetch_object($resql);
912 $nbtotalofrecords = $objforcount->nbtotalofrecords;
914 dol_print_error($db);
917 if (($page * $limit) > (
int) $nbtotalofrecords) {
925$sql .= $db->order($sortfield, $sortorder);
927 $sql .= $db->plimit($limit + 1, $offset);
929$resql = $db->query($sql);
931 dol_print_error($db);
935$num = $db->num_rows($resql);
939if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
940 $obj = $db->fetch_object($resql);
942 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
943 if ($obj->client > 0) {
944 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
947 if ($obj->fournisseur > 0) {
948 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
953 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
961foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
962 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
964foreach ($searchCategorySupplierList as $searchCategorySupplier) {
965 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
968llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
971$arrayofselected = is_array($toselect) ? $toselect : array();
975 $param .=
'&mode='.urlencode($mode);
977if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
978 $param .=
'&contextpage='.urlencode($contextpage);
980if ($limit > 0 && $limit !=
$conf->liste_limit) {
981 $param .=
'&limit='.((int) $limit);
983if ($optioncss !=
'') {
984 $param .=
'&optioncss='.urlencode($optioncss);
986if ($search_all !=
'') {
987 $param =
"&search_all=".urlencode($search_all);
989if ($search_categ_cus > 0) {
990 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
992if ($search_categ_sup > 0) {
993 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
995if ($searchCategoryCustomerOperator == 1) {
996 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
998if ($searchCategorySupplierOperator == 1) {
999 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
1001foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1002 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1004foreach ($searchCategorySupplierList as $searchCategorySupplier) {
1005 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
1007if (is_array($search_sale)) {
1008 foreach ($search_sale as $sale_id) {
1009 $param .=
'&search_sale[]=' . urlencode($sale_id);
1012if ($search_id > 0) {
1013 $param .=
"&search_id=".((int) $search_id);
1015if ($search_nom !=
'') {
1016 $param .=
"&search_nom=".urlencode($search_nom);
1018if ($search_alias !=
'') {
1019 $param .=
"&search_alias=".urlencode($search_alias);
1021if ($search_ref_ext !=
'') {
1022 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
1024if ($search_address !=
'') {
1025 $param .=
'&search_address='.urlencode($search_address);
1027if ($search_zip !=
'') {
1028 $param .=
"&search_zip=".urlencode($search_zip);
1030if ($search_town !=
'') {
1031 $param .=
"&search_town=".urlencode($search_town);
1033if ($search_phone !=
'') {
1034 $param .=
"&search_phone=".urlencode($search_phone);
1036if ($search_phone_mobile !=
'') {
1037 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
1039if ($search_fax !=
'') {
1040 $param .=
"&search_fax=".urlencode($search_fax);
1042if ($search_email !=
'') {
1043 $param .=
"&search_email=".urlencode($search_email);
1045if ($search_noemail !=
'') {
1046 $param .=
"&search_noemail=".urlencode($search_noemail);
1048if ($search_url !=
'') {
1049 $param .=
"&search_url=".urlencode($search_url);
1051if ($search_state !=
'') {
1052 $param .=
"&search_state=".urlencode($search_state);
1054if ($search_region !=
'') {
1055 $param .=
"&search_region=".urlencode($search_region);
1057if ($search_country !=
'') {
1058 $param .=
"&search_country=".urlencode($search_country);
1060if ($search_customer_code !=
'') {
1061 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1063if ($search_supplier_code !=
'') {
1064 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1066if ($search_account_customer_code !=
'') {
1067 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1069if ($search_account_supplier_code !=
'') {
1070 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1072if ($search_barcode !=
'') {
1073 $param .=
"&search_barcode=".urlencode($search_barcode);
1075if ($search_idprof1 !=
'') {
1076 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1078if ($search_idprof2 !=
'') {
1079 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1081if ($search_idprof3 !=
'') {
1082 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1084if ($search_idprof4 !=
'') {
1085 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1087if ($search_idprof5 !=
'') {
1088 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1090if ($search_idprof6 !=
'') {
1091 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1093if ($search_vat !=
'') {
1094 $param .=
'&search_vat='.urlencode($search_vat);
1096if ($search_price_level !=
'') {
1097 $param .=
'&search_price_level='.urlencode($search_price_level);
1099if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1100 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1102if ($search_type !=
'') {
1103 $param .=
'&search_type='.urlencode($search_type);
1105if ($search_status !=
'') {
1106 $param .=
'&search_status='.urlencode((
string) ($search_status));
1108if (is_array($search_level) && count($search_level)) {
1109 foreach ($search_level as $slevel) {
1110 $param .=
'&search_level[]='.urlencode($slevel);
1113if (is_array($search_stcomm) && count($search_stcomm)) {
1114 foreach ($search_stcomm as $slevel) {
1115 $param .=
'&search_stcomm[]='.urlencode($slevel);
1118if ($search_parent_name !=
'') {
1119 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1121if ($search_import_key !=
'') {
1122 $param .=
'&search_import_key='.urlencode($search_import_key);
1124if ($search_note_public !=
'') {
1125 $param .=
'&search_note_public='.urlencode($search_note_public);
1127if ($search_note_private !=
'') {
1128 $param .=
'&search_note_private='.urlencode($search_note_private);
1131 $param .=
'&type='.urlencode($type);
1133if ($search_date_creation_startmonth) {
1134 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1136if ($search_date_creation_startyear) {
1137 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1139if ($search_date_creation_startday) {
1140 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1142if ($search_date_creation_start) {
1143 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1145if ($search_date_creation_endmonth) {
1146 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1148if ($search_date_creation_endyear) {
1149 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1151if ($search_date_creation_endday) {
1152 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1154if ($search_date_creation_end) {
1155 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1157if ($search_date_modif_startmonth) {
1158 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1160if ($search_date_modif_startyear) {
1161 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1163if ($search_date_modif_startday) {
1164 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1166if ($search_date_modif_start) {
1167 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1169if ($search_date_modif_endmonth) {
1170 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1172if ($search_date_modif_endyear) {
1173 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1175if ($search_date_modif_endday) {
1176 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1178if ($search_date_modif_end) {
1179 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1183include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1185$parameters = array(
'param' => &$param);
1186$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1187$param .= $hookmanager->resPrint;
1191 setEventMessages($langs->trans(
"CompanyDeleted",
GETPOST(
'delsoc')),
null,
'mesgs');
1195$arrayofmassactions = array(
1196 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1200if (
isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1201 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1203if ($user->hasRight(
"societe",
"creer")) {
1204 $arrayofmassactions[
'preenable'] = img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1206if ($user->hasRight(
"societe",
"creer")) {
1207 $arrayofmassactions[
'predisable'] = img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1209if ($user->hasRight(
"societe",
"creer")) {
1210 $arrayofmassactions[
'presetcommercial'] = img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1211 $arrayofmassactions[
'unsetcommercial'] = img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1214if ($user->hasRight(
'societe',
'supprimer')) {
1215 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1217if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1218 $arrayofmassactions = array();
1220$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1223$label =
'MenuNewThirdParty';
1226 $typefilter =
'&type='.$type;
1228 $label =
'MenuNewProspect';
1231 $label =
'MenuNewCustomer';
1234 $label =
'NewSupplier';
1239 print
get_htmloutput_mesg(img_warning(
'default').
' '.$langs->trans(
"BecarefullChangeThirdpartyBeforeAddProductToInvoice"), [],
'warning', 1);
1243$parameters = array();
1244$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1245if (empty($reshook)) {
1248 if ($contextpage !=
'poslist') {
1249 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1250 if (!empty($socid)) {
1251 $url .=
'&socid='.$socid;
1253 $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'));
1254 $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'));
1255 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1256 } elseif ($user->hasRight(
'societe',
'creer')) {
1257 $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);
1258 $label =
'MenuNewCustomer';
1259 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1262 $newcardbutton = $hookmanager->resPrint;
1265print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off" spellcheck="false">'.
"\n";
1266if ($optioncss !=
'') {
1267 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1269print
'<input type="hidden" name="token" value="'.newToken().
'">';
1270print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1271if (empty($massaction)) {
1272 print
'<input type="hidden" name="action" value="list">';
1274print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1275print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1277print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1278if (!empty($place)) {
1279 print
'<input type="hidden" name="place" value="'.$place.
'">';
1281print
'<input type="hidden" name="page_y" value="">';
1282print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1283if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1284 print
'<input type="hidden" name="type" value="'.$type.
'">';
1286if (!empty($place)) {
1287 print
'<input type="hidden" name="place" value="'.$place.
'">';
1290print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1292$langs->load(
"other");
1293$textprofid = array();
1294foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1295 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1296 $textprofid[$key] =
'';
1297 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1299 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1303 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key,
$mysoc->country_code, $label);
1308$topicmail =
"Information";
1309$modelmail =
"thirdparty";
1311$trackid =
'thi'.$object->id;
1312include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1326 foreach ($fieldstosearchall as $key => $val) {
1327 $fieldstosearchall[$key] = $langs->trans($val);
1328 $setupstring .= $key.
"=".$val.
";";
1330 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1331 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1337if (empty($type) || $type ==
'c' || $type ==
'p') {
1338 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1340 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1345if (empty($type) || $type ==
'f') {
1348 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1353$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1354$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1355if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1356 $moreforfilter .=
'<div class="divsearchfield">';
1357 $tmptitle = $langs->transnoentitiesnoconv(
'SalesRepresentatives');
1358 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1359 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->transnoentitiesnoconv(
'SalesRepresentatives'), 1);
1360 $moreforfilter .=
'</div>';
1362if (!empty($moreforfilter)) {
1363 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1364 print $moreforfilter;
1365 $parameters = array(
'type' => $type);
1366 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1367 print $hookmanager->resPrint;
1371$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1372$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1374print
'<div class="div-table-responsive">';
1375print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1379print
'<tr class="liste_titre_filter">';
1381if (
$conf->main_checkbox_left_column) {
1382 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1383 $searchpicto = $form->showFilterButtons(
'left');
1387if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1388 print
'<td class="liste_titre" data-key="id">';
1389 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1392if (!empty($arrayfields[
's.nom'][
'checked'])) {
1393 print
'<td class="liste_titre" data-key="ref">';
1394 if (!empty($search_nom_only) && empty($search_nom)) {
1395 $search_nom = $search_nom_only;
1397 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1400if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1401 print
'<td class="liste_titre">';
1402 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1405if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1406 print
'<td class="liste_titre">';
1407 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1411if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1412 print
'<td class="liste_titre">';
1413 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1417if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1418 print
'<td class="liste_titre">';
1419 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1423if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1424 print
'<td class="liste_titre">';
1425 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1429if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1430 print
'<td class="liste_titre">';
1431 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1435if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1436 print
'<td class="liste_titre">';
1437 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1441if (!empty($arrayfields[
's.address'][
'checked'])) {
1442 print
'<td class="liste_titre">';
1443 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1447if (!empty($arrayfields[
's.zip'][
'checked'])) {
1448 print
'<td class="liste_titre">';
1449 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1453if (!empty($arrayfields[
's.town'][
'checked'])) {
1454 print
'<td class="liste_titre">';
1455 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1459if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1460 print
'<td class="liste_titre">';
1461 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1465if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1466 print
'<td class="liste_titre">';
1467 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1471if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1472 print
'<td class="liste_titre center">';
1473 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1477if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1478 print
'<td class="liste_titre maxwidthonsmartphone center">';
1480 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'),
'minwidth50 maxwidth125', 1);
1484if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1485 print
'<td class="liste_titre">';
1486 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1490if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1491 print
'<td class="liste_titre maxwidthonsmartphone center">';
1492 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1496if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1497 print
'<td class="liste_titre maxwidthonsmartphone center">';
1501if (!empty($arrayfields[
's.email'][
'checked'])) {
1503 print
'<td class="liste_titre">';
1504 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1507if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1509 print
'<td class="liste_titre center">';
1510 print
'<input class="flat searchemail maxwidth50imp" type="checkbox" name="search_noemail" '.($search_noemail ?
' checked="checked"' :
'').
'">';
1513if (!empty($arrayfields[
's.phone'][
'checked'])) {
1515 print
'<td class="liste_titre">';
1516 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1519if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1521 print
'<td class="liste_titre">';
1522 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1525if (!empty($arrayfields[
's.fax'][
'checked'])) {
1527 print
'<td class="liste_titre">';
1528 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1531if (!empty($arrayfields[
's.url'][
'checked'])) {
1533 print
'<td class="liste_titre">';
1534 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1537if (!empty($arrayfields[
's.siren'][
'checked'])) {
1539 print
'<td class="liste_titre">';
1540 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1543if (!empty($arrayfields[
's.siret'][
'checked'])) {
1545 print
'<td class="liste_titre">';
1546 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1549if (!empty($arrayfields[
's.ape'][
'checked'])) {
1551 print
'<td class="liste_titre">';
1552 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1555if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1557 print
'<td class="liste_titre">';
1558 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1561if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1563 print
'<td class="liste_titre">';
1564 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1567if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1569 print
'<td class="liste_titre">';
1570 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1573if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1575 print
'<td class="liste_titre">';
1576 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1581if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1582 print
'<td class="liste_titre maxwidthonsmartphone center">';
1584 print
'<input type="hidden" name="type" value="'.$type.
'">';
1586 $reshook = $hookmanager->executeHooks(
'selectProspectCustomerType', array(
'client_type' => $search_type));
1587 if (empty($reshook)) {
1588 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1593if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1594 print
'<td class="liste_titre">';
1598if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1599 print
'<td class="liste_titre center">';
1600 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1604if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1605 print
'<td class="liste_titre maxwidthonsmartphone center">';
1606 $arraystcomm = array();
1607 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1608 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1611 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1614if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1615 print
'<td class="liste_titre center">';
1616 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1620include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1623$parameters = array(
'arrayfields' => $arrayfields);
1624$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1625print $hookmanager->resPrint;
1627if (!empty($arrayfields[
's.ip'][
'checked'])) {
1628 print
'<td class="liste_titre center nowraponall">';
1632if (!empty($arrayfields[
's.datec'][
'checked'])) {
1633 print
'<td class="liste_titre center nowraponall">';
1634 print
'<div class="nowrapfordate">';
1635 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'));
1637 print
'<div class="nowrapfordate">';
1638 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'));
1643if (!empty($arrayfields[
's.tms'][
'checked'])) {
1644 print
'<td class="liste_titre center nowraponall">';
1645 print
'<div class="nowrapfordate">';
1646 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'));
1648 print
'<div class="nowrapfordate">';
1649 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'));
1654if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1655 print
'<td class="liste_titre">';
1656 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1660if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1661 print
'<td class="liste_titre">';
1662 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1666if (!empty($arrayfields[
's.status'][
'checked'])) {
1667 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1668 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);
1671if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1672 print
'<td class="liste_titre center">';
1673 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1677if (!
$conf->main_checkbox_left_column) {
1678 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1679 $searchpicto = $form->showFilterButtons();
1686$totalarray = array();
1687$totalarray[
'nbfield'] = 0;
1691print
'<tr class="liste_titre">';
1693if (
$conf->main_checkbox_left_column) {
1694 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1695 $totalarray[
'nbfield']++;
1697if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1698 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1699 $totalarray[
'nbfield']++;
1701if (!empty($arrayfields[
's.nom'][
'checked'])) {
1702 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1703 $totalarray[
'nbfield']++;
1705if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1713 $totalarray[
'nbfield']++;
1715if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode",
'', $param,
'', $sortfield, $sortorder);
1717 $totalarray[
'nbfield']++;
1719if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1724 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1725 $totalarray[
'nbfield']++;
1727if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1729 $totalarray[
'nbfield']++;
1731if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1732 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1733 $totalarray[
'nbfield']++;
1735if (!empty($arrayfields[
's.address'][
'checked'])) {
1736 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1737 $totalarray[
'nbfield']++;
1739if (!empty($arrayfields[
's.zip'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
's.town'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1753 $totalarray[
'nbfield']++;
1755if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1756 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1757 $totalarray[
'nbfield']++;
1759if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1760 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1761 $totalarray[
'nbfield']++;
1763if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1765 $totalarray[
'nbfield']++;
1767if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1769 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1770 $totalarray[
'nbfield']++;
1772if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1773 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1774 $totalarray[
'nbfield']++;
1776if (!empty($arrayfields[
's.email'][
'checked'])) {
1777 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1778 $totalarray[
'nbfield']++;
1780if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1781 print_liste_field_titre($arrayfields[
'su.noemail'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1782 $totalarray[
'nbfield']++;
1784if (!empty($arrayfields[
's.phone'][
'checked'])) {
1785 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1786 $totalarray[
'nbfield']++;
1788if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1789 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1790 $totalarray[
'nbfield']++;
1792if (!empty($arrayfields[
's.fax'][
'checked'])) {
1793 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1794 $totalarray[
'nbfield']++;
1796if (!empty($arrayfields[
's.url'][
'checked'])) {
1797 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1798 $totalarray[
'nbfield']++;
1800if (!empty($arrayfields[
's.siren'][
'checked'])) {
1801 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1802 $totalarray[
'nbfield']++;
1804if (!empty($arrayfields[
's.siret'][
'checked'])) {
1805 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1806 $totalarray[
'nbfield']++;
1808if (!empty($arrayfields[
's.ape'][
'checked'])) {
1809 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1810 $totalarray[
'nbfield']++;
1812if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1813 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1814 $totalarray[
'nbfield']++;
1816if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1817 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1818 $totalarray[
'nbfield']++;
1820if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1821 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1822 $totalarray[
'nbfield']++;
1824if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1825 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1826 $totalarray[
'nbfield']++;
1828if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1829 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1830 $totalarray[
'nbfield']++;
1832if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1833 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1834 $totalarray[
'nbfield']++;
1836if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1837 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1838 $totalarray[
'nbfield']++;
1840if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1841 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1842 $totalarray[
'nbfield']++;
1844if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1845 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1846 $totalarray[
'nbfield']++;
1849include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1851$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1852$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1853print $hookmanager->resPrint;
1855if (!empty($arrayfields[
's.ip'][
'checked'])) {
1856 print_liste_field_titre($arrayfields[
's.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1857 $totalarray[
'nbfield']++;
1860if (!empty($arrayfields[
's.datec'][
'checked'])) {
1861 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1862 $totalarray[
'nbfield']++;
1864if (!empty($arrayfields[
's.tms'][
'checked'])) {
1865 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1866 $totalarray[
'nbfield']++;
1868if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1869 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1870 $totalarray[
'nbfield']++;
1872if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1873 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1874 $totalarray[
'nbfield']++;
1876if (!empty($arrayfields[
's.status'][
'checked'])) {
1877 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1878 $totalarray[
'nbfield']++;
1880if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1881 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1882 $totalarray[
'nbfield']++;
1885if (!
$conf->main_checkbox_left_column) {
1886 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1887 $totalarray[
'nbfield']++;
1895$savnbfield = $totalarray[
'nbfield'];
1896$totalarray = array();
1897$totalarray[
'nbfield'] = 0;
1898$imaxinloop = ($limit ? min($num, $limit) : $num);
1899while ($i < $imaxinloop) {
1900 $obj = $db->fetch_object($resql);
1905 $parameters = array(
'staticdata' => $obj);
1908 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1909 if (empty($reshook)) {
1910 $companystatic->id = $obj->rowid;
1911 $companystatic->name = $obj->name;
1912 $companystatic->name_alias = $obj->name_alias;
1913 $companystatic->ref_ext = $obj->ref_ext;
1914 $companystatic->logo = $obj->logo;
1915 $companystatic->barcode = $obj->barcode;
1916 $companystatic->canvas = $obj->canvas;
1917 $companystatic->client = $obj->client;
1918 $companystatic->status = $obj->status;
1919 $companystatic->email = $obj->email;
1920 $companystatic->phone = $obj->phone;
1921 $companystatic->phone_mobile = $obj->phone_mobile;
1922 $companystatic->fax = $obj->fax;
1923 $companystatic->address = $obj->address;
1924 $companystatic->zip = $obj->zip;
1925 $companystatic->town = $obj->town;
1926 $companystatic->fournisseur = $obj->fournisseur;
1927 $companystatic->code_client = $obj->code_client;
1928 $companystatic->code_fournisseur = $obj->code_fournisseur;
1929 $companystatic->tva_intra = $obj->tva_intra;
1930 $companystatic->country_code = $obj->country_code;
1932 $companystatic->ip = $obj->ip;
1934 $companystatic->code_compta_client = $obj->code_compta;
1935 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1936 $companystatic->note_public = $obj->note_public;
1937 $companystatic->note_private = $obj->note_private;
1938 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1939 $companystatic->parent = $obj->fk_parent;
1940 $companystatic->entity = $obj->entity;
1945 if ($mode ==
'kanban') {
1947 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1948 print
'<div class="box-flex-container kanban">';
1951 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1952 if ($i == ($imaxinloop - 1)) {
1959 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven row-with-select"';
1960 if ($contextpage ==
'poslist') {
1961 print
' onclick="location.href=\'list.php?action=change&token='.newToken().
'&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1965 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
1966 if ($conf->main_checkbox_left_column) {
1967 print '<td class="nowrap center actioncolumn
">';
1968 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
1970 if (in_array($obj->rowid, $arrayofselected)) {
1973 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1977 $totalarray['nbfield']++;
1980 if (!empty($arrayfields['s.rowid']['checked'])) {
1981 print '<td class="tdoverflowmax50
" data-key="id">';
1982 print dol_escape_htmltag($obj->rowid);
1985 $totalarray['nbfield']++;
1988 if (!empty($arrayfields['s.nom']['checked'])) {
1989 print '<td class="tdlineheightsmall
" data-key="ref">';
1990 print '<div class="tdoverflowmax200
inline-block lineheightsmall
">';
1991 if ($contextpage == 'poslist') {
1992 print dolPrintHTML($companystatic->name);
1994 print $companystatic->getNomUrl(1, '', 100, 0, 1, 1, '', 'valignmiddle', 1);
1995 if (empty($arrayfields['s.name_alias']['checked'])) {
1996 print '<br><span class="spantitle
">'.dolPrintHTML($companystatic->name_alias).'</span>';
2002 $totalarray['nbfield']++;
2005 if (!empty($arrayfields['s.name_alias']['checked'])) {
2006 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->name_alias).'">';
2007 print '<span class="spantitle
">';
2008 print dolPrintHTML($companystatic->name_alias);
2012 $totalarray['nbfield']++;
2016 if (!empty($arrayfields['s.ref_ext']['checked'])) {
2017 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->ref_ext).'">';
2018 print dolPrintHTML($companystatic->ref_ext);
2021 $totalarray['nbfield']++;
2025 if (!empty($arrayfields['s.barcode']['checked'])) {
2026 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->barcode).'">'.dolPrintHTML($companystatic->barcode).'</td>';
2028 $totalarray['nbfield']++;
2032 if (!empty($arrayfields['s.code_client']['checked'])) {
2033 print '<td class="nowraponall
">'.dolPrintHTML($companystatic->code_client).'</td>';
2035 $totalarray['nbfield']++;
2039 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
2040 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
2042 $totalarray['nbfield']++;
2045 // Account customer code
2046 if (!empty($arrayfields['s.code_compta']['checked'])) {
2047 print '<td>'.dolPrintHTML($companystatic->code_compta_client).'</td>';
2049 $totalarray['nbfield']++;
2052 // Account supplier code
2053 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
2054 print '<td>'.dolPrintHTML($companystatic->code_compta_fournisseur).'</td>';
2056 $totalarray['nbfield']++;
2060 if (!empty($arrayfields['s.address']['checked'])) {
2061 print '<td class="tdoverflowmax250
" title="'.dolPrintHTMLForAttribute($companystatic->address).'">'.dolPrintHTML($companystatic->address).'</td>';
2063 $totalarray['nbfield']++;
2067 if (!empty($arrayfields['s.zip']['checked'])) {
2068 print "<td>
".dolPrintHTML($companystatic->zip)."</td>\n
";
2070 $totalarray['nbfield']++;
2074 if (!empty($arrayfields['s.town']['checked'])) {
2075 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->town).'">'.dolPrintHTML($companystatic->town)."</td>\n
";
2077 $totalarray['nbfield']++;
2081 if (!empty($arrayfields['state.nom']['checked'])) {
2082 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
2084 $totalarray['nbfield']++;
2088 if (!empty($arrayfields['region.nom']['checked'])) {
2089 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
2091 $totalarray['nbfield']++;
2095 if (!empty($arrayfields['country.code_iso']['checked'])) {
2096 print '<td class="center tdoverflowmax100
">';
2097 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2098 print $labelcountry;
2101 $totalarray['nbfield']++;
2105 if (!empty($arrayfields['typent.code']['checked'])) {
2106 $typenArray = $formcompany->typent_array(1);
2107 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2109 print '<td class="center tdoverflowmax125
" title="'.dolPrintHTMLForAttribute($labeltypeofcompany).'">';
2110 print dolPrintHTML($labeltypeofcompany);
2113 $totalarray['nbfield']++;
2117 if (!empty($arrayfields['s.price_level']['checked'])) {
2118 print '<td class="center
">'.$obj->price_level."</td>\n
";
2120 $totalarray['nbfield']++;
2124 if (!empty($arrayfields['staff.code']['checked'])) {
2125 print '<td class="center
">';
2126 if (!empty($obj->staff_code)) {
2127 if (empty($conf->cache['staffArray'])) {
2128 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2130 print $conf->cache['staffArray'][$obj->staff_code];
2134 $totalarray['nbfield']++;
2138 if (!empty($arrayfields['legalform.code']['checked'])) {
2140 if (!empty($obj->legalform_code)) {
2141 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2142 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2144 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2146 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2147 print dol_escape_htmltag($labeltoshow);
2150 $totalarray['nbfield']++;
2154 if (!empty($arrayfields['s.email']['checked'])) {
2155 $showinvalidemail = (int) !getDolGlobalInt('MAIN_SHOW_INVALID_EMAIL_IN_LIST'); // to avoid slow display
2156 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute((string) $obj->email).'">'.dol_print_email((string) $obj->email, $obj->rowid, $obj->rowid, 1, 0, $showinvalidemail, 1)."</td>\n
";
2158 $totalarray['nbfield']++;
2161 // Unsubscribe to ML list
2162 if (!empty($arrayfields['su.noemail']['checked'])) {
2163 print '<td class="center
">'.yn($obj->noemail)."</td>\n
";
2165 $totalarray['nbfield']++;
2168 if (!empty($arrayfields['s.phone']['checked'])) {
2169 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2171 $totalarray['nbfield']++;
2174 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2175 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n
";
2177 $totalarray['nbfield']++;
2180 if (!empty($arrayfields['s.fax']['checked'])) {
2181 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2183 $totalarray['nbfield']++;
2186 if (!empty($arrayfields['s.url']['checked'])) {
2187 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2189 $totalarray['nbfield']++;
2192 if (!empty($arrayfields['s.siren']['checked'])) {
2193 print "<td>
".$obj->idprof1."</td>\n
";
2195 $totalarray['nbfield']++;
2198 if (!empty($arrayfields['s.siret']['checked'])) {
2199 print "<td>
".$obj->idprof2."</td>\n
";
2201 $totalarray['nbfield']++;
2204 if (!empty($arrayfields['s.ape']['checked'])) {
2205 print "<td>
".$obj->idprof3."</td>\n
";
2207 $totalarray['nbfield']++;
2210 if (!empty($arrayfields['s.idprof4']['checked'])) {
2211 print "<td>
".$obj->idprof4."</td>\n
";
2213 $totalarray['nbfield']++;
2216 if (!empty($arrayfields['s.idprof5']['checked'])) {
2217 print "<td>
".$obj->idprof5."</td>\n
";
2219 $totalarray['nbfield']++;
2222 if (!empty($arrayfields['s.idprof6']['checked'])) {
2223 print "<td>
".$obj->idprof6."</td>\n
";
2225 $totalarray['nbfield']++;
2229 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2230 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2231 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2232 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2234 print $companystatic->tva_intra;
2237 $totalarray['nbfield']++;
2241 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2242 print '<td class="center
">';
2243 $reshook = $hookmanager->executeHooks('getTypeUrl', array('client_type' => $obj->client));
2244 if (empty($reshook)) {
2245 print $companystatic->getTypeUrl(1);
2249 $totalarray['nbfield']++;
2252 // Sales Representative
2253 if (!empty($arrayfields['sales.representative']['checked'])) {
2254 print '<td class="nowraponall tdoverflowmax150
">';
2255 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2256 $nbofsalesrepresentative = count($listsalesrepresentatives);
2257 if ($nbofsalesrepresentative > 6) {
2258 // We print only number
2259 print $nbofsalesrepresentative;
2260 } elseif ($nbofsalesrepresentative > 0) {
2261 $userstatic = new User($db);
2263 foreach ($listsalesrepresentatives as $val) {
2264 $userstatic->id = $val['id'];
2265 $userstatic->lastname = $val['lastname'];
2266 $userstatic->firstname = $val['firstname'];
2267 $userstatic->email = $val['email'];
2268 $userstatic->entity = $val['entity'];
2269 $userstatic->photo = $val['photo'];
2270 $userstatic->login = $val['login'];
2271 $userstatic->office_phone = $val['office_phone'];
2272 $userstatic->office_fax = $val['office_fax'];
2273 $userstatic->user_mobile = $val['user_mobile'];
2274 $userstatic->job = $val['job'];
2275 $userstatic->gender = $val['gender'];
2276 $userstatic->statut = $val['statut'];
2277 $userstatic->status = $val['statut'];
2278 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2280 if ($j < $nbofsalesrepresentative) {
2289 $totalarray['nbfield']++;
2293 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2294 print '<td class="center nowraponall
">';
2295 print $companystatic->getLibProspLevel();
2298 $totalarray['nbfield']++;
2302 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2303 print '<td class="center nowraponall
">';
2305 $prospectid = $obj->rowid;
2306 $statusprospect = $obj->stcomm_id;
2308 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2312 $totalarray['nbfield']++;
2316 if (!empty($arrayfields['s2.nom']['checked'])) {
2317 print '<td class="center tdoverflowmax100
">';
2318 if ($companystatic->parent > 0) {
2319 $companyparent->fetch($companystatic->parent);
2320 print $companyparent->getNomUrl(1);
2324 $totalarray['nbfield']++;
2328 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2330 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2331 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2332 print $hookmanager->resPrint;
2334 if (!empty($arrayfields['s.ip']['checked'])) {
2335 print '<td class="center nowraponall
">';
2336 print dol_print_ip($obj->ip);
2339 $totalarray['nbfield']++;
2343 if (!empty($arrayfields['s.datec']['checked'])) {
2344 print '<td class="center nowraponall
">';
2345 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2348 $totalarray['nbfield']++;
2351 // Date modification
2352 if (!empty($arrayfields['s.tms']['checked'])) {
2353 print '<td class="center nowraponall
">';
2354 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2357 $totalarray['nbfield']++;
2361 if (!empty($arrayfields['s.note_public']['checked'])) {
2362 print '<td class="flat maxwidth250imp
">';
2363 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2366 $totalarray['nbfield']++;
2370 if (!empty($arrayfields['s.note_private']['checked'])) {
2371 print '<td class="flat maxwidth250imp
">';
2372 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2375 $totalarray['nbfield']++;
2379 if (!empty($arrayfields['s.status']['checked'])) {
2380 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2382 $totalarray['nbfield']++;
2386 if (!empty($arrayfields['s.import_key']['checked'])) {
2387 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2388 print dol_escape_htmltag($obj->import_key);
2391 $totalarray['nbfield']++;
2394 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
2395 if (!$conf->main_checkbox_left_column) {
2396 print '<td class="nowrap center actioncolumn
">';
2397 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
2399 if (in_array($obj->rowid, $arrayofselected)) {
2402 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2406 $totalarray['nbfield']++;
2416include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2418// If no record found
2421 foreach ($arrayfields as $key => $val) {
2422 if (!empty($val['checked'])) {
2426 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2431$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2432$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2433print $hookmanager->resPrint;
2435print '</table>'."\n
";
2438// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2439$formcompany->selectProspectStatus('status_prospect', $prospectstatic, 0, 0, "js
");
2441print '</form>'."\n
";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
get_htmloutput_mesg($mesgstring='', $mesgarray=[], $style='ok', $keepembedded=0)
Get formatted messages to output (Used to show messages on html output).
dol_natural_search_phone($db, $fields, $value, $nofirstand=0)
Build a natural_search() SQL fragment for a phone/fax field, tolerant of the international storage fo...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.