42require_once
'../main.inc.php';
43include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
49if (isModEnabled(
'category')) {
50 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
64$langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
67$action =
GETPOST(
'action',
'aZ09');
68$massaction =
GETPOST(
'massaction',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
71$toselect =
GETPOST(
'toselect',
'array');
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')) {
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');
129if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) {
130 $searchCategoryCustomerList = array($search_categ_cus);
132$searchCategorySupplierList =
GETPOST(
'search_category_supplier_list',
'array');
133if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) {
134 $searchCategorySupplierList = array($search_categ_sup);
136$search_country =
GETPOST(
"search_country",
'aZ09');
137$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
138$search_price_level =
GETPOST(
'search_price_level',
'int');
139$search_staff =
GETPOST(
"search_staff",
'int');
140$search_legalform =
GETPOST(
"search_legalform",
'int');
141$search_status =
GETPOST(
"search_status",
'intcomma');
142$search_type =
GETPOST(
'search_type',
'alpha');
143$search_level =
GETPOST(
"search_level",
"array:alpha");
144$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
145$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
146$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
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';
264if (isModEnabled(
'barcode')) {
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';
359 $socid = $user->socid;
363$permissiontoadd = $user->hasRight(
'societe',
'lire');
370if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
374 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
375 $result = $db->query($sql);
376 $num_lines = $db->num_rows($result);
377 if ($num_lines == 0) {
378 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
380 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
383 $invoice->module_source =
'takepos';
384 $invoice->pos_source = $_SESSION[
"takeposterminal"];
385 $placeid = $invoice->create($user);
386 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
390 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
391 $resql = $db->query($sql); ?>
393 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
394 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
396 <?php
if (!$resql) { ?>
397 alert(
'Error failed to update customer on draft invoice.');
399 parent.$.colorbox.close();
406if (
GETPOST(
'cancel',
'alpha')) {
410if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
414$parameters = array(
'arrayfields' => &$arrayfields);
415$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
420if (empty($reshook)) {
422 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
425 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
429 $search_ref_ext =
'';
430 $search_categ_cus = 0;
431 $search_categ_sup = 0;
432 $searchCategoryCustomerOperator = 0;
433 $searchCategorySupplierOperator = 0;
434 $searchCategoryCustomerList = array();
435 $searchCategorySupplierList = array();
436 $search_sale = array();
437 $search_barcode =
"";
438 $search_customer_code =
'';
439 $search_supplier_code =
'';
440 $search_account_customer_code =
'';
441 $search_account_supplier_code =
'';
442 $search_address =
'';
447 $search_country =
'';
449 $search_noemail =
'';
451 $search_phone_mobile =
'';
454 $search_idprof1 =
'';
455 $search_idprof2 =
'';
456 $search_idprof3 =
'';
457 $search_idprof4 =
'';
458 $search_idprof5 =
'';
459 $search_idprof6 =
'';
462 $search_price_level =
'';
463 $search_type_thirdparty =
'';
465 $search_legalform =
'';
466 $search_date_creation_startmonth =
"";
467 $search_date_creation_startyear =
"";
468 $search_date_creation_startday =
"";
469 $search_date_creation_start =
"";
470 $search_date_creation_endmonth =
"";
471 $search_date_creation_endyear =
"";
472 $search_date_creation_endday =
"";
473 $search_date_creation_end =
"";
474 $search_date_modif_startmonth =
"";
475 $search_date_modif_startyear =
"";
476 $search_date_modif_startday =
"";
477 $search_date_modif_start =
"";
478 $search_date_modif_endmonth =
"";
479 $search_date_modif_endyear =
"";
480 $search_date_modif_endday =
"";
481 $search_date_modif_end =
"";
482 $search_note_public =
"";
483 $search_note_private =
"";
487 $search_parent_name =
'';
488 $search_import_key =
'';
492 $search_array_options = array();
496 $objectclass =
'Societe';
497 $objectlabel =
'ThirdParty';
498 $permissiontoread = $user->hasRight(
'societe',
'lire');
499 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
500 $permissiontoadd = $user->hasRight(
"societe",
"creer");
501 $uploaddir =
$conf->societe->dir_output;
504 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
506 if (!$error && $action ==
'setstcomm' && $permissiontoadd) {
519if ($search_status ==
'' && empty($search_all)) {
538$form =
new Form($db);
540$companystatic =
new Societe($db);
541$companyparent =
new Societe($db);
543$prospectstatic =
new Client($db);
544$prospectstatic->client = 2;
545$prospectstatic->loadCacheOfProspStatus();
549$title = $langs->trans(
"ThirdParties");
550if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
551 $title = $langs->trans(
"Customers");
553if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
554 $title = $langs->trans(
"Prospects");
556if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
557 $title = $langs->trans(
"Suppliers");
559$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
564$sql =
"SELECT code, label, sortorder";
565$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
566$sql .=
" WHERE active > 0";
567$sql .=
" ORDER BY sortorder";
568$resql = $db->query($sql);
570 while ($obj = $db->fetch_object($resql)) {
572 $level = $langs->trans($obj->code);
573 if ($level == $obj->code) {
574 $level = $langs->trans($obj->label);
576 $tab_level[$obj->code] = $level;
584$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,";
586$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,";
587$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,";
588$sql .=
" s.ip, s.tms as date_modification, s.datec as date_creation, s.import_key,";
589$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
590$sql .=
" s2.nom as name2,";
591$sql .=
" typent.code as typent_code,";
592$sql .=
" staff.code as staff_code,";
593$sql .=
" s.fk_forme_juridique as legalform_code,";
594$sql .=
" country.code as country_code, country.label as country_label,";
595$sql .=
" state.code_departement as state_code, state.nom as state_name,";
596$sql .=
" region.code_region as region_code, region.nom as region_name";
598if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
599 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
600 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
604$parameters = array();
605$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
606$sql .= $hookmanager->resPrint;
607$sql = preg_replace(
'/,\s*$/',
'', $sql);
612$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
613$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
614if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
615 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
618$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
619$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
620$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
624$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
626$parameters = array();
627$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
628$sql .= $hookmanager->resPrint;
629$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
630if (!$user->hasRight(
'fournisseur',
'lire')) {
631 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
635if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
636 $search_sale = array($user->id);
639if (!empty($search_sale) && $search_sale !=
'-1') {
640 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
641 $value = intval($value);
645 $search_sale_req = implode(
',', $search_sale_req);
647 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
648 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
649 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
650 $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).
"))";
651 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
652 $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).
"))";
653 $sql .=
" OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
658if (!empty($searchCategoryCustomerList)) {
659 $searchCategoryCustomerSqlList = array();
660 $listofcategoryid =
'';
661 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
662 if (intval($searchCategoryCustomer) == -2) {
663 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
664 } elseif (intval($searchCategoryCustomer) > 0) {
665 if ($searchCategoryCustomerOperator == 0) {
666 $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).
")";
668 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
672 if ($listofcategoryid) {
673 $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).
"))";
675 if ($searchCategoryCustomerOperator == 1) {
676 if (!empty($searchCategoryCustomerSqlList)) {
677 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
680 if (!empty($searchCategoryCustomerSqlList)) {
681 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
687if (!empty($searchCategorySupplierList)) {
688 $searchCategorySupplierSqlList = array();
689 $listofcategoryid =
'';
690 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
691 if (intval($searchCategorySupplier) == -2) {
692 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
693 } elseif (intval($searchCategorySupplier) > 0) {
694 if ($searchCategorySupplierOperator == 0) {
695 $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).
")";
697 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
701 if ($listofcategoryid) {
702 $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).
"))";
704 if ($searchCategorySupplierOperator == 1) {
705 if (!empty($searchCategorySupplierSqlList)) {
706 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
709 if (!empty($searchCategorySupplierSqlList)) {
710 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
715 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
717if (strlen($search_cti)) {
723if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
724 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
734if ($search_nom_only) {
737if ($search_ref_ext) {
740if ($search_customer_code) {
743if ($search_supplier_code) {
744 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
746if ($search_account_customer_code) {
747 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
749if ($search_account_supplier_code) {
750 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
752if ($search_address) {
755if (strlen($search_zip)) {
767if ($search_country && $search_country !=
'-1') {
768 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
773if ($search_noemail) {
774 $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').
"))";
776if (strlen($search_phone)) {
779if (strlen($search_phone_mobile)) {
782if (strlen($search_fax)) {
788if (strlen($search_idprof1)) {
791if (strlen($search_idprof2)) {
794if (strlen($search_idprof3)) {
797if (strlen($search_idprof4)) {
800if (strlen($search_idprof5)) {
803if (strlen($search_idprof6)) {
806if (strlen($search_vat)) {
810if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
811 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
813if ($search_type > 0 && in_array($search_type, array(
'4'))) {
814 $sql .=
" AND s.fournisseur = 1";
816if ($search_type ==
'0') {
817 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
819if ($search_status !=
'' && $search_status >= 0) {
822if (isModEnabled(
'barcode') && $search_barcode) {
825if ($search_price_level && $search_price_level !=
'-1') {
828if ($search_type_thirdparty && $search_type_thirdparty > 0) {
829 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
831if (!empty($search_staff) && $search_staff !=
'-1') {
834if (!empty($search_legalform) && $search_legalform !=
'-1') {
835 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
837if ($search_parent_name) {
841 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
844 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
846if ($search_import_key) {
849if ($search_note_public !=
'') {
852if ($search_note_private !=
'') {
855if ($search_date_creation_start) {
856 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
858if ($search_date_creation_end) {
859 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
862if ($search_date_modif_start) {
863 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
865if ($search_date_modif_end) {
866 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
870include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
872$parameters = array(
'socid' => $socid);
873$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
874if (empty($reshook)) {
876 $sql .=
" AND s.rowid = ".((int) $socid);
879$sql .= $hookmanager->resPrint;
882$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
883$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
884$sql .= $hookmanager->resPrint;
887$nbtotalofrecords =
'';
890 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
891 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
892 $resql = $db->query($sqlforcount);
894 $objforcount = $db->fetch_object($resql);
895 $nbtotalofrecords = $objforcount->nbtotalofrecords;
900 if (($page * $limit) > $nbtotalofrecords) {
908$sql .= $db->order($sortfield, $sortorder);
910 $sql .= $db->plimit($limit + 1, $offset);
912$resql = $db->query($sql);
918$num = $db->num_rows($resql);
922if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
923 $obj = $db->fetch_object($resql);
925 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
926 if ($obj->client > 0) {
927 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
930 if ($obj->fournisseur > 0) {
931 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
936 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
944foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
945 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
947foreach ($searchCategorySupplierList as $searchCategorySupplier) {
948 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
951llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
954$arrayofselected = is_array($toselect) ? $toselect : array();
958 $param .=
'&mode='.urlencode($mode);
960if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
961 $param .=
'&contextpage='.urlencode($contextpage);
963if ($limit > 0 && $limit !=
$conf->liste_limit) {
964 $param .=
'&limit='.((int) $limit);
966if ($optioncss !=
'') {
967 $param .=
'&optioncss='.urlencode($optioncss);
969if ($search_all !=
'') {
970 $param =
"&search_all=".urlencode($search_all);
972if ($search_categ_cus > 0) {
973 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
975if ($search_categ_sup > 0) {
976 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
978if ($searchCategoryCustomerOperator == 1) {
979 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
981if ($searchCategorySupplierOperator == 1) {
982 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
984foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
985 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
987foreach ($searchCategorySupplierList as $searchCategorySupplier) {
988 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
990if (is_array($search_sale)) {
991 foreach ($search_sale as $sale_id) {
992 $param .=
'&search_sale[]=' . urlencode($sale_id);
996 $param .=
"&search_id=".((int) $search_id);
998if ($search_nom !=
'') {
999 $param .=
"&search_nom=".urlencode($search_nom);
1001if ($search_alias !=
'') {
1002 $param .=
"&search_alias=".urlencode($search_alias);
1004if ($search_ref_ext !=
'') {
1005 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
1007if ($search_address !=
'') {
1008 $param .=
'&search_address='.urlencode($search_address);
1010if ($search_zip !=
'') {
1011 $param .=
"&search_zip=".urlencode($search_zip);
1013if ($search_town !=
'') {
1014 $param .=
"&search_town=".urlencode($search_town);
1016if ($search_phone !=
'') {
1017 $param .=
"&search_phone=".urlencode($search_phone);
1019if ($search_phone_mobile !=
'') {
1020 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
1022if ($search_fax !=
'') {
1023 $param .=
"&search_fax=".urlencode($search_fax);
1025if ($search_email !=
'') {
1026 $param .=
"&search_email=".urlencode($search_email);
1028if ($search_noemail !=
'') {
1029 $param .=
"&search_noemail=".urlencode($search_noemail);
1031if ($search_url !=
'') {
1032 $param .=
"&search_url=".urlencode($search_url);
1034if ($search_state !=
'') {
1035 $param .=
"&search_state=".urlencode($search_state);
1037if ($search_region !=
'') {
1038 $param .=
"&search_region=".urlencode($search_region);
1040if ($search_country !=
'') {
1041 $param .=
"&search_country=".urlencode($search_country);
1043if ($search_customer_code !=
'') {
1044 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1046if ($search_supplier_code !=
'') {
1047 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1049if ($search_account_customer_code !=
'') {
1050 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1052if ($search_account_supplier_code !=
'') {
1053 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1055if ($search_barcode !=
'') {
1056 $param .=
"&search_barcode=".urlencode($search_barcode);
1058if ($search_idprof1 !=
'') {
1059 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1061if ($search_idprof2 !=
'') {
1062 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1064if ($search_idprof3 !=
'') {
1065 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1067if ($search_idprof4 !=
'') {
1068 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1070if ($search_idprof5 !=
'') {
1071 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1073if ($search_idprof6 !=
'') {
1074 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1076if ($search_vat !=
'') {
1077 $param .=
'&search_vat='.urlencode($search_vat);
1079if ($search_price_level !=
'') {
1080 $param .=
'&search_price_level='.urlencode($search_price_level);
1082if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1083 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1085if ($search_type !=
'') {
1086 $param .=
'&search_type='.urlencode($search_type);
1088if ($search_status !=
'') {
1089 $param .=
'&search_status='.urlencode((
string) ($search_status));
1091if (is_array($search_level) && count($search_level)) {
1092 foreach ($search_level as $slevel) {
1093 $param .=
'&search_level[]='.urlencode($slevel);
1096if (is_array($search_stcomm) && count($search_stcomm)) {
1097 foreach ($search_stcomm as $slevel) {
1098 $param .=
'&search_stcomm[]='.urlencode($slevel);
1101if ($search_parent_name !=
'') {
1102 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1104if ($search_import_key !=
'') {
1105 $param .=
'&search_import_key='.urlencode($search_import_key);
1107if ($search_note_public !=
'') {
1108 $param .=
'&search_note_public='.urlencode($search_note_public);
1110if ($search_note_private !=
'') {
1111 $param .=
'&search_note_private='.urlencode($search_note_private);
1114 $param .=
'&type='.urlencode($type);
1116if ($search_date_creation_startmonth) {
1117 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1119if ($search_date_creation_startyear) {
1120 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1122if ($search_date_creation_startday) {
1123 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1125if ($search_date_creation_start) {
1126 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1128if ($search_date_creation_endmonth) {
1129 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1131if ($search_date_creation_endyear) {
1132 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1134if ($search_date_creation_endday) {
1135 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1137if ($search_date_creation_end) {
1138 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1140if ($search_date_modif_startmonth) {
1141 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1143if ($search_date_modif_startyear) {
1144 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1146if ($search_date_modif_startday) {
1147 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1149if ($search_date_modif_start) {
1150 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1152if ($search_date_modif_endmonth) {
1153 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1155if ($search_date_modif_endyear) {
1156 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1158if ($search_date_modif_endday) {
1159 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1161if ($search_date_modif_end) {
1162 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1166include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1168$parameters = array(
'param' => &$param);
1169$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1170$param .= $hookmanager->resPrint;
1178$arrayofmassactions = array(
1179 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1183if (isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1184 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1186if ($user->hasRight(
"societe",
"creer")) {
1187 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1189if ($user->hasRight(
"societe",
"creer")) {
1190 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1192if ($user->hasRight(
"societe",
"creer")) {
1193 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1194 $arrayofmassactions[
'unsetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1197if ($user->hasRight(
'societe',
'supprimer')) {
1198 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1200if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1201 $arrayofmassactions = array();
1203$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1206$label =
'MenuNewThirdParty';
1209 $typefilter =
'&type='.$type;
1211 $label =
'MenuNewProspect';
1214 $label =
'MenuNewCustomer';
1217 $label =
'NewSupplier';
1226$parameters = array();
1227$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1228if (empty($reshook)) {
1231 if ($contextpage !=
'poslist') {
1232 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1233 if (!empty($socid)) {
1234 $url .=
'&socid='.$socid;
1236 $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'));
1237 $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'));
1238 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1239 } elseif ($user->hasRight(
'societe',
'creer')) {
1240 $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);
1241 $label =
'MenuNewCustomer';
1242 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1245 $newcardbutton = $hookmanager->resPrint;
1248print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1249if ($optioncss !=
'') {
1250 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1252print
'<input type="hidden" name="token" value="'.newToken().
'">';
1253print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1254if (empty($massaction)) {
1255 print
'<input type="hidden" name="action" value="list">';
1257print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1258print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1260print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1261if (!empty($place)) {
1262 print
'<input type="hidden" name="place" value="'.$place.
'">';
1264print
'<input type="hidden" name="page_y" value="">';
1265print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1266if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1267 print
'<input type="hidden" name="type" value="'.$type.
'">';
1269if (!empty($place)) {
1270 print
'<input type="hidden" name="place" value="'.$place.
'">';
1273print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1275$langs->load(
"other");
1276$textprofid = array();
1277foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1278 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1279 $textprofid[$key] =
'';
1280 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1282 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1286 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
1291$topicmail =
"Information";
1292$modelmail =
"thirdparty";
1294$trackid =
'thi'.$object->id;
1295include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1309 foreach ($fieldstosearchall as $key => $val) {
1310 $fieldstosearchall[$key] = $langs->trans($val);
1311 $setupstring .= $key.
"=".$val.
";";
1313 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1314 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1320if (empty($type) || $type ==
'c' || $type ==
'p') {
1321 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1323 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1328if (empty($type) || $type ==
'f') {
1329 if (isModEnabled(
"fournisseur") && isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1331 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1336$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1337$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1338if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1339 $moreforfilter .=
'<div class="divsearchfield">';
1340 $tmptitle = $langs->transnoentitiesnoconv(
'SalesRepresentatives');
1341 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1342 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->transnoentitiesnoconv(
'SalesRepresentatives'), 1);
1343 $moreforfilter .=
'</div>';
1345if (!empty($moreforfilter)) {
1346 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1347 print $moreforfilter;
1348 $parameters = array(
'type' => $type);
1349 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1350 print $hookmanager->resPrint;
1354$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1355$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1356$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1357$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1359print
'<div class="div-table-responsive">';
1360print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1364print
'<tr class="liste_titre_filter">';
1366if (
$conf->main_checkbox_left_column) {
1367 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1368 $searchpicto = $form->showFilterButtons(
'left');
1372if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1373 print
'<td class="liste_titre" data-key="id">';
1374 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1377if (!empty($arrayfields[
's.nom'][
'checked'])) {
1378 print
'<td class="liste_titre" data-key="ref">';
1379 if (!empty($search_nom_only) && empty($search_nom)) {
1380 $search_nom = $search_nom_only;
1382 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1385if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1386 print
'<td class="liste_titre">';
1387 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1390if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1391 print
'<td class="liste_titre">';
1392 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1396if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1397 print
'<td class="liste_titre">';
1398 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1402if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1403 print
'<td class="liste_titre">';
1404 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1408if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1409 print
'<td class="liste_titre">';
1410 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1414if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1415 print
'<td class="liste_titre">';
1416 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1420if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1421 print
'<td class="liste_titre">';
1422 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1426if (!empty($arrayfields[
's.address'][
'checked'])) {
1427 print
'<td class="liste_titre">';
1428 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1432if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1433 print
'<td class="liste_titre">';
1437if (!empty($arrayfields[
's.zip'][
'checked'])) {
1438 print
'<td class="liste_titre">';
1439 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1443if (!empty($arrayfields[
's.town'][
'checked'])) {
1444 print
'<td class="liste_titre">';
1445 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1449if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1450 print
'<td class="liste_titre">';
1451 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1455if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1456 print
'<td class="liste_titre">';
1457 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1461if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1462 print
'<td class="liste_titre center">';
1463 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1467if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1468 print
'<td class="liste_titre maxwidthonsmartphone center">';
1470 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);
1474if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1475 print
'<td class="liste_titre">';
1476 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1480if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1481 print
'<td class="liste_titre maxwidthonsmartphone center">';
1482 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1486if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1487 print
'<td class="liste_titre maxwidthonsmartphone center">';
1491if (!empty($arrayfields[
's.email'][
'checked'])) {
1493 print
'<td class="liste_titre">';
1494 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1497if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1499 print
'<td class="liste_titre center">';
1500 print
'<input class="flat searchemail maxwidth50imp" type="checkbox" name="search_noemail" '.($search_noemail ?
' checked="checked"' :
'').
'">';
1503if (!empty($arrayfields[
's.phone'][
'checked'])) {
1505 print
'<td class="liste_titre">';
1506 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1509if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1511 print
'<td class="liste_titre">';
1512 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1515if (!empty($arrayfields[
's.fax'][
'checked'])) {
1517 print
'<td class="liste_titre">';
1518 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1521if (!empty($arrayfields[
's.url'][
'checked'])) {
1523 print
'<td class="liste_titre">';
1524 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1527if (!empty($arrayfields[
's.siren'][
'checked'])) {
1529 print
'<td class="liste_titre">';
1530 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1533if (!empty($arrayfields[
's.siret'][
'checked'])) {
1535 print
'<td class="liste_titre">';
1536 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1539if (!empty($arrayfields[
's.ape'][
'checked'])) {
1541 print
'<td class="liste_titre">';
1542 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1545if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1547 print
'<td class="liste_titre">';
1548 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1551if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1553 print
'<td class="liste_titre">';
1554 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1557if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1559 print
'<td class="liste_titre">';
1560 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1563if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1565 print
'<td class="liste_titre">';
1566 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1571if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1572 print
'<td class="liste_titre maxwidthonsmartphone center">';
1574 print
'<input type="hidden" name="type" value="'.$type.
'">';
1576 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1580if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1581 print
'<td class="liste_titre center">';
1582 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1586if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1587 print
'<td class="liste_titre maxwidthonsmartphone center">';
1588 $arraystcomm = array();
1589 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1590 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1593 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1596if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1597 print
'<td class="liste_titre center">';
1598 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1602include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1605$parameters = array(
'arrayfields' => $arrayfields);
1606$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1607print $hookmanager->resPrint;
1609if (!empty($arrayfields[
's.ip'][
'checked'])) {
1610 print
'<td class="liste_titre center nowraponall">';
1614if (!empty($arrayfields[
's.datec'][
'checked'])) {
1615 print
'<td class="liste_titre center nowraponall">';
1616 print
'<div class="nowrapfordate">';
1617 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'));
1619 print
'<div class="nowrapfordate">';
1620 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'));
1625if (!empty($arrayfields[
's.tms'][
'checked'])) {
1626 print
'<td class="liste_titre center nowraponall">';
1627 print
'<div class="nowrapfordate">';
1628 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'));
1630 print
'<div class="nowrapfordate">';
1631 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'));
1635if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1637 print
'<td class="liste_titre">';
1638 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1641if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1643 print
'<td class="liste_titre">';
1644 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1648if (!empty($arrayfields[
's.status'][
'checked'])) {
1649 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1650 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);
1653if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1654 print
'<td class="liste_titre center">';
1655 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1659if (!
$conf->main_checkbox_left_column) {
1660 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1661 $searchpicto = $form->showFilterButtons();
1673print
'<tr class="liste_titre">';
1675if (
$conf->main_checkbox_left_column) {
1676 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1679if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1683if (!empty($arrayfields[
's.nom'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1687if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1689 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1692if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1694 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1697if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1698 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode",
'', $param,
'', $sortfield, $sortorder);
1701if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1702 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1705if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1706 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1709if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1710 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1713if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1714 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1717if (!empty($arrayfields[
's.address'][
'checked'])) {
1718 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1721if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1725if (!empty($arrayfields[
's.zip'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1729if (!empty($arrayfields[
's.town'][
'checked'])) {
1730 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1733if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1734 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1737if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1738 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1741if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1742 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1745if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1746 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1749if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1750 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1753if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1758if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1762if (!empty($arrayfields[
's.email'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1766if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'su.noemail'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1770if (!empty($arrayfields[
's.phone'][
'checked'])) {
1771 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1774if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1775 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1778if (!empty($arrayfields[
's.fax'][
'checked'])) {
1779 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1782if (!empty($arrayfields[
's.url'][
'checked'])) {
1783 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1786if (!empty($arrayfields[
's.siren'][
'checked'])) {
1787 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1790if (!empty($arrayfields[
's.siret'][
'checked'])) {
1791 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1794if (!empty($arrayfields[
's.ape'][
'checked'])) {
1795 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1798if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1799 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1802if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1803 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1806if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1807 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1810if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1811 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1814if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1815 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1818if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1819 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1822if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1826if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1827 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1831include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1833$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1834$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1835print $hookmanager->resPrint;
1837if (!empty($arrayfields[
's.ip'][
'checked'])) {
1838 print_liste_field_titre($arrayfields[
's.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1842if (!empty($arrayfields[
's.datec'][
'checked'])) {
1843 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1846if (!empty($arrayfields[
's.tms'][
'checked'])) {
1847 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1850if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1851 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1854if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1855 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1858if (!empty($arrayfields[
's.status'][
'checked'])) {
1859 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1862if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1863 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1867if (!
$conf->main_checkbox_left_column) {
1868 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1880$imaxinloop = ($limit ? min($num, $limit) : $num);
1881while ($i < $imaxinloop) {
1882 $obj = $db->fetch_object($resql);
1887 $parameters = array(
'staticdata' => $obj);
1890 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1891 if (empty($reshook)) {
1892 $companystatic->id = $obj->rowid;
1893 $companystatic->name = $obj->name;
1894 $companystatic->name_alias = $obj->name_alias;
1895 $companystatic->ref_ext = $obj->ref_ext;
1896 $companystatic->logo = $obj->logo;
1897 $companystatic->barcode = $obj->barcode;
1898 $companystatic->canvas = $obj->canvas;
1899 $companystatic->client = $obj->client;
1900 $companystatic->status = $obj->status;
1901 $companystatic->email = $obj->email;
1902 $companystatic->phone = $obj->phone;
1903 $companystatic->phone_mobile = $obj->phone_mobile;
1904 $companystatic->fax = $obj->fax;
1905 $companystatic->address = $obj->address;
1906 $companystatic->zip = $obj->zip;
1907 $companystatic->town = $obj->town;
1908 $companystatic->fournisseur = $obj->fournisseur;
1909 $companystatic->code_client = $obj->code_client;
1910 $companystatic->code_fournisseur = $obj->code_fournisseur;
1911 $companystatic->tva_intra = $obj->tva_intra;
1912 $companystatic->country_code = $obj->country_code;
1914 $companystatic->ip = $obj->ip;
1916 $companystatic->code_compta_client = $obj->code_compta;
1917 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1918 $companystatic->note_public = $obj->note_public;
1919 $companystatic->note_private = $obj->note_private;
1920 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1921 $companystatic->parent = $obj->fk_parent;
1922 $companystatic->entity = $obj->entity;
1927 if ($mode ==
'kanban') {
1929 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1930 print
'<div class="box-flex-container kanban">';
1933 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1934 if ($i == ($imaxinloop - 1)) {
1941 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven"';
1942 if ($contextpage ==
'poslist') {
1943 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1947 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
1948 if ($conf->main_checkbox_left_column) {
1949 print '<td class="nowrap center actioncolumn
">';
1950 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
1952 if (in_array($obj->rowid, $arrayofselected)) {
1955 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1959 $totalarray['nbfield']++;
1962 if (!empty($arrayfields['s.rowid']['checked'])) {
1963 print '<td class="tdoverflowmax50
" data-key="id">';
1964 print dol_escape_htmltag($obj->rowid);
1967 $totalarray['nbfield']++;
1970 if (!empty($arrayfields['s.nom']['checked'])) {
1971 print '<td'.(getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? '' : ' class="tdoverflowmax200
"').' data-key="ref">';
1972 if ($contextpage == 'poslist') {
1973 print dol_escape_htmltag($companystatic->name);
1975 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1979 $totalarray['nbfield']++;
1982 if (!empty($arrayfields['s.name_alias']['checked'])) {
1983 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1984 print dol_escape_htmltag($companystatic->name_alias);
1987 $totalarray['nbfield']++;
1991 if (!empty($arrayfields['s.ref_ext']['checked'])) {
1992 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->ref_ext).'">';
1993 print dol_escape_htmltag($companystatic->ref_ext);
1996 $totalarray['nbfield']++;
2000 if (!empty($arrayfields['s.barcode']['checked'])) {
2001 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
2003 $totalarray['nbfield']++;
2007 if (!empty($arrayfields['s.code_client']['checked'])) {
2008 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
2010 $totalarray['nbfield']++;
2014 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
2015 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
2017 $totalarray['nbfield']++;
2020 // Account customer code
2021 if (!empty($arrayfields['s.code_compta']['checked'])) {
2022 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
2024 $totalarray['nbfield']++;
2027 // Account supplier code
2028 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
2029 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
2031 $totalarray['nbfield']++;
2035 if (!empty($arrayfields['s.address']['checked'])) {
2036 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
2038 $totalarray['nbfield']++;
2041 // Sales Representative
2042 if (!empty($arrayfields['sales.representative']['checked'])) {
2043 print '<td class="nowraponall tdoverflowmax200
">';
2044 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2045 $nbofsalesrepresentative = count($listsalesrepresentatives);
2046 if ($nbofsalesrepresentative > 6) {
2047 // We print only number
2048 print $nbofsalesrepresentative;
2049 } elseif ($nbofsalesrepresentative > 0) {
2050 $userstatic = new User($db);
2052 foreach ($listsalesrepresentatives as $val) {
2053 $userstatic->id = $val['id'];
2054 $userstatic->lastname = $val['lastname'];
2055 $userstatic->firstname = $val['firstname'];
2056 $userstatic->email = $val['email'];
2057 $userstatic->entity = $val['entity'];
2058 $userstatic->photo = $val['photo'];
2059 $userstatic->login = $val['login'];
2060 $userstatic->office_phone = $val['office_phone'];
2061 $userstatic->office_fax = $val['office_fax'];
2062 $userstatic->user_mobile = $val['user_mobile'];
2063 $userstatic->job = $val['job'];
2064 $userstatic->gender = $val['gender'];
2065 $userstatic->statut = $val['statut'];
2066 $userstatic->status = $val['statut'];
2067 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2069 if ($j < $nbofsalesrepresentative) {
2078 $totalarray['nbfield']++;
2082 if (!empty($arrayfields['s.zip']['checked'])) {
2083 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
2085 $totalarray['nbfield']++;
2089 if (!empty($arrayfields['s.town']['checked'])) {
2090 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
2092 $totalarray['nbfield']++;
2096 if (!empty($arrayfields['state.nom']['checked'])) {
2097 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
2099 $totalarray['nbfield']++;
2103 if (!empty($arrayfields['region.nom']['checked'])) {
2104 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
2106 $totalarray['nbfield']++;
2110 if (!empty($arrayfields['country.code_iso']['checked'])) {
2111 print '<td class="center tdoverflowmax100
">';
2112 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2113 print $labelcountry;
2116 $totalarray['nbfield']++;
2120 if (!empty($arrayfields['typent.code']['checked'])) {
2121 $typenArray = $formcompany->typent_array(1);
2122 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2124 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
2125 print dol_escape_htmltag($labeltypeofcompany);
2128 $totalarray['nbfield']++;
2132 if (!empty($arrayfields['s.price_level']['checked'])) {
2133 print '<td class="center
">'.$obj->price_level."</td>\n
";
2135 $totalarray['nbfield']++;
2139 if (!empty($arrayfields['staff.code']['checked'])) {
2140 print '<td class="center
">';
2141 if (!empty($obj->staff_code)) {
2142 if (empty($conf->cache['staffArray'])) {
2143 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2145 print $conf->cache['staffArray'][$obj->staff_code];
2149 $totalarray['nbfield']++;
2153 if (!empty($arrayfields['legalform.code']['checked'])) {
2155 if (!empty($obj->legalform_code)) {
2156 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2157 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2159 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2161 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2162 print dol_escape_htmltag($labeltoshow);
2165 $totalarray['nbfield']++;
2169 if (!empty($arrayfields['s.email']['checked'])) {
2170 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."</td>\n
";
2172 $totalarray['nbfield']++;
2175 // Unsubscribe to ML list
2176 if (!empty($arrayfields['su.noemail']['checked'])) {
2177 print '<td class="center
">'.yn($obj->noemail)."</td>\n
";
2179 $totalarray['nbfield']++;
2182 if (!empty($arrayfields['s.phone']['checked'])) {
2183 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2185 $totalarray['nbfield']++;
2188 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2189 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n
";
2191 $totalarray['nbfield']++;
2194 if (!empty($arrayfields['s.fax']['checked'])) {
2195 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2197 $totalarray['nbfield']++;
2200 if (!empty($arrayfields['s.url']['checked'])) {
2201 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2203 $totalarray['nbfield']++;
2206 if (!empty($arrayfields['s.siren']['checked'])) {
2207 print "<td>
".$obj->idprof1."</td>\n
";
2209 $totalarray['nbfield']++;
2212 if (!empty($arrayfields['s.siret']['checked'])) {
2213 print "<td>
".$obj->idprof2."</td>\n
";
2215 $totalarray['nbfield']++;
2218 if (!empty($arrayfields['s.ape']['checked'])) {
2219 print "<td>
".$obj->idprof3."</td>\n
";
2221 $totalarray['nbfield']++;
2224 if (!empty($arrayfields['s.idprof4']['checked'])) {
2225 print "<td>
".$obj->idprof4."</td>\n
";
2227 $totalarray['nbfield']++;
2230 if (!empty($arrayfields['s.idprof5']['checked'])) {
2231 print "<td>
".$obj->idprof5."</td>\n
";
2233 $totalarray['nbfield']++;
2236 if (!empty($arrayfields['s.idprof6']['checked'])) {
2237 print "<td>
".$obj->idprof6."</td>\n
";
2239 $totalarray['nbfield']++;
2243 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2244 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2245 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2246 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2248 print $companystatic->tva_intra;
2251 $totalarray['nbfield']++;
2255 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2256 print '<td class="center
">';
2257 print $companystatic->getTypeUrl(1);
2260 $totalarray['nbfield']++;
2264 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2265 print '<td class="center nowraponall
">';
2266 print $companystatic->getLibProspLevel();
2269 $totalarray['nbfield']++;
2273 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2274 print '<td class="center nowraponall
">';
2276 $prospectid = $obj->rowid;
2277 $statusprospect = $obj->stcomm_id;
2279 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2283 $totalarray['nbfield']++;
2287 if (!empty($arrayfields['s2.nom']['checked'])) {
2288 print '<td class="center tdoverflowmax100
">';
2289 if ($companystatic->parent > 0) {
2290 $companyparent->fetch($companystatic->parent);
2291 print $companyparent->getNomUrl(1);
2295 $totalarray['nbfield']++;
2299 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2301 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2302 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2303 print $hookmanager->resPrint;
2305 if (!empty($arrayfields['s.ip']['checked'])) {
2306 print '<td class="center nowraponall
">';
2307 print dol_print_ip($obj->ip);
2310 $totalarray['nbfield']++;
2314 if (!empty($arrayfields['s.datec']['checked'])) {
2315 print '<td class="center nowraponall
">';
2316 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2319 $totalarray['nbfield']++;
2322 // Date modification
2323 if (!empty($arrayfields['s.tms']['checked'])) {
2324 print '<td class="center nowraponall
">';
2325 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2328 $totalarray['nbfield']++;
2332 if (!empty($arrayfields['s.note_public']['checked'])) {
2333 print '<td class="flat maxwidth250imp
">';
2334 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2337 $totalarray['nbfield']++;
2341 if (!empty($arrayfields['s.note_private']['checked'])) {
2342 print '<td class="flat maxwidth250imp
">';
2343 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2346 $totalarray['nbfield']++;
2350 if (!empty($arrayfields['s.status']['checked'])) {
2351 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2353 $totalarray['nbfield']++;
2357 if (!empty($arrayfields['s.import_key']['checked'])) {
2358 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2359 print dol_escape_htmltag($obj->import_key);
2362 $totalarray['nbfield']++;
2365 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
2366 if (!$conf->main_checkbox_left_column) {
2367 print '<td class="nowrap center actioncolumn
">';
2368 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
2370 if (in_array($obj->rowid, $arrayofselected)) {
2373 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2377 $totalarray['nbfield']++;
2387include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2389// If no record found
2392 foreach ($arrayfields as $key => $val) {
2393 if (!empty($val['checked'])) {
2397 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2402$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2403$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2404print $hookmanager->resPrint;
2406print '</table>'."\n
";
2409// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2410$formcompany->selectProspectStatus('status_prospect', $prospectstatic, 0, 0, "js
");
2412print '</form>'."\n
";
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers or prospects.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.