39 require_once
'../main.inc.php';
40 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
49 $langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
53 $action =
GETPOST(
'action',
'aZ09');
54 $massaction =
GETPOST(
'massaction',
'alpha');
55 $show_files =
GETPOST(
'show_files',
'int');
56 $confirm =
GETPOST(
'confirm',
'alpha');
57 $toselect =
GETPOST(
'toselect',
'array');
58 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
59 $optioncss =
GETPOST(
'optioncss',
'alpha');
61 if ($contextpage ==
'poslist') {
65 $mode =
GETPOST(
"mode",
'alpha');
68 $search_all = trim(
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
69 $search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
71 $search_id = trim(
GETPOST(
"search_id",
"int"));
72 $search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
73 $search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
74 $search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
75 $search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
76 $search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
77 $search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
78 $search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
79 $search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
80 $search_address = trim(
GETPOST(
'search_address',
'alpha'));
81 $search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
82 $search_town = trim(
GETPOST(
"search_town",
'alpha'));
83 $search_state = trim(
GETPOST(
"search_state",
'alpha'));
84 $search_region = trim(
GETPOST(
"search_region",
'alpha'));
85 $search_email = trim(
GETPOST(
'search_email',
'alpha'));
86 $search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
87 $search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
88 $search_url = trim(
GETPOST(
'search_url',
'alpha'));
89 $search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
90 $search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
91 $search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
92 $search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
93 $search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
94 $search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
95 $search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
96 $search_sale =
GETPOST(
"search_sale",
'int');
97 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
98 $search_categ_sup =
GETPOST(
"search_categ_sup",
'int');
99 $search_country =
GETPOST(
"search_country",
'intcomma');
100 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
101 $search_price_level =
GETPOST(
'search_price_level',
'int');
102 $search_staff =
GETPOST(
"search_staff",
'int');
103 $search_status =
GETPOST(
"search_status",
'int');
104 $search_type =
GETPOST(
'search_type',
'alpha');
105 $search_level =
GETPOST(
"search_level",
"array");
106 $search_stcomm =
GETPOST(
'search_stcomm',
'int');
107 $search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
108 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
111 $type =
GETPOST(
'type',
'alpha');
112 $place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
114 $diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
117 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
118 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
119 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
125 $sortfield =
"s.nom";
127 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
130 $offset = $limit * $page;
131 $pageprev = $page - 1;
132 $pagenext = $page + 1;
135 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
136 $contextpage =
'customerlist';
137 }
if ($search_type ==
'') {
138 $search_type =
'1,3';
142 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
143 $contextpage =
'prospectlist';
144 }
if ($search_type ==
'') {
145 $search_type =
'2,3';
149 if (empty($contextpage) || $contextpage ==
'poslist') {
150 $contextpage =
'poslist';
151 }
if ($search_type ==
'') {
152 $search_type =
'1,2,3';
156 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
157 $contextpage =
'supplierlist';
158 }
if ($search_type ==
'') {
165 $hookmanager->initHooks(array(
'thirdpartylist'));
169 $extrafields->fetch_name_optionals_label($object->table_element);
171 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
174 $fieldstosearchall = array(
175 's.nom'=>
"ThirdPartyName",
176 's.name_alias'=>
"AliasNameShort",
177 's.code_client'=>
"CustomerCode",
178 's.code_fournisseur'=>
"SupplierCode",
179 's.code_compta'=>
"CustomerAccountancyCodeShort",
180 's.code_compta_fournisseur'=>
"SupplierAccountancyCodeShort",
185 's.tva_intra'=>
"VATIntra",
186 's.siren'=>
"ProfId1",
187 's.siret'=>
"ProfId2",
192 if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
193 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
195 if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
196 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
198 if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
199 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
202 $fieldstosearchall[
's.barcode'] =
'Gencod';
205 if (!empty($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS)) {
211 $checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ? 1 : 0);
212 $checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
213 $checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
214 $checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
215 $checkedtypetiers = 1;
225 $checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
226 $checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
227 $arrayfields = array(
228 's.rowid'=>array(
'label'=>
"TechnicalID",
'position'=>1,
'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)),
'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))),
229 's.nom'=>array(
'label'=>
"ThirdPartyName",
'position'=>2,
'checked'=>1),
230 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'position'=>3,
'checked'=>1),
231 's.barcode'=>array(
'label'=>
"Gencod",
'position'=>5,
'checked'=>1,
'enabled'=>(
isModEnabled(
'barcode'))),
232 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'position'=>10,
'checked'=>$checkedcustomercode),
233 's.code_fournisseur'=>array(
'label'=>
"SupplierCodeShort",
'position'=>11,
'checked'=>$checkedsuppliercode,
'enabled'=>((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
234 's.code_compta'=>array(
'label'=>
"CustomerAccountancyCodeShort",
'position'=>13,
'checked'=>$checkedcustomeraccountcode),
235 's.code_compta_fournisseur'=>array(
'label'=>
"SupplierAccountancyCodeShort",
'position'=>14,
'checked'=>$checkedsupplieraccountcode,
'enabled'=>((
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) ||
isModEnabled(
"supplier_order") ||
isModEnabled(
"supplier_invoice"))),
236 's.address'=>array(
'label'=>
"Address",
'position'=>19,
'checked'=>0),
237 's.zip'=>array(
'label'=>
"Zip",
'position'=>20,
'checked'=>1),
238 's.town'=>array(
'label'=>
"Town",
'position'=>21,
'checked'=>0),
239 'state.nom'=>array(
'label'=>
"State",
'position'=>22,
'checked'=>0),
240 'region.nom'=>array(
'label'=>
"Region",
'position'=>23,
'checked'=>0),
241 'country.code_iso'=>array(
'label'=>
"Country",
'position'=>24,
'checked'=>0),
242 's.email'=>array(
'label'=>
"Email",
'position'=>25,
'checked'=>0),
243 's.url'=>array(
'label'=>
"Url",
'position'=>26,
'checked'=>0),
244 's.phone'=>array(
'label'=>
"Phone",
'position'=>27,
'checked'=>1),
245 's.fax'=>array(
'label'=>
"Fax",
'position'=>28,
'checked'=>0),
246 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'position'=>29,
'checked'=>$checkedtypetiers),
247 'staff.code'=>array(
'label'=>
"Workforce",
'position'=>31,
'checked'=>0),
248 's.siren'=>array(
'label'=>
"ProfId1Short",
'position'=>40,
'checked'=>$checkedprofid1),
249 's.siret'=>array(
'label'=>
"ProfId2Short",
'position'=>41,
'checked'=>$checkedprofid2),
250 's.ape'=>array(
'label'=>
"ProfId3Short",
'position'=>42,
'checked'=>$checkedprofid3),
251 's.idprof4'=>array(
'label'=>
"ProfId4Short",
'position'=>43,
'checked'=>$checkedprofid4),
252 's.idprof5'=>array(
'label'=>
"ProfId5Short",
'position'=>44,
'checked'=>$checkedprofid5),
253 's.idprof6'=>array(
'label'=>
"ProfId6Short",
'position'=>45,
'checked'=>$checkedprofid6),
254 's.tva_intra'=>array(
'label'=>
"VATIntraShort",
'position'=>50,
'checked'=>0),
255 'customerorsupplier'=>array(
'label'=>
'NatureOfThirdParty',
'position'=>61,
'checked'=>1),
256 's.fk_prospectlevel'=>array(
'label'=>
"ProspectLevel",
'position'=>62,
'checked'=>$checkprospectlevel),
257 's.fk_stcomm'=>array(
'label'=>
"StatusProsp",
'position'=>63,
'checked'=>$checkstcomm),
258 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>64,
'checked'=>0),
259 's.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
260 's.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
261 's.status'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
262 's.import_key'=>array(
'label'=>
"ImportId",
'checked'=>0,
'position'=>1100),
264 if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
265 $arrayfields[
's.price_level'] = array(
'label'=>
"PriceLevel",
'position'=>30,
'checked'=>0);
269 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
275 $socid =
GETPOST(
'socid',
'int');
277 $socid = $user->socid;
287 if ($action ==
"change") {
288 $idcustomer =
GETPOST(
'idcustomer',
'int');
291 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
292 $result = $db->query($sql);
293 $num_lines = $db->num_rows($result);
294 if ($num_lines == 0) {
295 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
297 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
298 $invoice->socid = $conf->global->$constforthirdpartyid;
300 $invoice->module_source =
'takepos';
301 $invoice->pos_source = $_SESSION[
"takeposterminal"];
302 $placeid = $invoice->create($user);
303 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
307 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
308 $resql = $db->query($sql);
311 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
312 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
315 alert(
'Error failed to update customer on draft invoice.');
317 parent.$.colorbox.close();
324 if (
GETPOST(
'cancel',
'alpha')) {
328 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
332 $parameters = array();
333 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
338 if (empty($reshook)) {
340 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
343 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
347 $search_categ_cus = 0;
348 $search_categ_sup = 0;
350 $search_barcode =
"";
351 $search_customer_code =
'';
352 $search_supplier_code =
'';
353 $search_account_customer_code =
'';
354 $search_account_supplier_code =
'';
355 $search_address =
'';
360 $search_country =
'';
365 $search_idprof1 =
'';
366 $search_idprof2 =
'';
367 $search_idprof3 =
'';
368 $search_idprof4 =
'';
369 $search_idprof5 =
'';
370 $search_idprof6 =
'';
373 $search_price_level =
'';
374 $search_type_thirdparty =
'';
379 $search_parent_name =
'';
380 $search_import_key =
'';
382 $search_array_options = array();
386 $objectclass =
'Societe';
387 $objectlabel =
'ThirdParty';
388 $permissiontoread = $user->hasRight(
'societe',
'lire');
389 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
390 $permissiontoadd = $user->hasRight(
"societe",
"creer");
391 $uploaddir = $conf->societe->dir_output;
392 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
394 if ($action ==
'setstcomm') {
395 $object =
new Client($db);
396 $result = $object->fetch(
GETPOST(
'stcommsocid'));
398 $result = $object->update($object->id, $user);
407 if ($search_status ==
'') {
428 $companystatic =
new Societe($db);
429 $companyparent =
new Societe($db);
431 $prospectstatic =
new Client($db);
432 $prospectstatic->client = 2;
433 $prospectstatic->loadCacheOfProspStatus();
436 $title = $langs->trans(
"ThirdParties");
437 if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
438 $title = $langs->trans(
"Customers");
440 if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
441 $title = $langs->trans(
"Prospects");
443 if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
444 $title = $langs->trans(
"Suppliers");
447 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
448 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
451 $tab_level = array();
452 $sql =
"SELECT code, label, sortorder";
453 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
454 $sql .=
" WHERE active > 0";
455 $sql .=
" ORDER BY sortorder";
456 $resql = $db->query($sql);
458 while ($obj = $db->fetch_object(
$resql)) {
460 $level = $langs->trans($obj->code);
461 if ($level == $obj->code) {
462 $level = $langs->trans($obj->label);
464 $tab_level[$obj->code] = $level;
470 $sql =
"SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
471 $sql .=
" s.entity,";
472 $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,";
473 $sql .=
" s.email, s.phone, 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,";
474 $sql .=
" s.tms as date_update, s.datec as date_creation, s.import_key,";
475 $sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
476 $sql .=
" s2.nom as name2,";
477 $sql .=
" typent.code as typent_code,";
478 $sql .=
" staff.code as staff_code,";
479 $sql .=
" country.code as country_code, country.label as country_label,";
480 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
481 $sql .=
" region.code_region as region_code, region.nom as region_name";
483 if ($search_sale && $search_sale !=
'-1') {
484 $sql .=
", sc.fk_soc, sc.fk_user";
487 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
488 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
489 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
493 $parameters = array();
494 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
495 $sql .= $hookmanager->resPrint;
499 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
500 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
501 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
502 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
504 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
505 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
506 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
507 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
508 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
509 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
511 if ($search_sale == -2) {
512 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
514 } elseif (!empty($search_sale) && $search_sale !=
'-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
515 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
518 $parameters = array();
519 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
520 $sql .= $hookmanager->resPrint;
521 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
523 if (empty($user->rights->societe->client->voir) && !$socid) {
524 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
526 if ($search_sale && $search_sale !=
'-1' && $search_sale !=
'-2') {
527 $sql .=
" AND s.rowid = sc.fk_soc";
529 if (empty($user->rights->fournisseur->lire)) {
530 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
532 if ($search_sale == -2) {
533 $sql .=
" AND sc.fk_user IS NULL";
534 } elseif ($search_sale > 0) {
535 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
537 $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();;
538 $searchCategoryCustomerOperator = 0;
540 if (!empty($searchCategoryCustomerList)) {
541 $searchCategoryCustomerSqlList = array();
542 $listofcategoryid =
'';
543 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
544 if (intval($searchCategoryCustomer) == -2) {
545 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
546 } elseif (intval($searchCategoryCustomer) > 0) {
547 if ($searchCategoryCustomerOperator == 0) {
548 $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).
")";
550 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
554 if ($listofcategoryid) {
555 $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).
"))";
557 if ($searchCategoryCustomerOperator == 1) {
558 if (!empty($searchCategoryCustomerSqlList)) {
559 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
562 if (!empty($searchCategoryCustomerSqlList)) {
563 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
567 $searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
568 $searchCategorySupplierOperator = 0;
570 if (!empty($searchCategorySupplierList)) {
571 $searchCategorySupplierSqlList = array();
572 $listofcategoryid =
'';
573 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
574 if (intval($searchCategorySupplier) == -2) {
575 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
576 } elseif (intval($searchCategorySupplier) > 0) {
577 if ($searchCategorySupplierOperator == 0) {
578 $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).
")";
580 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
584 if ($listofcategoryid) {
585 $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).
"))";
587 if ($searchCategorySupplierOperator == 1) {
588 if (!empty($searchCategorySupplierSqlList)) {
589 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
592 if (!empty($searchCategorySupplierSqlList)) {
593 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
598 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
600 if (strlen($search_cti)) {
603 if ($search_id > 0) {
606 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
607 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
617 if ($search_nom_only) {
620 if ($search_customer_code) {
623 if ($search_supplier_code) {
624 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
626 if ($search_account_customer_code) {
627 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
629 if ($search_account_supplier_code) {
630 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
632 if ($search_address) {
635 if (strlen($search_zip)) {
644 if ($search_region) {
647 if ($search_country && $search_country !=
'-1') {
648 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
653 if (strlen($search_phone)) {
656 if (strlen($search_fax)) {
662 if (strlen($search_idprof1)) {
665 if (strlen($search_idprof2)) {
668 if (strlen($search_idprof3)) {
671 if (strlen($search_idprof4)) {
674 if (strlen($search_idprof5)) {
677 if (strlen($search_idprof6)) {
680 if (strlen($search_vat)) {
684 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
685 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
687 if ($search_type > 0 && in_array($search_type, array(
'4'))) {
688 $sql .=
" AND s.fournisseur = 1";
690 if ($search_type ==
'0') {
691 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
693 if ($search_status !=
'' && $search_status >= 0) {
699 if ($search_price_level && $search_price_level !=
'-1') {
702 if ($search_type_thirdparty && $search_type_thirdparty > 0) {
703 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
705 if (!empty($search_staff) && $search_staff !=
'-1') {
709 $sql .=
natural_search(
"s.fk_prospectlevel", join(
',', $search_level), 3);
711 if ($search_parent_name) {
714 if ($search_stcomm !=
'' && $search_stcomm !=
'-2') {
717 if ($search_import_key) {
721 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
723 $parameters = array(
'socid' => $socid);
724 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
725 if (empty($reshook)) {
727 $sql .=
" AND s.rowid = ".((int) $socid);
730 $sql .= $hookmanager->resPrint;
732 $parameters = array(
'fieldstosearchall' => $fieldstosearchall);
733 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
734 $sql .= $hookmanager->resPrint;
738 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
740 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
741 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
742 $resql = $db->query($sqlforcount);
744 $objforcount = $db->fetch_object(
$resql);
758 $sql .= $db->order($sortfield, $sortorder);
760 $sql .= $db->plimit($limit + 1, $offset);
763 $resql = $db->query($sql);
769 $num = $db->num_rows(
$resql);
772 $arrayofselected = is_array($toselect) ? $toselect : array();
775 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
776 $obj = $db->fetch_object(
$resql);
778 if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
779 if ($obj->client > 0) {
780 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.$id);
783 if ($obj->fournisseur > 0) {
784 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.$id);
789 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.$id);
793 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
797 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
798 $param .=
'&contextpage='.urlencode($contextpage);
800 if ($limit > 0 && $limit != $conf->liste_limit) {
801 $param .=
'&limit='.urlencode($limit);
803 if ($search_all !=
'') {
804 $param =
"&sall=".urlencode($search_all);
806 if ($search_categ_cus > 0) {
807 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
809 if ($search_categ_sup > 0) {
810 $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
812 if ($search_sale > 0) {
813 $param .=
'&search_sale='.urlencode($search_sale);
815 if ($search_id > 0) {
816 $param .=
"&search_id=".urlencode($search_id);
818 if ($search_nom !=
'') {
819 $param .=
"&search_nom=".urlencode($search_nom);
821 if ($search_alias !=
'') {
822 $param .=
"&search_alias=".urlencode($search_alias);
824 if ($search_address !=
'') {
825 $param .=
'&search_address='.urlencode($search_address);
827 if ($search_zip !=
'') {
828 $param .=
"&search_zip=".urlencode($search_zip);
830 if ($search_town !=
'') {
831 $param .=
"&search_town=".urlencode($search_town);
833 if ($search_phone !=
'') {
834 $param .=
"&search_phone=".urlencode($search_phone);
836 if ($search_fax !=
'') {
837 $param .=
"&search_fax=".urlencode($search_fax);
839 if ($search_email !=
'') {
840 $param .=
"&search_email=".urlencode($search_email);
842 if ($search_url !=
'') {
843 $param .=
"&search_url=".urlencode($search_url);
845 if ($search_state !=
'') {
846 $param .=
"&search_state=".urlencode($search_state);
848 if ($search_region !=
'') {
849 $param .=
"&search_region=".urlencode($search_region);
851 if ($search_country !=
'') {
852 $param .=
"&search_country=".urlencode($search_country);
854 if ($search_customer_code !=
'') {
855 $param .=
"&search_customer_code=".urlencode($search_customer_code);
857 if ($search_supplier_code !=
'') {
858 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
860 if ($search_account_customer_code !=
'') {
861 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
863 if ($search_account_supplier_code !=
'') {
864 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
866 if ($search_barcode !=
'') {
867 $param .=
"&search_barcode=".urlencode($search_barcode);
869 if ($search_idprof1 !=
'') {
870 $param .=
'&search_idprof1='.urlencode($search_idprof1);
872 if ($search_idprof2 !=
'') {
873 $param .=
'&search_idprof2='.urlencode($search_idprof2);
875 if ($search_idprof3 !=
'') {
876 $param .=
'&search_idprof3='.urlencode($search_idprof3);
878 if ($search_idprof4 !=
'') {
879 $param .=
'&search_idprof4='.urlencode($search_idprof4);
881 if ($search_idprof5 !=
'') {
882 $param .=
'&search_idprof5='.urlencode($search_idprof5);
884 if ($search_idprof6 !=
'') {
885 $param .=
'&search_idprof6='.urlencode($search_idprof6);
887 if ($search_vat !=
'') {
888 $param .=
'&search_vat='.urlencode($search_vat);
890 if ($search_price_level !=
'') {
891 $param .=
'&search_price_level='.urlencode($search_price_level);
893 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
894 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
896 if ($search_type !=
'') {
897 $param .=
'&search_type='.urlencode($search_type);
899 if (is_array($search_level) && count($search_level)) {
900 foreach ($search_level as $slevel) {
901 $param .=
'&search_level[]='.urlencode($slevel);
904 if ($search_status !=
'') {
905 $param .=
'&search_status='.urlencode($search_status);
907 if ($search_stcomm !=
'' && $search_stcomm !=
'-2') {
908 $param .=
'&search_stcomm='.urlencode($search_stcomm);
910 if ($search_parent_name !=
'') {
911 $param .=
'&search_parent_name='.urlencode($search_parent_name);
913 if ($search_import_key !=
'') {
914 $param .=
'&search_import_key='.urlencode($search_import_key);
917 $param .=
'&type='.urlencode($type);
919 if ($optioncss !=
'') {
920 $param .=
'&optioncss='.urlencode($optioncss);
923 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
931 $arrayofmassactions = array(
932 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
936 if (
isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
937 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
939 if ($user->hasRight(
"societe",
"creer")) {
940 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
942 if ($user->hasRight(
"societe",
"creer")) {
943 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_CEASED));
945 if ($user->hasRight(
"societe",
"creer")) {
946 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
948 if ($user->hasRight(
'societe',
'supprimer')) {
949 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
951 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
952 $arrayofmassactions = array();
954 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
957 $label =
'MenuNewThirdParty';
960 $typefilter =
'&type='.$type;
962 $label =
'MenuNewProspect';
965 $label =
'MenuNewCustomer';
968 $label =
'NewSupplier';
972 if ($contextpage ==
'poslist' && $type ==
't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
978 if ($contextpage !=
'poslist') {
979 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
980 if (!empty($socid)) {
981 $url .=
'&socid='.$socid;
983 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"societe",
"creer"));
984 } elseif ($user->hasRight(
"societe",
"creer")) {
985 $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);
986 $label =
'MenuNewCustomer';
987 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
990 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">';
991 if ($optioncss !=
'') {
992 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
994 print
'<input type="hidden" name="token" value="'.newToken().
'">';
995 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
996 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
997 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
999 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1000 if (!empty($place)) {
1001 print
'<input type="hidden" name="place" value="'.$place.
'">';
1004 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1006 $langs->load(
"other");
1007 $textprofid = array();
1008 foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1009 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1010 $textprofid[$key] =
'';
1011 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1012 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1015 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
1020 $topicmail =
"Information";
1021 $modelmail =
"thirdparty";
1022 $objecttmp =
new Societe($db);
1023 $trackid =
'thi'.$object->id;
1024 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1027 foreach ($fieldstosearchall as $key => $val) {
1028 $fieldstosearchall[$key] = $langs->trans($val);
1030 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
1034 $moreforfilter =
'';
1035 if (empty($type) || $type ==
'c' || $type ==
'p') {
1036 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1037 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1038 $moreforfilter .=
'<div class="divsearchfield">';
1039 $tmptitle = $langs->trans(
'Categories');
1040 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1041 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'CustomersProspectsCategoriesShort'));
1042 $moreforfilter .=
'</div>';
1046 if (empty($type) || $type ==
'f') {
1048 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1049 $moreforfilter .=
'<div class="divsearchfield">';
1050 $tmptitle = $langs->trans(
'Categories');
1051 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1052 $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $langs->trans(
'SuppliersCategoriesShort'));
1053 $moreforfilter .=
'</div>';
1058 if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1059 $moreforfilter .=
'<div class="divsearchfield">';
1060 $tmptitle = $langs->trans(
'SalesRepresentatives');
1061 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1062 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $langs->trans(
'SalesRepresentatives'), ($conf->dol_optimize_smallscreen ?
'maxwidth200' :
'maxwidth300'), 1);
1063 $moreforfilter .=
'</div>';
1065 if ($moreforfilter) {
1066 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1067 print $moreforfilter;
1068 $parameters = array(
'type'=>$type);
1069 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1070 print $hookmanager->resPrint;
1074 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1075 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1077 if ($massactionbutton && $contextpage !=
'poslist') {
1078 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
1081 if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1082 print
'<input type="hidden" name="type" value="'.$type.
'">';
1085 print
'<div class="div-table-responsive">';
1086 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1089 print
'<tr class="liste_titre_filter">';
1090 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1092 print
'<td class="liste_titre center actioncolumn">';
1093 $searchpicto =
$form->showFilterButtons(
'left');
1097 if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1098 print
'<td class="liste_titre" data-key="id">';
1099 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1102 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1103 print
'<td class="liste_titre" data-key="ref">';
1104 if (!empty($search_nom_only) && empty($search_nom)) {
1105 $search_nom = $search_nom_only;
1107 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1110 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1111 print
'<td class="liste_titre">';
1112 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1116 if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1117 print
'<td class="liste_titre">';
1118 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1122 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1123 print
'<td class="liste_titre">';
1124 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1128 if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1129 print
'<td class="liste_titre">';
1130 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1134 if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1135 print
'<td class="liste_titre">';
1136 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1140 if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1141 print
'<td class="liste_titre">';
1142 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1146 if (!empty($arrayfields[
's.address'][
'checked'])) {
1147 print
'<td class="liste_titre">';
1148 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1152 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1153 print
'<td class="liste_titre">';
1154 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1158 if (!empty($arrayfields[
's.town'][
'checked'])) {
1159 print
'<td class="liste_titre">';
1160 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1164 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1165 print
'<td class="liste_titre">';
1166 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1170 if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1171 print
'<td class="liste_titre">';
1172 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1176 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1177 print
'<td class="liste_titre center">';
1178 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1182 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1183 print
'<td class="liste_titre maxwidthonsmartphone center">';
1185 print
$form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'minwidth50 maxwidth125', 1);
1189 if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1190 print
'<td class="liste_titre">';
1191 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1195 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1196 print
'<td class="liste_titre maxwidthonsmartphone center">';
1197 print
$form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1200 if (!empty($arrayfields[
's.email'][
'checked'])) {
1202 print
'<td class="liste_titre">';
1203 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1206 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1208 print
'<td class="liste_titre">';
1209 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1212 if (!empty($arrayfields[
's.fax'][
'checked'])) {
1214 print
'<td class="liste_titre">';
1215 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1218 if (!empty($arrayfields[
's.url'][
'checked'])) {
1220 print
'<td class="liste_titre">';
1221 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1224 if (!empty($arrayfields[
's.siren'][
'checked'])) {
1226 print
'<td class="liste_titre">';
1227 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1230 if (!empty($arrayfields[
's.siret'][
'checked'])) {
1232 print
'<td class="liste_titre">';
1233 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1236 if (!empty($arrayfields[
's.ape'][
'checked'])) {
1238 print
'<td class="liste_titre">';
1239 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1242 if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1244 print
'<td class="liste_titre">';
1245 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1248 if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1250 print
'<td class="liste_titre">';
1251 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1254 if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1256 print
'<td class="liste_titre">';
1257 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1260 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1262 print
'<td class="liste_titre">';
1263 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1268 if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1269 print
'<td class="liste_titre maxwidthonsmartphone center">';
1271 print
'<input type="hidden" name="type" value="'.$type.
'">';
1273 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1277 if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1278 print
'<td class="liste_titre center">';
1279 print
$form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1283 if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1284 print
'<td class="liste_titre maxwidthonsmartphone center">';
1285 $arraystcomm = array();
1286 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1287 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1289 print
$form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1292 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1293 print
'<td class="liste_titre center">';
1294 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1298 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1301 $parameters = array(
'arrayfields'=>$arrayfields);
1302 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1303 print $hookmanager->resPrint;
1305 if (!empty($arrayfields[
's.datec'][
'checked'])) {
1306 print
'<td class="liste_titre">';
1310 if (!empty($arrayfields[
's.tms'][
'checked'])) {
1311 print
'<td class="liste_titre">';
1315 if (!empty($arrayfields[
's.status'][
'checked'])) {
1316 print
'<td class="liste_titre center minwidth75imp">';
1317 print
$form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status minwidth75imp maxwidth125 onrightofpage', 1);
1320 if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1321 print
'<td class="liste_titre center">';
1322 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1325 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1327 print
'<td class="liste_titre center actioncolumn">';
1328 $searchpicto =
$form->showFilterButtons();
1334 print
'<tr class="liste_titre">';
1335 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1336 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1338 if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1339 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'actioncolumn ');
1341 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1342 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
'actioncolumn ');
1344 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1345 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1347 if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1348 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode", $param,
'',
'', $sortfield, $sortorder);
1350 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1351 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1353 if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1354 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1356 if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1359 if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1360 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1362 if (!empty($arrayfields[
's.address'][
'checked'])) {
1363 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1365 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1366 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1368 if (!empty($arrayfields[
's.town'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1371 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1374 if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1375 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1377 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1378 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1380 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1383 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1386 if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1389 if (!empty($arrayfields[
's.email'][
'checked'])) {
1390 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1392 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1395 if (!empty($arrayfields[
's.fax'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1398 if (!empty($arrayfields[
's.url'][
'checked'])) {
1399 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1401 if (!empty($arrayfields[
's.siren'][
'checked'])) {
1402 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1404 if (!empty($arrayfields[
's.siret'][
'checked'])) {
1405 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1407 if (!empty($arrayfields[
's.ape'][
'checked'])) {
1408 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1410 if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1411 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1413 if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1414 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1416 if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1417 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1419 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1420 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1422 if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1425 if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1426 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1428 if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1431 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1432 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1435 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1437 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1438 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1439 print $hookmanager->resPrint;
1440 if (!empty($arrayfields[
's.datec'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1443 if (!empty($arrayfields[
's.tms'][
'checked'])) {
1444 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1446 if (!empty($arrayfields[
's.status'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1449 if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1452 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1453 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1459 $totalarray = array();
1460 $totalarray[
'nbfield'] = 0;
1461 while ($i < min($num, $limit)) {
1462 $obj = $db->fetch_object(
$resql);
1463 $parameters = array(
'staticdata' => $obj);
1466 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1467 if (empty($reshook)) {
1468 $companystatic->id = $obj->rowid;
1469 $companystatic->name = $obj->name;
1470 $companystatic->name_alias = $obj->name_alias;
1471 $companystatic->logo = $obj->logo;
1472 $companystatic->barcode = $obj->barcode;
1473 $companystatic->canvas = $obj->canvas;
1474 $companystatic->client = $obj->client;
1475 $companystatic->status = $obj->status;
1476 $companystatic->email = $obj->email;
1477 $companystatic->address = $obj->address;
1478 $companystatic->zip = $obj->zip;
1479 $companystatic->town = $obj->town;
1480 $companystatic->fournisseur = $obj->fournisseur;
1481 $companystatic->code_client = $obj->code_client;
1482 $companystatic->code_fournisseur = $obj->code_fournisseur;
1483 $companystatic->tva_intra = $obj->tva_intra;
1484 $companystatic->country_code = $obj->country_code;
1486 $companystatic->code_compta_client = $obj->code_compta;
1487 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1489 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1490 $companystatic->fk_parent = $obj->fk_parent;
1491 $companystatic->entity = $obj->entity;
1494 print
'<tr class="oddeven"';
1495 if ($contextpage ==
'poslist') {
1496 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1500 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1501 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1502 print '<td class="nowrap center actioncolumn
">';
1503 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
1505 if (in_array($obj->rowid, $arrayofselected)) {
1508 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1512 $totalarray['nbfield']++;
1515 if (!empty($arrayfields['s.rowid']['checked'])) {
1516 print '<td class="tdoverflowmax50
" data-key="id">';
1520 $totalarray['nbfield']++;
1523 if (!empty($arrayfields['s.nom']['checked'])) {
1524 print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200
"' : '').' data-key="ref">';
1525 if ($contextpage == 'poslist') {
1526 print dol_escape_htmltag($companystatic->name);
1528 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1532 $totalarray['nbfield']++;
1535 if (!empty($arrayfields['s.name_alias']['checked'])) {
1536 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1537 print dol_escape_htmltag($companystatic->name_alias);
1540 $totalarray['nbfield']++;
1544 if (!empty($arrayfields['s.barcode']['checked'])) {
1545 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
1547 $totalarray['nbfield']++;
1551 if (!empty($arrayfields['s.code_client']['checked'])) {
1552 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
1554 $totalarray['nbfield']++;
1558 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1559 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
1561 $totalarray['nbfield']++;
1564 // Account customer code
1565 if (!empty($arrayfields['s.code_compta']['checked'])) {
1566 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
1568 $totalarray['nbfield']++;
1571 // Account supplier code
1572 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1573 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
1575 $totalarray['nbfield']++;
1579 if (!empty($arrayfields['s.address']['checked'])) {
1580 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
1582 $totalarray['nbfield']++;
1586 if (!empty($arrayfields['s.zip']['checked'])) {
1587 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
1589 $totalarray['nbfield']++;
1593 if (!empty($arrayfields['s.town']['checked'])) {
1594 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
1596 $totalarray['nbfield']++;
1600 if (!empty($arrayfields['state.nom']['checked'])) {
1601 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
1603 $totalarray['nbfield']++;
1607 if (!empty($arrayfields['region.nom']['checked'])) {
1608 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
1610 $totalarray['nbfield']++;
1614 if (!empty($arrayfields['country.code_iso']['checked'])) {
1615 print '<td class="center tdoverflowmax100
">';
1616 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
1617 print $labelcountry;
1620 $totalarray['nbfield']++;
1624 if (!empty($arrayfields['typent.code']['checked'])) {
1625 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1626 $typenArray = $formcompany->typent_array(1);
1628 $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1630 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1631 print dol_escape_htmltag($labeltypeofcompany);
1634 $totalarray['nbfield']++;
1638 if (!empty($arrayfields['s.price_level']['checked'])) {
1639 print '<td class="center
">'.$obj->price_level."</td>\n
";
1641 $totalarray['nbfield']++;
1645 if (!empty($arrayfields['staff.code']['checked'])) {
1646 print '<td class="center
">';
1647 if (!empty($obj->staff_code)) {
1648 if (empty($conf->cache['staffArray'])) {
1649 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
1651 print $conf->cache['staffArray'][$obj->staff_code];
1655 $totalarray['nbfield']++;
1658 if (!empty($arrayfields['s.email']['checked'])) {
1659 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n
";
1661 $totalarray['nbfield']++;
1664 if (!empty($arrayfields['s.phone']['checked'])) {
1665 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
1667 $totalarray['nbfield']++;
1670 if (!empty($arrayfields['s.fax']['checked'])) {
1671 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
1673 $totalarray['nbfield']++;
1676 if (!empty($arrayfields['s.url']['checked'])) {
1677 print "<td>
".dol_print_url($obj->url, '', '', 1)."</td>\n
";
1679 $totalarray['nbfield']++;
1682 if (!empty($arrayfields['s.siren']['checked'])) {
1683 print "<td>
".$obj->idprof1."</td>\n
";
1685 $totalarray['nbfield']++;
1688 if (!empty($arrayfields['s.siret']['checked'])) {
1689 print "<td>
".$obj->idprof2."</td>\n
";
1691 $totalarray['nbfield']++;
1694 if (!empty($arrayfields['s.ape']['checked'])) {
1695 print "<td>
".$obj->idprof3."</td>\n
";
1697 $totalarray['nbfield']++;
1700 if (!empty($arrayfields['s.idprof4']['checked'])) {
1701 print "<td>
".$obj->idprof4."</td>\n
";
1703 $totalarray['nbfield']++;
1706 if (!empty($arrayfields['s.idprof5']['checked'])) {
1707 print "<td>
".$obj->idprof5."</td>\n
";
1709 $totalarray['nbfield']++;
1712 if (!empty($arrayfields['s.idprof6']['checked'])) {
1713 print "<td>
".$obj->idprof6."</td>\n
";
1715 $totalarray['nbfield']++;
1719 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1720 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
1721 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
1722 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
1724 print $companystatic->tva_intra;
1727 $totalarray['nbfield']++;
1731 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1732 print '<td class="center
">';
1733 print $companystatic->getTypeUrl(1);
1736 $totalarray['nbfield']++;
1740 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1742 print '<td class="center
">';
1743 print $companystatic->getLibProspLevel();
1746 $totalarray['nbfield']++;
1750 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1752 print '<td class="center nowrap
"><div class="nowraponall
">';
1753 print '<div class="inline-block
">';
1754 print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1755 print '</div> - <div class="inline-block
">';
1756 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1757 $titlealt = 'default';
1758 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1759 $titlealt = $val['label'];
1761 if ($obj->stcomm_id != $val['id']) {
1762 print '<a class="pictosubstatus reposition
" href="'.$_SERVER["PHP_SELF"].'?stcommsocid=
'.$obj->rowid.'&stcomm=
'.urlencode($val['code']).'&action=setstcomm&token=
'.newToken().$param.($page ? '&page=
'.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
1765 print '</div></div></td>';
1767 $totalarray['nbfield']++;
1771 if (!empty($arrayfields['s2.nom']['checked'])) {
1772 print '<td class="center tdoverflowmax100
">';
1773 if ($companystatic->fk_parent > 0) {
1774 $companyparent->fetch($companystatic->fk_parent);
1775 print $companyparent->getNomUrl(1);
1779 $totalarray['nbfield']++;
1783 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1785 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1786 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1787 print $hookmanager->resPrint;
1789 if (!empty($arrayfields['s.datec']['checked'])) {
1790 print '<td class="center nowraponall
">';
1791 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1794 $totalarray['nbfield']++;
1797 // Date modification
1798 if (!empty($arrayfields['s.tms']['checked'])) {
1799 print '<td class="center nowraponall
">';
1800 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1803 $totalarray['nbfield']++;
1807 if (!empty($arrayfields['s.status']['checked'])) {
1808 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
1810 $totalarray['nbfield']++;
1814 if (!empty($arrayfields['s.import_key']['checked'])) {
1815 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->import_key).'">';
1816 print dol_escape_htmltag($obj->import_key);
1819 $totalarray['nbfield']++;
1822 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1823 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1824 print '<td class="nowrap center actioncolumn
">';
1825 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
1827 if (in_array($obj->rowid, $arrayofselected)) {
1830 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1834 $totalarray['nbfield']++;
1842 // If no record found
1845 foreach ($arrayfields as $key => $val) {
1846 if (!empty($val['checked'])) {
1850 print '<tr><td colspan="'.$colspan.'" class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</td></tr>';
1855 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1856 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1857 print $hookmanager->resPrint;
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers or prospects.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
get_htmloutput_mesg($mesgstring='', $mesgarray='', $style='ok', $keepembedded=0)
Get formated messages to output (Used to show messages on html output).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
$nbtotalofrecords
Count total nb of records.
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.
print *****$script_file(".$version.") pid code
! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge,...