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;
176$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
177$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
183 $sortfield =
"s.nom";
185if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
189$offset = $limit * $page;
190$pageprev = $page - 1;
191$pagenext = $page + 1;
194 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
195 $contextpage =
'customerlist';
197 if ($search_type ==
'') {
198 $search_type =
'1,3';
202 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
203 $contextpage =
'prospectlist';
205 if ($search_type ==
'') {
206 $search_type =
'2,3';
210 if (empty($contextpage) || $contextpage ==
'poslist') {
211 $contextpage =
'poslist';
213 if ($search_type ==
'') {
215 $search_type =
'1,2,3';
219 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
220 $contextpage =
'supplierlist';
222 if ($search_type ==
'') {
229$hookmanager->initHooks(array($contextpage,
'thirdpartylist'));
232$extrafields->fetch_name_optionals_label(
$object->table_element);
234$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
237$fieldstosearchall = array(
238 's.nom' =>
"ThirdPartyName",
239 's.name_alias' =>
"AliasNameShort",
240 's.code_client' =>
"CustomerCode",
241 's.code_fournisseur' =>
"SupplierCode",
242 's.code_compta' =>
"CustomerAccountancyCodeShort",
243 's.code_compta_fournisseur' =>
"SupplierAccountancyCodeShort",
246 's.email' =>
"EMail",
248 's.tva_intra' =>
"VATIntra",
249 's.siren' =>
"ProfId1",
250 's.siret' =>
"ProfId2",
251 's.ape' =>
"ProfId3",
252 's.phone' =>
"Phone",
253 's.phone_mobile' =>
"PhoneMobile",
256if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
257 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
259if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
260 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
262if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
263 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
266 $fieldstosearchall[
's.barcode'] =
'Gencod';
273$parameters = array(
'fieldstosearchall'=>$fieldstosearchall);
274$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
276 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
277} elseif ($reshook == 0) {
278 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
282$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ?
'1' :
'0');
283$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
284$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ?
'1' :
'0');
285$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ?
'1' :
'0');
286$checkedtypetiers =
'1';
287$checkedprofid1 =
'0';
288$checkedprofid2 =
'0';
289$checkedprofid3 =
'0';
290$checkedprofid4 =
'0';
291$checkedprofid5 =
'0';
292$checkedprofid6 =
'0';
296$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
297$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ?
'1' :
'0');
299 's.rowid' => array(
'label' =>
"TechnicalID",
'position' => 1,
'checked' =>
'-1',
'enabled' =>
'1'),
300 's.nom' => array(
'label' =>
"ThirdPartyName",
'position' => 2,
'checked' =>
'1'),
301 's.name_alias' => array(
'label' =>
"AliasNameShort",
'position' => 3,
'checked' =>
'1'),
302 's.ref_ext' => array(
'label' =>
"RefExt",
'position' => 4,
'checked' =>
'-1',
'enabled' => (
string)
getDolGlobalInt(
'MAIN_LIST_SHOW_REF_EXT')),
303 's.barcode' => array(
'label' =>
"Gencod",
'position' => 5,
'checked' =>
'1',
'enabled' => (
string) (
int)
isModEnabled(
'barcode')),
304 's.code_client' => array(
'label' =>
"CustomerCodeShort",
'position' => 10,
'checked' => $checkedcustomercode),
305 's.code_fournisseur' => array(
'label' =>
"SupplierCodeShort",
'position' => 11,
'checked' => $checkedsuppliercode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
306 's.code_compta' => array(
'label' =>
"CustomerAccountancyCodeShort",
'position' => 13,
'checked' => $checkedcustomeraccountcode),
307 's.code_compta_fournisseur' => array(
'label' =>
"SupplierAccountancyCodeShort",
'position' => 14,
'checked' => $checkedsupplieraccountcode,
'enabled' => (
string) (
int) (
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
308 's.address' => array(
'label' =>
"Address",
'position' => 19,
'checked' =>
'0'),
309 's.zip' => array(
'label' =>
"Zip",
'position' => 20,
'checked' =>
'1'),
310 's.town' => array(
'label' =>
"Town",
'position' => 21,
'checked' =>
'0'),
311 'state.nom' => array(
'label' =>
"State",
'position' => 22,
'checked' =>
'0'),
312 'region.nom' => array(
'label' =>
"Region",
'position' => 23,
'checked' =>
'0'),
313 'country.code_iso' => array(
'label' =>
"Country",
'position' => 24,
'checked' =>
'0'),
314 's.email' => array(
'label' =>
"Email",
'position' => 25,
'checked' =>
'0'),
315 'su.noemail' => array(
'label' =>
"No_Email",
'position' => 26,
'checked' =>
'0'),
316 's.url' => array(
'label' =>
"Url",
'position' => 26,
'checked' =>
'0'),
317 's.phone' => array(
'label' =>
"Phone",
'position' => 27,
'checked' =>
'1'),
318 's.fax' => array(
'label' =>
"Fax",
'position' => 28,
'checked' =>
'0'),
319 'typent.code' => array(
'label' =>
"ThirdPartyType",
'position' => 29,
'checked' => $checkedtypetiers),
320 'staff.code' => array(
'label' =>
"Workforce",
'position' => 31,
'checked' =>
'0'),
321 'legalform.code' => array(
'label' =>
'JuridicalStatus',
'position' => 32,
'checked' =>
'0'),
322 's.phone_mobile' => array(
'label' =>
"PhoneMobile",
'position' => 35,
'checked' =>
'0'),
323 's.siren' => array(
'label' =>
"ProfId1Short",
'position' => 40,
'checked' => $checkedprofid1),
324 's.siret' => array(
'label' =>
"ProfId2Short",
'position' => 41,
'checked' => $checkedprofid2),
325 's.ape' => array(
'label' =>
"ProfId3Short",
'position' => 42,
'checked' => $checkedprofid3),
326 's.idprof4' => array(
'label' =>
"ProfId4Short",
'position' => 43,
'checked' => $checkedprofid4),
327 's.idprof5' => array(
'label' =>
"ProfId5Short",
'position' => 44,
'checked' => $checkedprofid5),
328 's.idprof6' => array(
'label' =>
"ProfId6Short",
'position' => 45,
'checked' => $checkedprofid6),
329 's.tva_intra' => array(
'label' =>
"VATIntraShort",
'position' => 50,
'checked' =>
'0'),
330 'customerorsupplier' => array(
'label' =>
'NatureOfThirdParty',
'position' => 61,
'checked' =>
'1'),
331 's.fk_prospectlevel' => array(
'label' =>
"ProspectLevel",
'position' => 62,
'checked' => $checkprospectlevel),
332 's.fk_stcomm' => array(
'label' =>
"StatusProsp",
'position' => 63,
'checked' => $checkstcomm),
333 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 64,
'checked' =>
'0'),
334 's.ip' => array(
'type' =>
'ip',
'label' =>
"IPAddress",
'checked' =>
'-2',
'position' => 500),
335 's.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
336 's.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 505),
337 's.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
338 's.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (
int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
339 's.status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
340 's.import_key' => array(
'label' =>
"ImportId",
'checked' =>
'0',
'position' => 1100),
343 $arrayfields[
's.price_level'] = array(
'label' =>
"PriceLevel",
'position' => 30,
'checked' =>
'0');
347$arrayfields[
'sales.representative'] = array(
'label' => $langs->trans(
"SalesRepresentatives"),
'checked' =>
'1',
'position' => 12);
350include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
352$parameters = array(
'arrayfields' => &$arrayfields);
353$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
363 $socid = $user->socid;
367$permissiontoadd = $user->hasRight(
'societe',
'lire');
374if (
GETPOST(
'cancel',
'alpha')) {
378if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
382$parameters = array(
'arrayfields' => &$arrayfields);
383$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
388if (empty($reshook)) {
389 if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
393 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".
$db->escape($place).
")' AND entity IN (".
getEntity(
'invoice').
")";
394 $result =
$db->query($sql);
395 $num_lines =
$db->num_rows($result);
396 if ($num_lines == 0) {
397 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
399 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
402 $invoice->module_source =
'takepos';
403 $invoice->pos_source = $_SESSION[
"takeposterminal"];
404 $placeid = $invoice->create($user);
405 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
409 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".
$db->escape($place).
")'";
410 $resql =
$db->query($sql); ?>
412 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
413 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
415 <?php
if (!$resql) { ?>
416 alert(
'Error failed to update customer on draft invoice.');
418 parent.$.colorbox.close();
426 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
429 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
433 $search_ref_ext =
'';
434 $search_categ_cus = 0;
435 $search_categ_sup = 0;
436 $searchCategoryCustomerOperator = 0;
437 $searchCategorySupplierOperator = 0;
438 $searchCategoryCustomerList = array();
439 $searchCategorySupplierList = array();
440 $search_sale = array();
441 $search_barcode =
"";
442 $search_customer_code =
'';
443 $search_supplier_code =
'';
444 $search_account_customer_code =
'';
445 $search_account_supplier_code =
'';
446 $search_address =
'';
451 $search_country =
'';
453 $search_noemail =
'';
455 $search_phone_mobile =
'';
458 $search_idprof1 =
'';
459 $search_idprof2 =
'';
460 $search_idprof3 =
'';
461 $search_idprof4 =
'';
462 $search_idprof5 =
'';
463 $search_idprof6 =
'';
466 $search_price_level =
'';
467 $search_type_thirdparty =
'';
469 $search_legalform =
'';
470 $search_date_creation_startmonth =
"";
471 $search_date_creation_startyear =
"";
472 $search_date_creation_startday =
"";
473 $search_date_creation_start =
"";
474 $search_date_creation_endmonth =
"";
475 $search_date_creation_endyear =
"";
476 $search_date_creation_endday =
"";
477 $search_date_creation_end =
"";
478 $search_date_modif_startmonth =
"";
479 $search_date_modif_startyear =
"";
480 $search_date_modif_startday =
"";
481 $search_date_modif_start =
"";
482 $search_date_modif_endmonth =
"";
483 $search_date_modif_endyear =
"";
484 $search_date_modif_endday =
"";
485 $search_date_modif_end =
"";
486 $search_note_public =
"";
487 $search_note_private =
"";
491 $search_parent_name =
'';
492 $search_import_key =
'';
496 $search_array_options = array();
500 $objectclass =
'Societe';
501 $objectlabel =
'ThirdParty';
502 $permissiontoread = $user->hasRight(
'societe',
'lire');
503 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
504 $permissiontoadd = $user->hasRight(
"societe",
"creer");
505 $uploaddir =
$conf->societe->dir_output;
508 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
510 if (!$error && $action ==
'setstcomm' && $permissiontoadd) {
523if ($search_status ==
'' && empty($search_all)) {
548$prospectstatic->client = 2;
549$prospectstatic->loadCacheOfProspStatus();
553$title = $langs->trans(
"ThirdParties");
554if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
555 $title = $langs->trans(
"Customers");
557if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
558 $title = $langs->trans(
"Prospects");
560if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
561 $title = $langs->trans(
"Suppliers");
563$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
568$sql =
"SELECT code, label, sortorder";
569$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
570$sql .=
" WHERE active > 0";
571$sql .=
" ORDER BY sortorder";
572$resql =
$db->query($sql);
574 while ($obj =
$db->fetch_object($resql)) {
576 $level = $langs->trans($obj->code);
577 if ($level == $obj->code) {
578 $level = $langs->trans($obj->label);
580 $tab_level[$obj->code] = $level;
588$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,";
590$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,";
591$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,";
592$sql .=
" s.ip, s.tms as date_modification, s.datec as date_creation, s.import_key,";
593$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
594$sql .=
" s2.nom as name2,";
595$sql .=
" typent.code as typent_code,";
596$sql .=
" staff.code as staff_code,";
597$sql .=
" s.fk_forme_juridique as legalform_code,";
598$sql .=
" country.code as country_code, country.label as country_label,";
599$sql .=
" state.code_departement as state_code, state.nom as state_name,";
600$sql .=
" region.code_region as region_code, region.nom as region_name";
602if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
603 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
604 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
608$parameters = array();
609$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
610$sql .= $hookmanager->resPrint;
611$sql = preg_replace(
'/,\s*$/',
'', $sql);
616$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
617$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
618if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
619 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
624$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
626$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
627$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
628$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
630$parameters = array();
631$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
632$sql .= $hookmanager->resPrint;
633$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
634if (!$user->hasRight(
'fournisseur',
'lire')) {
635 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
639if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
640 $search_sale = array($user->id);
643if (!empty($search_sale) && $search_sale !=
'-1') {
644 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
645 $value = intval($value);
649 $search_sale_req = implode(
',', $search_sale_req);
651 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
652 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
653 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
654 $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).
"))";
655 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
656 $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).
"))";
657 $sql .=
" OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
662if (!empty($searchCategoryCustomerList)) {
663 $searchCategoryCustomerSqlList = array();
664 $listofcategoryid =
'';
665 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
666 if (intval($searchCategoryCustomer) == -2) {
667 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
668 } elseif (intval($searchCategoryCustomer) > 0) {
669 if ($searchCategoryCustomerOperator == 0) {
670 $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).
")";
672 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
676 if ($listofcategoryid) {
677 $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).
"))";
679 if ($searchCategoryCustomerOperator == 1) {
680 if (!empty($searchCategoryCustomerSqlList)) {
681 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
684 if (!empty($searchCategoryCustomerSqlList)) {
685 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
691if (!empty($searchCategorySupplierList)) {
692 $searchCategorySupplierSqlList = array();
693 $listofcategoryid =
'';
694 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
695 if (intval($searchCategorySupplier) == -2) {
696 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
697 } elseif (intval($searchCategorySupplier) > 0) {
698 if ($searchCategorySupplierOperator == 0) {
699 $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).
")";
701 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
705 if ($listofcategoryid) {
706 $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).
"))";
708 if ($searchCategorySupplierOperator == 1) {
709 if (!empty($searchCategorySupplierSqlList)) {
710 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
713 if (!empty($searchCategorySupplierSqlList)) {
714 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
719 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
721if (strlen($search_cti)) {
727if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
728 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
738if ($search_nom_only) {
741if ($search_ref_ext) {
744if ($search_customer_code) {
747if ($search_supplier_code) {
748 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
750if ($search_account_customer_code) {
751 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
753if ($search_account_supplier_code) {
754 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
756if ($search_address) {
759if (strlen($search_zip)) {
771if ($search_country && $search_country !=
'-1') {
772 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
777if ($search_noemail) {
778 $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').
"))";
780if (strlen($search_phone)) {
783if (strlen($search_phone_mobile)) {
786if (strlen($search_fax)) {
792if (strlen($search_idprof1)) {
795if (strlen($search_idprof2)) {
798if (strlen($search_idprof3)) {
801if (strlen($search_idprof4)) {
804if (strlen($search_idprof5)) {
807if (strlen($search_idprof6)) {
810if (strlen($search_vat)) {
814$reshook = $hookmanager->executeHooks(
'filterType', array(
'search_type' => $search_type), $sql);
815if (empty($reshook)) {
816 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
817 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
820if ($search_type > 0 && in_array($search_type, array(
'4'))) {
821 $sql .=
" AND s.fournisseur = 1";
823if ($search_type ==
'0') {
824 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
826if ($search_status !=
'' && $search_status >= 0) {
832if ($search_price_level && $search_price_level !=
'-1') {
835if ($search_type_thirdparty && $search_type_thirdparty > 0) {
836 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
838if (!empty($search_staff) && $search_staff !=
'-1') {
841if (!empty($search_legalform) && $search_legalform !=
'-1') {
842 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
844if ($search_parent_name) {
848 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
851 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
853if ($search_import_key) {
856if ($search_note_public !=
'') {
859if ($search_note_private !=
'') {
862if ($search_date_creation_start) {
863 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
865if ($search_date_creation_end) {
866 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
869if ($search_date_modif_start) {
870 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
872if ($search_date_modif_end) {
873 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
876 $sql .=
" AND s.rowid = ".((int) $socid);
880include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
882$parameters = array(
'socid' => $socid,
'sql' => $sql);
883$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
884if (empty($reshook)) {
885 $sql .= $hookmanager->resPrint;
887 $sql = $hookmanager->resPrint;
891$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
892$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
893if (empty($reshook)) {
894 $sql .= $hookmanager->resPrint;
896 $sql = $hookmanager->resPrint;
900$nbtotalofrecords =
'';
903 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
904 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
905 $resql =
$db->query($sqlforcount);
907 $objforcount =
$db->fetch_object($resql);
908 $nbtotalofrecords = $objforcount->nbtotalofrecords;
913 if (($page * $limit) > (
int) $nbtotalofrecords) {
921$sql .=
$db->order($sortfield, $sortorder);
923 $sql .=
$db->plimit($limit + 1, $offset);
925$resql =
$db->query($sql);
931$num =
$db->num_rows($resql);
935if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
936 $obj =
$db->fetch_object($resql);
938 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
939 if ($obj->client > 0) {
940 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
943 if ($obj->fournisseur > 0) {
944 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
949 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
957foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
958 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
960foreach ($searchCategorySupplierList as $searchCategorySupplier) {
961 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
964llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
967$arrayofselected = is_array($toselect) ? $toselect : array();
971 $param .=
'&mode='.urlencode($mode);
973if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
974 $param .=
'&contextpage='.urlencode($contextpage);
976if ($limit > 0 && $limit !=
$conf->liste_limit) {
977 $param .=
'&limit='.((int) $limit);
979if ($optioncss !=
'') {
980 $param .=
'&optioncss='.urlencode($optioncss);
982if ($search_all !=
'') {
983 $param =
"&search_all=".urlencode($search_all);
985if ($search_categ_cus > 0) {
986 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
988if ($search_categ_sup > 0) {
989 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
991if ($searchCategoryCustomerOperator == 1) {
992 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
994if ($searchCategorySupplierOperator == 1) {
995 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
997foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
998 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1000foreach ($searchCategorySupplierList as $searchCategorySupplier) {
1001 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
1003if (is_array($search_sale)) {
1004 foreach ($search_sale as $sale_id) {
1005 $param .=
'&search_sale[]=' . urlencode($sale_id);
1008if ($search_id > 0) {
1009 $param .=
"&search_id=".((int) $search_id);
1011if ($search_nom !=
'') {
1012 $param .=
"&search_nom=".urlencode($search_nom);
1014if ($search_alias !=
'') {
1015 $param .=
"&search_alias=".urlencode($search_alias);
1017if ($search_ref_ext !=
'') {
1018 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
1020if ($search_address !=
'') {
1021 $param .=
'&search_address='.urlencode($search_address);
1023if ($search_zip !=
'') {
1024 $param .=
"&search_zip=".urlencode($search_zip);
1026if ($search_town !=
'') {
1027 $param .=
"&search_town=".urlencode($search_town);
1029if ($search_phone !=
'') {
1030 $param .=
"&search_phone=".urlencode($search_phone);
1032if ($search_phone_mobile !=
'') {
1033 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
1035if ($search_fax !=
'') {
1036 $param .=
"&search_fax=".urlencode($search_fax);
1038if ($search_email !=
'') {
1039 $param .=
"&search_email=".urlencode($search_email);
1041if ($search_noemail !=
'') {
1042 $param .=
"&search_noemail=".urlencode($search_noemail);
1044if ($search_url !=
'') {
1045 $param .=
"&search_url=".urlencode($search_url);
1047if ($search_state !=
'') {
1048 $param .=
"&search_state=".urlencode($search_state);
1050if ($search_region !=
'') {
1051 $param .=
"&search_region=".urlencode($search_region);
1053if ($search_country !=
'') {
1054 $param .=
"&search_country=".urlencode($search_country);
1056if ($search_customer_code !=
'') {
1057 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1059if ($search_supplier_code !=
'') {
1060 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1062if ($search_account_customer_code !=
'') {
1063 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1065if ($search_account_supplier_code !=
'') {
1066 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1068if ($search_barcode !=
'') {
1069 $param .=
"&search_barcode=".urlencode($search_barcode);
1071if ($search_idprof1 !=
'') {
1072 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1074if ($search_idprof2 !=
'') {
1075 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1077if ($search_idprof3 !=
'') {
1078 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1080if ($search_idprof4 !=
'') {
1081 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1083if ($search_idprof5 !=
'') {
1084 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1086if ($search_idprof6 !=
'') {
1087 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1089if ($search_vat !=
'') {
1090 $param .=
'&search_vat='.urlencode($search_vat);
1092if ($search_price_level !=
'') {
1093 $param .=
'&search_price_level='.urlencode($search_price_level);
1095if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1096 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1098if ($search_type !=
'') {
1099 $param .=
'&search_type='.urlencode($search_type);
1101if ($search_status !=
'') {
1102 $param .=
'&search_status='.urlencode((
string) ($search_status));
1104if (is_array($search_level) && count($search_level)) {
1105 foreach ($search_level as $slevel) {
1106 $param .=
'&search_level[]='.urlencode($slevel);
1109if (is_array($search_stcomm) && count($search_stcomm)) {
1110 foreach ($search_stcomm as $slevel) {
1111 $param .=
'&search_stcomm[]='.urlencode($slevel);
1114if ($search_parent_name !=
'') {
1115 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1117if ($search_import_key !=
'') {
1118 $param .=
'&search_import_key='.urlencode($search_import_key);
1120if ($search_note_public !=
'') {
1121 $param .=
'&search_note_public='.urlencode($search_note_public);
1123if ($search_note_private !=
'') {
1124 $param .=
'&search_note_private='.urlencode($search_note_private);
1127 $param .=
'&type='.urlencode($type);
1129if ($search_date_creation_startmonth) {
1130 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1132if ($search_date_creation_startyear) {
1133 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1135if ($search_date_creation_startday) {
1136 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1138if ($search_date_creation_start) {
1139 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1141if ($search_date_creation_endmonth) {
1142 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1144if ($search_date_creation_endyear) {
1145 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1147if ($search_date_creation_endday) {
1148 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1150if ($search_date_creation_end) {
1151 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1153if ($search_date_modif_startmonth) {
1154 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1156if ($search_date_modif_startyear) {
1157 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1159if ($search_date_modif_startday) {
1160 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1162if ($search_date_modif_start) {
1163 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1165if ($search_date_modif_endmonth) {
1166 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1168if ($search_date_modif_endyear) {
1169 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1171if ($search_date_modif_endday) {
1172 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1174if ($search_date_modif_end) {
1175 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1179include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1181$parameters = array(
'param' => &$param);
1182$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1183$param .= $hookmanager->resPrint;
1191$arrayofmassactions = array(
1192 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1196if (
isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1197 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1199if ($user->hasRight(
"societe",
"creer")) {
1200 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1202if ($user->hasRight(
"societe",
"creer")) {
1203 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1205if ($user->hasRight(
"societe",
"creer")) {
1206 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1207 $arrayofmassactions[
'unsetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1210if ($user->hasRight(
'societe',
'supprimer')) {
1211 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1213if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1214 $arrayofmassactions = array();
1216$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1219$label =
'MenuNewThirdParty';
1222 $typefilter =
'&type='.$type;
1224 $label =
'MenuNewProspect';
1227 $label =
'MenuNewCustomer';
1230 $label =
'NewSupplier';
1239$parameters = array();
1240$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1241if (empty($reshook)) {
1244 if ($contextpage !=
'poslist') {
1245 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1246 if (!empty($socid)) {
1247 $url .=
'&socid='.$socid;
1249 $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'));
1250 $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'));
1251 $newcardbutton .= dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1252 } elseif ($user->hasRight(
'societe',
'creer')) {
1253 $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);
1254 $label =
'MenuNewCustomer';
1255 $newcardbutton = dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1258 $newcardbutton = $hookmanager->resPrint;
1261print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1262if ($optioncss !=
'') {
1263 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1265print
'<input type="hidden" name="token" value="'.newToken().
'">';
1266print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1267if (empty($massaction)) {
1268 print
'<input type="hidden" name="action" value="list">';
1270print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1271print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1273print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1274if (!empty($place)) {
1275 print
'<input type="hidden" name="place" value="'.$place.
'">';
1277print
'<input type="hidden" name="page_y" value="">';
1278print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1279if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1280 print
'<input type="hidden" name="type" value="'.$type.
'">';
1282if (!empty($place)) {
1283 print
'<input type="hidden" name="place" value="'.$place.
'">';
1286print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1288$langs->load(
"other");
1289$textprofid = array();
1290foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1291 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1292 $textprofid[$key] =
'';
1293 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1295 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1299 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key,
$mysoc->country_code, $label);
1304$topicmail =
"Information";
1305$modelmail =
"thirdparty";
1307$trackid =
'thi'.$object->id;
1308include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1322 foreach ($fieldstosearchall as $key => $val) {
1323 $fieldstosearchall[$key] = $langs->trans($val);
1324 $setupstring .= $key.
"=".$val.
";";
1326 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1327 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1333if (empty($type) || $type ==
'c' || $type ==
'p') {
1334 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1336 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1341if (empty($type) || $type ==
'f') {
1344 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1349$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1350$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1351if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1352 $moreforfilter .=
'<div class="divsearchfield">';
1353 $tmptitle = $langs->transnoentitiesnoconv(
'SalesRepresentatives');
1354 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1355 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->transnoentitiesnoconv(
'SalesRepresentatives'), 1);
1356 $moreforfilter .=
'</div>';
1358if (!empty($moreforfilter)) {
1359 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1360 print $moreforfilter;
1361 $parameters = array(
'type' => $type);
1362 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1363 print $hookmanager->resPrint;
1367$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1368$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1369$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1370$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1372print
'<div class="div-table-responsive">';
1373print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1377print
'<tr class="liste_titre_filter">';
1379if (
$conf->main_checkbox_left_column) {
1380 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1381 $searchpicto = $form->showFilterButtons(
'left');
1385if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1386 print
'<td class="liste_titre" data-key="id">';
1387 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1390if (!empty($arrayfields[
's.nom'][
'checked'])) {
1391 print
'<td class="liste_titre" data-key="ref">';
1392 if (!empty($search_nom_only) && empty($search_nom)) {
1393 $search_nom = $search_nom_only;
1395 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1398if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1399 print
'<td class="liste_titre">';
1400 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1403if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1404 print
'<td class="liste_titre">';
1405 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1409if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1410 print
'<td class="liste_titre">';
1411 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1415if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1416 print
'<td class="liste_titre">';
1417 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1421if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1422 print
'<td class="liste_titre">';
1423 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1427if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1428 print
'<td class="liste_titre">';
1429 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1433if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1434 print
'<td class="liste_titre">';
1435 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1439if (!empty($arrayfields[
's.address'][
'checked'])) {
1440 print
'<td class="liste_titre">';
1441 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1445if (!empty($arrayfields[
's.zip'][
'checked'])) {
1446 print
'<td class="liste_titre">';
1447 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1451if (!empty($arrayfields[
's.town'][
'checked'])) {
1452 print
'<td class="liste_titre">';
1453 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1457if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1458 print
'<td class="liste_titre">';
1459 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1463if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1464 print
'<td class="liste_titre">';
1465 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1469if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1470 print
'<td class="liste_titre center">';
1471 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1475if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1476 print
'<td class="liste_titre maxwidthonsmartphone center">';
1478 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'minwidth50 maxwidth125', 1);
1482if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1483 print
'<td class="liste_titre">';
1484 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1488if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1489 print
'<td class="liste_titre maxwidthonsmartphone center">';
1490 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1494if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1495 print
'<td class="liste_titre maxwidthonsmartphone center">';
1499if (!empty($arrayfields[
's.email'][
'checked'])) {
1501 print
'<td class="liste_titre">';
1502 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1505if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1507 print
'<td class="liste_titre center">';
1508 print
'<input class="flat searchemail maxwidth50imp" type="checkbox" name="search_noemail" '.($search_noemail ?
' checked="checked"' :
'').
'">';
1511if (!empty($arrayfields[
's.phone'][
'checked'])) {
1513 print
'<td class="liste_titre">';
1514 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1517if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1519 print
'<td class="liste_titre">';
1520 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1523if (!empty($arrayfields[
's.fax'][
'checked'])) {
1525 print
'<td class="liste_titre">';
1526 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1529if (!empty($arrayfields[
's.url'][
'checked'])) {
1531 print
'<td class="liste_titre">';
1532 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1535if (!empty($arrayfields[
's.siren'][
'checked'])) {
1537 print
'<td class="liste_titre">';
1538 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1541if (!empty($arrayfields[
's.siret'][
'checked'])) {
1543 print
'<td class="liste_titre">';
1544 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1547if (!empty($arrayfields[
's.ape'][
'checked'])) {
1549 print
'<td class="liste_titre">';
1550 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1553if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1555 print
'<td class="liste_titre">';
1556 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1559if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1561 print
'<td class="liste_titre">';
1562 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1565if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1567 print
'<td class="liste_titre">';
1568 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1571if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1573 print
'<td class="liste_titre">';
1574 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1579if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1580 print
'<td class="liste_titre maxwidthonsmartphone center">';
1582 print
'<input type="hidden" name="type" value="'.$type.
'">';
1584 $reshook = $hookmanager->executeHooks(
'selectProspectCustomerType', array(
'client_type' => $search_type));
1585 if (empty($reshook)) {
1586 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1591if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1592 print
'<td class="liste_titre">';
1596if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1597 print
'<td class="liste_titre center">';
1598 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1602if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1603 print
'<td class="liste_titre maxwidthonsmartphone center">';
1604 $arraystcomm = array();
1605 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1606 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1609 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1612if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1613 print
'<td class="liste_titre center">';
1614 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1618include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1621$parameters = array(
'arrayfields' => $arrayfields);
1622$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1623print $hookmanager->resPrint;
1625if (!empty($arrayfields[
's.ip'][
'checked'])) {
1626 print
'<td class="liste_titre center nowraponall">';
1630if (!empty($arrayfields[
's.datec'][
'checked'])) {
1631 print
'<td class="liste_titre center nowraponall">';
1632 print
'<div class="nowrapfordate">';
1633 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'));
1635 print
'<div class="nowrapfordate">';
1636 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'));
1641if (!empty($arrayfields[
's.tms'][
'checked'])) {
1642 print
'<td class="liste_titre center nowraponall">';
1643 print
'<div class="nowrapfordate">';
1644 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'));
1646 print
'<div class="nowrapfordate">';
1647 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'));
1652if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1653 print
'<td class="liste_titre">';
1654 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1658if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1659 print
'<td class="liste_titre">';
1660 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1664if (!empty($arrayfields[
's.status'][
'checked'])) {
1665 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1666 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);
1669if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1670 print
'<td class="liste_titre center">';
1671 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1675if (!
$conf->main_checkbox_left_column) {
1676 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1677 $searchpicto = $form->showFilterButtons();
1689print
'<tr class="liste_titre">';
1691if (
$conf->main_checkbox_left_column) {
1692 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1695if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1699if (!empty($arrayfields[
's.nom'][
'checked'])) {
1700 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1703if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1705 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1708if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1710 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1713if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1714 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode",
'', $param,
'', $sortfield, $sortorder);
1717if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1718 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1721if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1725if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1729if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1730 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1733if (!empty($arrayfields[
's.address'][
'checked'])) {
1734 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1737if (!empty($arrayfields[
's.zip'][
'checked'])) {
1738 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1741if (!empty($arrayfields[
's.town'][
'checked'])) {
1742 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1745if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1746 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1749if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1750 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1753if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1754 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1757if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1758 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1761if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1762 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1765if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1767 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1770if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1771 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1774if (!empty($arrayfields[
's.email'][
'checked'])) {
1775 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1778if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1779 print_liste_field_titre($arrayfields[
'su.noemail'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1782if (!empty($arrayfields[
's.phone'][
'checked'])) {
1783 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1786if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1787 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1790if (!empty($arrayfields[
's.fax'][
'checked'])) {
1791 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1794if (!empty($arrayfields[
's.url'][
'checked'])) {
1795 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1798if (!empty($arrayfields[
's.siren'][
'checked'])) {
1799 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1802if (!empty($arrayfields[
's.siret'][
'checked'])) {
1803 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1806if (!empty($arrayfields[
's.ape'][
'checked'])) {
1807 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1810if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1811 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1814if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1815 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1818if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1819 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1822if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1826if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1827 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1830if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1831 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1834if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1835 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1838if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1839 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1842if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1843 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1847include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1849$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1850$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1851print $hookmanager->resPrint;
1853if (!empty($arrayfields[
's.ip'][
'checked'])) {
1854 print_liste_field_titre($arrayfields[
's.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1858if (!empty($arrayfields[
's.datec'][
'checked'])) {
1859 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1862if (!empty($arrayfields[
's.tms'][
'checked'])) {
1863 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1866if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1867 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1870if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1871 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1874if (!empty($arrayfields[
's.status'][
'checked'])) {
1875 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1878if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1879 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1883if (!
$conf->main_checkbox_left_column) {
1884 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1896$imaxinloop = ($limit ? min($num, $limit) : $num);
1897while ($i < $imaxinloop) {
1898 $obj =
$db->fetch_object($resql);
1903 $parameters = array(
'staticdata' => $obj);
1906 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1907 if (empty($reshook)) {
1908 $companystatic->id = $obj->rowid;
1909 $companystatic->name = $obj->name;
1910 $companystatic->name_alias = $obj->name_alias;
1911 $companystatic->ref_ext = $obj->ref_ext;
1912 $companystatic->logo = $obj->logo;
1913 $companystatic->barcode = $obj->barcode;
1914 $companystatic->canvas = $obj->canvas;
1915 $companystatic->client = $obj->client;
1916 $companystatic->status = $obj->status;
1917 $companystatic->email = $obj->email;
1918 $companystatic->phone = $obj->phone;
1919 $companystatic->phone_mobile = $obj->phone_mobile;
1920 $companystatic->fax = $obj->fax;
1921 $companystatic->address = $obj->address;
1922 $companystatic->zip = $obj->zip;
1923 $companystatic->town = $obj->town;
1924 $companystatic->fournisseur = $obj->fournisseur;
1925 $companystatic->code_client = $obj->code_client;
1926 $companystatic->code_fournisseur = $obj->code_fournisseur;
1927 $companystatic->tva_intra = $obj->tva_intra;
1928 $companystatic->country_code = $obj->country_code;
1930 $companystatic->ip = $obj->ip;
1932 $companystatic->code_compta_client = $obj->code_compta;
1933 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1934 $companystatic->note_public = $obj->note_public;
1935 $companystatic->note_private = $obj->note_private;
1936 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1937 $companystatic->parent = $obj->fk_parent;
1938 $companystatic->entity = $obj->entity;
1943 if ($mode ==
'kanban') {
1945 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1946 print
'<div class="box-flex-container kanban">';
1949 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1950 if ($i == ($imaxinloop - 1)) {
1957 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven row-with-select"';
1958 if ($contextpage ==
'poslist') {
1959 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1963 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
1964 if ($conf->main_checkbox_left_column) {
1965 print '<td class="nowrap center actioncolumn
">';
1966 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
1968 if (in_array($obj->rowid, $arrayofselected)) {
1971 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1975 $totalarray['nbfield']++;
1978 if (!empty($arrayfields['s.rowid']['checked'])) {
1979 print '<td class="tdoverflowmax50
" data-key="id">';
1980 print dol_escape_htmltag($obj->rowid);
1983 $totalarray['nbfield']++;
1986 if (!empty($arrayfields['s.nom']['checked'])) {
1987 print '<td'.(getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? '' : ' class="tdoverflowmax200
"').' data-key="ref">';
1988 if ($contextpage == 'poslist') {
1989 print dol_escape_htmltag($companystatic->name);
1991 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1995 $totalarray['nbfield']++;
1998 if (!empty($arrayfields['s.name_alias']['checked'])) {
1999 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
2000 print dol_escape_htmltag($companystatic->name_alias);
2003 $totalarray['nbfield']++;
2007 if (!empty($arrayfields['s.ref_ext']['checked'])) {
2008 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->ref_ext).'">';
2009 print dol_escape_htmltag($companystatic->ref_ext);
2012 $totalarray['nbfield']++;
2016 if (!empty($arrayfields['s.barcode']['checked'])) {
2017 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
2019 $totalarray['nbfield']++;
2023 if (!empty($arrayfields['s.code_client']['checked'])) {
2024 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
2026 $totalarray['nbfield']++;
2030 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
2031 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
2033 $totalarray['nbfield']++;
2036 // Account customer code
2037 if (!empty($arrayfields['s.code_compta']['checked'])) {
2038 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
2040 $totalarray['nbfield']++;
2043 // Account supplier code
2044 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
2045 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
2047 $totalarray['nbfield']++;
2051 if (!empty($arrayfields['s.address']['checked'])) {
2052 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
2054 $totalarray['nbfield']++;
2058 if (!empty($arrayfields['s.zip']['checked'])) {
2059 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
2061 $totalarray['nbfield']++;
2065 if (!empty($arrayfields['s.town']['checked'])) {
2066 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
2068 $totalarray['nbfield']++;
2072 if (!empty($arrayfields['state.nom']['checked'])) {
2073 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
2075 $totalarray['nbfield']++;
2079 if (!empty($arrayfields['region.nom']['checked'])) {
2080 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
2082 $totalarray['nbfield']++;
2086 if (!empty($arrayfields['country.code_iso']['checked'])) {
2087 print '<td class="center tdoverflowmax100
">';
2088 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2089 print $labelcountry;
2092 $totalarray['nbfield']++;
2096 if (!empty($arrayfields['typent.code']['checked'])) {
2097 $typenArray = $formcompany->typent_array(1);
2098 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2100 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
2101 print dol_escape_htmltag($labeltypeofcompany);
2104 $totalarray['nbfield']++;
2108 if (!empty($arrayfields['s.price_level']['checked'])) {
2109 print '<td class="center
">'.$obj->price_level."</td>\n
";
2111 $totalarray['nbfield']++;
2115 if (!empty($arrayfields['staff.code']['checked'])) {
2116 print '<td class="center
">';
2117 if (!empty($obj->staff_code)) {
2118 if (empty($conf->cache['staffArray'])) {
2119 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2121 print $conf->cache['staffArray'][$obj->staff_code];
2125 $totalarray['nbfield']++;
2129 if (!empty($arrayfields['legalform.code']['checked'])) {
2131 if (!empty($obj->legalform_code)) {
2132 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2133 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2135 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2137 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2138 print dol_escape_htmltag($labeltoshow);
2141 $totalarray['nbfield']++;
2145 if (!empty($arrayfields['s.email']['checked'])) {
2146 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."</td>\n
";
2148 $totalarray['nbfield']++;
2151 // Unsubscribe to ML list
2152 if (!empty($arrayfields['su.noemail']['checked'])) {
2153 print '<td class="center
">'.yn($obj->noemail)."</td>\n
";
2155 $totalarray['nbfield']++;
2158 if (!empty($arrayfields['s.phone']['checked'])) {
2159 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2161 $totalarray['nbfield']++;
2164 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2165 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n
";
2167 $totalarray['nbfield']++;
2170 if (!empty($arrayfields['s.fax']['checked'])) {
2171 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2173 $totalarray['nbfield']++;
2176 if (!empty($arrayfields['s.url']['checked'])) {
2177 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2179 $totalarray['nbfield']++;
2182 if (!empty($arrayfields['s.siren']['checked'])) {
2183 print "<td>
".$obj->idprof1."</td>\n
";
2185 $totalarray['nbfield']++;
2188 if (!empty($arrayfields['s.siret']['checked'])) {
2189 print "<td>
".$obj->idprof2."</td>\n
";
2191 $totalarray['nbfield']++;
2194 if (!empty($arrayfields['s.ape']['checked'])) {
2195 print "<td>
".$obj->idprof3."</td>\n
";
2197 $totalarray['nbfield']++;
2200 if (!empty($arrayfields['s.idprof4']['checked'])) {
2201 print "<td>
".$obj->idprof4."</td>\n
";
2203 $totalarray['nbfield']++;
2206 if (!empty($arrayfields['s.idprof5']['checked'])) {
2207 print "<td>
".$obj->idprof5."</td>\n
";
2209 $totalarray['nbfield']++;
2212 if (!empty($arrayfields['s.idprof6']['checked'])) {
2213 print "<td>
".$obj->idprof6."</td>\n
";
2215 $totalarray['nbfield']++;
2219 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2220 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2221 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2222 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2224 print $companystatic->tva_intra;
2227 $totalarray['nbfield']++;
2231 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2232 print '<td class="center
">';
2233 $reshook = $hookmanager->executeHooks('getTypeUrl', array('client_type' => $obj->client));
2234 if (empty($reshook)) {
2235 print $companystatic->getTypeUrl(1);
2239 $totalarray['nbfield']++;
2242 // Sales Representative
2243 if (!empty($arrayfields['sales.representative']['checked'])) {
2244 print '<td class="nowraponall tdoverflowmax150
">';
2245 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2246 $nbofsalesrepresentative = count($listsalesrepresentatives);
2247 if ($nbofsalesrepresentative > 6) {
2248 // We print only number
2249 print $nbofsalesrepresentative;
2250 } elseif ($nbofsalesrepresentative > 0) {
2251 $userstatic = new User($db);
2253 foreach ($listsalesrepresentatives as $val) {
2254 $userstatic->id = $val['id'];
2255 $userstatic->lastname = $val['lastname'];
2256 $userstatic->firstname = $val['firstname'];
2257 $userstatic->email = $val['email'];
2258 $userstatic->entity = $val['entity'];
2259 $userstatic->photo = $val['photo'];
2260 $userstatic->login = $val['login'];
2261 $userstatic->office_phone = $val['office_phone'];
2262 $userstatic->office_fax = $val['office_fax'];
2263 $userstatic->user_mobile = $val['user_mobile'];
2264 $userstatic->job = $val['job'];
2265 $userstatic->gender = $val['gender'];
2266 $userstatic->statut = $val['statut'];
2267 $userstatic->status = $val['statut'];
2268 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2270 if ($j < $nbofsalesrepresentative) {
2279 $totalarray['nbfield']++;
2283 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2284 print '<td class="center nowraponall
">';
2285 print $companystatic->getLibProspLevel();
2288 $totalarray['nbfield']++;
2292 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2293 print '<td class="center nowraponall
">';
2295 $prospectid = $obj->rowid;
2296 $statusprospect = $obj->stcomm_id;
2298 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2302 $totalarray['nbfield']++;
2306 if (!empty($arrayfields['s2.nom']['checked'])) {
2307 print '<td class="center tdoverflowmax100
">';
2308 if ($companystatic->parent > 0) {
2309 $companyparent->fetch($companystatic->parent);
2310 print $companyparent->getNomUrl(1);
2314 $totalarray['nbfield']++;
2318 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2320 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2321 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2322 print $hookmanager->resPrint;
2324 if (!empty($arrayfields['s.ip']['checked'])) {
2325 print '<td class="center nowraponall
">';
2326 print dol_print_ip($obj->ip);
2329 $totalarray['nbfield']++;
2333 if (!empty($arrayfields['s.datec']['checked'])) {
2334 print '<td class="center nowraponall
">';
2335 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2338 $totalarray['nbfield']++;
2341 // Date modification
2342 if (!empty($arrayfields['s.tms']['checked'])) {
2343 print '<td class="center nowraponall
">';
2344 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2347 $totalarray['nbfield']++;
2351 if (!empty($arrayfields['s.note_public']['checked'])) {
2352 print '<td class="flat maxwidth250imp
">';
2353 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2356 $totalarray['nbfield']++;
2360 if (!empty($arrayfields['s.note_private']['checked'])) {
2361 print '<td class="flat maxwidth250imp
">';
2362 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2365 $totalarray['nbfield']++;
2369 if (!empty($arrayfields['s.status']['checked'])) {
2370 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2372 $totalarray['nbfield']++;
2376 if (!empty($arrayfields['s.import_key']['checked'])) {
2377 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2378 print dol_escape_htmltag($obj->import_key);
2381 $totalarray['nbfield']++;
2384 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
2385 if (!$conf->main_checkbox_left_column) {
2386 print '<td class="nowrap center actioncolumn
">';
2387 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
2389 if (in_array($obj->rowid, $arrayofselected)) {
2392 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2396 $totalarray['nbfield']++;
2406include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2408// If no record found
2411 foreach ($arrayfields as $key => $val) {
2412 if (!empty($val['checked'])) {
2416 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2421$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2422$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2423print $hookmanager->resPrint;
2425print '</table>'."\n
";
2428// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2429$formcompany->selectProspectStatus('status_prospect', $prospectstatic, 0, 0, "js
");
2431print '</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.
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.