37 require_once
'../main.inc.php';
38 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
45 $langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
47 $action =
GETPOST(
'action',
'aZ09');
48 $massaction =
GETPOST(
'massaction',
'alpha');
49 $show_files =
GETPOST(
'show_files',
'int');
50 $confirm =
GETPOST(
'confirm',
'alpha');
51 $toselect =
GETPOST(
'toselect',
'array');
52 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
53 $optioncss =
GETPOST(
'optioncss',
'alpha');
54 if ($contextpage ==
'poslist') {
57 $mode =
GETPOST(
"mode",
'alpha');
59 $search_all = trim(
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
60 $search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
62 $search_id = trim(
GETPOST(
"search_id",
"int"));
63 $search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
64 $search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
65 $search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
66 $search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
67 $search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
68 $search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
69 $search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
70 $search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
71 $search_address = trim(
GETPOST(
'search_address',
'alpha'));
72 $search_town = trim(
GETPOST(
"search_town",
'alpha'));
73 $search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
74 $search_state = trim(
GETPOST(
"search_state",
'alpha'));
75 $search_region = trim(
GETPOST(
"search_region",
'alpha'));
76 $search_email = trim(
GETPOST(
'search_email',
'alpha'));
77 $search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
78 $search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
79 $search_url = trim(
GETPOST(
'search_url',
'alpha'));
80 $search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
81 $search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
82 $search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
83 $search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
84 $search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
85 $search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
86 $search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
87 $search_sale =
GETPOST(
"search_sale",
'int');
88 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
89 $search_categ_sup =
GETPOST(
"search_categ_sup",
'int');
90 $search_country =
GETPOST(
"search_country",
'intcomma');
91 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
92 $search_price_level =
GETPOST(
'search_price_level',
'int');
93 $search_staff =
GETPOST(
"search_staff",
'int');
94 $search_status =
GETPOST(
"search_status",
'int');
95 $search_type =
GETPOST(
'search_type',
'alpha');
96 $search_level =
GETPOST(
"search_level",
"array");
97 $search_stcomm =
GETPOST(
'search_stcomm',
'int');
98 $search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
99 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
101 $type =
GETPOST(
'type',
'alpha');
102 $place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
104 $diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
106 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
107 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
108 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
114 $sortfield =
"s.nom";
116 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
119 $offset = $limit * $page;
120 $pageprev = $page - 1;
121 $pagenext = $page + 1;
124 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
125 $contextpage =
'customerlist';
126 }
if ($search_type ==
'') {
127 $search_type =
'1,3';
131 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
132 $contextpage =
'prospectlist';
133 }
if ($search_type ==
'') {
134 $search_type =
'2,3';
138 if (empty($contextpage) || $contextpage ==
'poslist') {
139 $contextpage =
'poslist';
140 }
if ($search_type ==
'') {
141 $search_type =
'1,2,3';
145 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
146 $contextpage =
'supplierlist';
147 }
if ($search_type ==
'') {
154 $hookmanager->initHooks(array(
'thirdpartylist'));
158 $extrafields->fetch_name_optionals_label($object->table_element);
160 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
163 $fieldstosearchall = array(
164 's.nom'=>
"ThirdPartyName",
165 's.name_alias'=>
"AliasNameShort",
166 's.code_client'=>
"CustomerCode",
167 's.code_fournisseur'=>
"SupplierCode",
168 's.code_compta'=>
"CustomerAccountancyCodeShort",
169 's.code_compta_fournisseur'=>
"SupplierAccountancyCodeShort",
174 's.tva_intra'=>
"VATIntra",
175 's.siren'=>
"ProfId1",
176 's.siret'=>
"ProfId2",
181 if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
182 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
184 if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
185 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
187 if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
188 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
190 if (!empty($conf->barcode->enabled)) {
191 $fieldstosearchall[
's.barcode'] =
'Gencod';
194 if (!empty($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS)) {
200 $checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ? 1 : 0);
201 $checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
202 $checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
203 $checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
204 $checkedtypetiers = 1;
214 $checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
215 $checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
216 $arrayfields = array(
217 's.rowid'=>array(
'label'=>
"TechnicalID",
'position'=>1,
'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)),
'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))),
218 's.nom'=>array(
'label'=>
"ThirdPartyName",
'position'=>2,
'checked'=>1),
219 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'position'=>3,
'checked'=>1),
220 's.barcode'=>array(
'label'=>
"Gencod",
'position'=>5,
'checked'=>1,
'enabled'=>(!empty($conf->barcode->enabled))),
221 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'position'=>10,
'checked'=>$checkedcustomercode),
222 's.code_fournisseur'=>array(
'label'=>
"SupplierCodeShort",
'position'=>11,
'checked'=>$checkedsuppliercode,
'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
223 's.code_compta'=>array(
'label'=>
"CustomerAccountancyCodeShort",
'position'=>13,
'checked'=>$checkedcustomeraccountcode),
224 's.code_compta_fournisseur'=>array(
'label'=>
"SupplierAccountancyCodeShort",
'position'=>14,
'checked'=>$checkedsupplieraccountcode,
'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
225 's.address'=>array(
'label'=>
"Address",
'position'=>19,
'checked'=>0),
226 's.zip'=>array(
'label'=>
"Zip",
'position'=>20,
'checked'=>1),
227 's.town'=>array(
'label'=>
"Town",
'position'=>21,
'checked'=>0),
228 'state.nom'=>array(
'label'=>
"State",
'position'=>22,
'checked'=>0),
229 'region.nom'=>array(
'label'=>
"Region",
'position'=>23,
'checked'=>0),
230 'country.code_iso'=>array(
'label'=>
"Country",
'position'=>24,
'checked'=>0),
231 's.email'=>array(
'label'=>
"Email",
'position'=>25,
'checked'=>0),
232 's.url'=>array(
'label'=>
"Url",
'position'=>26,
'checked'=>0),
233 's.phone'=>array(
'label'=>
"Phone",
'position'=>27,
'checked'=>1),
234 's.fax'=>array(
'label'=>
"Fax",
'position'=>28,
'checked'=>0),
235 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'position'=>29,
'checked'=>$checkedtypetiers),
236 'staff.code'=>array(
'label'=>
"Staff",
'position'=>31,
'checked'=>0),
237 's.siren'=>array(
'label'=>
"ProfId1Short",
'position'=>40,
'checked'=>$checkedprofid1),
238 's.siret'=>array(
'label'=>
"ProfId2Short",
'position'=>41,
'checked'=>$checkedprofid2),
239 's.ape'=>array(
'label'=>
"ProfId3Short",
'position'=>42,
'checked'=>$checkedprofid3),
240 's.idprof4'=>array(
'label'=>
"ProfId4Short",
'position'=>43,
'checked'=>$checkedprofid4),
241 's.idprof5'=>array(
'label'=>
"ProfId5Short",
'position'=>44,
'checked'=>$checkedprofid5),
242 's.idprof6'=>array(
'label'=>
"ProfId6Short",
'position'=>45,
'checked'=>$checkedprofid6),
243 's.tva_intra'=>array(
'label'=>
"VATIntraShort",
'position'=>50,
'checked'=>0),
244 'customerorsupplier'=>array(
'label'=>
'NatureOfThirdParty',
'position'=>61,
'checked'=>1),
245 's.fk_prospectlevel'=>array(
'label'=>
"ProspectLevel",
'position'=>62,
'checked'=>$checkprospectlevel),
246 's.fk_stcomm'=>array(
'label'=>
"StatusProsp",
'position'=>63,
'checked'=>$checkstcomm),
247 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>64,
'checked'=>0),
248 's.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
249 's.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
250 's.status'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
251 's.import_key'=>array(
'label'=>
"ImportId",
'checked'=>0,
'position'=>1100),
253 if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
254 $arrayfields[
's.price_level'] = array(
'label'=>
"PriceLevel",
'position'=>30,
'checked'=>0);
258 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
264 $socid =
GETPOST(
'socid',
'int');
266 $socid = $user->socid;
276 if ($action ==
"change") {
277 $idcustomer =
GETPOST(
'idcustomer',
'int');
280 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
281 $result = $db->query($sql);
282 $num_lines = $db->num_rows($result);
283 if ($num_lines == 0) {
284 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
286 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
287 $invoice->socid = $conf->global->$constforthirdpartyid;
289 $invoice->module_source =
'takepos';
290 $invoice->pos_source = $_SESSION[
"takeposterminal"];
291 $placeid = $invoice->create($user);
292 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
296 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
297 $resql = $db->query($sql);
300 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
301 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
304 alert(
'Error failed to update customer on draft invoice.');
306 parent.$.colorbox.close();
313 if (
GETPOST(
'cancel',
'alpha')) {
314 $action =
'list'; $massaction =
'';
316 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
320 $parameters = array();
321 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
326 if (empty($reshook)) {
328 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
331 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
335 $search_categ_cus = 0;
336 $search_categ_sup = 0;
338 $search_barcode =
"";
339 $search_customer_code =
'';
340 $search_supplier_code =
'';
341 $search_account_customer_code =
'';
342 $search_account_supplier_code =
'';
343 $search_address =
'';
348 $search_country =
'';
353 $search_idprof1 =
'';
354 $search_idprof2 =
'';
355 $search_idprof3 =
'';
356 $search_idprof4 =
'';
357 $search_idprof5 =
'';
358 $search_idprof6 =
'';
361 $search_price_level =
'';
362 $search_type_thirdparty =
'';
367 $search_parent_name =
'';
368 $search_import_key =
'';
370 $search_array_options = array();
374 $objectclass =
'Societe';
375 $objectlabel =
'ThirdParty';
376 $permissiontoread = $user->rights->societe->lire;
377 $permissiontodelete = $user->rights->societe->supprimer;
378 $permissiontoadd = $user->rights->societe->creer;
379 $uploaddir = $conf->societe->dir_output;
380 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
382 if ($action ==
'setstcomm') {
383 $object =
new Client($db);
384 $result = $object->fetch(
GETPOST(
'stcommsocid'));
386 $result = $object->update($object->id, $user);
395 if ($search_status ==
'') {
416 $companystatic =
new Societe($db);
417 $companyparent =
new Societe($db);
419 $prospectstatic =
new Client($db);
420 $prospectstatic->client = 2;
421 $prospectstatic->loadCacheOfProspStatus();
424 $title = $langs->trans(
"ThirdParties");
425 if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
426 $title = $langs->trans(
"Customers");
428 if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
429 $title = $langs->trans(
"Prospects");
431 if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
432 $title = $langs->trans(
"Suppliers");
436 $tab_level = array();
437 $sql =
"SELECT code, label, sortorder";
438 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
439 $sql .=
" WHERE active > 0";
440 $sql .=
" ORDER BY sortorder";
441 $resql = $db->query($sql);
443 while ($obj = $db->fetch_object(
$resql)) {
445 $level = $langs->trans($obj->code);
446 if ($level == $obj->code) {
447 $level = $langs->trans($obj->label);
449 $tab_level[$obj->code] = $level;
455 $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,";
456 $sql .=
" s.entity,";
457 $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,";
458 $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,";
459 $sql .=
" s.tms as date_update, s.datec as date_creation, s.import_key,";
460 $sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
461 $sql .=
" s2.nom as name2,";
462 $sql .=
" typent.code as typent_code,";
463 $sql .=
" staff.code as staff_code,";
464 $sql .=
" country.code as country_code, country.label as country_label,";
465 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
466 $sql .=
" region.code_region as region_code, region.nom as region_name";
468 if ($search_sale && $search_sale !=
'-1') {
469 $sql .=
", sc.fk_soc, sc.fk_user";
472 if ($search_categ_cus && $search_categ_cus != -1) {
473 $sql .=
", cc.fk_categorie, cc.fk_soc";
475 if ($search_categ_sup && $search_categ_sup != -1) {
476 $sql .=
", cs.fk_categorie, cs.fk_soc";
479 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
480 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
481 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
485 $parameters = array();
486 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
487 $sql .= $hookmanager->resPrint;
488 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
489 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
490 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
491 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
493 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
494 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
495 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
496 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
497 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
499 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
500 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
502 if (!empty($search_categ_sup) && $search_categ_sup !=
'-1') {
503 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
505 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
507 if ($search_sale == -2) {
508 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
510 } elseif (!empty($search_sale) && $search_sale !=
'-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
511 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
514 $parameters = array();
515 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
516 $sql .= $hookmanager->resPrint;
517 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
519 if (empty($user->rights->societe->client->voir) && !$socid) {
520 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
522 if ($search_sale && $search_sale !=
'-1' && $search_sale !=
'-2') {
523 $sql .=
" AND s.rowid = sc.fk_soc";
525 if (empty($user->rights->fournisseur->lire)) {
526 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
528 if ($search_sale == -2) {
529 $sql .=
" AND sc.fk_user IS NULL";
530 } elseif ($search_sale > 0) {
531 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
533 if ($search_categ_cus > 0) {
534 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
536 if ($search_categ_sup > 0) {
537 $sql .=
" AND cs.fk_categorie = ".((int) $search_categ_sup);
539 if ($search_categ_cus == -2) {
540 $sql .=
" AND cc.fk_categorie IS NULL";
542 if ($search_categ_sup == -2) {
543 $sql .=
" AND cs.fk_categorie IS NULL";
547 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
549 if (strlen($search_cti)) {
553 if ($search_id > 0) {
562 if ($search_nom_only) {
565 if ($search_customer_code) {
568 if ($search_supplier_code) {
569 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
571 if ($search_account_customer_code) {
572 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
574 if ($search_account_supplier_code) {
575 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
577 if ($search_address) {
583 if (strlen($search_zip)) {
589 if ($search_region) {
592 if ($search_country && $search_country !=
'-1') {
593 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
598 if (strlen($search_phone)) {
601 if (strlen($search_fax)) {
607 if (strlen($search_idprof1)) {
610 if (strlen($search_idprof2)) {
613 if (strlen($search_idprof3)) {
616 if (strlen($search_idprof4)) {
619 if (strlen($search_idprof5)) {
622 if (strlen($search_idprof6)) {
625 if (strlen($search_vat)) {
629 if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
630 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
632 if ($search_type > 0 && in_array($search_type, array(
'4'))) {
633 $sql .=
" AND s.fournisseur = 1";
635 if ($search_type ==
'0') {
636 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
638 if ($search_status !=
'' && $search_status >= 0) {
641 if (!empty($conf->barcode->enabled) && $search_barcode) {
644 if ($search_price_level && $search_price_level !=
'-1') {
647 if ($search_type_thirdparty && $search_type_thirdparty > 0) {
648 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
650 if (!empty($search_staff) && $search_staff !=
'-1') {
654 $sql .=
natural_search(
"s.fk_prospectlevel", join(
',', $search_level), 3);
656 if ($search_parent_name) {
659 if ($search_stcomm !=
'' && $search_stcomm !=
'-2') {
662 if ($search_import_key) {
666 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
668 $parameters = array(
'socid' => $socid);
669 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
670 if (empty($reshook)) {
672 $sql .=
" AND s.rowid = ".((int) $socid);
675 $sql .= $hookmanager->resPrint;
677 $parameters = array(
'fieldstosearchall' => $fieldstosearchall);
678 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
679 $sql .= $hookmanager->resPrint;
682 $nbtotalofrecords =
'';
683 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
684 $resql = $db->query($sql);
686 $nbtotalofrecords = $db->num_rows(
$resql);
691 if (($page * $limit) > $nbtotalofrecords) {
699 $sql .= $db->order($sortfield, $sortorder);
701 $sql .= $db->plimit($limit + 1, $offset);
704 $resql = $db->query($sql);
710 $num = $db->num_rows(
$resql);
713 $arrayofselected = is_array($toselect) ? $toselect : array();
715 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
716 $obj = $db->fetch_object(
$resql);
718 if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
719 if ($obj->client > 0) {
720 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.$id);
723 if ($obj->fournisseur > 0) {
724 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.$id);
729 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.$id);
733 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
737 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
738 $param .=
'&contextpage='.urlencode($contextpage);
740 if ($limit > 0 && $limit != $conf->liste_limit) {
741 $param .=
'&limit='.urlencode($limit);
743 if ($search_all !=
'') {
744 $param =
"&sall=".urlencode($search_all);
746 if ($search_categ_cus > 0) {
747 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
749 if ($search_categ_sup > 0) {
750 $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
752 if ($search_sale > 0) {
753 $param .=
'&search_sale='.urlencode($search_sale);
755 if ($search_id > 0) {
756 $param .=
"&search_id=".urlencode($search_id);
758 if ($search_nom !=
'') {
759 $param .=
"&search_nom=".urlencode($search_nom);
761 if ($search_alias !=
'') {
762 $param .=
"&search_alias=".urlencode($search_alias);
764 if ($search_address !=
'') {
765 $param .=
'&search_address='.urlencode($search_address);
767 if ($search_town !=
'') {
768 $param .=
"&search_town=".urlencode($search_town);
770 if ($search_zip !=
'') {
771 $param .=
"&search_zip=".urlencode($search_zip);
773 if ($search_phone !=
'') {
774 $param .=
"&search_phone=".urlencode($search_phone);
776 if ($search_fax !=
'') {
777 $param .=
"&search_fax=".urlencode($search_fax);
779 if ($search_email !=
'') {
780 $param .=
"&search_email=".urlencode($search_email);
782 if ($search_url !=
'') {
783 $param .=
"&search_url=".urlencode($search_url);
785 if ($search_state !=
'') {
786 $param .=
"&search_state=".urlencode($search_state);
788 if ($search_region !=
'') {
789 $param .=
"&search_region=".urlencode($search_region);
791 if ($search_country !=
'') {
792 $param .=
"&search_country=".urlencode($search_country);
794 if ($search_customer_code !=
'') {
795 $param .=
"&search_customer_code=".urlencode($search_customer_code);
797 if ($search_supplier_code !=
'') {
798 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
800 if ($search_account_customer_code !=
'') {
801 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
803 if ($search_account_supplier_code !=
'') {
804 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
806 if ($search_barcode !=
'') {
807 $param .=
"&search_barcode=".urlencode($search_barcode);
809 if ($search_idprof1 !=
'') {
810 $param .=
'&search_idprof1='.urlencode($search_idprof1);
812 if ($search_idprof2 !=
'') {
813 $param .=
'&search_idprof2='.urlencode($search_idprof2);
815 if ($search_idprof3 !=
'') {
816 $param .=
'&search_idprof3='.urlencode($search_idprof3);
818 if ($search_idprof4 !=
'') {
819 $param .=
'&search_idprof4='.urlencode($search_idprof4);
821 if ($search_idprof5 !=
'') {
822 $param .=
'&search_idprof5='.urlencode($search_idprof5);
824 if ($search_idprof6 !=
'') {
825 $param .=
'&search_idprof6='.urlencode($search_idprof6);
827 if ($search_vat !=
'') {
828 $param .=
'&search_vat='.urlencode($search_vat);
830 if ($search_price_level !=
'') {
831 $param .=
'&search_price_level='.urlencode($search_price_level);
833 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
834 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
836 if ($search_type !=
'') {
837 $param .=
'&search_type='.urlencode($search_type);
839 if (is_array($search_level) && count($search_level)) {
840 foreach ($search_level as $slevel) {
841 $param .=
'&search_level[]='.urlencode($slevel);
844 if ($search_status !=
'') {
845 $param .=
'&search_status='.urlencode($search_status);
847 if ($search_stcomm !=
'' && $search_stcomm !=
'-2') {
848 $param .=
'&search_stcomm='.urlencode($search_stcomm);
850 if ($search_parent_name !=
'') {
851 $param .=
'&search_parent_name='.urlencode($search_parent_name);
853 if ($search_import_key !=
'') {
854 $param .=
'&search_import_key='.urlencode($search_import_key);
857 $param .=
'&type='.urlencode($type);
859 if ($optioncss !=
'') {
860 $param .=
'&optioncss='.urlencode($optioncss);
863 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
871 $arrayofmassactions = array(
872 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
876 if (
isModEnabled(
'category') && $user->rights->societe->creer) {
877 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
879 if ($user->rights->societe->creer) {
880 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToEnabled");
882 if ($user->rights->societe->creer) {
883 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToDisabled");
885 if ($user->rights->societe->creer) {
886 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
888 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
889 $arrayofmassactions = array();
891 if ($user->rights->societe->supprimer) {
892 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
894 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
897 $label =
'MenuNewThirdParty';
900 $typefilter =
'&type='.$type;
902 $label =
'MenuNewProspect';
905 $label =
'MenuNewCustomer';
908 $label =
'NewSupplier';
912 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))) {
918 if ($contextpage !=
'poslist') {
919 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
920 if (!empty($socid)) {
921 $url .=
'&socid='.$socid;
923 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->rights->societe->creer);
924 } elseif ($user->rights->societe->creer) {
925 $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);
926 $label =
'MenuNewCustomer';
927 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
930 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">';
931 if ($optioncss !=
'') {
932 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
934 print
'<input type="hidden" name="token" value="'.newToken().
'">';
935 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
936 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
937 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
939 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
941 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
943 $langs->load(
"other");
944 $textprofid = array();
945 foreach (array(1, 2, 3, 4, 5, 6) as $key) {
946 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
947 $textprofid[$key] =
'';
948 if ($label !=
"ProfId".$key.$mysoc->country_code) {
949 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
952 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
956 $topicmail =
"Information";
957 $modelmail =
"thirdparty";
959 $trackid =
'thi'.$object->id;
960 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
963 foreach ($fieldstosearchall as $key => $val) {
964 $fieldstosearchall[$key] = $langs->trans($val);
966 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
971 if (empty($type) || $type ==
'c' || $type ==
'p') {
972 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
973 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
974 $moreforfilter .=
'<div class="divsearchfield">';
975 $tmptitle = $langs->trans(
'Categories');
976 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
977 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'CustomersProspectsCategoriesShort'));
978 $moreforfilter .=
'</div>';
982 if (empty($type) || $type ==
'f') {
983 if (!empty($conf->fournisseur->enabled) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
984 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
985 $moreforfilter .=
'<div class="divsearchfield">';
986 $tmptitle = $langs->trans(
'Categories');
987 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
988 $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $langs->trans(
'SuppliersCategoriesShort'));
989 $moreforfilter .=
'</div>';
994 if ($user->rights->societe->client->voir || $socid) {
995 $moreforfilter .=
'<div class="divsearchfield">';
996 $tmptitle = $langs->trans(
'SalesRepresentatives');
997 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
998 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $langs->trans(
'SalesRepresentatives'), ($conf->dol_optimize_smallscreen ?
'maxwidth200' :
'maxwidth300'), 1);
999 $moreforfilter .=
'</div>';
1001 if ($moreforfilter) {
1002 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1003 print $moreforfilter;
1004 $parameters = array(
'type'=>$type);
1005 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1006 print $hookmanager->resPrint;
1010 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1011 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1013 if ($massactionbutton && $contextpage !=
'poslist') {
1014 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
1017 if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1018 print
'<input type="hidden" name="type" value="'.$type.
'">';
1021 print
'<div class="div-table-responsive">';
1022 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1025 print
'<tr class="liste_titre_filter">';
1026 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1028 print
'<td class="liste_titre center actioncolumn">';
1029 $searchpicto =
$form->showFilterButtons(
'left');
1033 if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1034 print
'<td class="liste_titre" data-key="id">';
1035 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1038 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1039 print
'<td class="liste_titre" data-key="ref">';
1040 if (!empty($search_nom_only) && empty($search_nom)) {
1041 $search_nom = $search_nom_only;
1043 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1046 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1047 print
'<td class="liste_titre">';
1048 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1052 if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1053 print
'<td class="liste_titre">';
1054 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1058 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1059 print
'<td class="liste_titre">';
1060 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1064 if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1065 print
'<td class="liste_titre">';
1066 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1070 if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1071 print
'<td class="liste_titre">';
1072 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1076 if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1077 print
'<td class="liste_titre">';
1078 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1082 if (!empty($arrayfields[
's.address'][
'checked'])) {
1083 print
'<td class="liste_titre">';
1084 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1088 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1089 print
'<td class="liste_titre">';
1090 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1094 if (!empty($arrayfields[
's.town'][
'checked'])) {
1095 print
'<td class="liste_titre">';
1096 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1100 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1101 print
'<td class="liste_titre">';
1102 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1106 if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1107 print
'<td class="liste_titre">';
1108 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1112 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1113 print
'<td class="liste_titre center">';
1114 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1118 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1119 print
'<td class="liste_titre maxwidthonsmartphone center">';
1121 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);
1125 if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1126 print
'<td class="liste_titre">';
1127 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1131 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1132 print
'<td class="liste_titre maxwidthonsmartphone center">';
1133 print
$form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1136 if (!empty($arrayfields[
's.email'][
'checked'])) {
1138 print
'<td class="liste_titre">';
1139 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1142 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1145 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1148 if (!empty($arrayfields[
's.fax'][
'checked'])) {
1150 print
'<td class="liste_titre">';
1151 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1154 if (!empty($arrayfields[
's.url'][
'checked'])) {
1156 print
'<td class="liste_titre">';
1157 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1160 if (!empty($arrayfields[
's.siren'][
'checked'])) {
1162 print
'<td class="liste_titre">';
1163 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1166 if (!empty($arrayfields[
's.siret'][
'checked'])) {
1168 print
'<td class="liste_titre">';
1169 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1172 if (!empty($arrayfields[
's.ape'][
'checked'])) {
1174 print
'<td class="liste_titre">';
1175 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1178 if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1180 print
'<td class="liste_titre">';
1181 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1184 if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1186 print
'<td class="liste_titre">';
1187 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1190 if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1192 print
'<td class="liste_titre">';
1193 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1196 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1198 print
'<td class="liste_titre">';
1199 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1204 if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1205 print
'<td class="liste_titre maxwidthonsmartphone center">';
1207 print
'<input type="hidden" name="type" value="'.$type.
'">';
1209 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1213 if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1214 print
'<td class="liste_titre center">';
1215 print
$form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1219 if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1220 print
'<td class="liste_titre maxwidthonsmartphone center">';
1221 $arraystcomm = array();
1222 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1223 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1225 print
$form->selectarray(
'search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1228 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1229 print
'<td class="liste_titre center">';
1230 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1234 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1237 $parameters = array(
'arrayfields'=>$arrayfields);
1238 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1239 print $hookmanager->resPrint;
1241 if (!empty($arrayfields[
's.datec'][
'checked'])) {
1242 print
'<td class="liste_titre">';
1246 if (!empty($arrayfields[
's.tms'][
'checked'])) {
1247 print
'<td class="liste_titre">';
1251 if (!empty($arrayfields[
's.status'][
'checked'])) {
1252 print
'<td class="liste_titre center minwidth75imp">';
1253 print
$form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1256 if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1257 print
'<td class="liste_titre center">';
1258 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1261 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1263 print
'<td class="liste_titre center actioncolumn">';
1264 $searchpicto =
$form->showFilterButtons();
1270 print
'<tr class="liste_titre">';
1271 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1272 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1274 if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1275 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'actioncolumn ');
1277 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1278 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
'actioncolumn ');
1280 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1281 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1283 if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1284 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode", $param,
'',
'', $sortfield, $sortorder);
1286 if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1287 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1289 if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1290 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1292 if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1293 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1295 if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1296 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1298 if (!empty($arrayfields[
's.address'][
'checked'])) {
1299 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1301 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1302 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1304 if (!empty($arrayfields[
's.town'][
'checked'])) {
1305 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1307 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1308 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1310 if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1311 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1313 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1314 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1316 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1317 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1319 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1320 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1322 if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1323 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1325 if (!empty($arrayfields[
's.email'][
'checked'])) {
1326 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1328 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1329 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1331 if (!empty($arrayfields[
's.fax'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1334 if (!empty($arrayfields[
's.url'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1337 if (!empty($arrayfields[
's.siren'][
'checked'])) {
1338 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1340 if (!empty($arrayfields[
's.siret'][
'checked'])) {
1341 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1343 if (!empty($arrayfields[
's.ape'][
'checked'])) {
1344 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1346 if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1347 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1349 if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1350 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1352 if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1353 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1355 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1358 if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1361 if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1364 if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1367 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1371 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1373 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1374 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1375 print $hookmanager->resPrint;
1376 if (!empty($arrayfields[
's.datec'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1379 if (!empty($arrayfields[
's.tms'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1382 if (!empty($arrayfields[
's.status'][
'checked'])) {
1383 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1385 if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1386 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1388 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1389 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1395 $totalarray = array();
1396 $totalarray[
'nbfield'] = 0;
1397 while ($i < min($num, $limit)) {
1398 $obj = $db->fetch_object(
$resql);
1400 $companystatic->id = $obj->rowid;
1401 $companystatic->name = $obj->name;
1402 $companystatic->name_alias = $obj->name_alias;
1403 $companystatic->logo = $obj->logo;
1404 $companystatic->canvas = $obj->canvas;
1405 $companystatic->client = $obj->client;
1406 $companystatic->status = $obj->status;
1407 $companystatic->email = $obj->email;
1408 $companystatic->fournisseur = $obj->fournisseur;
1409 $companystatic->code_client = $obj->code_client;
1410 $companystatic->code_fournisseur = $obj->code_fournisseur;
1411 $companystatic->tva_intra = $obj->tva_intra;
1412 $companystatic->country_code = $obj->country_code;
1414 $companystatic->code_compta_client = $obj->code_compta;
1415 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1417 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1418 $companystatic->fk_parent = $obj->fk_parent;
1419 $companystatic->entity = $obj->entity;
1421 print
'<tr class="oddeven"';
1422 if ($contextpage ==
'poslist') {
1423 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1427 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1428 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1429 print '<td class="nowrap center actioncolumn
">';
1430 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
1432 if (in_array($obj->rowid, $arrayofselected)) {
1435 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1439 if (!empty($arrayfields['s.rowid']['checked'])) {
1440 print '<td class="tdoverflowmax50
" data-key="id">';
1444 $totalarray['nbfield']++;
1447 if (!empty($arrayfields['s.nom']['checked'])) {
1448 print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200
"' : '').' data-key="ref">';
1449 if ($contextpage == 'poslist') {
1450 print dol_escape_htmltag($obj->name);
1452 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1456 $totalarray['nbfield']++;
1459 if (!empty($arrayfields['s.name_alias']['checked'])) {
1460 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1461 print dol_escape_htmltag($companystatic->name_alias);
1464 $totalarray['nbfield']++;
1468 if (!empty($arrayfields['s.barcode']['checked'])) {
1469 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($obj->barcode).'">'.dol_escape_htmltag($obj->barcode).'</td>';
1471 $totalarray['nbfield']++;
1475 if (!empty($arrayfields['s.code_client']['checked'])) {
1476 print '<td class="nowraponall
">'.dol_escape_htmltag($obj->code_client).'</td>';
1478 $totalarray['nbfield']++;
1482 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1483 print '<td class="nowraponall
">'.dol_escape_htmltag($obj->code_fournisseur).'</td>';
1485 $totalarray['nbfield']++;
1488 // Account customer code
1489 if (!empty($arrayfields['s.code_compta']['checked'])) {
1490 print '<td>'.dol_escape_htmltag($obj->code_compta).'</td>';
1492 $totalarray['nbfield']++;
1495 // Account supplier code
1496 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1497 print '<td>'.dol_escape_htmltag($obj->code_compta_fournisseur).'</td>';
1499 $totalarray['nbfield']++;
1503 if (!empty($arrayfields['s.address']['checked'])) {
1504 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($obj->address).'">'.dol_escape_htmltag($obj->address).'</td>';
1506 $totalarray['nbfield']++;
1510 if (!empty($arrayfields['s.zip']['checked'])) {
1511 print "<td>
".dol_escape_htmltag($obj->zip)."</td>\n
";
1513 $totalarray['nbfield']++;
1517 if (!empty($arrayfields['s.town']['checked'])) {
1518 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town)."</td>\n
";
1520 $totalarray['nbfield']++;
1524 if (!empty($arrayfields['state.nom']['checked'])) {
1525 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
1527 $totalarray['nbfield']++;
1531 if (!empty($arrayfields['region.nom']['checked'])) {
1532 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
1534 $totalarray['nbfield']++;
1538 if (!empty($arrayfields['country.code_iso']['checked'])) {
1539 print '<td class="center tdoverflowmax100
">';
1540 $labelcountry = ($obj->country_code && ($langs->trans("Country
".$obj->country_code) != "Country
".$obj->country_code)) ? $langs->trans("Country
".$obj->country_code) : $obj->country_label;
1541 print $labelcountry;
1544 $totalarray['nbfield']++;
1548 if (!empty($arrayfields['typent.code']['checked'])) {
1549 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1550 $typenArray = $formcompany->typent_array(1);
1552 $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1554 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1555 print dol_escape_htmltag($labeltypeofcompany);
1558 $totalarray['nbfield']++;
1562 if (!empty($arrayfields['s.price_level']['checked'])) {
1563 print '<td class="center
">'.$obj->price_level."</td>\n
";
1565 $totalarray['nbfield']++;
1569 if (!empty($arrayfields['staff.code']['checked'])) {
1570 print '<td class="center
">';
1571 if (!is_array($staffArray) || count($staffArray) == 0) {
1572 $staffArray = $formcompany->effectif_array(1);
1574 print $staffArray[$obj->staff_code];
1577 $totalarray['nbfield']++;
1580 if (!empty($arrayfields['s.email']['checked'])) {
1581 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n
";
1583 $totalarray['nbfield']++;
1586 if (!empty($arrayfields['s.phone']['checked'])) {
1587 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
1589 $totalarray['nbfield']++;
1592 if (!empty($arrayfields['s.fax']['checked'])) {
1593 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
1595 $totalarray['nbfield']++;
1598 if (!empty($arrayfields['s.url']['checked'])) {
1599 print "<td>
".dol_print_url($obj->url, '', '', 1)."</td>\n
";
1601 $totalarray['nbfield']++;
1604 if (!empty($arrayfields['s.siren']['checked'])) {
1605 print "<td>
".$obj->idprof1."</td>\n
";
1607 $totalarray['nbfield']++;
1610 if (!empty($arrayfields['s.siret']['checked'])) {
1611 print "<td>
".$obj->idprof2."</td>\n
";
1613 $totalarray['nbfield']++;
1616 if (!empty($arrayfields['s.ape']['checked'])) {
1617 print "<td>
".$obj->idprof3."</td>\n
";
1619 $totalarray['nbfield']++;
1622 if (!empty($arrayfields['s.idprof4']['checked'])) {
1623 print "<td>
".$obj->idprof4."</td>\n
";
1625 $totalarray['nbfield']++;
1628 if (!empty($arrayfields['s.idprof5']['checked'])) {
1629 print "<td>
".$obj->idprof5."</td>\n
";
1631 $totalarray['nbfield']++;
1634 if (!empty($arrayfields['s.idprof6']['checked'])) {
1635 print "<td>
".$obj->idprof6."</td>\n
";
1637 $totalarray['nbfield']++;
1641 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1642 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($obj->tva_intra).'">';
1643 if ($obj->tva_intra && !isValidVATID($companystatic)) {
1644 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
1646 print $obj->tva_intra;
1649 $totalarray['nbfield']++;
1653 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1654 print '<td class="center
">';
1655 print $companystatic->getTypeUrl(1);
1658 $totalarray['nbfield']++;
1662 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1664 print '<td class="center
">';
1665 print $companystatic->getLibProspLevel();
1668 $totalarray['nbfield']++;
1672 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1674 print '<td class="center nowrap
"><div class="nowrap
">';
1675 print '<div class="inline-block
">';
1676 print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1677 print '</div> - <div class="inline-block
">';
1678 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1679 $titlealt = 'default';
1680 if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1681 $titlealt = $val['label'];
1683 if ($obj->stcomm_id != $val['id']) {
1684 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>';
1687 print '</div></div></td>';
1689 $totalarray['nbfield']++;
1693 if (!empty($arrayfields['s2.nom']['checked'])) {
1694 print '<td class="center tdoverflowmax100
">';
1695 if ($companystatic->fk_parent > 0) {
1696 $companyparent->fetch($companystatic->fk_parent);
1697 print $companyparent->getNomUrl(1);
1701 $totalarray['nbfield']++;
1705 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1707 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1708 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1709 print $hookmanager->resPrint;
1711 if (!empty($arrayfields['s.datec']['checked'])) {
1712 print '<td class="center nowraponall
">';
1713 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1716 $totalarray['nbfield']++;
1719 // Date modification
1720 if (!empty($arrayfields['s.tms']['checked'])) {
1721 print '<td class="center nowraponall
">';
1722 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1725 $totalarray['nbfield']++;
1729 if (!empty($arrayfields['s.status']['checked'])) {
1730 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
1732 $totalarray['nbfield']++;
1736 if (!empty($arrayfields['s.import_key']['checked'])) {
1737 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->import_key).'">';
1738 print dol_escape_htmltag($obj->import_key);
1741 $totalarray['nbfield']++;
1744 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1745 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1746 print '<td class="nowrap center actioncolumn
">';
1747 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
1749 if (in_array($obj->rowid, $arrayofselected)) {
1752 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1757 $totalarray['nbfield']++;
1764 // If no record found
1767 foreach ($arrayfields as $key => $val) {
1768 if (!empty($val['checked'])) {
1772 print '<tr><td colspan="'.$colspan.'" class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</td></tr>';
1777 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1778 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1779 print $hookmanager->resPrint;