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');
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');
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' =>
'0'),
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';
566$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
567$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
572$sql =
"SELECT code, label, sortorder";
573$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
574$sql .=
" WHERE active > 0";
575$sql .=
" ORDER BY sortorder";
576$resql =
$db->query($sql);
578 while ($obj =
$db->fetch_object($resql)) {
580 $level = $langs->trans($obj->code);
581 if ($level == $obj->code) {
582 $level = $langs->trans($obj->label);
584 $tab_level[$obj->code] = $level;
592$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,";
594$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,";
595$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,";
596$sql .=
" s.ip, s.tms as date_modification, s.datec as date_creation, s.import_key,";
597$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
598$sql .=
" s2.nom as name2,";
599$sql .=
" typent.code as typent_code,";
600$sql .=
" staff.code as staff_code,";
601$sql .=
" s.fk_forme_juridique as legalform_code,";
602$sql .=
" country.code as country_code, country.label as country_label,";
603$sql .=
" state.code_departement as state_code, state.nom as state_name,";
604$sql .=
" region.code_region as region_code, region.nom as region_name";
606if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
607 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
608 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
612$parameters = array();
613$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
614$sql .= $hookmanager->resPrint;
615$sql = preg_replace(
'/,\s*$/',
'', $sql);
620$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
621$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
622if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
623 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
626$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
627$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
628$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
630$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
631$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
632$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
634$parameters = array();
635$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
636$sql .= $hookmanager->resPrint;
637$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
638if (!$user->hasRight(
'fournisseur',
'lire')) {
639 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
643if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
644 $search_sale = array($user->id);
647if (!empty($search_sale) && $search_sale !=
'-1') {
648 $search_sale_req = array_filter($search_sale,
function (
string $value): bool {
649 $value = intval($value);
653 $search_sale_req = implode(
',', $search_sale_req);
655 if (count($search_sale) == 1 && in_array(
'-2', $search_sale)) {
656 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
657 } elseif (count($search_sale) > 0 && !in_array(
'-2', $search_sale)) {
658 $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).
"))";
659 } elseif (count($search_sale) > 0 && in_array(
'-2', $search_sale)) {
660 $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).
"))";
661 $sql .=
" OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
666if (!empty($searchCategoryCustomerList)) {
667 $searchCategoryCustomerSqlList = array();
668 $listofcategoryid =
'';
669 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
670 if (intval($searchCategoryCustomer) == -2) {
671 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
672 } elseif (intval($searchCategoryCustomer) > 0) {
673 if ($searchCategoryCustomerOperator == 0) {
674 $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).
")";
676 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
680 if ($listofcategoryid) {
681 $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).
"))";
683 if ($searchCategoryCustomerOperator == 1) {
684 if (!empty($searchCategoryCustomerSqlList)) {
685 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
688 if (!empty($searchCategoryCustomerSqlList)) {
689 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
695if (!empty($searchCategorySupplierList)) {
696 $searchCategorySupplierSqlList = array();
697 $listofcategoryid =
'';
698 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
699 if (intval($searchCategorySupplier) == -2) {
700 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
701 } elseif (intval($searchCategorySupplier) > 0) {
702 if ($searchCategorySupplierOperator == 0) {
703 $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).
")";
705 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
709 if ($listofcategoryid) {
710 $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).
"))";
712 if ($searchCategorySupplierOperator == 1) {
713 if (!empty($searchCategorySupplierSqlList)) {
714 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
717 if (!empty($searchCategorySupplierSqlList)) {
718 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
723 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
725if (strlen($search_cti)) {
731if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
732 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
741if ($search_nom_only) {
744if ($search_ref_ext) {
747if ($search_customer_code) {
750if ($search_supplier_code) {
751 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
753if ($search_account_customer_code) {
754 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
756if ($search_account_supplier_code) {
757 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
759if ($search_address) {
762if (strlen($search_zip)) {
774if ($search_country && $search_country !=
'-1') {
775 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
780if ($search_noemail) {
781 $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').
"))";
783if (strlen($search_phone)) {
786if (strlen($search_phone_mobile)) {
789if (strlen($search_fax)) {
795if (strlen($search_idprof1)) {
798if (strlen($search_idprof2)) {
801if (strlen($search_idprof3)) {
804if (strlen($search_idprof4)) {
807if (strlen($search_idprof5)) {
810if (strlen($search_idprof6)) {
813if (strlen($search_vat)) {
817$reshook = $hookmanager->executeHooks(
'filterType', array(
'search_type' => $search_type), $sql);
818if (empty($reshook)) {
819 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
820 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
823if ($search_type > 0 && in_array($search_type, array(
'4'))) {
824 $sql .=
" AND s.fournisseur = 1";
826if ($search_type ==
'0') {
827 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
829if ($search_status !=
'' && $search_status >= 0) {
835if ($search_price_level && $search_price_level !=
'-1') {
838if ($search_type_thirdparty && $search_type_thirdparty > 0) {
839 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
841if (!empty($search_staff) && $search_staff !=
'-1') {
844if (!empty($search_legalform) && $search_legalform !=
'-1') {
845 $sql .=
natural_search(
"s.fk_forme_juridique", $search_legalform, 2);
847if ($search_parent_name) {
851 $sql .=
natural_search(
"s.fk_prospectlevel", implode(
',', $search_level), 3);
854 $sql .=
natural_search(
"s.fk_stcomm", implode(
',', $search_stcomm), 2);
856if ($search_import_key) {
859if ($search_note_public !=
'') {
862if ($search_note_private !=
'') {
865if ($search_date_creation_start) {
866 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
868if ($search_date_creation_end) {
869 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
872if ($search_date_modif_start) {
873 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
875if ($search_date_modif_end) {
876 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
879 $sql .=
" AND s.rowid = ".((int) $socid);
883include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
885$parameters = array(
'socid' => $socid,
'sql' => $sql);
886$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
887if (empty($reshook)) {
888 $sql .= $hookmanager->resPrint;
890 $sql = $hookmanager->resPrint;
894$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
895$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
896if (empty($reshook)) {
897 $sql .= $hookmanager->resPrint;
899 $sql = $hookmanager->resPrint;
903$nbtotalofrecords =
'';
906 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
907 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
908 $resql =
$db->query($sqlforcount);
910 $objforcount =
$db->fetch_object($resql);
911 $nbtotalofrecords = $objforcount->nbtotalofrecords;
916 if (($page * $limit) > (
int) $nbtotalofrecords) {
924$sql .=
$db->order($sortfield, $sortorder);
926 $sql .=
$db->plimit($limit + 1, $offset);
928$resql =
$db->query($sql);
934$num =
$db->num_rows($resql);
938if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
939 $obj =
$db->fetch_object($resql);
941 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
942 if ($obj->client > 0) {
943 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.
$id);
946 if ($obj->fournisseur > 0) {
947 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.
$id);
952 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.
$id);
960foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
961 $paramsCat .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
963foreach ($searchCategorySupplierList as $searchCategorySupplier) {
964 $paramsCat .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
967llxHeader(
'', $title, $help_url,
'', 0, 0, array(), array(), $paramsCat,
'bodyforlist');
970$arrayofselected = is_array($toselect) ? $toselect : array();
974 $param .=
'&mode='.urlencode($mode);
976if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
977 $param .=
'&contextpage='.urlencode($contextpage);
979if ($limit > 0 && $limit !=
$conf->liste_limit) {
980 $param .=
'&limit='.((int) $limit);
982if ($optioncss !=
'') {
983 $param .=
'&optioncss='.urlencode($optioncss);
985if ($search_all !=
'') {
986 $param =
"&search_all=".urlencode($search_all);
988if ($search_categ_cus > 0) {
989 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
991if ($search_categ_sup > 0) {
992 $param .=
'&search_categ_sup='.urlencode((
string) ($search_categ_sup));
994if ($searchCategoryCustomerOperator == 1) {
995 $param .=
"&search_category_customer_operator=".urlencode((
string) ($searchCategoryCustomerOperator));
997if ($searchCategorySupplierOperator == 1) {
998 $param .=
"&search_category_supplier_operator=".urlencode((
string) ($searchCategorySupplierOperator));
1000foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1001 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
1003foreach ($searchCategorySupplierList as $searchCategorySupplier) {
1004 $param .=
"&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
1006if (is_array($search_sale)) {
1007 foreach ($search_sale as $sale_id) {
1008 $param .=
'&search_sale[]=' . urlencode($sale_id);
1011if ($search_id > 0) {
1012 $param .=
"&search_id=".((int) $search_id);
1014if ($search_nom !=
'') {
1015 $param .=
"&search_nom=".urlencode($search_nom);
1017if ($search_alias !=
'') {
1018 $param .=
"&search_alias=".urlencode($search_alias);
1020if ($search_ref_ext !=
'') {
1021 $param .=
"&search_ref_ext=".urlencode($search_ref_ext);
1023if ($search_address !=
'') {
1024 $param .=
'&search_address='.urlencode($search_address);
1026if ($search_zip !=
'') {
1027 $param .=
"&search_zip=".urlencode($search_zip);
1029if ($search_town !=
'') {
1030 $param .=
"&search_town=".urlencode($search_town);
1032if ($search_phone !=
'') {
1033 $param .=
"&search_phone=".urlencode($search_phone);
1035if ($search_phone_mobile !=
'') {
1036 $param .=
"&search_phone_mobile=".urlencode($search_phone_mobile);
1038if ($search_fax !=
'') {
1039 $param .=
"&search_fax=".urlencode($search_fax);
1041if ($search_email !=
'') {
1042 $param .=
"&search_email=".urlencode($search_email);
1044if ($search_noemail !=
'') {
1045 $param .=
"&search_noemail=".urlencode($search_noemail);
1047if ($search_url !=
'') {
1048 $param .=
"&search_url=".urlencode($search_url);
1050if ($search_state !=
'') {
1051 $param .=
"&search_state=".urlencode($search_state);
1053if ($search_region !=
'') {
1054 $param .=
"&search_region=".urlencode($search_region);
1056if ($search_country !=
'') {
1057 $param .=
"&search_country=".urlencode($search_country);
1059if ($search_customer_code !=
'') {
1060 $param .=
"&search_customer_code=".urlencode($search_customer_code);
1062if ($search_supplier_code !=
'') {
1063 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
1065if ($search_account_customer_code !=
'') {
1066 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
1068if ($search_account_supplier_code !=
'') {
1069 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
1071if ($search_barcode !=
'') {
1072 $param .=
"&search_barcode=".urlencode($search_barcode);
1074if ($search_idprof1 !=
'') {
1075 $param .=
'&search_idprof1='.urlencode($search_idprof1);
1077if ($search_idprof2 !=
'') {
1078 $param .=
'&search_idprof2='.urlencode($search_idprof2);
1080if ($search_idprof3 !=
'') {
1081 $param .=
'&search_idprof3='.urlencode($search_idprof3);
1083if ($search_idprof4 !=
'') {
1084 $param .=
'&search_idprof4='.urlencode($search_idprof4);
1086if ($search_idprof5 !=
'') {
1087 $param .=
'&search_idprof5='.urlencode($search_idprof5);
1089if ($search_idprof6 !=
'') {
1090 $param .=
'&search_idprof6='.urlencode($search_idprof6);
1092if ($search_vat !=
'') {
1093 $param .=
'&search_vat='.urlencode($search_vat);
1095if ($search_price_level !=
'') {
1096 $param .=
'&search_price_level='.urlencode($search_price_level);
1098if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1099 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1101if ($search_type !=
'') {
1102 $param .=
'&search_type='.urlencode($search_type);
1104if ($search_status !=
'') {
1105 $param .=
'&search_status='.urlencode((
string) ($search_status));
1107if (is_array($search_level) && count($search_level)) {
1108 foreach ($search_level as $slevel) {
1109 $param .=
'&search_level[]='.urlencode($slevel);
1112if (is_array($search_stcomm) && count($search_stcomm)) {
1113 foreach ($search_stcomm as $slevel) {
1114 $param .=
'&search_stcomm[]='.urlencode($slevel);
1117if ($search_parent_name !=
'') {
1118 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1120if ($search_import_key !=
'') {
1121 $param .=
'&search_import_key='.urlencode($search_import_key);
1123if ($search_note_public !=
'') {
1124 $param .=
'&search_note_public='.urlencode($search_note_public);
1126if ($search_note_private !=
'') {
1127 $param .=
'&search_note_private='.urlencode($search_note_private);
1130 $param .=
'&type='.urlencode($type);
1132if ($search_date_creation_startmonth) {
1133 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
1135if ($search_date_creation_startyear) {
1136 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
1138if ($search_date_creation_startday) {
1139 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
1141if ($search_date_creation_start) {
1142 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
1144if ($search_date_creation_endmonth) {
1145 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
1147if ($search_date_creation_endyear) {
1148 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
1150if ($search_date_creation_endday) {
1151 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
1153if ($search_date_creation_end) {
1154 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
1156if ($search_date_modif_startmonth) {
1157 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
1159if ($search_date_modif_startyear) {
1160 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
1162if ($search_date_modif_startday) {
1163 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
1165if ($search_date_modif_start) {
1166 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
1168if ($search_date_modif_endmonth) {
1169 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
1171if ($search_date_modif_endyear) {
1172 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
1174if ($search_date_modif_endday) {
1175 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
1177if ($search_date_modif_end) {
1178 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
1182include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1184$parameters = array(
'param' => &$param);
1185$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1186$param .= $hookmanager->resPrint;
1194$arrayofmassactions = array(
1195 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1199if (
isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1200 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1202if ($user->hasRight(
"societe",
"creer")) {
1203 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_INACTIVITY));
1205if ($user->hasRight(
"societe",
"creer")) {
1206 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus",
$object->LibStatut($object::STATUS_CEASED));
1208if ($user->hasRight(
"societe",
"creer")) {
1209 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1210 $arrayofmassactions[
'unsetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"UnallocateCommercial");
1213if ($user->hasRight(
'societe',
'supprimer')) {
1214 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1216if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1217 $arrayofmassactions = array();
1219$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1222$label =
'MenuNewThirdParty';
1225 $typefilter =
'&type='.$type;
1227 $label =
'MenuNewProspect';
1230 $label =
'MenuNewCustomer';
1233 $label =
'NewSupplier';
1242$parameters = array();
1243$reshook = $hookmanager->executeHooks(
'printNewCardButton', $parameters, $object);
1244if (empty($reshook)) {
1247 if ($contextpage !=
'poslist') {
1248 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1249 if (!empty($socid)) {
1250 $url .=
'&socid='.$socid;
1252 $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'));
1253 $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'));
1254 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1255 } elseif ($user->hasRight(
'societe',
'creer')) {
1256 $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);
1257 $label =
'MenuNewCustomer';
1258 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1261 $newcardbutton = $hookmanager->resPrint;
1264print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off" spellcheck="false">'.
"\n";
1265if ($optioncss !=
'') {
1266 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1268print
'<input type="hidden" name="token" value="'.newToken().
'">';
1269print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1270if (empty($massaction)) {
1271 print
'<input type="hidden" name="action" value="list">';
1273print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1274print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1276print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1277if (!empty($place)) {
1278 print
'<input type="hidden" name="place" value="'.$place.
'">';
1280print
'<input type="hidden" name="page_y" value="">';
1281print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1282if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1283 print
'<input type="hidden" name="type" value="'.$type.
'">';
1285if (!empty($place)) {
1286 print
'<input type="hidden" name="place" value="'.$place.
'">';
1289print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1291$langs->load(
"other");
1292$textprofid = array();
1293foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1294 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1295 $textprofid[$key] =
'';
1296 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1298 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1302 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key,
$mysoc->country_code, $label);
1307$topicmail =
"Information";
1308$modelmail =
"thirdparty";
1310$trackid =
'thi'.$object->id;
1311include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1325 foreach ($fieldstosearchall as $key => $val) {
1326 $fieldstosearchall[$key] = $langs->trans($val);
1327 $setupstring .= $key.
"=".$val.
";";
1329 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1330 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1336if (empty($type) || $type ==
'c' || $type ==
'p') {
1337 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1339 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities(
"CustomersProspectsCategoriesShort"));
1344if (empty($type) || $type ==
'f') {
1347 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList,
'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities(
"SuppliersCategoriesShort"));
1352$userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
1353$userlist[-2] = $langs->trans(
"NoSalesRepresentativeAffected");
1354if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1355 $moreforfilter .=
'<div class="divsearchfield">';
1356 $tmptitle = $langs->transnoentitiesnoconv(
'SalesRepresentatives');
1357 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1358 $moreforfilter .= $form->multiselectarray(
'search_sale', $userlist, $search_sale, 0, 0,
'', 0, 300,
'',
'', $langs->transnoentitiesnoconv(
'SalesRepresentatives'), 1);
1359 $moreforfilter .=
'</div>';
1361if (!empty($moreforfilter)) {
1362 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1363 print $moreforfilter;
1364 $parameters = array(
'type' => $type);
1365 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1366 print $hookmanager->resPrint;
1370$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1371$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1373print
'<div class="div-table-responsive">';
1374print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1378print
'<tr class="liste_titre_filter">';
1380if (
$conf->main_checkbox_left_column) {
1381 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1382 $searchpicto = $form->showFilterButtons(
'left');
1386if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1387 print
'<td class="liste_titre" data-key="id">';
1388 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1391if (!empty($arrayfields[
's.nom'][
'checked'])) {
1392 print
'<td class="liste_titre" data-key="ref">';
1393 if (!empty($search_nom_only) && empty($search_nom)) {
1394 $search_nom = $search_nom_only;
1396 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1399if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1404if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1405 print
'<td class="liste_titre">';
1406 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1410if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1411 print
'<td class="liste_titre">';
1412 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1416if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1417 print
'<td class="liste_titre">';
1418 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1422if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1423 print
'<td class="liste_titre">';
1424 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1428if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1429 print
'<td class="liste_titre">';
1430 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1434if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1435 print
'<td class="liste_titre">';
1436 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1440if (!empty($arrayfields[
's.address'][
'checked'])) {
1441 print
'<td class="liste_titre">';
1442 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1446if (!empty($arrayfields[
's.zip'][
'checked'])) {
1447 print
'<td class="liste_titre">';
1448 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1452if (!empty($arrayfields[
's.town'][
'checked'])) {
1453 print
'<td class="liste_titre">';
1454 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1458if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1459 print
'<td class="liste_titre">';
1460 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1464if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1465 print
'<td class="liste_titre">';
1466 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1470if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1471 print
'<td class="liste_titre center">';
1472 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1476if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1477 print
'<td class="liste_titre maxwidthonsmartphone center">';
1479 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);
1483if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1484 print
'<td class="liste_titre">';
1485 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1489if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1490 print
'<td class="liste_titre maxwidthonsmartphone center">';
1491 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1495if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1496 print
'<td class="liste_titre maxwidthonsmartphone center">';
1500if (!empty($arrayfields[
's.email'][
'checked'])) {
1502 print
'<td class="liste_titre">';
1503 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1506if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1508 print
'<td class="liste_titre center">';
1509 print
'<input class="flat searchemail maxwidth50imp" type="checkbox" name="search_noemail" '.($search_noemail ?
' checked="checked"' :
'').
'">';
1512if (!empty($arrayfields[
's.phone'][
'checked'])) {
1514 print
'<td class="liste_titre">';
1515 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1518if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1520 print
'<td class="liste_titre">';
1521 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1524if (!empty($arrayfields[
's.fax'][
'checked'])) {
1526 print
'<td class="liste_titre">';
1527 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1530if (!empty($arrayfields[
's.url'][
'checked'])) {
1532 print
'<td class="liste_titre">';
1533 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1536if (!empty($arrayfields[
's.siren'][
'checked'])) {
1538 print
'<td class="liste_titre">';
1539 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1542if (!empty($arrayfields[
's.siret'][
'checked'])) {
1544 print
'<td class="liste_titre">';
1545 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1548if (!empty($arrayfields[
's.ape'][
'checked'])) {
1550 print
'<td class="liste_titre">';
1551 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1554if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1556 print
'<td class="liste_titre">';
1557 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1560if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1562 print
'<td class="liste_titre">';
1563 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1566if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1568 print
'<td class="liste_titre">';
1569 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1572if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1574 print
'<td class="liste_titre">';
1575 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1580if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1581 print
'<td class="liste_titre maxwidthonsmartphone center">';
1583 print
'<input type="hidden" name="type" value="'.$type.
'">';
1585 $reshook = $hookmanager->executeHooks(
'selectProspectCustomerType', array(
'client_type' => $search_type));
1586 if (empty($reshook)) {
1587 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1592if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1593 print
'<td class="liste_titre">';
1597if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1598 print
'<td class="liste_titre center">';
1599 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1603if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1604 print
'<td class="liste_titre maxwidthonsmartphone center">';
1605 $arraystcomm = array();
1606 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1607 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1610 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1613if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1614 print
'<td class="liste_titre center">';
1615 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1619include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1622$parameters = array(
'arrayfields' => $arrayfields);
1623$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1624print $hookmanager->resPrint;
1626if (!empty($arrayfields[
's.ip'][
'checked'])) {
1627 print
'<td class="liste_titre center nowraponall">';
1631if (!empty($arrayfields[
's.datec'][
'checked'])) {
1632 print
'<td class="liste_titre center nowraponall">';
1633 print
'<div class="nowrapfordate">';
1634 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'));
1636 print
'<div class="nowrapfordate">';
1637 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'));
1642if (!empty($arrayfields[
's.tms'][
'checked'])) {
1643 print
'<td class="liste_titre center nowraponall">';
1644 print
'<div class="nowrapfordate">';
1645 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'));
1647 print
'<div class="nowrapfordate">';
1648 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'));
1653if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1654 print
'<td class="liste_titre">';
1655 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
1659if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1660 print
'<td class="liste_titre">';
1661 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
1665if (!empty($arrayfields[
's.status'][
'checked'])) {
1666 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1667 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);
1670if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1671 print
'<td class="liste_titre center">';
1672 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1676if (!
$conf->main_checkbox_left_column) {
1677 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1678 $searchpicto = $form->showFilterButtons();
1690print
'<tr class="liste_titre">';
1692if (
$conf->main_checkbox_left_column) {
1693 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1696if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1697 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1700if (!empty($arrayfields[
's.nom'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1704if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1706 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1709if (!empty($arrayfields[
's.ref_ext'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
's.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ref_ext",
"", $param,
"", $sortfield, $sortorder);
1714if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode",
'', $param,
'', $sortfield, $sortorder);
1718if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1722if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1723 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1726if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1727 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1730if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1734if (!empty($arrayfields[
's.address'][
'checked'])) {
1735 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1738if (!empty($arrayfields[
's.zip'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1742if (!empty($arrayfields[
's.town'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1746if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1747 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1750if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1751 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1754if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1758if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1759 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1762if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1763 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1766if (!empty($arrayfields[
'legalform.code'][
'checked'])) {
1768 print_liste_field_titre($arrayfields[
'legalform.code'][
'label'], $_SERVER[
"PHP_SELF"],
"legalform_code",
"", $param,
'', $sortfield, $sortorder);
1771if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1772 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1775if (!empty($arrayfields[
's.email'][
'checked'])) {
1776 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1779if (!empty($arrayfields[
'su.noemail'][
'checked'])) {
1780 print_liste_field_titre($arrayfields[
'su.noemail'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1783if (!empty($arrayfields[
's.phone'][
'checked'])) {
1784 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1787if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1788 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1791if (!empty($arrayfields[
's.fax'][
'checked'])) {
1792 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1795if (!empty($arrayfields[
's.url'][
'checked'])) {
1796 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1799if (!empty($arrayfields[
's.siren'][
'checked'])) {
1800 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1803if (!empty($arrayfields[
's.siret'][
'checked'])) {
1804 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1807if (!empty($arrayfields[
's.ape'][
'checked'])) {
1808 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1811if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1812 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1815if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1816 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1819if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1820 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1,
'info'), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1823if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1824 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1827if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1828 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1831if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1832 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1835if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1836 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1839if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1840 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1843if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1844 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1848include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1850$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1851$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1852print $hookmanager->resPrint;
1854if (!empty($arrayfields[
's.ip'][
'checked'])) {
1855 print_liste_field_titre($arrayfields[
's.ip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.ip",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1859if (!empty($arrayfields[
's.datec'][
'checked'])) {
1860 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1863if (!empty($arrayfields[
's.tms'][
'checked'])) {
1864 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1867if (!empty($arrayfields[
's.note_public'][
'checked'])) {
1868 print_liste_field_titre($arrayfields[
's.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1871if (!empty($arrayfields[
's.note_private'][
'checked'])) {
1872 print_liste_field_titre($arrayfields[
's.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"s.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1875if (!empty($arrayfields[
's.status'][
'checked'])) {
1876 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1879if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1880 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1884if (!
$conf->main_checkbox_left_column) {
1885 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1897$imaxinloop = ($limit ? min($num, $limit) : $num);
1898while ($i < $imaxinloop) {
1899 $obj =
$db->fetch_object($resql);
1904 $parameters = array(
'staticdata' => $obj);
1907 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1908 if (empty($reshook)) {
1909 $companystatic->id = $obj->rowid;
1910 $companystatic->name = $obj->name;
1911 $companystatic->name_alias = $obj->name_alias;
1912 $companystatic->ref_ext = $obj->ref_ext;
1913 $companystatic->logo = $obj->logo;
1914 $companystatic->barcode = $obj->barcode;
1915 $companystatic->canvas = $obj->canvas;
1916 $companystatic->client = $obj->client;
1917 $companystatic->status = $obj->status;
1918 $companystatic->email = $obj->email;
1919 $companystatic->phone = $obj->phone;
1920 $companystatic->phone_mobile = $obj->phone_mobile;
1921 $companystatic->fax = $obj->fax;
1922 $companystatic->address = $obj->address;
1923 $companystatic->zip = $obj->zip;
1924 $companystatic->town = $obj->town;
1925 $companystatic->fournisseur = $obj->fournisseur;
1926 $companystatic->code_client = $obj->code_client;
1927 $companystatic->code_fournisseur = $obj->code_fournisseur;
1928 $companystatic->tva_intra = $obj->tva_intra;
1929 $companystatic->country_code = $obj->country_code;
1931 $companystatic->ip = $obj->ip;
1933 $companystatic->code_compta_client = $obj->code_compta;
1934 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1935 $companystatic->note_public = $obj->note_public;
1936 $companystatic->note_private = $obj->note_private;
1937 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1938 $companystatic->parent = $obj->fk_parent;
1939 $companystatic->entity = $obj->entity;
1944 if ($mode ==
'kanban') {
1946 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1947 print
'<div class="box-flex-container kanban">';
1950 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1951 if ($i == ($imaxinloop - 1)) {
1958 print
'<tr data-rowid="'.$companystatic->id.
'" class="oddeven row-with-select"';
1959 if ($contextpage ==
'poslist') {
1960 print
' onclick="location.href=\'list.php?action=change&token='.newToken().
'&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1964 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
1965 if ($conf->main_checkbox_left_column) {
1966 print '<td class="nowrap center actioncolumn
">';
1967 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
1969 if (in_array($obj->rowid, $arrayofselected)) {
1972 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1976 $totalarray['nbfield']++;
1979 if (!empty($arrayfields['s.rowid']['checked'])) {
1980 print '<td class="tdoverflowmax50
" data-key="id">';
1981 print dol_escape_htmltag($obj->rowid);
1984 $totalarray['nbfield']++;
1987 if (!empty($arrayfields['s.nom']['checked'])) {
1988 print '<td class="tdoverflowmax200 tdlineheightsmall
" data-key="ref">';
1989 print '<div class="inline-block lineheightsmall
">';
1990 if ($contextpage == 'poslist') {
1991 print dolPrintHTML($companystatic->name);
1993 print $companystatic->getNomUrl(1, '', 100, 0, 1, 1);
1994 if (empty($arrayfields['s.name_alias']['checked'])) {
1995 print '<br><span class="spantitle
">'.dolPrintHTML($companystatic->name_alias).'</span>';
2001 $totalarray['nbfield']++;
2004 if (!empty($arrayfields['s.name_alias']['checked'])) {
2005 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->name_alias).'">';
2006 print '<span class="spantitle
">';
2007 print dolPrintHTML($companystatic->name_alias);
2011 $totalarray['nbfield']++;
2015 if (!empty($arrayfields['s.ref_ext']['checked'])) {
2016 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->ref_ext).'">';
2017 print dolPrintHTML($companystatic->ref_ext);
2020 $totalarray['nbfield']++;
2024 if (!empty($arrayfields['s.barcode']['checked'])) {
2025 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->barcode).'">'.dolPrintHTML($companystatic->barcode).'</td>';
2027 $totalarray['nbfield']++;
2031 if (!empty($arrayfields['s.code_client']['checked'])) {
2032 print '<td class="nowraponall
">'.dolPrintHTML($companystatic->code_client).'</td>';
2034 $totalarray['nbfield']++;
2038 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
2039 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
2041 $totalarray['nbfield']++;
2044 // Account customer code
2045 if (!empty($arrayfields['s.code_compta']['checked'])) {
2046 print '<td>'.dolPrintHTML($companystatic->code_compta_client).'</td>';
2048 $totalarray['nbfield']++;
2051 // Account supplier code
2052 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
2053 print '<td>'.dolPrintHTML($companystatic->code_compta_fournisseur).'</td>';
2055 $totalarray['nbfield']++;
2059 if (!empty($arrayfields['s.address']['checked'])) {
2060 print '<td class="tdoverflowmax250
" title="'.dolPrintHTMLForAttribute($companystatic->address).'">'.dolPrintHTML($companystatic->address).'</td>';
2062 $totalarray['nbfield']++;
2066 if (!empty($arrayfields['s.zip']['checked'])) {
2067 print "<td>
".dolPrintHTML($companystatic->zip)."</td>\n
";
2069 $totalarray['nbfield']++;
2073 if (!empty($arrayfields['s.town']['checked'])) {
2074 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($companystatic->town).'">'.dolPrintHTML($companystatic->town)."</td>\n
";
2076 $totalarray['nbfield']++;
2080 if (!empty($arrayfields['state.nom']['checked'])) {
2081 print "<td>
".dolPrintHTML($obj->state_name)."</td>\n
";
2083 $totalarray['nbfield']++;
2087 if (!empty($arrayfields['region.nom']['checked'])) {
2088 print "<td>
".dolPrintHTML($obj->region_name)."</td>\n
";
2090 $totalarray['nbfield']++;
2094 if (!empty($arrayfields['country.code_iso']['checked'])) {
2095 print '<td class="center tdoverflowmax100
">';
2096 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
2097 print $labelcountry;
2100 $totalarray['nbfield']++;
2104 if (!empty($arrayfields['typent.code']['checked'])) {
2105 $typenArray = $formcompany->typent_array(1);
2106 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2108 print '<td class="center tdoverflowmax125
" title="'.dolPrintHTMLForAttribute($labeltypeofcompany).'">';
2109 print dolPrintHTML($labeltypeofcompany);
2112 $totalarray['nbfield']++;
2116 if (!empty($arrayfields['s.price_level']['checked'])) {
2117 print '<td class="center
">'.$obj->price_level."</td>\n
";
2119 $totalarray['nbfield']++;
2123 if (!empty($arrayfields['staff.code']['checked'])) {
2124 print '<td class="center
">';
2125 if (!empty($obj->staff_code)) {
2126 if (empty($conf->cache['staffArray'])) {
2127 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2129 print $conf->cache['staffArray'][$obj->staff_code];
2133 $totalarray['nbfield']++;
2137 if (!empty($arrayfields['legalform.code']['checked'])) {
2139 if (!empty($obj->legalform_code)) {
2140 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2141 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2143 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2145 print '<td class="center tdoverflowmax100
" title="'.dol_escape_htmltag($labeltoshow).'">';
2146 print dol_escape_htmltag($labeltoshow);
2149 $totalarray['nbfield']++;
2153 if (!empty($arrayfields['s.email']['checked'])) {
2154 $showinvalidemail = (int) !getDolGlobalInt('MAIN_SHOW_INVALID_EMAIL_IN_LIST'); // to avoid slow display
2155 print '<td class="tdoverflowmax150
" title="'.dolPrintHTMLForAttribute($obj->email).'">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, $showinvalidemail, 1)."</td>\n
";
2157 $totalarray['nbfield']++;
2160 // Unsubscribe to ML list
2161 if (!empty($arrayfields['su.noemail']['checked'])) {
2162 print '<td class="center
">'.yn($obj->noemail)."</td>\n
";
2164 $totalarray['nbfield']++;
2167 if (!empty($arrayfields['s.phone']['checked'])) {
2168 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
2170 $totalarray['nbfield']++;
2173 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2174 print '<td class="nowraponall
">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n
";
2176 $totalarray['nbfield']++;
2179 if (!empty($arrayfields['s.fax']['checked'])) {
2180 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
2182 $totalarray['nbfield']++;
2185 if (!empty($arrayfields['s.url']['checked'])) {
2186 print "<td>
".dol_print_url($obj->url, '', 0, 1)."</td>\n
";
2188 $totalarray['nbfield']++;
2191 if (!empty($arrayfields['s.siren']['checked'])) {
2192 print "<td>
".$obj->idprof1."</td>\n
";
2194 $totalarray['nbfield']++;
2197 if (!empty($arrayfields['s.siret']['checked'])) {
2198 print "<td>
".$obj->idprof2."</td>\n
";
2200 $totalarray['nbfield']++;
2203 if (!empty($arrayfields['s.ape']['checked'])) {
2204 print "<td>
".$obj->idprof3."</td>\n
";
2206 $totalarray['nbfield']++;
2209 if (!empty($arrayfields['s.idprof4']['checked'])) {
2210 print "<td>
".$obj->idprof4."</td>\n
";
2212 $totalarray['nbfield']++;
2215 if (!empty($arrayfields['s.idprof5']['checked'])) {
2216 print "<td>
".$obj->idprof5."</td>\n
";
2218 $totalarray['nbfield']++;
2221 if (!empty($arrayfields['s.idprof6']['checked'])) {
2222 print "<td>
".$obj->idprof6."</td>\n
";
2224 $totalarray['nbfield']++;
2228 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2229 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2230 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2231 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
2233 print $companystatic->tva_intra;
2236 $totalarray['nbfield']++;
2240 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2241 print '<td class="center
">';
2242 $reshook = $hookmanager->executeHooks('getTypeUrl', array('client_type' => $obj->client));
2243 if (empty($reshook)) {
2244 print $companystatic->getTypeUrl(1);
2248 $totalarray['nbfield']++;
2251 // Sales Representative
2252 if (!empty($arrayfields['sales.representative']['checked'])) {
2253 print '<td class="nowraponall tdoverflowmax150
">';
2254 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2255 $nbofsalesrepresentative = count($listsalesrepresentatives);
2256 if ($nbofsalesrepresentative > 6) {
2257 // We print only number
2258 print $nbofsalesrepresentative;
2259 } elseif ($nbofsalesrepresentative > 0) {
2260 $userstatic = new User($db);
2262 foreach ($listsalesrepresentatives as $val) {
2263 $userstatic->id = $val['id'];
2264 $userstatic->lastname = $val['lastname'];
2265 $userstatic->firstname = $val['firstname'];
2266 $userstatic->email = $val['email'];
2267 $userstatic->entity = $val['entity'];
2268 $userstatic->photo = $val['photo'];
2269 $userstatic->login = $val['login'];
2270 $userstatic->office_phone = $val['office_phone'];
2271 $userstatic->office_fax = $val['office_fax'];
2272 $userstatic->user_mobile = $val['user_mobile'];
2273 $userstatic->job = $val['job'];
2274 $userstatic->gender = $val['gender'];
2275 $userstatic->statut = $val['statut'];
2276 $userstatic->status = $val['statut'];
2277 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2279 if ($j < $nbofsalesrepresentative) {
2288 $totalarray['nbfield']++;
2292 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2293 print '<td class="center nowraponall
">';
2294 print $companystatic->getLibProspLevel();
2297 $totalarray['nbfield']++;
2301 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2302 print '<td class="center nowraponall
">';
2304 $prospectid = $obj->rowid;
2305 $statusprospect = $obj->stcomm_id;
2307 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2311 $totalarray['nbfield']++;
2315 if (!empty($arrayfields['s2.nom']['checked'])) {
2316 print '<td class="center tdoverflowmax100
">';
2317 if ($companystatic->parent > 0) {
2318 $companyparent->fetch($companystatic->parent);
2319 print $companyparent->getNomUrl(1);
2323 $totalarray['nbfield']++;
2327 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2329 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2330 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2331 print $hookmanager->resPrint;
2333 if (!empty($arrayfields['s.ip']['checked'])) {
2334 print '<td class="center nowraponall
">';
2335 print dol_print_ip($obj->ip);
2338 $totalarray['nbfield']++;
2342 if (!empty($arrayfields['s.datec']['checked'])) {
2343 print '<td class="center nowraponall
">';
2344 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2347 $totalarray['nbfield']++;
2350 // Date modification
2351 if (!empty($arrayfields['s.tms']['checked'])) {
2352 print '<td class="center nowraponall
">';
2353 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2356 $totalarray['nbfield']++;
2360 if (!empty($arrayfields['s.note_public']['checked'])) {
2361 print '<td class="flat maxwidth250imp
">';
2362 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
2365 $totalarray['nbfield']++;
2369 if (!empty($arrayfields['s.note_private']['checked'])) {
2370 print '<td class="flat maxwidth250imp
">';
2371 print '<div class="small lineheightsmall twolinesmax-normallineheight
">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
2374 $totalarray['nbfield']++;
2378 if (!empty($arrayfields['s.status']['checked'])) {
2379 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2381 $totalarray['nbfield']++;
2385 if (!empty($arrayfields['s.import_key']['checked'])) {
2386 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->import_key).'">';
2387 print dol_escape_htmltag($obj->import_key);
2390 $totalarray['nbfield']++;
2393 // Action column (Show the massaction button only when this page is not opened from the Extended POS)
2394 if (!$conf->main_checkbox_left_column) {
2395 print '<td class="nowrap center actioncolumn
">';
2396 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
2398 if (in_array($obj->rowid, $arrayofselected)) {
2401 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2405 $totalarray['nbfield']++;
2415include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2417// If no record found
2420 foreach ($arrayfields as $key => $val) {
2421 if (!empty($val['checked'])) {
2425 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2430$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2431$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2432print $hookmanager->resPrint;
2434print '</table>'."\n
";
2437// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2438$formcompany->selectProspectStatus('status_prospect', $prospectstatic, 0, 0, "js
");
2440print '</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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.