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/class/html.formcompany.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
59 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
64$langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
67$action =
GETPOST(
'action',
'aZ09');
68$massaction =
GETPOST(
'massaction',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
71$toselect =
GETPOST(
'toselect',
'array:int');
72$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
73$optioncss =
GETPOST(
'optioncss',
'alpha');
74if ($contextpage ==
'poslist') {
77$mode =
GETPOST(
"mode",
'alpha');
80$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
81$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
83$search_id =
GETPOST(
"search_id",
'int');
84$search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
85$search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
86$search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
87$search_ref_ext = trim(
GETPOST(
"search_ref_ext",
'restricthtml'));
88$search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
89$search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
90$search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
91$search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
92$search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
93$search_address = trim(
GETPOST(
'search_address',
'alpha'));
94$search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
95$search_town = trim(
GETPOST(
"search_town",
'alpha'));
96$search_state = trim(
GETPOST(
"search_state",
'alpha'));
97$search_region = trim(
GETPOST(
"search_region",
'alpha'));
98$search_email = trim(
GETPOST(
'search_email',
'alpha'));
99$search_noemail = trim(
GETPOST(
'search_noemail',
'alpha'));
100$search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
101$search_phone_mobile = trim(
GETPOST(
'search_phone_mobile',
'alpha'));
102$search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
103$search_url = trim(
GETPOST(
'search_url',
'alpha'));
104$search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
105$search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
106$search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
107$search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
108$search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
109$search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
110$search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
113 $search_sale =
GETPOST(
'search_sale',
'array:int');
114} elseif (GETPOSTISSET(
'search_sale') &&
GETPOSTINT(
'search_sale') > 0) {
115 $search_sale = array(
GETPOSTINT(
'search_sale'));
117$search_categ_cus =
GETPOSTINT(
"search_categ_cus");
118$search_categ_sup =
GETPOSTINT(
"search_categ_sup");
119$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
120$searchCategorySupplierOperator =
GETPOSTINT(
'search_category_supplier_operator');
121if (GETPOSTISSET(
'formfilteraction')) {
122 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
123 $searchCategorySupplierOperator =
GETPOSTINT(
'search_category_supplier_operator');
125 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
126 $searchCategorySupplierOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
128$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array:int');
129if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) {
130 $searchCategoryCustomerList = array($search_categ_cus);
132$searchCategorySupplierList =
GETPOST(
'search_category_supplier_list',
'array:int');
133if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) {
134 $searchCategorySupplierList = array($search_categ_sup);
136$search_country =
GETPOST(
"search_country",
'aZ09');
137$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
138$search_price_level =
GETPOST(
'search_price_level',
'int');
139$search_staff =
GETPOST(
"search_staff",
'int');
140$search_legalform =
GETPOST(
"search_legalform",
'int');
141$search_status =
GETPOST(
"search_status",
'intcomma');
142$search_type =
GETPOST(
'search_type',
'alpha');
143$search_level =
GETPOST(
"search_level",
"array:alpha");
144$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
145$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
146$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
147$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
148$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
150$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
151$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
152$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
153$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
154$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
155$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
156$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
157$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
159$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
160$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
161$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
162$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
163$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
164$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
165$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
166$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
168$type =
GETPOST(
'type',
'alpha');
169$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
171$diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
175$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
176$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
182 $sortfield =
"s.nom";
184if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
188$offset = $limit * $page;
189$pageprev = $page - 1;
190$pagenext = $page + 1;
193 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
194 $contextpage =
'customerlist';
196 if ($search_type ==
'') {
197 $search_type =
'1,3';
201 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
202 $contextpage =
'prospectlist';
204 if ($search_type ==
'') {
205 $search_type =
'2,3';
209 if (empty($contextpage) || $contextpage ==
'poslist') {
210 $contextpage =
'poslist';
212 if ($search_type ==
'') {
214 $search_type =
'1,2,3';
218 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
219 $contextpage =
'supplierlist';
221 if ($search_type ==
'') {
228$hookmanager->initHooks(array($contextpage,
'thirdpartylist'));
231$extrafields->fetch_name_optionals_label(
$object->table_element);
233$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
236$fieldstosearchall = array(
237 's.nom' =>
"ThirdPartyName",
238 's.name_alias' =>
"AliasNameShort",
239 's.code_client' =>
"CustomerCode",
240 's.code_fournisseur' =>
"SupplierCode",
241 's.code_compta' =>
"CustomerAccountancyCodeShort",
242 's.code_compta_fournisseur' =>
"SupplierAccountancyCodeShort",
245 's.email' =>
"EMail",
247 's.tva_intra' =>
"VATIntra",
248 's.siren' =>
"ProfId1",
249 's.siret' =>
"ProfId2",
250 's.ape' =>
"ProfId3",
251 's.phone' =>
"Phone",
252 's.phone_mobile' =>
"PhoneMobile",
255if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
256 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
258if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
259 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
261if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
262 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
265 $fieldstosearchall[
's.barcode'] =
'Gencod';
272$parameters = array(
'fieldstosearchall'=>$fieldstosearchall);
273$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
275 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
276} elseif ($reshook == 0) {
277 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
281$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ?
'1' :
'0');
282$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
283$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ?
'1' :
'0');
284$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
285$checkedtypetiers =
'1';
286$checkedprofid1 =
'0';
287$checkedprofid2 =
'0';
288$checkedprofid3 =
'0';
289$checkedprofid4 =
'0';
290$checkedprofid5 =
'0';
291$checkedprofid6 =
'0';
295$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
296$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
298 's.rowid' => array(
'label' =>
"TechnicalID",
'position' => 1,
'checked' =>
'-1',
'enabled' =>
'1'),
299 's.nom' => array(
'label' =>
"ThirdPartyName",
'position' => 2,
'checked' =>
'1'),
300 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 3,
'checked' =>
'1'),
301 's.ref_ext' => array(
'label' =>
"RefExt",
'position' => 4,
'checked' =>
'-1',
'enabled' => (
string)
getDolGlobalInt(
'MAIN_LIST_SHOW_REF_EXT')),
302 's.barcode' => array(
'label' =>
"Gencod",
'position' => 5,
'checked' =>
'1',
'enabled' => (
string) (
int)
isModEnabled(
'barcode')),
303 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'position' => 10,
'checked' => $checkedcustomercode),
304 's.code_fournisseur' => array(
'label' =>
"SupplierCodeShort",
'position' => 11,
'checked' => $checkedsuppliercode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
305 's.code_compta' => array(
'label' =>
"CustomerAccountancyCodeShort",
'position' => 13,
'checked' => $checkedcustomeraccountcode),
306 's.code_compta_fournisseur' => array(
'label' =>
"SupplierAccountancyCodeShort",
'position' => 14,
'checked' => $checkedsupplieraccountcode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
307 's.address' => array(
'label' =>
"Address",
'position' => 19,
'checked' =>
'0'),
308 's.zip' => array(
'label' =>
"Zip",
'position' => 20,
'checked' =>
'1'),
309 's.town' => array(
'label' =>
"Town",
'position' => 21,
'checked' =>
'0'),
310 'state.nom' => array(
'label' =>
"State",
'position' => 22,
'checked' =>
'0'),
311 'region.nom' => array(
'label' =>
"Region",
'position' => 23,
'checked' =>
'0'),
312 'country.code_iso' => array(
'label' =>
"Country",
'position' => 24,
'checked' =>
'0'),
313 's.email' => array(
'label' =>
"Email",
'position' => 25,
'checked' =>
'0'),
314 'su.noemail' => array(
'label' =>
"No_Email",
'position' => 26,
'checked' =>
'0'),
315 's.url' => array(
'label' =>
"Url",
'position' => 26,
'checked' =>
'0'),
316 's.phone' => array(
'label' =>
"Phone",
'position' => 27,
'checked' =>
'1'),
317 's.fax' => array(
'label' =>
"Fax",
'position' => 28,
'checked' =>
'0'),
318 'typent.code' => array(
'label' =>
"ThirdPartyType",
'position' => 29,
'checked' => $checkedtypetiers),
319 'staff.code' => array(
'label' =>
"Workforce",
'position' => 31,
'checked' =>
'0'),
320 'legalform.code' => array(
'label' =>
'JuridicalStatus',
'position' => 32,
'checked' =>
'0'),
321 's.phone_mobile' => array(
'label' =>
"PhoneMobile",
'position' => 35,
'checked' =>
'0'),
322 's.siren' => array(
'label' =>
"ProfId1Short",
'position' => 40,
'checked' => $checkedprofid1),
323 's.siret' => array(
'label' =>
"ProfId2Short",
'position' => 41,
'checked' => $checkedprofid2),
324 's.ape' => array(
'label' =>
"ProfId3Short",
'position' => 42,
'checked' => $checkedprofid3),
325 's.idprof4' => array(
'label' =>
"ProfId4Short",
'position' => 43,
'checked' => $checkedprofid4),
326 's.idprof5' => array(
'label' =>
"ProfId5Short",
'position' => 44,
'checked' => $checkedprofid5),
327 's.idprof6' => array(
'label' =>
"ProfId6Short",
'position' => 45,
'checked' => $checkedprofid6),
328 's.tva_intra' => array(
'label' =>
"VATIntraShort",
'position' => 50,
'checked' =>
'0'),
329 'customerorsupplier' => array(
'label' =>
'NatureOfThirdParty',
'position' => 61,
'checked' =>
'1'),
330 's.fk_prospectlevel' => array(
'label' =>
"ProspectLevel",
'position' => 62,
'checked' => $checkprospectlevel),
331 's.fk_stcomm' => array(
'label' =>
"StatusProsp",
'position' => 63,
'checked' => $checkstcomm),
332 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 64,
'checked' =>
'0'),
333 's.ip' => array(
'type' =>
'ip',
'label' =>
"IPAddress",
'checked' =>
'-2',
'position' => 500),
334 's.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
335 's.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 505),
336 's.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
337 's.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
338 's.status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
339 's.import_key' => array(
'label' =>
"ImportId",
'checked' =>
'0',
'position' => 1100),
342 $arrayfields[
's.price_level'] = array(
'label' =>
"PriceLevel",
'position' => 30,
'checked' =>
'0');
346$arrayfields[
'sales.representative'] = array(
'label' => $langs->trans(
"SalesRepresentatives"),
'checked' =>
'1',
'position' => 12);
349include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
351$parameters = array(
'arrayfields' => &$arrayfields);
352$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
362 $socid = $user->socid;
366$permissiontoadd = $user->hasRight(
'societe',
'lire');
373if (
GETPOST(
'cancel',
'alpha')) {
377if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
381$parameters = array(
'arrayfields' => &$arrayfields);
382$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
387if (empty($reshook)) {
388 if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
392 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$db->escape($place).
")' AND entity IN (".
getEntity(
'invoice').
")";
393 $result = $db->query($sql);
394 $num_lines = $db->num_rows($result);
395 if ($num_lines == 0) {
396 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
398 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
401 $invoice->module_source =
'takepos';
402 $invoice->pos_source = $_SESSION[
"takeposterminal"];
403 $placeid = $invoice->create($user);
404 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
408 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$db->escape($place).
")'";
409 $resql = $db->query($sql); ?>
411 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
412 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
414 <?php
if (!$resql) { ?>
415 alert(
'Error failed to update customer on draft invoice.');
417 parent.$.colorbox.close();
425 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
428 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
432 $search_ref_ext =
'';
433 $search_categ_cus = 0;
434 $search_categ_sup = 0;
435 $searchCategoryCustomerOperator = 0;
436 $searchCategorySupplierOperator = 0;
437 $searchCategoryCustomerList = array();
438 $searchCategorySupplierList = array();
439 $search_sale = array();
440 $search_barcode =
"";
441 $search_customer_code =
'';
442 $search_supplier_code =
'';
443 $search_account_customer_code =
'';
444 $search_account_supplier_code =
'';
445 $search_address =
'';
450 $search_country =
'';
452 $search_noemail =
'';
454 $search_phone_mobile =
'';
457 $search_idprof1 =
'';
458 $search_idprof2 =
'';
459 $search_idprof3 =
'';
460 $search_idprof4 =
'';
461 $search_idprof5 =
'';
462 $search_idprof6 =
'';
465 $search_price_level =
'';
466 $search_type_thirdparty =
'';
468 $search_legalform =
'';
469 $search_date_creation_startmonth =
"";
470 $search_date_creation_startyear =
"";
471 $search_date_creation_startday =
"";
472 $search_date_creation_start =
"";
473 $search_date_creation_endmonth =
"";
474 $search_date_creation_endyear =
"";
475 $search_date_creation_endday =
"";
476 $search_date_creation_end =
"";
477 $search_date_modif_startmonth =
"";
478 $search_date_modif_startyear =
"";
479 $search_date_modif_startday =
"";
480 $search_date_modif_start =
"";
481 $search_date_modif_endmonth =
"";
482 $search_date_modif_endyear =
"";
483 $search_date_modif_endday =
"";
484 $search_date_modif_end =
"";
485 $search_note_public =
"";
486 $search_note_private =
"";
490 $search_parent_name =
'';
491 $search_import_key =
'';
495 $search_array_options = array();
499 $objectclass =
'Societe';
500 $objectlabel =
'ThirdParty';
501 $permissiontoread = $user->hasRight(
'societe',
'lire');
502 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
503 $permissiontoadd = $user->hasRight(
"societe",
"creer");
504 $uploaddir = $conf->societe->dir_output;
507 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
509 if (!$error && $action ==
'setstcomm' && $permissiontoadd) {
522if ($search_status ==
'' && empty($search_all)) {
541$form =
new Form($db);
543$companystatic =
new Societe($db);
544$companyparent =
new Societe($db);
546$prospectstatic =
new Client($db);
547$prospectstatic->client = 2;
548$prospectstatic->loadCacheOfProspStatus();
552$title = $langs->trans(
"ThirdParties");
553if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
554 $title = $langs->trans(
"Customers");
556if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
557 $title = $langs->trans(
"Prospects");
559if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
560 $title = $langs->trans(
"Suppliers");
562$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
567$sql =
"SELECT code, label, sortorder";
568$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
569$sql .=
" WHERE active > 0";
570$sql .=
" ORDER BY sortorder";
571$resql = $db->query($sql);
573 while ($obj = $db->fetch_object($resql)) {
575 $level = $langs->trans($obj->code);
576 if ($level == $obj->code) {
577 $level = $langs->trans($obj->label);
579 $tab_level[$obj->code] = $level;
587$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,";
589$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,";
590$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,";
591$sql .=
" s.ip, s.tms as date_modification, s.datec as date_creation, s.import_key,";
592$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
593$sql .=
" s2.nom as name2,";
594$sql .=
" typent.code as typent_code,";
595$sql .=
" staff.code as staff_code,";
596$sql .=
" s.fk_forme_juridique as legalform_code,";
597$sql .=
" country.code as country_code, country.label as country_label,";
598$sql .=
" state.code_departement as state_code, state.nom as state_name,";
599$sql .=
" region.code_region as region_code, region.nom as region_name";
601if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
602 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
603 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
607$parameters = array();
608$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
609$sql .= $hookmanager->resPrint;
610$sql = preg_replace(
'/,\s*$/',
'', $sql);
615$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
616$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
617if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
618 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
621$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
625$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
626$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
627$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
629$parameters = array();
630$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
631$sql .= $hookmanager->resPrint;
632$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
633if (!$user->hasRight(
'fournisseur',
'lire')) {
634 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
638if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
639 $search_sale = array($user->id);
642if (!empty($search_sale) && $search_sale !=
'-1') {
643 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
644 $value = intval($value);
648 $search_sale_req = implode(
',', $search_sale_req);
650 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
651 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
652 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
653 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req).
"))";
654 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
655 $sql .=
" AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req).
"))";
656 $sql .=
" OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
661if (!empty($searchCategoryCustomerList)) {
662 $searchCategoryCustomerSqlList = array();
663 $listofcategoryid =
'';
664 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
665 if (intval($searchCategoryCustomer) == -2) {
666 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
667 } elseif (intval($searchCategoryCustomer) > 0) {
668 if ($searchCategoryCustomerOperator == 0) {
669 $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).
")";
671 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
675 if ($listofcategoryid) {
676 $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).
"))";
678 if ($searchCategoryCustomerOperator == 1) {
679 if (!empty($searchCategoryCustomerSqlList)) {
680 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
683 if (!empty($searchCategoryCustomerSqlList)) {
684 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
690if (!empty($searchCategorySupplierList)) {
691 $searchCategorySupplierSqlList = array();
692 $listofcategoryid =
'';
693 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
694 if (intval($searchCategorySupplier) == -2) {
695 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
696 } elseif (intval($searchCategorySupplier) > 0) {
697 if ($searchCategorySupplierOperator == 0) {
698 $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).
")";
700 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
704 if ($listofcategoryid) {
705 $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).
"))";
707 if ($searchCategorySupplierOperator == 1) {
708 if (!empty($searchCategorySupplierSqlList)) {
709 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
712 if (!empty($searchCategorySupplierSqlList)) {
713 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
718 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
720if (strlen($search_cti)) {
726if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
727 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
737if ($search_nom_only) {
740if ($search_ref_ext) {
743if ($search_customer_code) {
746if ($search_supplier_code) {
747 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
749if ($search_account_customer_code) {
750 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
752if ($search_account_supplier_code) {
753 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
755if ($search_address) {
758if (strlen($search_zip)) {
770if ($search_country && $search_country !=
'-1') {
771 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
776if ($search_noemail) {
777 $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').
"))";
779if (strlen($search_phone)) {
782if (strlen($search_phone_mobile)) {
785if (strlen($search_fax)) {
791if (strlen($search_idprof1)) {
794if (strlen($search_idprof2)) {
797if (strlen($search_idprof3)) {
800if (strlen($search_idprof4)) {
803if (strlen($search_idprof5)) {
806if (strlen($search_idprof6)) {
809if (strlen($search_vat)) {
813$reshook = $hookmanager->executeHooks(
'filterType', array(
'search_type' => $search_type), $sql);
814if (empty($reshook)) {
815 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
816 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
819if ($search_type > 0 && in_array($search_type, array(
'4'))) {
820 $sql .=
" AND s.fournisseur = 1";
822if ($search_type ==
'0') {
823 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
825if ($search_status !=
'' && $search_status >= 0) {
831if ($search_price_level && $search_price_level !=
'-1') {
834if ($search_type_thirdparty && $search_type_thirdparty > 0) {
835 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
837if (!empty($search_staff) && $search_staff !=
'-1') {
840if (!empty($search_legalform) && $search_legalform !=
'-1') {
841 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
843if ($search_parent_name) {
847 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
850 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
852if ($search_import_key) {
855if ($search_note_public !=
'') {
858if ($search_note_private !=
'') {
861if ($search_date_creation_start) {
862 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
864if ($search_date_creation_end) {
865 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
868if ($search_date_modif_start) {
869 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
871if ($search_date_modif_end) {
872 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
875 $sql .=
" AND s.rowid = ".((int) $socid);
879include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
881$parameters = array(
'socid' => $socid,
'sql' => $sql);
882$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
883if (empty($reshook)) {
884 $sql .= $hookmanager->resPrint;
886 $sql = $hookmanager->resPrint;
890$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
891$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
892if (empty($reshook)) {
893 $sql .= $hookmanager->resPrint;
895 $sql = $hookmanager->resPrint;
899$nbtotalofrecords =
'';
902 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
903 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
904 $resql = $db->query($sqlforcount);
906 $objforcount = $db->fetch_object($resql);
907 $nbtotalofrecords = $objforcount->nbtotalofrecords;
912 if (($page * $limit) > (
int) $nbtotalofrecords) {
920$sql .= $db->order($sortfield, $sortorder);
922 $sql .= $db->plimit($limit + 1, $offset);
924$resql = $db->query($sql);
930$num = $db->num_rows($resql);
934if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
935 $obj = $db->fetch_object($resql);
937 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
938 if ($obj->client > 0) {
939 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
942 if ($obj->fournisseur > 0) {
943 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
948 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
956foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
957 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
959foreach ($searchCategorySupplierList as $searchCategorySupplier) {
960 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
963llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
966$arrayofselected = is_array($toselect) ? $toselect : array();
970 $param .=
'&mode='.urlencode($mode);
972if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
973 $param .=
'&contextpage='.urlencode($contextpage);
975if ($limit > 0 && $limit != $conf->liste_limit) {
976 $param .=
'&limit='.((int) $limit);
978if ($optioncss !=
'') {
979 $param .=
'&optioncss='.urlencode($optioncss);
981if ($search_all !=
'') {
982 $param =
"&search_all=".urlencode($search_all);
984if ($search_categ_cus > 0) {
985 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
987if ($search_categ_sup > 0) {
988 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
990if ($searchCategoryCustomerOperator == 1) {
991 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
993if ($searchCategorySupplierOperator == 1) {
994 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
996foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
997 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
999foreach ($searchCategorySupplierList as $searchCategorySupplier) {
1000 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
1002if (is_array($search_sale)) {
1003 foreach ($search_sale as $sale_id) {
1004 $param .=
'&search_sale[]=' . urlencode($sale_id);
1007if ($search_id > 0) {
1008 $param .=
"&search_id=".((int) $search_id);
1010if ($search_nom !=
'') {
1011 $param .=
"&search_nom=".urlencode($search_nom);
1013if ($search_alias !=
'') {
1014 $param .=
"&search_alias=".urlencode($search_alias);
1016if ($search_ref_ext !=
'') {
1017 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
1019if ($search_address !=
'') {
1020 $param .=
'&search_address='.urlencode($search_address);
1022if ($search_zip !=
'') {
1023 $param .=
"&search_zip=".urlencode($search_zip);
1025if ($search_town !=
'') {
1026 $param .=
"&search_town=".urlencode($search_town);
1028if ($search_phone !=
'') {
1029 $param .=
"&search_phone=".urlencode($search_phone);
1031if ($search_phone_mobile !=
'') {
1032 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
1034if ($search_fax !=
'') {
1035 $param .=
"&search_fax=".urlencode($search_fax);
1037if ($search_email !=
'') {
1038 $param .=
"&search_email=".urlencode($search_email);
1040if ($search_noemail !=
'') {
1041 $param .=
"&search_noemail=".urlencode($search_noemail);
1043if ($search_url !=
'') {
1044 $param .=
"&search_url=".urlencode($search_url);
1046if ($search_state !=
'') {
1047 $param .=
"&search_state=".urlencode($search_state);
1049if ($search_region !=
'') {
1050 $param .=
"&search_region=".urlencode($search_region);
1052if ($search_country !=
'') {
1053 $param .=
"&search_country=".urlencode($search_country);
1055if ($search_customer_code !=
'') {
1056 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1058if ($search_supplier_code !=
'') {
1059 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1061if ($search_account_customer_code !=
'') {
1062 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1064if ($search_account_supplier_code !=
'') {
1065 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1067if ($search_barcode !=
'') {
1068 $param .=
"&search_barcode=".urlencode($search_barcode);
1070if ($search_idprof1 !=
'') {
1071 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1073if ($search_idprof2 !=
'') {
1074 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1076if ($search_idprof3 !=
'') {
1077 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1079if ($search_idprof4 !=
'') {
1080 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1082if ($search_idprof5 !=
'') {
1083 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1085if ($search_idprof6 !=
'') {
1086 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1088if ($search_vat !=
'') {
1089 $param .=
'&search_vat='.urlencode($search_vat);
1091if ($search_price_level !=
'') {
1092 $param .=
'&search_price_level='.urlencode($search_price_level);
1094if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1095 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1097if ($search_type !=
'') {
1098 $param .=
'&search_type='.urlencode($search_type);
1100if ($search_status !=
'') {
1101 $param .=
'&search_status='.urlencode((
string) ($search_status));
1103if (is_array($search_level) && count($search_level)) {
1104 foreach ($search_level as $slevel) {
1105 $param .=
'&search_level[]='.urlencode($slevel);
1108if (is_array($search_stcomm) && count($search_stcomm)) {
1109 foreach ($search_stcomm as $slevel) {
1110 $param .=
'&search_stcomm[]='.urlencode($slevel);
1113if ($search_parent_name !=
'') {
1114 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1116if ($search_import_key !=
'') {
1117 $param .=
'&search_import_key='.urlencode($search_import_key);
1119if ($search_note_public !=
'') {
1120 $param .=
'&search_note_public='.urlencode($search_note_public);
1122if ($search_note_private !=
'') {
1123 $param .=
'&search_note_private='.urlencode($search_note_private);
1126 $param .=
'&type='.urlencode($type);
1128if ($search_date_creation_startmonth) {
1129 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1131if ($search_date_creation_startyear) {
1132 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1134if ($search_date_creation_startday) {
1135 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1137if ($search_date_creation_start) {
1138 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1140if ($search_date_creation_endmonth) {
1141 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1143if ($search_date_creation_endyear) {
1144 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1146if ($search_date_creation_endday) {
1147 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1149if ($search_date_creation_end) {
1150 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1152if ($search_date_modif_startmonth) {
1153 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1155if ($search_date_modif_startyear) {
1156 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1158if ($search_date_modif_startday) {
1159 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1161if ($search_date_modif_start) {
1162 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1164if ($search_date_modif_endmonth) {
1165 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1167if ($search_date_modif_endyear) {
1168 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1170if ($search_date_modif_endday) {
1171 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1173if ($search_date_modif_end) {
1174 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1178include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1180$parameters = array(
'param' => &$param);
1181$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1182$param .= $hookmanager->resPrint;
1190$arrayofmassactions = array(
1191 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1195if (
isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1196 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1198if ($user->hasRight(
"societe",
"creer")) {
1199 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1201if ($user->hasRight(
"societe",
"creer")) {
1202 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1204if ($user->hasRight(
"societe",
"creer")) {
1205 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1206 $arrayofmassactions[
'unsetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1209if ($user->hasRight(
'societe',
'supprimer')) {
1210 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1212if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1213 $arrayofmassactions = array();
1215$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1218$label =
'MenuNewThirdParty';
1221 $typefilter =
'&type='.$type;
1223 $label =
'MenuNewProspect';
1226 $label =
'MenuNewCustomer';
1229 $label =
'NewSupplier';
1238$parameters = array();
1239$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1240if (empty($reshook)) {
1243 if ($contextpage !=
'poslist') {
1244 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1245 if (!empty($socid)) {
1246 $url .=
'&socid='.$socid;
1248 $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'));
1249 $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'));
1250 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1251 } elseif ($user->hasRight(
'societe',
'creer')) {
1252 $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);
1253 $label =
'MenuNewCustomer';
1254 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1257 $newcardbutton = $hookmanager->resPrint;
1260print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1261if ($optioncss !=
'') {
1262 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1264print
'<input type="hidden" name="token" value="'.newToken().
'">';
1265print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1266if (empty($massaction)) {
1267 print
'<input type="hidden" name="action" value="list">';
1269print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1270print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1272print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1273if (!empty($place)) {
1274 print
'<input type="hidden" name="place" value="'.$place.
'">';
1276print
'<input type="hidden" name="page_y" value="">';
1277print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1278if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1279 print
'<input type="hidden" name="type" value="'.$type.
'">';
1281if (!empty($place)) {
1282 print
'<input type="hidden" name="place" value="'.$place.
'">';
1285print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1287$langs->load(
"other");
1288$textprofid = array();
1289foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1290 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1291 $textprofid[$key] =
'';
1292 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1294 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1298 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key,
$mysoc->country_code, $label);
1303$topicmail =
"Information";
1304$modelmail =
"thirdparty";
1306$trackid =
'thi'.$object->id;
1307include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1321 foreach ($fieldstosearchall as $key => $val) {
1322 $fieldstosearchall[$key] = $langs->trans($val);
1323 $setupstring .= $key.
"=".$val.
";";
1325 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1326 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1332if (empty($type) || $type ==
'c' || $type ==
'p') {
1333 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1335 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1340if (empty($type) || $type ==
'f') {
1343 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1348$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1349$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1350if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1351 $moreforfilter .=
'<div class="divsearchfield">';
1352 $tmptitle = $langs->transnoentitiesnoconv(
'SalesRepresentatives');
1353 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1354 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->transnoentitiesnoconv(
'SalesRepresentatives'), 1);
1355 $moreforfilter .=
'</div>';
1357if (!empty($moreforfilter)) {
1358 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1359 print $moreforfilter;
1360 $parameters = array(
'type' => $type);
1361 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1362 print $hookmanager->resPrint;
1366$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1367$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
1368$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1369$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1371print
'<div class="div-table-responsive">';
1372print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1376print
'<tr class="liste_titre_filter">';
1378if ($conf->main_checkbox_left_column) {
1379 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1380 $searchpicto = $form->showFilterButtons(
'left');
1384if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1385 print
'<td class="liste_titre" data-key="id">';
1386 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1389if (!empty($arrayfields[
's.nom'][
'checked'])) {
1390 print
'<td class="liste_titre" data-key="ref">';
1391 if (!empty($search_nom_only) && empty($search_nom)) {
1392 $search_nom = $search_nom_only;
1394 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1397if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1398 print
'<td class="liste_titre">';
1399 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1402if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1403 print
'<td class="liste_titre">';
1404 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1408if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1409 print
'<td class="liste_titre">';
1410 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1414if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1415 print
'<td class="liste_titre">';
1416 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1420if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1421 print
'<td class="liste_titre">';
1422 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1426if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1427 print
'<td class="liste_titre">';
1428 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1432if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1433 print
'<td class="liste_titre">';
1434 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1438if (!empty($arrayfields[
's.address'][
'checked'])) {
1439 print
'<td class="liste_titre">';
1440 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1444if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1445 print
'<td class="liste_titre">';
1449if (!empty($arrayfields[
's.zip'][
'checked'])) {
1450 print
'<td class="liste_titre">';
1451 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1455if (!empty($arrayfields[
's.town'][
'checked'])) {
1456 print
'<td class="liste_titre">';
1457 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1461if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1462 print
'<td class="liste_titre">';
1463 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1467if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1468 print
'<td class="liste_titre">';
1469 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1473if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1474 print
'<td class="liste_titre center">';
1475 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1479if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1480 print
'<td class="liste_titre maxwidthonsmartphone center">';
1482 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'minwidth50 maxwidth125', 1);
1486if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1487 print
'<td class="liste_titre">';
1488 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1492if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1493 print
'<td class="liste_titre maxwidthonsmartphone center">';
1494 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1498if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1499 print
'<td class="liste_titre maxwidthonsmartphone center">';
1503if (!empty($arrayfields[
's.email'][
'checked'])) {
1505 print
'<td class="liste_titre">';
1506 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1509if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1511 print
'<td class="liste_titre center">';
1512 print
'<input class="flat searchemail maxwidth50imp" type="checkbox" name="search_noemail" '.($search_noemail ?
' checked="checked"' :
'').
'">';
1515if (!empty($arrayfields[
's.phone'][
'checked'])) {
1517 print
'<td class="liste_titre">';
1518 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1521if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1523 print
'<td class="liste_titre">';
1524 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1527if (!empty($arrayfields[
's.fax'][
'checked'])) {
1529 print
'<td class="liste_titre">';
1530 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1533if (!empty($arrayfields[
's.url'][
'checked'])) {
1535 print
'<td class="liste_titre">';
1536 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1539if (!empty($arrayfields[
's.siren'][
'checked'])) {
1541 print
'<td class="liste_titre">';
1542 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1545if (!empty($arrayfields[
's.siret'][
'checked'])) {
1547 print
'<td class="liste_titre">';
1548 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1551if (!empty($arrayfields[
's.ape'][
'checked'])) {
1553 print
'<td class="liste_titre">';
1554 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1557if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1559 print
'<td class="liste_titre">';
1560 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1563if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1565 print
'<td class="liste_titre">';
1566 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1569if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1571 print
'<td class="liste_titre">';
1572 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1575if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1578 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1583if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1584 print
'<td class="liste_titre maxwidthonsmartphone center">';
1586 print
'<input type="hidden" name="type" value="'.$type.
'">';
1588 $reshook = $hookmanager->executeHooks(
'selectProspectCustomerType', array(
'client_type' => $search_type));
1589 if (empty($reshook)) {
1590 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1595if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1596 print
'<td class="liste_titre center">';
1597 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1601if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1602 print
'<td class="liste_titre maxwidthonsmartphone center">';
1603 $arraystcomm = array();
1604 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1605 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1608 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1611if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1612 print
'<td class="liste_titre center">';
1613 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1617include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1620$parameters = array(
'arrayfields' => $arrayfields);
1621$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1622print $hookmanager->resPrint;
1624if (!empty($arrayfields[
's.ip'][
'checked'])) {
1625 print
'<td class="liste_titre center nowraponall">';
1629if (!empty($arrayfields[
's.datec'][
'checked'])) {
1630 print
'<td class="liste_titre center nowraponall">';
1631 print
'<div class="nowrapfordate">';
1632 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'));
1634 print
'<div class="nowrapfordate">';
1635 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'));
1640if (!empty($arrayfields[
's.tms'][
'checked'])) {
1641 print
'<td class="liste_titre center nowraponall">';
1642 print
'<div class="nowrapfordate">';
1643 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'));
1645 print
'<div class="nowrapfordate">';
1646 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'));
1651if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1652 print
'<td class="liste_titre">';
1653 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1657if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1658 print
'<td class="liste_titre">';
1659 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1663if (!empty($arrayfields[
's.status'][
'checked'])) {
1664 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1665 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);
1668if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1669 print
'<td class="liste_titre center">';
1670 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1674if (!$conf->main_checkbox_left_column) {
1675 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1676 $searchpicto = $form->showFilterButtons();
1688print
'<tr class="liste_titre">';
1690if ($conf->main_checkbox_left_column) {
1691 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1694if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1698if (!empty($arrayfields[
's.nom'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1702if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1707if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1709 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1712if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1713 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode",
'', $param,
'', $sortfield, $sortorder);
1716if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1717 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1720if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1721 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1724if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1728if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1732if (!empty($arrayfields[
's.address'][
'checked'])) {
1733 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1736if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1740if (!empty($arrayfields[
's.zip'][
'checked'])) {
1741 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1744if (!empty($arrayfields[
's.town'][
'checked'])) {
1745 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1748if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1752if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1753 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1756if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1757 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1760if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1764if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1765 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1768if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1770 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1773if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1774 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1777if (!empty($arrayfields[
's.email'][
'checked'])) {
1778 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1781if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1782 print_liste_field_titre($arrayfields[
'su.noemail'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1785if (!empty($arrayfields[
's.phone'][
'checked'])) {
1786 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1789if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1790 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1793if (!empty($arrayfields[
's.fax'][
'checked'])) {
1794 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1797if (!empty($arrayfields[
's.url'][
'checked'])) {
1798 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1801if (!empty($arrayfields[
's.siren'][
'checked'])) {
1802 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1805if (!empty($arrayfields[
's.siret'][
'checked'])) {
1806 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1809if (!empty($arrayfields[
's.ape'][
'checked'])) {
1810 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1813if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1814 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1817if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1818 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1821if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1822 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1825if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1826 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1829if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1830 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1833if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1834 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1837if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1838 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1841if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1842 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1846include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1848$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1849$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1850print $hookmanager->resPrint;
1852if (!empty($arrayfields[
's.ip'][
'checked'])) {
1853 print_liste_field_titre($arrayfields[
's.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1857if (!empty($arrayfields[
's.datec'][
'checked'])) {
1858 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1861if (!empty($arrayfields[
's.tms'][
'checked'])) {
1862 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1865if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1866 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1869if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1870 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1873if (!empty($arrayfields[
's.status'][
'checked'])) {
1874 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1877if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1878 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1882if (!$conf->main_checkbox_left_column) {
1883 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1895$imaxinloop = ($limit ? min($num, $limit) : $num);
1896while ($i < $imaxinloop) {
1897 $obj = $db->fetch_object($resql);
1902 $parameters = array(
'staticdata' => $obj);
1905 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1906 if (empty($reshook)) {
1907 $companystatic->id = $obj->rowid;
1908 $companystatic->name = $obj->name;
1909 $companystatic->name_alias = $obj->name_alias;
1910 $companystatic->ref_ext = $obj->ref_ext;
1911 $companystatic->logo = $obj->logo;
1912 $companystatic->barcode = $obj->barcode;
1913 $companystatic->canvas = $obj->canvas;
1914 $companystatic->client = $obj->client;
1915 $companystatic->status = $obj->status;
1916 $companystatic->email = $obj->email;
1917 $companystatic->phone = $obj->phone;
1918 $companystatic->phone_mobile = $obj->phone_mobile;
1919 $companystatic->fax = $obj->fax;
1920 $companystatic->address = $obj->address;
1921 $companystatic->zip = $obj->zip;
1922 $companystatic->town = $obj->town;
1923 $companystatic->fournisseur = $obj->fournisseur;
1924 $companystatic->code_client = $obj->code_client;
1925 $companystatic->code_fournisseur = $obj->code_fournisseur;
1926 $companystatic->tva_intra = $obj->tva_intra;
1927 $companystatic->country_code = $obj->country_code;
1929 $companystatic->ip = $obj->ip;
1931 $companystatic->code_compta_client = $obj->code_compta;
1932 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1933 $companystatic->note_public = $obj->note_public;
1934 $companystatic->note_private = $obj->note_private;
1935 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1936 $companystatic->parent = $obj->fk_parent;
1937 $companystatic->entity = $obj->entity;
1942 if ($mode ==
'kanban') {
1944 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1945 print
'<div class="box-flex-container kanban">';
1948 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1949 if ($i == ($imaxinloop - 1)) {
1956 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven row-with-select"';
1957 if ($contextpage ==
'poslist') {
1958 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1962 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
1963 if ($conf->main_checkbox_left_column) {
1964 print '<td class="nowrap center actioncolumn
">';
1965 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
1967 if (in_array($obj->rowid, $arrayofselected)) {
1970 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1974 $totalarray['nbfield']++;
1977 if (!empty($arrayfields['s.rowid']['checked'])) {
1978 print '<td class="tdoverflowmax50
" data-key="id">';
1979 print dol_escape_htmltag($obj->rowid);
1982 $totalarray['nbfield']++;
1985 if (!empty($arrayfields['s.nom']['checked'])) {
1986 print '<td'.(getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? '' : ' class="tdoverflowmax200
"').' data-key="ref">';
1987 if ($contextpage == 'poslist') {
1988 print dol_escape_htmltag($companystatic->name);
1990 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1994 $totalarray['nbfield']++;
1997 if (!empty($arrayfields['s.name_alias']['checked'])) {
1998 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1999 print dol_escape_htmltag($companystatic->name_alias);
2002 $totalarray['nbfield']++;
2006 if (!empty($arrayfields['s.ref_ext']['checked'])) {
2007 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->ref_ext).'">';
2008 print dol_escape_htmltag($companystatic->ref_ext);
2011 $totalarray['nbfield']++;
2015 if (!empty($arrayfields['s.barcode']['checked'])) {
2016 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
2018 $totalarray['nbfield']++;
2022 if (!empty($arrayfields['s.code_client']['checked'])) {
2023 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
2025 $totalarray['nbfield']++;
2029 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
2030 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
2032 $totalarray['nbfield']++;
2035 // Account customer code
2036 if (!empty($arrayfields['s.code_compta']['checked'])) {
2037 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
2039 $totalarray['nbfield']++;
2042 // Account supplier code
2043 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
2044 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
2046 $totalarray['nbfield']++;
2050 if (!empty($arrayfields['s.address']['checked'])) {
2051 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
2053 $totalarray['nbfield']++;
2056 // Sales Representative
2057 if (!empty($arrayfields['sales.representative']['checked'])) {
2058 print '<td class="nowraponall tdoverflowmax200
">';
2059 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2060 $nbofsalesrepresentative = count($listsalesrepresentatives);
2061 if ($nbofsalesrepresentative > 6) {
2062 // We print only number
2063 print $nbofsalesrepresentative;
2064 } elseif ($nbofsalesrepresentative > 0) {
2065 $userstatic = new User($db);
2067 foreach ($listsalesrepresentatives as $val) {
2068 $userstatic->id = $val['id'];
2069 $userstatic->lastname = $val['lastname'];
2070 $userstatic->firstname = $val['firstname'];
2071 $userstatic->email = $val['email'];
2072 $userstatic->entity = $val['entity'];
2073 $userstatic->photo = $val['photo'];
2074 $userstatic->login = $val['login'];
2075 $userstatic->office_phone = $val['office_phone'];
2076 $userstatic->office_fax = $val['office_fax'];
2077 $userstatic->user_mobile = $val['user_mobile'];
2078 $userstatic->job = $val['job'];
2079 $userstatic->gender = $val['gender'];
2080 $userstatic->statut = $val['statut'];
2081 $userstatic->status = $val['statut'];
2082 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2084 if ($j < $nbofsalesrepresentative) {
2093 $totalarray['nbfield']++;
2097 if (!empty($arrayfields['s.zip']['checked'])) {
2098 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
2100 $totalarray['nbfield']++;
2104 if (!empty($arrayfields['s.town']['checked'])) {
2105 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
2107 $totalarray['nbfield']++;
2111 if (!empty($arrayfields['state.nom']['checked'])) {
2112 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
2114 $totalarray['nbfield']++;
2118 if (!empty($arrayfields['region.nom']['checked'])) {
2119 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
2121 $totalarray['nbfield']++;
2125 if (!empty($arrayfields['country.code_iso']['checked'])) {
2126 print '<td class="center tdoverflowmax100
">';
2127 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2128 print $labelcountry;
2131 $totalarray['nbfield']++;
2135 if (!empty($arrayfields['typent.code']['checked'])) {
2136 $typenArray = $formcompany->typent_array(1);
2137 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2139 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
2140 print dol_escape_htmltag($labeltypeofcompany);
2143 $totalarray['nbfield']++;
2147 if (!empty($arrayfields['s.price_level']['checked'])) {
2148 print '<td class="center
">'.$obj->price_level."</td>\n
";
2150 $totalarray['nbfield']++;
2154 if (!empty($arrayfields['staff.code']['checked'])) {
2155 print '<td class="center
">';
2156 if (!empty($obj->staff_code)) {
2157 if (empty($conf->cache['staffArray'])) {
2158 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2160 print $conf->cache['staffArray'][$obj->staff_code];
2164 $totalarray['nbfield']++;
2168 if (!empty($arrayfields['legalform.code']['checked'])) {
2170 if (!empty($obj->legalform_code)) {
2171 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2172 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2174 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2176 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2177 print dol_escape_htmltag($labeltoshow);
2180 $totalarray['nbfield']++;
2184 if (!empty($arrayfields['s.email']['checked'])) {
2185 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."</td>\n
";
2187 $totalarray['nbfield']++;
2190 // Unsubscribe to ML list
2191 if (!empty($arrayfields['su.noemail']['checked'])) {
2192 print '<td class="center
">'.yn($obj->noemail)."</td>\n
";
2194 $totalarray['nbfield']++;
2197 if (!empty($arrayfields['s.phone']['checked'])) {
2198 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2200 $totalarray['nbfield']++;
2203 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2204 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n
";
2206 $totalarray['nbfield']++;
2209 if (!empty($arrayfields['s.fax']['checked'])) {
2210 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2212 $totalarray['nbfield']++;
2215 if (!empty($arrayfields['s.url']['checked'])) {
2216 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2218 $totalarray['nbfield']++;
2221 if (!empty($arrayfields['s.siren']['checked'])) {
2222 print "<td>
".$obj->idprof1."</td>\n
";
2224 $totalarray['nbfield']++;
2227 if (!empty($arrayfields['s.siret']['checked'])) {
2228 print "<td>
".$obj->idprof2."</td>\n
";
2230 $totalarray['nbfield']++;
2233 if (!empty($arrayfields['s.ape']['checked'])) {
2234 print "<td>
".$obj->idprof3."</td>\n
";
2236 $totalarray['nbfield']++;
2239 if (!empty($arrayfields['s.idprof4']['checked'])) {
2240 print "<td>
".$obj->idprof4."</td>\n
";
2242 $totalarray['nbfield']++;
2245 if (!empty($arrayfields['s.idprof5']['checked'])) {
2246 print "<td>
".$obj->idprof5."</td>\n
";
2248 $totalarray['nbfield']++;
2251 if (!empty($arrayfields['s.idprof6']['checked'])) {
2252 print "<td>
".$obj->idprof6."</td>\n
";
2254 $totalarray['nbfield']++;
2258 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2259 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2260 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2261 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2263 print $companystatic->tva_intra;
2266 $totalarray['nbfield']++;
2270 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2271 print '<td class="center
">';
2272 $reshook = $hookmanager->executeHooks('getTypeUrl', array('client_type' => $obj->client));
2273 if (empty($reshook)) {
2274 print $companystatic->getTypeUrl(1);
2278 $totalarray['nbfield']++;
2282 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2283 print '<td class="center nowraponall
">';
2284 print $companystatic->getLibProspLevel();
2287 $totalarray['nbfield']++;
2291 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2292 print '<td class="center nowraponall
">';
2294 $prospectid = $obj->rowid;
2295 $statusprospect = $obj->stcomm_id;
2297 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2301 $totalarray['nbfield']++;
2305 if (!empty($arrayfields['s2.nom']['checked'])) {
2306 print '<td class="center tdoverflowmax100
">';
2307 if ($companystatic->parent > 0) {
2308 $companyparent->fetch($companystatic->parent);
2309 print $companyparent->getNomUrl(1);
2313 $totalarray['nbfield']++;
2317 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2319 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2320 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2321 print $hookmanager->resPrint;
2323 if (!empty($arrayfields['s.ip']['checked'])) {
2324 print '<td class="center nowraponall
">';
2325 print dol_print_ip($obj->ip);
2328 $totalarray['nbfield']++;
2332 if (!empty($arrayfields['s.datec']['checked'])) {
2333 print '<td class="center nowraponall
">';
2334 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2337 $totalarray['nbfield']++;
2340 // Date modification
2341 if (!empty($arrayfields['s.tms']['checked'])) {
2342 print '<td class="center nowraponall
">';
2343 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2346 $totalarray['nbfield']++;
2350 if (!empty($arrayfields['s.note_public']['checked'])) {
2351 print '<td class="flat maxwidth250imp
">';
2352 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2355 $totalarray['nbfield']++;
2359 if (!empty($arrayfields['s.note_private']['checked'])) {
2360 print '<td class="flat maxwidth250imp
">';
2361 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2364 $totalarray['nbfield']++;
2368 if (!empty($arrayfields['s.status']['checked'])) {
2369 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2371 $totalarray['nbfield']++;
2375 if (!empty($arrayfields['s.import_key']['checked'])) {
2376 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2377 print dol_escape_htmltag($obj->import_key);
2380 $totalarray['nbfield']++;
2383 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
2384 if (!$conf->main_checkbox_left_column) {
2385 print '<td class="nowrap center actioncolumn
">';
2386 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
2388 if (in_array($obj->rowid, $arrayofselected)) {
2391 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2395 $totalarray['nbfield']++;
2405include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2407// If no record found
2410 foreach ($arrayfields as $key => $val) {
2411 if (!empty($val['checked'])) {
2415 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2420$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2421$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2422print $hookmanager->resPrint;
2424print '</table>'."\n
";
2427// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2428$formcompany->selectProspectStatus('status_prospect', $prospectstatic, 0, 0, "js
");
2430print '</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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
get_htmloutput_mesg($mesgstring='', $mesgarray=[], $style='ok', $keepembedded=0)
Get formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.