40require_once
'../main.inc.php';
41include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/societe/class/client.class.php';
50$langs->loadLangs(array(
"companies",
"commercial",
"customers",
"suppliers",
"bills",
"compta",
"categories",
"cashdesk"));
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$show_files =
GETPOST(
'show_files',
'int');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$toselect =
GETPOST(
'toselect',
'array');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
60$optioncss =
GETPOST(
'optioncss',
'alpha');
61if ($contextpage ==
'poslist') {
64$mode =
GETPOST(
"mode",
'alpha');
67$search_all = trim(
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
68$search_cti = preg_replace(
'/^0+/',
'', preg_replace(
'/[^0-9]/',
'',
GETPOST(
'search_cti',
'alphanohtml')));
70$search_id = trim(
GETPOST(
"search_id",
"int"));
71$search_nom = trim(
GETPOST(
"search_nom",
'restricthtml'));
72$search_alias = trim(
GETPOST(
"search_alias",
'restricthtml'));
73$search_nom_only = trim(
GETPOST(
"search_nom_only",
'restricthtml'));
74$search_barcode = trim(
GETPOST(
"search_barcode",
'alpha'));
75$search_customer_code = trim(
GETPOST(
'search_customer_code',
'alpha'));
76$search_supplier_code = trim(
GETPOST(
'search_supplier_code',
'alpha'));
77$search_account_customer_code = trim(
GETPOST(
'search_account_customer_code',
'alpha'));
78$search_account_supplier_code = trim(
GETPOST(
'search_account_supplier_code',
'alpha'));
79$search_address = trim(
GETPOST(
'search_address',
'alpha'));
80$search_zip = trim(
GETPOST(
"search_zip",
'alpha'));
81$search_town = trim(
GETPOST(
"search_town",
'alpha'));
82$search_state = trim(
GETPOST(
"search_state",
'alpha'));
83$search_region = trim(
GETPOST(
"search_region",
'alpha'));
84$search_email = trim(
GETPOST(
'search_email',
'alpha'));
85$search_phone = trim(
GETPOST(
'search_phone',
'alpha'));
86$search_fax = trim(
GETPOST(
'search_fax',
'alpha'));
87$search_url = trim(
GETPOST(
'search_url',
'alpha'));
88$search_idprof1 = trim(
GETPOST(
'search_idprof1',
'alpha'));
89$search_idprof2 = trim(
GETPOST(
'search_idprof2',
'alpha'));
90$search_idprof3 = trim(
GETPOST(
'search_idprof3',
'alpha'));
91$search_idprof4 = trim(
GETPOST(
'search_idprof4',
'alpha'));
92$search_idprof5 = trim(
GETPOST(
'search_idprof5',
'alpha'));
93$search_idprof6 = trim(
GETPOST(
'search_idprof6',
'alpha'));
94$search_vat = trim(
GETPOST(
'search_vat',
'alpha'));
95$search_sale =
GETPOST(
"search_sale",
'int');
96$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
97$search_categ_sup =
GETPOST(
"search_categ_sup",
'int');
98$search_country =
GETPOST(
"search_country",
'intcomma');
99$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
100$search_price_level =
GETPOST(
'search_price_level',
'int');
101$search_staff =
GETPOST(
"search_staff",
'int');
102$search_status =
GETPOST(
"search_status",
'int');
103$search_type =
GETPOST(
'search_type',
'alpha');
104$search_level =
GETPOST(
"search_level",
"array:alpha");
105$search_stcomm =
GETPOST(
'search_stcomm',
"array:int");
106$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
107$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alpha'));
109$search_date_creation_startmonth =
GETPOST(
'search_date_creation_startmonth',
'int');
110$search_date_creation_startyear =
GETPOST(
'search_date_creation_startyear',
'int');
111$search_date_creation_startday =
GETPOST(
'search_date_creation_startday',
'int');
112$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
113$search_date_creation_endmonth =
GETPOST(
'search_date_creation_endmonth',
'int');
114$search_date_creation_endyear =
GETPOST(
'search_date_creation_endyear',
'int');
115$search_date_creation_endday =
GETPOST(
'search_date_creation_endday',
'int');
116$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
118$search_date_modif_startmonth =
GETPOST(
'search_date_modif_startmonth',
'int');
119$search_date_modif_startyear =
GETPOST(
'search_date_modif_startyear',
'int');
120$search_date_modif_startday =
GETPOST(
'search_date_modif_startday',
'int');
121$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
122$search_date_modif_endmonth =
GETPOST(
'search_date_modif_endmonth',
'int');
123$search_date_modif_endyear =
GETPOST(
'search_date_modif_endyear',
'int');
124$search_date_modif_endday =
GETPOST(
'search_date_modif_endday',
'int');
125$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
128$type =
GETPOST(
'type',
'alpha');
129$place =
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0';
131$diroutputmassaction = $conf->societe->dir_output.
'/temp/massgeneration/'.$user->id;
134$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
135$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
136$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
137$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
142 $sortfield =
"s.nom";
144if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
148$offset = $limit * $page;
149$pageprev = $page - 1;
150$pagenext = $page + 1;
153 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
154 $contextpage =
'customerlist';
156 if ($search_type ==
'') {
157 $search_type =
'1,3';
161 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
162 $contextpage =
'prospectlist';
164 if ($search_type ==
'') {
165 $search_type =
'2,3';
169 if (empty($contextpage) || $contextpage ==
'poslist') {
170 $contextpage =
'poslist';
172 if ($search_type ==
'') {
173 $search_type =
'1,2,3';
177 if (empty($contextpage) || $contextpage ==
'thirdpartylist') {
178 $contextpage =
'supplierlist';
180 if ($search_type ==
'') {
188$hookmanager->initHooks(array($contextpage));
191$extrafields->fetch_name_optionals_label($object->table_element);
193$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
196$fieldstosearchall = array(
197 's.nom'=>
"ThirdPartyName",
198 's.name_alias'=>
"AliasNameShort",
199 's.code_client'=>
"CustomerCode",
200 's.code_fournisseur'=>
"SupplierCode",
201 's.code_compta'=>
"CustomerAccountancyCodeShort",
202 's.code_compta_fournisseur'=>
"SupplierAccountancyCodeShort",
207 's.tva_intra'=>
"VATIntra",
208 's.siren'=>
"ProfId1",
209 's.siret'=>
"ProfId2",
214if (($tmp = $langs->transnoentities(
"ProfId4".$mysoc->country_code)) && $tmp !=
"ProfId4".$mysoc->country_code && $tmp !=
'-') {
215 $fieldstosearchall[
's.idprof4'] =
'ProfId4';
217if (($tmp = $langs->transnoentities(
"ProfId5".$mysoc->country_code)) && $tmp !=
"ProfId5".$mysoc->country_code && $tmp !=
'-') {
218 $fieldstosearchall[
's.idprof5'] =
'ProfId5';
220if (($tmp = $langs->transnoentities(
"ProfId6".$mysoc->country_code)) && $tmp !=
"ProfId6".$mysoc->country_code && $tmp !=
'-') {
221 $fieldstosearchall[
's.idprof6'] =
'ProfId6';
223if (isModEnabled(
'barcode')) {
224 $fieldstosearchall[
's.barcode'] =
'Gencod';
233$checkedcustomercode = (in_array($contextpage, array(
'thirdpartylist',
'customerlist',
'prospectlist',
'poslist')) ? 1 : 0);
234$checkedsuppliercode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
235$checkedcustomeraccountcode = (in_array($contextpage, array(
'customerlist')) ? 1 : 0);
236$checkedsupplieraccountcode = (in_array($contextpage, array(
'supplierlist')) ? 1 : 0);
237$checkedtypetiers = 1;
247$checkprospectlevel = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
248$checkstcomm = (in_array($contextpage, array(
'prospectlist')) ? 1 : 0);
250 's.rowid'=>array(
'label'=>
"TechnicalID",
'position'=>1,
'checked'=>-1,
'enabled'=>1),
251 's.nom'=>array(
'label'=>
"ThirdPartyName",
'position'=>2,
'checked'=>1),
252 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'position'=>3,
'checked'=>1),
253 's.barcode'=>array(
'label'=>
"Gencod",
'position'=>5,
'checked'=>1,
'enabled'=>(isModEnabled(
'barcode'))),
254 's.code_client'=>array(
'label'=>
"CustomerCodeShort",
'position'=>10,
'checked'=>$checkedcustomercode),
255 's.code_fournisseur'=>array(
'label'=>
"SupplierCodeShort",
'position'=>11,
'checked'=>$checkedsuppliercode,
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
256 's.code_compta'=>array(
'label'=>
"CustomerAccountancyCodeShort",
'position'=>13,
'checked'=>$checkedcustomeraccountcode),
257 's.code_compta_fournisseur'=>array(
'label'=>
"SupplierAccountancyCodeShort",
'position'=>14,
'checked'=>$checkedsupplieraccountcode,
'enabled'=>(isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
258 's.address'=>array(
'label'=>
"Address",
'position'=>19,
'checked'=>0),
259 's.zip'=>array(
'label'=>
"Zip",
'position'=>20,
'checked'=>1),
260 's.town'=>array(
'label'=>
"Town",
'position'=>21,
'checked'=>0),
261 'state.nom'=>array(
'label'=>
"State",
'position'=>22,
'checked'=>0),
262 'region.nom'=>array(
'label'=>
"Region",
'position'=>23,
'checked'=>0),
263 'country.code_iso'=>array(
'label'=>
"Country",
'position'=>24,
'checked'=>0),
264 's.email'=>array(
'label'=>
"Email",
'position'=>25,
'checked'=>0),
265 's.url'=>array(
'label'=>
"Url",
'position'=>26,
'checked'=>0),
266 's.phone'=>array(
'label'=>
"Phone",
'position'=>27,
'checked'=>1),
267 's.fax'=>array(
'label'=>
"Fax",
'position'=>28,
'checked'=>0),
268 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'position'=>29,
'checked'=>$checkedtypetiers),
269 'staff.code'=>array(
'label'=>
"Workforce",
'position'=>31,
'checked'=>0),
270 's.siren'=>array(
'label'=>
"ProfId1Short",
'position'=>40,
'checked'=>$checkedprofid1),
271 's.siret'=>array(
'label'=>
"ProfId2Short",
'position'=>41,
'checked'=>$checkedprofid2),
272 's.ape'=>array(
'label'=>
"ProfId3Short",
'position'=>42,
'checked'=>$checkedprofid3),
273 's.idprof4'=>array(
'label'=>
"ProfId4Short",
'position'=>43,
'checked'=>$checkedprofid4),
274 's.idprof5'=>array(
'label'=>
"ProfId5Short",
'position'=>44,
'checked'=>$checkedprofid5),
275 's.idprof6'=>array(
'label'=>
"ProfId6Short",
'position'=>45,
'checked'=>$checkedprofid6),
276 's.tva_intra'=>array(
'label'=>
"VATIntraShort",
'position'=>50,
'checked'=>0),
277 'customerorsupplier'=>array(
'label'=>
'NatureOfThirdParty',
'position'=>61,
'checked'=>1),
278 's.fk_prospectlevel'=>array(
'label'=>
"ProspectLevel",
'position'=>62,
'checked'=>$checkprospectlevel),
279 's.fk_stcomm'=>array(
'label'=>
"StatusProsp",
'position'=>63,
'checked'=>$checkstcomm),
280 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>64,
'checked'=>0),
281 's.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
282 's.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
283 's.status'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
284 's.import_key'=>array(
'label'=>
"ImportId",
'checked'=>0,
'position'=>1100),
287 $arrayfields[
's.price_level'] = array(
'label'=>
"PriceLevel",
'position'=>30,
'checked'=>0);
291$arrayfields[
'sales.representative'] = array(
'label'=>$langs->trans(
"SalesRepresentatives"),
'checked'=>1,
'position'=>12);
294include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
300$socid =
GETPOST(
'socid',
'int');
302 $socid = $user->socid;
312if ($action ==
"change" && $user->hasRight(
'takepos',
'run')) {
313 $idcustomer =
GETPOST(
'idcustomer',
'int');
316 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' AND entity IN (".
getEntity(
'invoice').
")";
317 $result = $db->query($sql);
318 $num_lines = $db->num_rows($result);
319 if ($num_lines == 0) {
320 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
322 $constforthirdpartyid =
'CASHDESK_ID_THIRDPARTY'.$_SESSION[
"takeposterminal"];
325 $invoice->module_source =
'takepos';
326 $invoice->pos_source = $_SESSION[
"takeposterminal"];
327 $placeid = $invoice->create($user);
328 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")' where rowid = ".((int) $placeid);
332 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"facture set fk_soc=".((int) $idcustomer).
" where ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
333 $resql = $db->query($sql); ?>
335 console.log(
"Reload page invoice.php with place=<?php print $place; ?>");
336 parent.$(
"#poslines").load(
"invoice.php?place=<?php print $place; ?>",
function() {
338 <?php
if (!$resql) { ?>
339 alert(
'Error failed to update customer on draft invoice.');
341 parent.$.colorbox.close();
348if (
GETPOST(
'cancel',
'alpha')) {
352if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
356$parameters = array();
357$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
362if (empty($reshook)) {
364 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
367 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
371 $search_categ_cus = 0;
372 $search_categ_sup = 0;
374 $search_barcode =
"";
375 $search_customer_code =
'';
376 $search_supplier_code =
'';
377 $search_account_customer_code =
'';
378 $search_account_supplier_code =
'';
379 $search_address =
'';
384 $search_country =
'';
389 $search_idprof1 =
'';
390 $search_idprof2 =
'';
391 $search_idprof3 =
'';
392 $search_idprof4 =
'';
393 $search_idprof5 =
'';
394 $search_idprof6 =
'';
397 $search_price_level =
'';
398 $search_type_thirdparty =
'';
400 $search_date_creation_startmonth =
"";
401 $search_date_creation_startyear =
"";
402 $search_date_creation_startday =
"";
403 $search_date_creation_start =
"";
404 $search_date_creation_endmonth =
"";
405 $search_date_creation_endyear =
"";
406 $search_date_creation_endday =
"";
407 $search_date_creation_end =
"";
408 $search_date_modif_startmonth =
"";
409 $search_date_modif_startyear =
"";
410 $search_date_modif_startday =
"";
411 $search_date_modif_start =
"";
412 $search_date_modif_endmonth =
"";
413 $search_date_modif_endyear =
"";
414 $search_date_modif_endday =
"";
415 $search_date_modif_end =
"";
419 $search_parent_name =
'';
420 $search_import_key =
'';
422 $search_array_options = array();
426 $objectclass =
'Societe';
427 $objectlabel =
'ThirdParty';
428 $permissiontoread = $user->hasRight(
'societe',
'lire');
429 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
430 $permissiontoadd = $user->hasRight(
"societe",
"creer");
431 $uploaddir = $conf->societe->dir_output;
432 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
434 if ($action ==
'setstcomm') {
435 $object =
new Client($db);
436 $result = $object->fetch(
GETPOST(
'stcommsocid'));
438 $result = $object->update($object->id, $user);
447if ($search_status ==
'') {
466$form =
new Form($db);
468$companystatic =
new Societe($db);
469$companyparent =
new Societe($db);
471$prospectstatic =
new Client($db);
472$prospectstatic->client = 2;
473$prospectstatic->loadCacheOfProspStatus();
477$title = $langs->trans(
"ThirdParties");
478if ($type ==
'c' && (empty($search_type) || ($search_type ==
'1,3'))) {
479 $title = $langs->trans(
"Customers");
481if ($type ==
'p' && (empty($search_type) || ($search_type ==
'2,3'))) {
482 $title = $langs->trans(
"Prospects");
484if ($type ==
'f' && (empty($search_type) || ($search_type ==
'4'))) {
485 $title = $langs->trans(
"Suppliers");
487$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
492$sql =
"SELECT code, label, sortorder";
493$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
494$sql .=
" WHERE active > 0";
495$sql .=
" ORDER BY sortorder";
496$resql = $db->query($sql);
498 while ($obj = $db->fetch_object($resql)) {
500 $level = $langs->trans($obj->code);
501 if ($level == $obj->code) {
502 $level = $langs->trans($obj->label);
504 $tab_level[$obj->code] = $level;
512$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,";
514$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,";
515$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,";
516$sql .=
" s.tms as date_update, s.datec as date_creation, s.import_key,";
517$sql .=
" s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
518$sql .=
" s2.nom as name2,";
519$sql .=
" typent.code as typent_code,";
520$sql .=
" staff.code as staff_code,";
521$sql .=
" country.code as country_code, country.label as country_label,";
522$sql .=
" state.code_departement as state_code, state.nom as state_name,";
523$sql .=
" region.code_region as region_code, region.nom as region_name";
525if ($search_sale && $search_sale !=
'-1') {
526 $sql .=
", sc.fk_soc, sc.fk_user";
529if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
530 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
531 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
535$parameters = array();
536$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
537$sql .= $hookmanager->resPrint;
538$sql = preg_replace(
'/,\s*$/',
'', $sql);
543$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
544$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s.parent = s2.rowid";
545if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
546 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
549$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
550$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
551$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_effectif as staff on (staff.id = s.fk_effectif)";
552$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
553$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as region on (region.code_region = state.fk_region)";
554$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_stcomm as st ON s.fk_stcomm = st.id";
556if ($search_sale == -2) {
557 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc = s.rowid";
559} elseif (!empty($search_sale) && $search_sale !=
'-1' || (!$user->hasRight(
'societe',
'client',
'voir') && !$socid)) {
560 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
563$parameters = array();
564$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
565$sql .= $hookmanager->resPrint;
566$sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
568if (!$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
569 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
571if ($search_sale && $search_sale !=
'-1' && $search_sale !=
'-2') {
572 $sql .=
" AND s.rowid = sc.fk_soc";
574if (!$user->hasRight(
'fournisseur',
'lire')) {
575 $sql .=
" AND (s.fournisseur <> 1 OR s.client <> 0)";
577if ($search_sale == -2) {
578 $sql .=
" AND sc.fk_user IS NULL";
579} elseif ($search_sale > 0) {
580 $sql .=
" AND sc.fk_user = ".((int) $search_sale);
582$searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
583$searchCategoryCustomerOperator = 0;
585if (!empty($searchCategoryCustomerList)) {
586 $searchCategoryCustomerSqlList = array();
587 $listofcategoryid =
'';
588 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
589 if (intval($searchCategoryCustomer) == -2) {
590 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
591 } elseif (intval($searchCategoryCustomer) > 0) {
592 if ($searchCategoryCustomerOperator == 0) {
593 $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).
")";
595 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
599 if ($listofcategoryid) {
600 $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).
"))";
602 if ($searchCategoryCustomerOperator == 1) {
603 if (!empty($searchCategoryCustomerSqlList)) {
604 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
607 if (!empty($searchCategoryCustomerSqlList)) {
608 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
613$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
614$searchCategorySupplierOperator = 0;
616if (!empty($searchCategorySupplierList)) {
617 $searchCategorySupplierSqlList = array();
618 $listofcategoryid =
'';
619 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
620 if (intval($searchCategorySupplier) == -2) {
621 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
622 } elseif (intval($searchCategorySupplier) > 0) {
623 if ($searchCategorySupplierOperator == 0) {
624 $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).
")";
626 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
630 if ($listofcategoryid) {
631 $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).
"))";
633 if ($searchCategorySupplierOperator == 1) {
634 if (!empty($searchCategorySupplierSqlList)) {
635 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
638 if (!empty($searchCategorySupplierSqlList)) {
639 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
644 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
646if (strlen($search_cti)) {
652if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_nom) {
653 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_nom);
663if ($search_nom_only) {
666if ($search_customer_code) {
669if ($search_supplier_code) {
670 $sql .=
natural_search(
"s.code_fournisseur", $search_supplier_code);
672if ($search_account_customer_code) {
673 $sql .=
natural_search(
"s.code_compta", $search_account_customer_code);
675if ($search_account_supplier_code) {
676 $sql .=
natural_search(
"s.code_compta_fournisseur", $search_account_supplier_code);
678if ($search_address) {
681if (strlen($search_zip)) {
693if ($search_country && $search_country !=
'-1') {
694 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
699if (strlen($search_phone)) {
702if (strlen($search_fax)) {
708if (strlen($search_idprof1)) {
711if (strlen($search_idprof2)) {
714if (strlen($search_idprof3)) {
717if (strlen($search_idprof4)) {
720if (strlen($search_idprof5)) {
723if (strlen($search_idprof6)) {
726if (strlen($search_vat)) {
730if ($search_type > 0 && in_array($search_type, array(
'1,3',
'1,2,3',
'2,3'))) {
731 $sql .=
" AND s.client IN (".$db->sanitize($search_type).
")";
733if ($search_type > 0 && in_array($search_type, array(
'4'))) {
734 $sql .=
" AND s.fournisseur = 1";
736if ($search_type ==
'0') {
737 $sql .=
" AND s.client = 0 AND s.fournisseur = 0";
739if ($search_status !=
'' && $search_status >= 0) {
742if (isModEnabled(
'barcode') && $search_barcode) {
745if ($search_price_level && $search_price_level !=
'-1') {
748if ($search_type_thirdparty && $search_type_thirdparty > 0) {
749 $sql .=
natural_search(
"s.fk_typent", $search_type_thirdparty, 2);
751if (!empty($search_staff) && $search_staff !=
'-1') {
754if ($search_parent_name) {
758 $sql .=
natural_search(
"s.fk_prospectlevel", join(
',', $search_level), 3);
761 $sql .=
natural_search(
"s.fk_stcomm", join(
',', $search_stcomm), 2);
763if ($search_import_key) {
766if ($search_date_creation_start) {
767 $sql .=
" AND s.datec >= '".$db->idate($search_date_creation_start).
"'";
769if ($search_date_creation_end) {
770 $sql .=
" AND s.datec <= '".$db->idate($search_date_creation_end).
"'";
773if ($search_date_modif_start) {
774 $sql .=
" AND s.tms >= '".$db->idate($search_date_modif_start).
"'";
776if ($search_date_modif_end) {
777 $sql .=
" AND s.tms <= '".$db->idate($search_date_modif_end).
"'";
781include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
783$parameters = array(
'socid' => $socid);
784$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
785if (empty($reshook)) {
787 $sql .=
" AND s.rowid = ".((int) $socid);
790$sql .= $hookmanager->resPrint;
793$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
794$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
795$sql .= $hookmanager->resPrint;
798$nbtotalofrecords =
'';
801 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
802 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
803 $resql = $db->query($sqlforcount);
805 $objforcount = $db->fetch_object($resql);
806 $nbtotalofrecords = $objforcount->nbtotalofrecords;
811 if (($page * $limit) > $nbtotalofrecords) {
819$sql .= $db->order($sortfield, $sortorder);
821 $sql .= $db->plimit($limit + 1, $offset);
824$resql = $db->query($sql);
830$num = $db->num_rows($resql);
834if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all !=
'' || $search_cti !=
'') && $action !=
'list') {
835 $obj = $db->fetch_object($resql);
837 if (
getDolGlobalString(
'SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
838 if ($obj->client > 0) {
839 header(
"Location: ".DOL_URL_ROOT.
'/comm/card.php?socid='.$id);
842 if ($obj->fournisseur > 0) {
843 header(
"Location: ".DOL_URL_ROOT.
'/fourn/card.php?socid='.$id);
848 header(
"Location: ".DOL_URL_ROOT.
'/societe/card.php?socid='.$id);
858$arrayofselected = is_array($toselect) ? $toselect : array();
862 $param .=
'&mode='.urlencode($mode);
864if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
865 $param .=
'&contextpage='.urlencode($contextpage);
867if ($limit > 0 && $limit != $conf->liste_limit) {
868 $param .=
'&limit='.((int) $limit);
870if ($optioncss !=
'') {
871 $param .=
'&optioncss='.urlencode($optioncss);
873if ($search_all !=
'') {
874 $param =
"&search_all=".urlencode($search_all);
876if ($search_categ_cus > 0) {
877 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
879if ($search_categ_sup > 0) {
880 $param .=
'&search_categ_sup='.urlencode($search_categ_sup);
882if ($search_sale > 0) {
883 $param .=
'&search_sale='.urlencode($search_sale);
886 $param .=
"&search_id=".urlencode($search_id);
888if ($search_nom !=
'') {
889 $param .=
"&search_nom=".urlencode($search_nom);
891if ($search_alias !=
'') {
892 $param .=
"&search_alias=".urlencode($search_alias);
894if ($search_address !=
'') {
895 $param .=
'&search_address='.urlencode($search_address);
897if ($search_zip !=
'') {
898 $param .=
"&search_zip=".urlencode($search_zip);
900if ($search_town !=
'') {
901 $param .=
"&search_town=".urlencode($search_town);
903if ($search_phone !=
'') {
904 $param .=
"&search_phone=".urlencode($search_phone);
906if ($search_fax !=
'') {
907 $param .=
"&search_fax=".urlencode($search_fax);
909if ($search_email !=
'') {
910 $param .=
"&search_email=".urlencode($search_email);
912if ($search_url !=
'') {
913 $param .=
"&search_url=".urlencode($search_url);
915if ($search_state !=
'') {
916 $param .=
"&search_state=".urlencode($search_state);
918if ($search_region !=
'') {
919 $param .=
"&search_region=".urlencode($search_region);
921if ($search_country !=
'') {
922 $param .=
"&search_country=".urlencode($search_country);
924if ($search_customer_code !=
'') {
925 $param .=
"&search_customer_code=".urlencode($search_customer_code);
927if ($search_supplier_code !=
'') {
928 $param .=
"&search_supplier_code=".urlencode($search_supplier_code);
930if ($search_account_customer_code !=
'') {
931 $param .=
"&search_account_customer_code=".urlencode($search_account_customer_code);
933if ($search_account_supplier_code !=
'') {
934 $param .=
"&search_account_supplier_code=".urlencode($search_account_supplier_code);
936if ($search_barcode !=
'') {
937 $param .=
"&search_barcode=".urlencode($search_barcode);
939if ($search_idprof1 !=
'') {
940 $param .=
'&search_idprof1='.urlencode($search_idprof1);
942if ($search_idprof2 !=
'') {
943 $param .=
'&search_idprof2='.urlencode($search_idprof2);
945if ($search_idprof3 !=
'') {
946 $param .=
'&search_idprof3='.urlencode($search_idprof3);
948if ($search_idprof4 !=
'') {
949 $param .=
'&search_idprof4='.urlencode($search_idprof4);
951if ($search_idprof5 !=
'') {
952 $param .=
'&search_idprof5='.urlencode($search_idprof5);
954if ($search_idprof6 !=
'') {
955 $param .=
'&search_idprof6='.urlencode($search_idprof6);
957if ($search_vat !=
'') {
958 $param .=
'&search_vat='.urlencode($search_vat);
960if ($search_price_level !=
'') {
961 $param .=
'&search_price_level='.urlencode($search_price_level);
963if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
964 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
966if ($search_type !=
'') {
967 $param .=
'&search_type='.urlencode($search_type);
969if ($search_status !=
'') {
970 $param .=
'&search_status='.urlencode($search_status);
972if (is_array($search_level) && count($search_level)) {
973 foreach ($search_level as $slevel) {
974 $param .=
'&search_level[]='.urlencode($slevel);
977if (is_array($search_stcomm) && count($search_stcomm)) {
978 foreach ($search_stcomm as $slevel) {
979 $param .=
'&search_stcomm[]='.urlencode($slevel);
982if ($search_parent_name !=
'') {
983 $param .=
'&search_parent_name='.urlencode($search_parent_name);
985if ($search_import_key !=
'') {
986 $param .=
'&search_import_key='.urlencode($search_import_key);
989 $param .=
'&type='.urlencode($type);
991if ($search_date_creation_startmonth) {
992 $param .=
'&search_date_creation_startmonth='.urlencode($search_date_creation_startmonth);
994if ($search_date_creation_startyear) {
995 $param .=
'&search_date_creation_startyear='.urlencode($search_date_creation_startyear);
997if ($search_date_creation_startday) {
998 $param .=
'&search_date_creation_startday='.urlencode($search_date_creation_startday);
1000if ($search_date_creation_start) {
1001 $param .=
'&search_date_creation_start='.urlencode($search_date_creation_start);
1003if ($search_date_creation_endmonth) {
1004 $param .=
'&search_date_creation_endmonth='.urlencode($search_date_creation_endmonth);
1006if ($search_date_creation_endyear) {
1007 $param .=
'&search_date_creation_endyear='.urlencode($search_date_creation_endyear);
1009if ($search_date_creation_endday) {
1010 $param .=
'&search_date_creation_endday='.urlencode($search_date_creation_endday);
1012if ($search_date_creation_end) {
1013 $param .=
'&search_date_creation_end='.urlencode($search_date_creation_end);
1015if ($search_date_modif_startmonth) {
1016 $param .=
'&search_date_modif_startmonth='.urlencode($search_date_modif_startmonth);
1018if ($search_date_modif_startyear) {
1019 $param .=
'&search_date_modif_startyear='.urlencode($search_date_modif_startyear);
1021if ($search_date_modif_startday) {
1022 $param .=
'&search_date_modif_startday='.urlencode($search_date_modif_startday);
1024if ($search_date_modif_start) {
1025 $param .=
'&search_date_modif_start='.urlencode($search_date_modif_start);
1027if ($search_date_modif_endmonth) {
1028 $param .=
'&search_date_modif_endmonth='.urlencode($search_date_modif_endmonth);
1030if ($search_date_modif_endyear) {
1031 $param .=
'&search_date_modif_endyear='.urlencode($search_date_modif_endyear);
1033if ($search_date_modif_endday) {
1034 $param .=
'&search_date_modif_endday='.urlencode($search_date_modif_endday);
1036if ($search_date_modif_end) {
1037 $param .=
'&search_date_modif_end=' . urlencode($search_date_modif_end);
1041include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1043$parameters = array(
'param' => &$param);
1044$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1045$param .= $hookmanager->resPrint;
1053$arrayofmassactions = array(
1054 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1058if (isModEnabled(
'category') && $user->hasRight(
"societe",
"creer")) {
1059 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1061if ($user->hasRight(
"societe",
"creer")) {
1062 $arrayofmassactions[
'preenable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
1064if ($user->hasRight(
"societe",
"creer")) {
1065 $arrayofmassactions[
'predisable'] =
img_picto(
'',
'stop-circle',
'class="pictofixedwidth"').$langs->trans(
"SetToStatus", $object->LibStatut($object::STATUS_CEASED));
1067if ($user->hasRight(
"societe",
"creer")) {
1068 $arrayofmassactions[
'presetcommercial'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"AllocateCommercial");
1070if ($user->hasRight(
'societe',
'supprimer')) {
1071 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1073if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'preenable',
'preclose'))) {
1074 $arrayofmassactions = array();
1076$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1079$label =
'MenuNewThirdParty';
1082 $typefilter =
'&type='.$type;
1084 $label =
'MenuNewProspect';
1087 $label =
'MenuNewCustomer';
1090 $label =
'NewSupplier';
1100if ($contextpage !=
'poslist') {
1101 $url = DOL_URL_ROOT.
'/societe/card.php?action=create'.$typefilter;
1102 if (!empty($socid)) {
1103 $url .=
'&socid='.$socid;
1105 $newcardbutton =
'';
1106 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
1107 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
1108 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'societe',
'creer'));
1109} elseif ($user->hasRight(
'societe',
'creer')) {
1110 $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);
1111 $label =
'MenuNewCustomer';
1112 $newcardbutton =
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', $url);
1115print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'" name="formfilter" autocomplete="off">'.
"\n";
1116if ($optioncss !=
'') {
1117 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1119print
'<input type="hidden" name="token" value="'.newToken().
'">';
1120print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1121print
'<input type="hidden" name="action" value="list">';
1122print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1123print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1125print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1126if (!empty($place)) {
1127 print
'<input type="hidden" name="place" value="'.$place.
'">';
1129print
'<input type="hidden" name="page_y" value="">';
1130print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1131if (empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1132 print
'<input type="hidden" name="type" value="'.$type.
'">';
1134if (!empty($place)) {
1135 print
'<input type="hidden" name="place" value="'.$place.
'">';
1138print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'building', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1140$langs->load(
"other");
1141$textprofid = array();
1142foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1143 $label = $langs->transnoentities(
"ProfId".$key.$mysoc->country_code);
1144 $textprofid[$key] =
'';
1145 if ($label !=
"ProfId".$key.$mysoc->country_code) {
1146 if (preg_match(
'/\((.*)\)/i', $label, $reg)) {
1149 $textprofid[$key] = $langs->trans(
"ProfIdShortDesc", $key, $mysoc->country_code, $label);
1154$topicmail =
"Information";
1155$modelmail =
"thirdparty";
1157$trackid =
'thi'.$object->id;
1158include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1162 foreach ($fieldstosearchall as $key => $val) {
1163 $fieldstosearchall[$key] = $langs->trans($val);
1164 $setupstring .= $key.
"=".$val.
";";
1166 print
'<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1167 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
1171if (empty($type) || $type ==
'c' || $type ==
'p') {
1172 if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1173 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1174 $moreforfilter .=
'<div class="divsearchfield">';
1175 $tmptitle = $langs->trans(
'Categories');
1176 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1177 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $langs->trans(
'CustomersProspectsCategoriesShort'));
1178 $moreforfilter .=
'</div>';
1182if (empty($type) || $type ==
'f') {
1183 if (isModEnabled(
"fournisseur") && isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1184 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1185 $moreforfilter .=
'<div class="divsearchfield">';
1186 $tmptitle = $langs->trans(
'Categories');
1187 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
1188 $moreforfilter .= $formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $langs->trans(
'SuppliersCategoriesShort'));
1189 $moreforfilter .=
'</div>';
1194if ($user->hasRight(
"societe",
"client",
"voir") || $socid) {
1195 $moreforfilter .=
'<div class="divsearchfield">';
1196 $tmptitle = $langs->trans(
'SalesRepresentatives');
1197 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"');
1198 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $langs->trans(
'SalesRepresentatives'), ($conf->dol_optimize_smallscreen ?
'maxwidth200' :
'maxwidth300'), 1);
1199 $moreforfilter .=
'</div>';
1201if (!empty($moreforfilter)) {
1202 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1203 print $moreforfilter;
1204 $parameters = array(
'type'=>$type);
1205 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1206 print $hookmanager->resPrint;
1210$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1211$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1213$selectedfields .= ((count($arrayofmassactions) && $contextpage !=
'poslist') ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1215print
'<div class="div-table-responsive">';
1216print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1220print
'<tr class="liste_titre_filter">';
1223 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
1224 $searchpicto = $form->showFilterButtons(
'left');
1228if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1229 print
'<td class="liste_titre" data-key="id">';
1230 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1233if (!empty($arrayfields[
's.nom'][
'checked'])) {
1234 print
'<td class="liste_titre" data-key="ref">';
1235 if (!empty($search_nom_only) && empty($search_nom)) {
1236 $search_nom = $search_nom_only;
1238 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).
'">';
1241if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1242 print
'<td class="liste_titre">';
1243 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).
'">';
1247if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1248 print
'<td class="liste_titre">';
1249 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).
'">';
1253if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1254 print
'<td class="liste_titre">';
1255 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).
'">';
1259if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1260 print
'<td class="liste_titre">';
1261 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).
'">';
1265if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1267 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).
'">';
1271if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1272 print
'<td class="liste_titre">';
1273 print
'<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).
'">';
1277if (!empty($arrayfields[
's.address'][
'checked'])) {
1278 print
'<td class="liste_titre">';
1279 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).
'">';
1283if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1284 print
'<td class="liste_titre">';
1288if (!empty($arrayfields[
's.zip'][
'checked'])) {
1289 print
'<td class="liste_titre">';
1290 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'">';
1294if (!empty($arrayfields[
's.town'][
'checked'])) {
1295 print
'<td class="liste_titre">';
1296 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'">';
1300if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1301 print
'<td class="liste_titre">';
1302 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1306if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1307 print
'<td class="liste_titre">';
1308 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).
'">';
1312if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1313 print
'<td class="liste_titre center">';
1314 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1318if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1319 print
'<td class="liste_titre maxwidthonsmartphone center">';
1321 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'minwidth50 maxwidth125', 1);
1325if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1326 print
'<td class="liste_titre">';
1327 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).
'">';
1331if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1332 print
'<td class="liste_titre maxwidthonsmartphone center">';
1333 print $form->selectarray(
"search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100', 1);
1336if (!empty($arrayfields[
's.email'][
'checked'])) {
1338 print
'<td class="liste_titre">';
1339 print
'<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1342if (!empty($arrayfields[
's.phone'][
'checked'])) {
1344 print
'<td class="liste_titre">';
1345 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1348if (!empty($arrayfields[
's.fax'][
'checked'])) {
1350 print
'<td class="liste_titre">';
1351 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).
'">';
1354if (!empty($arrayfields[
's.url'][
'checked'])) {
1356 print
'<td class="liste_titre">';
1357 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).
'">';
1360if (!empty($arrayfields[
's.siren'][
'checked'])) {
1362 print
'<td class="liste_titre">';
1363 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).
'">';
1366if (!empty($arrayfields[
's.siret'][
'checked'])) {
1368 print
'<td class="liste_titre">';
1369 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).
'">';
1372if (!empty($arrayfields[
's.ape'][
'checked'])) {
1374 print
'<td class="liste_titre">';
1375 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).
'">';
1378if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1380 print
'<td class="liste_titre">';
1381 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).
'">';
1384if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1386 print
'<td class="liste_titre">';
1387 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).
'">';
1390if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1392 print
'<td class="liste_titre">';
1393 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).
'">';
1396if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1398 print
'<td class="liste_titre">';
1399 print
'<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).
'">';
1404if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1405 print
'<td class="liste_titre maxwidthonsmartphone center">';
1407 print
'<input type="hidden" name="type" value="'.$type.
'">';
1409 print $formcompany->selectProspectCustomerType($search_type,
'search_type',
'search_type',
'list');
1413if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1414 print
'<td class="liste_titre center">';
1415 print $form->multiselectarray(
'search_level', $tab_level, $search_level, 0, 0,
'width75', 0, 0,
'',
'',
'', 2);
1419if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1420 print
'<td class="liste_titre maxwidthonsmartphone center">';
1421 $arraystcomm = array();
1422 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1423 $arraystcomm[$val[
'id']] = ($langs->trans(
"StatusProspect".$val[
'id']) !=
"StatusProspect".$val[
'id'] ? $langs->trans(
"StatusProspect".$val[
'id']) : $val[
'label']);
1426 print $form->multiselectarray(
'search_stcomm', $arraystcomm, $search_stcomm, 0, 0,
'width100', 0, 0,
'',
'',
'', 2);
1429if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1430 print
'<td class="liste_titre center">';
1431 print
'<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1435include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1438$parameters = array(
'arrayfields'=>$arrayfields);
1439$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1440print $hookmanager->resPrint;
1442if (!empty($arrayfields[
's.datec'][
'checked'])) {
1443 print
'<td class="liste_titre center nowraponall">';
1444 print
'<div class="nowrapfordate">';
1445 print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1447 print
'<div class="nowrapfordate">';
1448 print $form->selectDate($search_date_creation_end ? $search_date_creation_end : -1,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1453if (!empty($arrayfields[
's.tms'][
'checked'])) {
1454 print
'<td class="liste_titre center nowraponall">';
1455 print
'<div class="nowrapfordate">';
1456 print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1,
'search_date_modif_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1458 print
'<div class="nowrapfordate">';
1459 print $form->selectDate($search_date_modif_end ? $search_date_modif_end : -1,
'search_date_modif_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1464if (!empty($arrayfields[
's.status'][
'checked'])) {
1465 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
1466 print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'ActivityCeased'),
'1'=>$langs->trans(
'InActivity')), $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1469if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1470 print
'<td class="liste_titre center">';
1471 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1476 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1477 $searchpicto = $form->showFilterButtons();
1484$totalarray = array();
1485$totalarray[
'nbfield'] = 0;
1489print
'<tr class="liste_titre">';
1492 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1493 $totalarray[
'nbfield']++;
1495if (!empty($arrayfields[
's.rowid'][
'checked'])) {
1496 print_liste_field_titre($arrayfields[
's.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"s.rowid",
"", $param,
' data-key="id"', $sortfield, $sortorder,
'');
1497 $totalarray[
'nbfield']++;
1499if (!empty($arrayfields[
's.nom'][
'checked'])) {
1500 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
' data-key="ref"', $sortfield, $sortorder,
' ');
1501 $totalarray[
'nbfield']++;
1503if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1504 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1505 $totalarray[
'nbfield']++;
1507if (!empty($arrayfields[
's.barcode'][
'checked'])) {
1508 print_liste_field_titre($arrayfields[
's.barcode'][
'label'], $_SERVER[
"PHP_SELF"],
"s.barcode", $param,
'',
'', $sortfield, $sortorder);
1509 $totalarray[
'nbfield']++;
1511if (!empty($arrayfields[
's.code_client'][
'checked'])) {
1512 print_liste_field_titre($arrayfields[
's.code_client'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_client",
"", $param,
'', $sortfield, $sortorder);
1513 $totalarray[
'nbfield']++;
1515if (!empty($arrayfields[
's.code_fournisseur'][
'checked'])) {
1516 print_liste_field_titre($arrayfields[
's.code_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1517 $totalarray[
'nbfield']++;
1519if (!empty($arrayfields[
's.code_compta'][
'checked'])) {
1520 print_liste_field_titre($arrayfields[
's.code_compta'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta",
"", $param,
'', $sortfield, $sortorder);
1521 $totalarray[
'nbfield']++;
1523if (!empty($arrayfields[
's.code_compta_fournisseur'][
'checked'])) {
1524 print_liste_field_titre($arrayfields[
's.code_compta_fournisseur'][
'label'], $_SERVER[
"PHP_SELF"],
"s.code_compta_fournisseur",
"", $param,
'', $sortfield, $sortorder);
1525 $totalarray[
'nbfield']++;
1527if (!empty($arrayfields[
's.address'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
's.address'][
'label'], $_SERVER[
'PHP_SELF'],
's.address',
'', $param,
'', $sortfield, $sortorder);
1529 $totalarray[
'nbfield']++;
1531if (!empty($arrayfields[
'sales.representative'][
'checked'])) {
1532 print_liste_field_titre($arrayfields[
'sales.representative'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1533 $totalarray[
'nbfield']++;
1535if (!empty($arrayfields[
's.zip'][
'checked'])) {
1536 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
"s.zip",
"", $param,
'', $sortfield, $sortorder);
1537 $totalarray[
'nbfield']++;
1539if (!empty($arrayfields[
's.town'][
'checked'])) {
1540 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
"s.town",
"", $param,
'', $sortfield, $sortorder);
1541 $totalarray[
'nbfield']++;
1543if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1544 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1545 $totalarray[
'nbfield']++;
1547if (!empty($arrayfields[
'region.nom'][
'checked'])) {
1548 print_liste_field_titre($arrayfields[
'region.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"region.nom",
"", $param,
'', $sortfield, $sortorder);
1549 $totalarray[
'nbfield']++;
1551if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1552 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1553 $totalarray[
'nbfield']++;
1555if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1556 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
"", $sortfield, $sortorder,
'center ');
1557 $totalarray[
'nbfield']++;
1559if (!empty($arrayfields[
'staff.code'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'staff.code'][
'label'], $_SERVER[
"PHP_SELF"],
"staff.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1561 $totalarray[
'nbfield']++;
1563if (!empty($arrayfields[
's.price_level'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
's.price_level'][
'label'], $_SERVER[
"PHP_SELF"],
"s.price_level",
"", $param,
'', $sortfield, $sortorder);
1565 $totalarray[
'nbfield']++;
1567if (!empty($arrayfields[
's.email'][
'checked'])) {
1568 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1569 $totalarray[
'nbfield']++;
1571if (!empty($arrayfields[
's.phone'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1573 $totalarray[
'nbfield']++;
1575if (!empty($arrayfields[
's.fax'][
'checked'])) {
1576 print_liste_field_titre($arrayfields[
's.fax'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fax",
"", $param,
'', $sortfield, $sortorder);
1577 $totalarray[
'nbfield']++;
1579if (!empty($arrayfields[
's.url'][
'checked'])) {
1580 print_liste_field_titre($arrayfields[
's.url'][
'label'], $_SERVER[
"PHP_SELF"],
"s.url",
"", $param,
'', $sortfield, $sortorder);
1581 $totalarray[
'nbfield']++;
1583if (!empty($arrayfields[
's.siren'][
'checked'])) {
1584 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId1Short"), $textprofid[1], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siren",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1585 $totalarray[
'nbfield']++;
1587if (!empty($arrayfields[
's.siret'][
'checked'])) {
1588 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId2Short"), $textprofid[2], 1, 0), $_SERVER[
"PHP_SELF"],
"s.siret",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1589 $totalarray[
'nbfield']++;
1591if (!empty($arrayfields[
's.ape'][
'checked'])) {
1592 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId3Short"), $textprofid[3], 1, 0), $_SERVER[
"PHP_SELF"],
"s.ape",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1593 $totalarray[
'nbfield']++;
1595if (!empty($arrayfields[
's.idprof4'][
'checked'])) {
1596 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId4Short"), $textprofid[4], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof4",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1597 $totalarray[
'nbfield']++;
1599if (!empty($arrayfields[
's.idprof5'][
'checked'])) {
1600 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId5Short"), $textprofid[5], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof5",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1601 $totalarray[
'nbfield']++;
1603if (!empty($arrayfields[
's.idprof6'][
'checked'])) {
1604 print_liste_field_titre($form->textwithpicto($langs->trans(
"ProfId6Short"), $textprofid[6], 1, 0), $_SERVER[
"PHP_SELF"],
"s.idprof6",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1605 $totalarray[
'nbfield']++;
1607if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
1608 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder,
'nowrap ');
1609 $totalarray[
'nbfield']++;
1611if (!empty($arrayfields[
'customerorsupplier'][
'checked'])) {
1612 print_liste_field_titre($arrayfields[
'customerorsupplier'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1613 $totalarray[
'nbfield']++;
1615if (!empty($arrayfields[
's.fk_prospectlevel'][
'checked'])) {
1616 print_liste_field_titre($arrayfields[
's.fk_prospectlevel'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_prospectlevel",
"", $param,
'', $sortfield, $sortorder,
'center ');
1617 $totalarray[
'nbfield']++;
1619if (!empty($arrayfields[
's.fk_stcomm'][
'checked'])) {
1620 print_liste_field_titre($arrayfields[
's.fk_stcomm'][
'label'], $_SERVER[
"PHP_SELF"],
"s.fk_stcomm",
"", $param,
'', $sortfield, $sortorder,
'center ');
1621 $totalarray[
'nbfield']++;
1623if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1624 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s2.nom",
"", $param,
'', $sortfield, $sortorder,
'center ');
1625 $totalarray[
'nbfield']++;
1628include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1630$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1631$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1632print $hookmanager->resPrint;
1633if (!empty($arrayfields[
's.datec'][
'checked'])) {
1634 print_liste_field_titre($arrayfields[
's.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"s.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1635 $totalarray[
'nbfield']++;
1637if (!empty($arrayfields[
's.tms'][
'checked'])) {
1638 print_liste_field_titre($arrayfields[
's.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1639 $totalarray[
'nbfield']++;
1641if (!empty($arrayfields[
's.status'][
'checked'])) {
1642 print_liste_field_titre($arrayfields[
's.status'][
'label'], $_SERVER[
"PHP_SELF"],
"s.status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1643 $totalarray[
'nbfield']++;
1645if (!empty($arrayfields[
's.import_key'][
'checked'])) {
1646 print_liste_field_titre($arrayfields[
's.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"s.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1647 $totalarray[
'nbfield']++;
1651 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1652 $totalarray[
'nbfield']++;
1660$savnbfield = $totalarray[
'nbfield'];
1661$totalarray = array();
1662$totalarray[
'nbfield'] = 0;
1663$imaxinloop = ($limit ? min($num, $limit) : $num);
1664while ($i < $imaxinloop) {
1665 $obj = $db->fetch_object($resql);
1670 $parameters = array(
'staticdata' => $obj);
1673 $reshook = $hookmanager->executeHooks(
'loadStaticObject', $parameters, $companystatic, $action);
1674 if (empty($reshook)) {
1675 $companystatic->id = $obj->rowid;
1676 $companystatic->name = $obj->name;
1677 $companystatic->name_alias = $obj->name_alias;
1678 $companystatic->logo = $obj->logo;
1679 $companystatic->barcode = $obj->barcode;
1680 $companystatic->canvas = $obj->canvas;
1681 $companystatic->client = $obj->client;
1682 $companystatic->status = $obj->status;
1683 $companystatic->email = $obj->email;
1684 $companystatic->address = $obj->address;
1685 $companystatic->zip = $obj->zip;
1686 $companystatic->town = $obj->town;
1687 $companystatic->fournisseur = $obj->fournisseur;
1688 $companystatic->code_client = $obj->code_client;
1689 $companystatic->code_fournisseur = $obj->code_fournisseur;
1690 $companystatic->tva_intra = $obj->tva_intra;
1691 $companystatic->country_code = $obj->country_code;
1693 $companystatic->code_compta_client = $obj->code_compta;
1694 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1696 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1697 $companystatic->parent = $obj->fk_parent;
1698 $companystatic->entity = $obj->entity;
1701 if ($mode ==
'kanban') {
1703 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1704 print
'<div class="box-flex-container kanban">';
1707 print $companystatic->getKanbanView(
'', array(
'selected' => in_array($obj->rowid, $arrayofselected)));
1708 if ($i == ($imaxinloop - 1)) {
1715 print
'<tr data-rowid="'.$object->id.
'" class="oddeven"';
1716 if ($contextpage ==
'poslist') {
1717 print
' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.
'&place='.urlencode($place).
'\'"';
1721 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1722 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1723 print '<td class="nowrap center actioncolumn
">';
1724 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
1726 if (in_array($obj->rowid, $arrayofselected)) {
1729 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
1733 $totalarray['nbfield']++;
1736 if (!empty($arrayfields['s.rowid']['checked'])) {
1737 print '<td class="tdoverflowmax50
" data-key="id">';
1741 $totalarray['nbfield']++;
1744 if (!empty($arrayfields['s.nom']['checked'])) {
1745 print '<td'.(!getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? ' class="tdoverflowmax200
"' : '').' data-key="ref">';
1746 if ($contextpage == 'poslist') {
1747 print dol_escape_htmltag($companystatic->name);
1749 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1753 $totalarray['nbfield']++;
1756 if (!empty($arrayfields['s.name_alias']['checked'])) {
1757 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1758 print dol_escape_htmltag($companystatic->name_alias);
1761 $totalarray['nbfield']++;
1765 if (!empty($arrayfields['s.barcode']['checked'])) {
1766 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
1768 $totalarray['nbfield']++;
1772 if (!empty($arrayfields['s.code_client']['checked'])) {
1773 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_client).'</td>';
1775 $totalarray['nbfield']++;
1779 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1780 print '<td class="nowraponall
">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
1782 $totalarray['nbfield']++;
1785 // Account customer code
1786 if (!empty($arrayfields['s.code_compta']['checked'])) {
1787 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
1789 $totalarray['nbfield']++;
1792 // Account supplier code
1793 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1794 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
1796 $totalarray['nbfield']++;
1800 if (!empty($arrayfields['s.address']['checked'])) {
1801 print '<td class="tdoverflowmax250
" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
1803 $totalarray['nbfield']++;
1806 // Sales Representative
1807 if (!empty($arrayfields['sales.representative']['checked'])) {
1808 print '<td class="nowraponall tdoverflowmax200
">';
1809 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1810 $nbofsalesrepresentative = count($listsalesrepresentatives);
1811 if ($nbofsalesrepresentative > 6) {
1812 // We print only number
1813 print $nbofsalesrepresentative;
1814 } elseif ($nbofsalesrepresentative > 0) {
1815 $userstatic = new User($db);
1817 foreach ($listsalesrepresentatives as $val) {
1818 $userstatic->id = $val['id'];
1819 $userstatic->lastname = $val['lastname'];
1820 $userstatic->firstname = $val['firstname'];
1821 $userstatic->email = $val['email'];
1822 $userstatic->entity = $val['entity'];
1823 $userstatic->photo = $val['photo'];
1824 $userstatic->login = $val['login'];
1825 $userstatic->office_phone = $val['office_phone'];
1826 $userstatic->office_fax = $val['office_fax'];
1827 $userstatic->user_mobile = $val['user_mobile'];
1828 $userstatic->job = $val['job'];
1829 $userstatic->gender = $val['gender'];
1830 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
1832 if ($j < $nbofsalesrepresentative) {
1841 $totalarray['nbfield']++;
1845 if (!empty($arrayfields['s.zip']['checked'])) {
1846 print "<td>
".dol_escape_htmltag($companystatic->zip)."</td>\n
";
1848 $totalarray['nbfield']++;
1852 if (!empty($arrayfields['s.town']['checked'])) {
1853 print '<td class="tdoverflowmax150
" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n
";
1855 $totalarray['nbfield']++;
1859 if (!empty($arrayfields['state.nom']['checked'])) {
1860 print "<td>
".dol_escape_htmltag($obj->state_name)."</td>\n
";
1862 $totalarray['nbfield']++;
1866 if (!empty($arrayfields['region.nom']['checked'])) {
1867 print "<td>
".dol_escape_htmltag($obj->region_name)."</td>\n
";
1869 $totalarray['nbfield']++;
1873 if (!empty($arrayfields['country.code_iso']['checked'])) {
1874 print '<td class="center tdoverflowmax100
">';
1875 $labelcountry = ($companystatic->country_code && ($langs->trans("Country
".$companystatic->country_code) != "Country
".$companystatic->country_code)) ? $langs->trans("Country
".$companystatic->country_code) : $obj->country_label;
1876 print $labelcountry;
1879 $totalarray['nbfield']++;
1883 if (!empty($arrayfields['typent.code']['checked'])) {
1884 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1885 $typenArray = $formcompany->typent_array(1);
1887 $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1889 print '<td class="center tdoverflowmax125
" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1890 print dol_escape_htmltag($labeltypeofcompany);
1893 $totalarray['nbfield']++;
1897 if (!empty($arrayfields['s.price_level']['checked'])) {
1898 print '<td class="center
">'.$obj->price_level."</td>\n
";
1900 $totalarray['nbfield']++;
1904 if (!empty($arrayfields['staff.code']['checked'])) {
1905 print '<td class="center
">';
1906 if (!empty($obj->staff_code)) {
1907 if (empty($conf->cache['staffArray'])) {
1908 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
1910 print $conf->cache['staffArray'][$obj->staff_code];
1914 $totalarray['nbfield']++;
1917 if (!empty($arrayfields['s.email']['checked'])) {
1918 print '<td class="tdoverflowmax150
">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n
";
1920 $totalarray['nbfield']++;
1923 if (!empty($arrayfields['s.phone']['checked'])) {
1924 print '<td class="nowraponall
">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n
";
1926 $totalarray['nbfield']++;
1929 if (!empty($arrayfields['s.fax']['checked'])) {
1930 print '<td class="nowraponall
">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n
";
1932 $totalarray['nbfield']++;
1935 if (!empty($arrayfields['s.url']['checked'])) {
1936 print "<td>
".dol_print_url($obj->url, '', '', 1)."</td>\n
";
1938 $totalarray['nbfield']++;
1941 if (!empty($arrayfields['s.siren']['checked'])) {
1942 print "<td>
".$obj->idprof1."</td>\n
";
1944 $totalarray['nbfield']++;
1947 if (!empty($arrayfields['s.siret']['checked'])) {
1948 print "<td>
".$obj->idprof2."</td>\n
";
1950 $totalarray['nbfield']++;
1953 if (!empty($arrayfields['s.ape']['checked'])) {
1954 print "<td>
".$obj->idprof3."</td>\n
";
1956 $totalarray['nbfield']++;
1959 if (!empty($arrayfields['s.idprof4']['checked'])) {
1960 print "<td>
".$obj->idprof4."</td>\n
";
1962 $totalarray['nbfield']++;
1965 if (!empty($arrayfields['s.idprof5']['checked'])) {
1966 print "<td>
".$obj->idprof5."</td>\n
";
1968 $totalarray['nbfield']++;
1971 if (!empty($arrayfields['s.idprof6']['checked'])) {
1972 print "<td>
".$obj->idprof6."</td>\n
";
1974 $totalarray['nbfield']++;
1978 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1979 print '<td class="tdoverflowmax125
" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
1980 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
1981 print img_warning("BadVATNumber
", '', 'pictofixedwidth');
1983 print $companystatic->tva_intra;
1986 $totalarray['nbfield']++;
1990 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1991 print '<td class="center
">';
1992 print $companystatic->getTypeUrl(1);
1995 $totalarray['nbfield']++;
1999 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2000 print '<td class="center nowraponall
">';
2001 print $companystatic->getLibProspLevel();
2004 $totalarray['nbfield']++;
2008 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2009 print '<td class="center nowraponall
">';
2011 $prospectid = $obj->rowid;
2012 $statusprospect = $obj->stcomm_id;
2014 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2018 $totalarray['nbfield']++;
2022 if (!empty($arrayfields['s2.nom']['checked'])) {
2023 print '<td class="center tdoverflowmax100
">';
2024 if ($companystatic->parent > 0) {
2025 $companyparent->fetch($companystatic->parent);
2026 print $companyparent->getNomUrl(1);
2030 $totalarray['nbfield']++;
2034 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2036 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
2037 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2038 print $hookmanager->resPrint;
2040 if (!empty($arrayfields['s.datec']['checked'])) {
2041 print '<td class="center nowraponall
">';
2042 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2045 $totalarray['nbfield']++;
2048 // Date modification
2049 if (!empty($arrayfields['s.tms']['checked'])) {
2050 print '<td class="center nowraponall
">';
2051 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
2054 $totalarray['nbfield']++;
2058 if (!empty($arrayfields['s.status']['checked'])) {
2059 print '<td class="center nowraponall
">'.$companystatic->getLibStatut(5).'</td>';
2061 $totalarray['nbfield']++;
2065 if (!empty($arrayfields['s.import_key']['checked'])) {
2066 print '<td class="tdoverflowmax100
" title="'.dol_escape_htmltag($obj->import_key).'">';
2067 print dol_escape_htmltag($obj->import_key);
2070 $totalarray['nbfield']++;
2073 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
2074 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2075 print '<td class="nowrap center actioncolumn
">';
2076 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
2078 if (in_array($obj->rowid, $arrayofselected)) {
2081 print '<input id="cb
'.$obj->rowid.'" class="flat checkforselect
" type="checkbox
" name="toselect[]
" value="'.$obj->rowid.'"'.($selected ? ' checked="checked
"' : '').'>';
2085 $totalarray['nbfield']++;
2095include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2097// If no record found
2100 foreach ($arrayfields as $key => $val) {
2101 if (!empty($val['checked'])) {
2105 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium
">'.$langs->trans("NoRecordFound
").'</span></td></tr>';
2110$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
2111$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2112print $hookmanager->resPrint;
2114print '</table>'."\n
";
2117// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2118$formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js
");
2120print '</form>'."\n
";
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...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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...
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.