dolibarr 21.0.0-beta
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2019 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
6 * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
8 * Copyright (C) 2016-2024 Josep Lluis Amador <joseplluis@lliuretic.cat>
9 * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
10 * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
11 * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
12 * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
13 * Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
14 * Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
15 * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
16 * Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
17 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
18 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
19 * Copyright (C) 2024 Nick Fragoulis
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 3 of the License, or
24 * (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program. If not, see <https://www.gnu.org/licenses/>.
33 */
34
41// Load Dolibarr environment
42require_once '../main.inc.php';
43include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
48require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
49if (isModEnabled('category')) {
50 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
51 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
52}
53
63// Load translation files required by the page
64$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk"));
65
66
67// Get parameters
68$action = GETPOST('action', 'aZ09');
69$massaction = GETPOST('massaction', 'alpha');
70$show_files = GETPOSTINT('show_files');
71$confirm = GETPOST('confirm', 'alpha');
72$toselect = GETPOST('toselect', 'array');
73$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'thirdpartylist';
74$optioncss = GETPOST('optioncss', 'alpha');
75if ($contextpage == 'poslist') {
76 $optioncss = 'print';
77}
78$mode = GETPOST("mode", 'alpha');
79
80// search fields
81$search_all = trim(GETPOST('search_all', 'alphanohtml'));
82$search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
83
84$search_id = GETPOST("search_id", 'int');
85$search_nom = trim(GETPOST("search_nom", 'restricthtml'));
86$search_alias = trim(GETPOST("search_alias", 'restricthtml'));
87$search_nom_only = trim(GETPOST("search_nom_only", 'restricthtml'));
88$search_barcode = trim(GETPOST("search_barcode", 'alpha'));
89$search_customer_code = trim(GETPOST('search_customer_code', 'alpha'));
90$search_supplier_code = trim(GETPOST('search_supplier_code', 'alpha'));
91$search_account_customer_code = trim(GETPOST('search_account_customer_code', 'alpha'));
92$search_account_supplier_code = trim(GETPOST('search_account_supplier_code', 'alpha'));
93$search_address = trim(GETPOST('search_address', 'alpha'));
94$search_zip = trim(GETPOST("search_zip", 'alpha'));
95$search_town = trim(GETPOST("search_town", 'alpha'));
96$search_state = trim(GETPOST("search_state", 'alpha'));
97$search_region = trim(GETPOST("search_region", 'alpha'));
98$search_email = trim(GETPOST('search_email', 'alpha'));
99$search_phone = trim(GETPOST('search_phone', 'alpha'));
100$search_phone_mobile = trim(GETPOST('search_phone_mobile', 'alpha'));
101$search_fax = trim(GETPOST('search_fax', 'alpha'));
102$search_url = trim(GETPOST('search_url', 'alpha'));
103$search_idprof1 = trim(GETPOST('search_idprof1', 'alpha'));
104$search_idprof2 = trim(GETPOST('search_idprof2', 'alpha'));
105$search_idprof3 = trim(GETPOST('search_idprof3', 'alpha'));
106$search_idprof4 = trim(GETPOST('search_idprof4', 'alpha'));
107$search_idprof5 = trim(GETPOST('search_idprof5', 'alpha'));
108$search_idprof6 = trim(GETPOST('search_idprof6', 'alpha'));
109$search_vat = trim(GETPOST('search_vat', 'alpha'));
110$search_sale = "";
111if (GETPOSTISARRAY('search_sale')) {
112 $search_sale = GETPOST('search_sale', 'array:int');
113} elseif (GETPOSTISSET('search_sale')) {
114 $search_sale = array(GETPOSTINT('search_sale'));
115}
116$search_categ_cus = GETPOSTINT("search_categ_cus");
117$search_categ_sup = GETPOSTINT("search_categ_sup");
118$searchCategoryCustomerOperator = GETPOSTINT('search_category_customer_operator');
119$searchCategorySupplierOperator = GETPOSTINT('search_category_supplier_operator');
120if (GETPOSTISSET('formfilteraction')) {
121 $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator');
122 $searchCategorySupplierOperator = GETPOST('search_category_supplier_operator');
123} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) {
124 $searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
125 $searchCategorySupplierOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
126}
127$searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array');
128if (!empty($search_categ_cus) && empty($searchCategoryCustomerList)) {
129 $searchCategoryCustomerList = array($search_categ_cus);
130}
131$searchCategorySupplierList = GETPOST('search_category_supplier_list', 'array');
132if (!empty($search_categ_sup) && empty($searchCategorySupplierList)) {
133 $searchCategorySupplierList = array($search_categ_sup);
134}
135$search_country = GETPOST("search_country", 'aZ09');
136$search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma');
137$search_price_level = GETPOST('search_price_level', 'int');
138$search_staff = GETPOST("search_staff", 'int');
139$search_legalform = GETPOST("search_legalform", 'int');
140$search_status = GETPOST("search_status", 'intcomma');
141$search_type = GETPOST('search_type', 'alpha');
142$search_level = GETPOST("search_level", "array:alpha");
143$search_stcomm = GETPOST('search_stcomm', "array:int");
144$search_import_key = trim(GETPOST("search_import_key", "alpha"));
145$search_parent_name = trim(GETPOST('search_parent_name', 'alpha'));
146
147$search_date_creation_startmonth = GETPOSTINT('search_date_creation_startmonth');
148$search_date_creation_startyear = GETPOSTINT('search_date_creation_startyear');
149$search_date_creation_startday = GETPOSTINT('search_date_creation_startday');
150$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear); // Use tzserver
151$search_date_creation_endmonth = GETPOSTINT('search_date_creation_endmonth');
152$search_date_creation_endyear = GETPOSTINT('search_date_creation_endyear');
153$search_date_creation_endday = GETPOSTINT('search_date_creation_endday');
154$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear); // Use tzserver
155
156$search_date_modif_startmonth = GETPOSTINT('search_date_modif_startmonth');
157$search_date_modif_startyear = GETPOSTINT('search_date_modif_startyear');
158$search_date_modif_startday = GETPOSTINT('search_date_modif_startday');
159$search_date_modif_start = dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear); // Use tzserver
160$search_date_modif_endmonth = GETPOSTINT('search_date_modif_endmonth');
161$search_date_modif_endyear = GETPOSTINT('search_date_modif_endyear');
162$search_date_modif_endday = GETPOSTINT('search_date_modif_endday');
163$search_date_modif_end = dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear); // Use tzserver
164
165$type = GETPOST('type', 'alpha');
166$place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant
167
168$diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id;
169
170// Load variable for pagination
171$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
172$sortfield = GETPOST('sortfield', 'aZ09comma');
173$sortorder = GETPOST('sortorder', 'aZ09comma');
174$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
175if (!$sortorder) {
176 $sortorder = "ASC";
177}
178if (!$sortfield) {
179 $sortfield = "s.nom";
180}
181if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
182 // If $page is not defined, or '' or -1 or if we click on clear filters
183 $page = 0;
184}
185$offset = $limit * $page;
186$pageprev = $page - 1;
187$pagenext = $page + 1;
188
189if ($type == 'c') {
190 if (empty($contextpage) || $contextpage == 'thirdpartylist') {
191 $contextpage = 'customerlist';
192 }
193 if ($search_type == '') {
194 $search_type = '1,3';
195 }
196}
197if ($type == 'p') {
198 if (empty($contextpage) || $contextpage == 'thirdpartylist') {
199 $contextpage = 'prospectlist';
200 }
201 if ($search_type == '') {
202 $search_type = '2,3';
203 }
204}
205if ($type == 't') {
206 if (empty($contextpage) || $contextpage == 'poslist') {
207 $contextpage = 'poslist';
208 }
209 if ($search_type == '') {
210 $search_type = '1,2,3';
211 }
212}
213if ($type == 'f') {
214 if (empty($contextpage) || $contextpage == 'thirdpartylist') {
215 $contextpage = 'supplierlist';
216 }
217 if ($search_type == '') {
218 $search_type = '4';
219 }
220}
221// Initialize a technical objects to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
222$object = new Societe($db);
223$extrafields = new ExtraFields($db);
224$hookmanager->initHooks(array($contextpage, 'thirdpartylist'));
225
226// Fetch optionals attributes and labels
227$extrafields->fetch_name_optionals_label($object->table_element);
228
229$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
230
231// List of fields to search into when doing a "search in all"
232$fieldstosearchall = array(
233 's.nom' => "ThirdPartyName",
234 's.name_alias' => "AliasNameShort",
235 's.code_client' => "CustomerCode",
236 's.code_fournisseur' => "SupplierCode",
237 's.code_compta' => "CustomerAccountancyCodeShort",
238 's.code_compta_fournisseur' => "SupplierAccountancyCodeShort",
239 's.zip' => "Zip",
240 's.town' => "Town",
241 's.email' => "EMail",
242 's.url' => "URL",
243 's.tva_intra' => "VATIntra",
244 's.siren' => "ProfId1",
245 's.siret' => "ProfId2",
246 's.ape' => "ProfId3",
247 's.phone' => "Phone",
248 's.phone_mobile' => "PhoneMobile",
249 's.fax' => "Fax",
250);
251if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') {
252 $fieldstosearchall['s.idprof4'] = 'ProfId4';
253}
254if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') {
255 $fieldstosearchall['s.idprof5'] = 'ProfId5';
256}
257if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') {
258 $fieldstosearchall['s.idprof6'] = 'ProfId6';
259}
260if (isModEnabled('barcode')) {
261 $fieldstosearchall['s.barcode'] = 'Gencod';
262}
263// Personalized search criteria. Example: $conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS = 's.nom=ThirdPartyName;s.name_alias=AliasNameShort;s.code_client=CustomerCode'
264if (getDolGlobalString('THIRDPARTY_QUICKSEARCH_ON_FIELDS')) {
265 $fieldstosearchall = dolExplodeIntoArray($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS);
266}
267
268
269// Define list of fields to show into list
270$checkedcustomercode = (in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0);
271$checkedsuppliercode = (in_array($contextpage, array('supplierlist')) ? 1 : 0);
272$checkedcustomeraccountcode = (in_array($contextpage, array('customerlist')) ? 1 : 0);
273$checkedsupplieraccountcode = (in_array($contextpage, array('supplierlist')) ? 1 : 0);
274$checkedtypetiers = 1;
275$checkedprofid1 = 0;
276$checkedprofid2 = 0;
277$checkedprofid3 = 0;
278$checkedprofid4 = 0;
279$checkedprofid5 = 0;
280$checkedprofid6 = 0;
281//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
282//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
283//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
284$checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
285$checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
286$arrayfields = array(
287 's.rowid' => array('label' => "TechnicalID", 'position' => 1, 'checked' => -1, 'enabled' => 1),
288 's.nom' => array('label' => "ThirdPartyName", 'position' => 2, 'checked' => 1),
289 's.name_alias' => array('label' => "AliasNameShort", 'position' => 3, 'checked' => 1),
290 's.barcode' => array('label' => "Gencod", 'position' => 5, 'checked' => 1, 'enabled' => (isModEnabled('barcode'))),
291 's.code_client' => array('label' => "CustomerCodeShort", 'position' => 10, 'checked' => $checkedcustomercode),
292 's.code_fournisseur' => array('label' => "SupplierCodeShort", 'position' => 11, 'checked' => $checkedsuppliercode, 'enabled' => (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
293 's.code_compta' => array('label' => "CustomerAccountancyCodeShort", 'position' => 13, 'checked' => $checkedcustomeraccountcode),
294 's.code_compta_fournisseur' => array('label' => "SupplierAccountancyCodeShort", 'position' => 14, 'checked' => $checkedsupplieraccountcode, 'enabled' => (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
295 's.address' => array('label' => "Address", 'position' => 19, 'checked' => 0),
296 's.zip' => array('label' => "Zip", 'position' => 20, 'checked' => 1),
297 's.town' => array('label' => "Town", 'position' => 21, 'checked' => 0),
298 'state.nom' => array('label' => "State", 'position' => 22, 'checked' => 0),
299 'region.nom' => array('label' => "Region", 'position' => 23, 'checked' => 0),
300 'country.code_iso' => array('label' => "Country", 'position' => 24, 'checked' => 0),
301 's.email' => array('label' => "Email", 'position' => 25, 'checked' => 0),
302 's.url' => array('label' => "Url", 'position' => 26, 'checked' => 0),
303 's.phone' => array('label' => "Phone", 'position' => 27, 'checked' => 1),
304 's.fax' => array('label' => "Fax", 'position' => 28, 'checked' => 0),
305 'typent.code' => array('label' => "ThirdPartyType", 'position' => 29, 'checked' => $checkedtypetiers),
306 'staff.code' => array('label' => "Workforce", 'position' => 31, 'checked' => 0),
307 'legalform.code' => array('label' => 'JuridicalStatus', 'position' => 32, 'checked' => 0),
308 's.phone_mobile' => array('label' => "PhoneMobile", 'position' => 35, 'checked' => 0),
309 's.siren' => array('label' => "ProfId1Short", 'position' => 40, 'checked' => $checkedprofid1),
310 's.siret' => array('label' => "ProfId2Short", 'position' => 41, 'checked' => $checkedprofid2),
311 's.ape' => array('label' => "ProfId3Short", 'position' => 42, 'checked' => $checkedprofid3),
312 's.idprof4' => array('label' => "ProfId4Short", 'position' => 43, 'checked' => $checkedprofid4),
313 's.idprof5' => array('label' => "ProfId5Short", 'position' => 44, 'checked' => $checkedprofid5),
314 's.idprof6' => array('label' => "ProfId6Short", 'position' => 45, 'checked' => $checkedprofid6),
315 's.tva_intra' => array('label' => "VATIntraShort", 'position' => 50, 'checked' => 0),
316 'customerorsupplier' => array('label' => 'NatureOfThirdParty', 'position' => 61, 'checked' => 1),
317 's.fk_prospectlevel' => array('label' => "ProspectLevel", 'position' => 62, 'checked' => $checkprospectlevel),
318 's.fk_stcomm' => array('label' => "StatusProsp", 'position' => 63, 'checked' => $checkstcomm),
319 's2.nom' => array('label' => 'ParentCompany', 'position' => 64, 'checked' => 0),
320 's.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
321 's.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500),
322 's.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
323 's.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 521, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
324 's.status' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
325 's.import_key' => array('label' => "ImportId", 'checked' => 0, 'position' => 1100),
326);
327if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
328 $arrayfields['s.price_level'] = array('label' => "PriceLevel", 'position' => 30, 'checked' => 0);
329}
330
331// Add non object fields to fields for list
332$arrayfields['sales.representative'] = array('label' => $langs->trans("SalesRepresentatives"), 'checked' => 1, 'position' => 12);
333
334// Extra fields
335include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
336
337$object->fields = dol_sort_array($object->fields, 'position');
338$arrayfields = dol_sort_array($arrayfields, 'position');
339'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
340
341// Security check
342$socid = GETPOSTINT('socid');
343if ($user->socid) {
344 $socid = $user->socid;
345}
346$result = restrictedArea($user, 'societe', $socid, '');
347
348$permissiontoadd = $user->hasRight('societe', 'lire');
349
350
351/*
352 * Actions
353 */
354
355if ($action == "change" && $user->hasRight('takepos', 'run')) { // Change customer for TakePOS
356 $idcustomer = GETPOSTINT('idcustomer');
357
358 // Check if draft invoice already exists, if not create it
359 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
360 $result = $db->query($sql);
361 $num_lines = $db->num_rows($result);
362 if ($num_lines == 0) {
363 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
364 $invoice = new Facture($db);
365 $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
366 $invoice->socid = getDolGlobalInt($constforthirdpartyid);
367 $invoice->date = dol_now();
368 $invoice->module_source = 'takepos';
369 $invoice->pos_source = $_SESSION["takeposterminal"];
370 $placeid = $invoice->create($user);
371 $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid);
372 $db->query($sql);
373 }
374
375 $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".((int) $idcustomer)." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
376 $resql = $db->query($sql); ?>
377 <script>
378 console.log("Reload page invoice.php with place=<?php print $place; ?>");
379 parent.$("#poslines").load("invoice.php?place=<?php print $place; ?>", function() {
380 //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
381 <?php if (!$resql) { ?>
382 alert('Error failed to update customer on draft invoice.');
383 <?php } ?>
384 parent.$.colorbox.close(); /* Close the popup */
385 });
386 </script>
387 <?php
388 exit;
389}
390
391if (GETPOST('cancel', 'alpha')) {
392 $action = 'list';
393 $massaction = '';
394}
395if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
396 $massaction = '';
397}
398
399$parameters = array('arrayfields' => &$arrayfields);
400$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
401if ($reshook < 0) {
402 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
403}
404
405if (empty($reshook)) {
406 // Selection of new fields
407 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
408
409 // Purge search criteria
410 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
411 $search_id = '';
412 $search_nom = '';
413 $search_alias = '';
414 $search_categ_cus = 0;
415 $search_categ_sup = 0;
416 $searchCategoryCustomerOperator = 0;
417 $searchCategorySupplierOperator = 0;
418 $searchCategoryCustomerList = array();
419 $searchCategorySupplierList = array();
420 $search_sale = '';
421 $search_barcode = "";
422 $search_customer_code = '';
423 $search_supplier_code = '';
424 $search_account_customer_code = '';
425 $search_account_supplier_code = '';
426 $search_address = '';
427 $search_zip = "";
428 $search_town = "";
429 $search_state = "";
430 $search_region = "";
431 $search_country = '';
432 $search_email = '';
433 $search_phone = '';
434 $search_phone_mobile = '';
435 $search_fax = '';
436 $search_url = '';
437 $search_idprof1 = '';
438 $search_idprof2 = '';
439 $search_idprof3 = '';
440 $search_idprof4 = '';
441 $search_idprof5 = '';
442 $search_idprof6 = '';
443 $search_vat = '';
444 $search_type = '';
445 $search_price_level = '';
446 $search_type_thirdparty = '';
447 $search_staff = '';
448 $search_legalform = '';
449 $search_date_creation_startmonth = "";
450 $search_date_creation_startyear = "";
451 $search_date_creation_startday = "";
452 $search_date_creation_start = "";
453 $search_date_creation_endmonth = "";
454 $search_date_creation_endyear = "";
455 $search_date_creation_endday = "";
456 $search_date_creation_end = "";
457 $search_date_modif_startmonth = "";
458 $search_date_modif_startyear = "";
459 $search_date_modif_startday = "";
460 $search_date_modif_start = "";
461 $search_date_modif_endmonth = "";
462 $search_date_modif_endyear = "";
463 $search_date_modif_endday = "";
464 $search_date_modif_end = "";
465 $search_status = -1;
466 $search_stcomm = '';
467 $search_level = '';
468 $search_parent_name = '';
469 $search_import_key = '';
470
471 $search_all = '';
472 $toselect = array();
473 $search_array_options = array();
474 }
475
476 // Mass actions
477 $objectclass = 'Societe';
478 $objectlabel = 'ThirdParty';
479 $permissiontoread = $user->hasRight('societe', 'lire');
480 $permissiontodelete = $user->hasRight('societe', 'supprimer');
481 $permissiontoadd = $user->hasRight("societe", "creer");
482 $uploaddir = $conf->societe->dir_output;
483
484 global $error;
485 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
486
487 if (!$error && $action == 'setstcomm' && $permissiontoadd) {
488 $object = new Client($db);
489 $result = $object->fetch(GETPOST('stcommsocid'));
490 $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm');
491 $result = $object->update($object->id, $user);
492 if ($result < 0) {
493 setEventMessages($object->error, $object->errors, 'errors');
494 }
495
496 $action = '';
497 }
498}
499
500if ($search_status == '' && empty($search_all)) {
501 $search_status = 1; // display active thirdparty only by default
502}
503
504
505
506/*
507 * View
508 */
509
510/*
511 REM: Rules on permissions to see thirdparties
512 Internal or External user + No permission to see customers => See nothing
513 Internal user socid=0 + Permission to see ALL customers => See all thirdparties
514 Internal user socid=0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative
515 External user socid=x + Permission to see ALL customers => Can see only himself
516 External user socid=x + No permission to see ALL customers => Can see only himself
517 */
518
519$form = new Form($db);
520$formother = new FormOther($db);
521$companystatic = new Societe($db);
522$companyparent = new Societe($db);
523$formcompany = new FormCompany($db);
524$prospectstatic = new Client($db);
525$prospectstatic->client = 2;
526$prospectstatic->loadCacheOfProspStatus();
527
528$now = dol_now();
529
530$title = $langs->trans("ThirdParties");
531if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) {
532 $title = $langs->trans("Customers");
533}
534if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) {
535 $title = $langs->trans("Prospects");
536}
537if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) {
538 $title = $langs->trans("Suppliers");
539}
540$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
541
542
543// Select every potentials, and note each potentials which fit in search parameters
544$tab_level = array();
545$sql = "SELECT code, label, sortorder";
546$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
547$sql .= " WHERE active > 0";
548$sql .= " ORDER BY sortorder";
549$resql = $db->query($sql);
550if ($resql) {
551 while ($obj = $db->fetch_object($resql)) {
552 // Compute level text
553 $level = $langs->trans($obj->code);
554 if ($level == $obj->code) {
555 $level = $langs->trans($obj->label);
556 }
557 $tab_level[$obj->code] = $level;
558 }
559} else {
560 dol_print_error($db);
561}
562
563// Build and execute select
564// --------------------------------------------------------------------
565$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,";
566$sql .= " s.entity,";
567$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status, s.note_private, s.note_public,";
568$sql .= " s.email, s.phone, s.phone_mobile, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
569$sql .= " s.tms as date_modification, s.datec as date_creation, s.import_key,";
570$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
571$sql .= " s2.nom as name2,";
572$sql .= " typent.code as typent_code,";
573$sql .= " staff.code as staff_code,";
574$sql .= " s.fk_forme_juridique as legalform_code,";
575$sql .= " country.code as country_code, country.label as country_label,";
576$sql .= " state.code_departement as state_code, state.nom as state_name,";
577$sql .= " region.code_region as region_code, region.nom as region_name";
578// Add fields from extrafields
579if (!empty($extrafields->attributes[$object->table_element]['label'])) {
580 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
581 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
582 }
583}
584// Add fields from hooks
585$parameters = array();
586$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
587$sql .= $hookmanager->resPrint;
588$sql = preg_replace('/,\s*$/', '', $sql);
589//$sql .= ", COUNT(rc.rowid) as anotherfield";
590
591$sqlfields = $sql; // $sql fields to remove for count total
592
593$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
594$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid";
595if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
596 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
597}
598
599$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
600$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
601$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
602//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_forme_juridique as legalform on (legalform.rowid = s.fk_forme_juridique)";
603$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
604$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)";
605$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
606// Add table from hooks
607$parameters = array();
608$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
609$sql .= $hookmanager->resPrint;
610$sql .= " WHERE s.entity IN (".getEntity('societe').")";
611if (!$user->hasRight('fournisseur', 'lire')) {
612 $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
613}
614// Search on sale representative
615if (!empty($search_sale) && $search_sale != '-1') {
616 $search_sale_req = array_filter($search_sale, function (string $value): bool {
617 $value = intval($value);
618 return $value >= 0;
619 });
620
621 $search_sale_req = implode(',', $search_sale_req);
622
623 if (count($search_sale) == 1 && in_array('-2', $search_sale)) {
624 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid)";
625 } elseif (count($search_sale) > 0 && !in_array('-2', $search_sale)) {
626 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req)."))";
627 } elseif (count($search_sale) > 0 && in_array('-2', $search_sale)) {
628 $sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user IN (".$db->sanitize($search_sale_req)."))";
629 $sql .= " OR NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid))";
630 }
631}
632
633// Search for tag/category ($searchCategoryCustomerList is an array of ID)
634if (!empty($searchCategoryCustomerList)) {
635 $searchCategoryCustomerSqlList = array();
636 $listofcategoryid = '';
637 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
638 if (intval($searchCategoryCustomer) == -2) {
639 $searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
640 } elseif (intval($searchCategoryCustomer) > 0) {
641 if ($searchCategoryCustomerOperator == 0) {
642 $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).")";
643 } else {
644 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
645 }
646 }
647 }
648 if ($listofcategoryid) {
649 $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)."))";
650 }
651 if ($searchCategoryCustomerOperator == 1) {
652 if (!empty($searchCategoryCustomerSqlList)) {
653 $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
654 }
655 } else {
656 if (!empty($searchCategoryCustomerSqlList)) {
657 $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
658 }
659 }
660}
661
662// Search for tag/category ($searchCategorySupplierList is an array of ID)
663if (!empty($searchCategorySupplierList)) {
664 $searchCategorySupplierSqlList = array();
665 $listofcategoryid = '';
666 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
667 if (intval($searchCategorySupplier) == -2) {
668 $searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
669 } elseif (intval($searchCategorySupplier) > 0) {
670 if ($searchCategorySupplierOperator == 0) {
671 $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).")";
672 } else {
673 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
674 }
675 }
676 }
677 if ($listofcategoryid) {
678 $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)."))";
679 }
680 if ($searchCategorySupplierOperator == 1) {
681 if (!empty($searchCategorySupplierSqlList)) {
682 $sql .= " AND (".implode(' OR ', $searchCategorySupplierSqlList).")";
683 }
684 } else {
685 if (!empty($searchCategorySupplierSqlList)) {
686 $sql .= " AND (".implode(' AND ', $searchCategorySupplierSqlList).")";
687 }
688 }
689}
690if ($search_all) {
691 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
692}
693if (strlen($search_cti)) {
694 $sql .= natural_search('s.phone', $search_cti);
695}
696if ($search_id > 0) {
697 $sql .= natural_search("s.rowid", $search_id, 1);
698}
699if (empty($arrayfields['s.name_alias']['checked']) && $search_nom) {
700 $sql .= natural_search(array("s.nom", "s.name_alias"), $search_nom);
701} else {
702 if ($search_nom) {
703 $sql .= natural_search("s.nom", $search_nom);
704 }
705
706 if ($search_alias) {
707 $sql .= natural_search("s.name_alias", $search_alias);
708 }
709}
710if ($search_nom_only) {
711 $sql .= natural_search("s.nom", $search_nom_only);
712}
713if ($search_customer_code) {
714 $sql .= natural_search("s.code_client", $search_customer_code);
715}
716if ($search_supplier_code) {
717 $sql .= natural_search("s.code_fournisseur", $search_supplier_code);
718}
719if ($search_account_customer_code) {
720 $sql .= natural_search("s.code_compta", $search_account_customer_code);
721}
722if ($search_account_supplier_code) {
723 $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code);
724}
725if ($search_address) {
726 $sql .= natural_search('s.address', $search_address);
727}
728if (strlen($search_zip)) {
729 $sql .= natural_search("s.zip", $search_zip);
730}
731if ($search_town) {
732 $sql .= natural_search("s.town", $search_town);
733}
734if ($search_state) {
735 $sql .= natural_search("state.nom", $search_state);
736}
737if ($search_region) {
738 $sql .= natural_search("region.nom", $search_region);
739}
740if ($search_country && $search_country != '-1') {
741 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
742}
743if ($search_email) {
744 $sql .= natural_search("s.email", $search_email);
745}
746if (strlen($search_phone)) {
747 $sql .= natural_search("s.phone", $search_phone);
748}
749if (strlen($search_phone_mobile)) {
750 $sql .= natural_search("s.phone_mobile", $search_phone_mobile);
751}
752if (strlen($search_fax)) {
753 $sql .= natural_search("s.fax", $search_fax);
754}
755if ($search_url) {
756 $sql .= natural_search("s.url", $search_url);
757}
758if (strlen($search_idprof1)) {
759 $sql .= natural_search("s.siren", $search_idprof1);
760}
761if (strlen($search_idprof2)) {
762 $sql .= natural_search("s.siret", $search_idprof2);
763}
764if (strlen($search_idprof3)) {
765 $sql .= natural_search("s.ape", $search_idprof3);
766}
767if (strlen($search_idprof4)) {
768 $sql .= natural_search("s.idprof4", $search_idprof4);
769}
770if (strlen($search_idprof5)) {
771 $sql .= natural_search("s.idprof5", $search_idprof5);
772}
773if (strlen($search_idprof6)) {
774 $sql .= natural_search("s.idprof6", $search_idprof6);
775}
776if (strlen($search_vat)) {
777 $sql .= natural_search("s.tva_intra", $search_vat);
778}
779// Filter on type of thirdparty
780if ($search_type > 0 && in_array($search_type, array('1,3', '1,2,3', '2,3'))) {
781 $sql .= " AND s.client IN (".$db->sanitize($search_type).")";
782}
783if ($search_type > 0 && in_array($search_type, array('4'))) {
784 $sql .= " AND s.fournisseur = 1";
785}
786if ($search_type == '0') {
787 $sql .= " AND s.client = 0 AND s.fournisseur = 0";
788}
789if ($search_status != '' && $search_status >= 0) {
790 $sql .= natural_search("s.status", $search_status, 2);
791}
792if (isModEnabled('barcode') && $search_barcode) {
793 $sql .= natural_search("s.barcode", $search_barcode);
794}
795if ($search_price_level && $search_price_level != '-1') {
796 $sql .= natural_search("s.price_level", $search_price_level, 2);
797}
798if ($search_type_thirdparty && $search_type_thirdparty > 0) {
799 $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2);
800}
801if (!empty($search_staff) && $search_staff != '-1') {
802 $sql .= natural_search("s.fk_effectif", $search_staff, 2);
803}
804if (!empty($search_legalform) && $search_legalform != '-1') {
805 $sql .= natural_search("s.fk_forme_juridique", $search_legalform, 2);
806}
807if ($search_parent_name) {
808 $sql .= natural_search("s2.nom", $search_parent_name);
809}
810if ($search_level) {
811 $sql .= natural_search("s.fk_prospectlevel", implode(',', $search_level), 3);
812}
813if ($search_stcomm) {
814 $sql .= natural_search("s.fk_stcomm", implode(',', $search_stcomm), 2);
815}
816if ($search_import_key) {
817 $sql .= natural_search("s.import_key", $search_import_key);
818}
819if ($search_date_creation_start) {
820 $sql .= " AND s.datec >= '".$db->idate($search_date_creation_start)."'";
821}
822if ($search_date_creation_end) {
823 $sql .= " AND s.datec <= '".$db->idate($search_date_creation_end)."'";
824}
825
826if ($search_date_modif_start) {
827 $sql .= " AND s.tms >= '".$db->idate($search_date_modif_start)."'";
828}
829if ($search_date_modif_end) {
830 $sql .= " AND s.tms <= '".$db->idate($search_date_modif_end)."'";
831}
832
833// Add where from extra fields
834include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
835// Add where from hooks
836$parameters = array('socid' => $socid);
837$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
838if (empty($reshook)) {
839 if ($socid) {
840 $sql .= " AND s.rowid = ".((int) $socid);
841 }
842}
843$sql .= $hookmanager->resPrint;
844
845// Add GroupBy from hooks
846$parameters = array('fieldstosearchall' => $fieldstosearchall);
847$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
848$sql .= $hookmanager->resPrint;
849
850// Count total nb of records
851$nbtotalofrecords = '';
852if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
853 /* The fast and low memory method to get and count full list converts the sql into a sql count */
854 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
855 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
856 $resql = $db->query($sqlforcount);
857 if ($resql) {
858 $objforcount = $db->fetch_object($resql);
859 $nbtotalofrecords = $objforcount->nbtotalofrecords;
860 } else {
861 dol_print_error($db);
862 }
863
864 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
865 $page = 0;
866 $offset = 0;
867 }
868 $db->free($resql);
869}
870
871// Complete request and execute it with limit
872$sql .= $db->order($sortfield, $sortorder);
873if ($limit) {
874 $sql .= $db->plimit($limit + 1, $offset);
875}
876$resql = $db->query($sql);
877if (!$resql) {
878 dol_print_error($db);
879 exit;
880}
881
882$num = $db->num_rows($resql);
883
884
885// Direct jump if only one record found
886if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && ($search_all != '' || $search_cti != '') && $action != 'list') {
887 $obj = $db->fetch_object($resql);
888 $id = $obj->rowid;
889 if (getDolGlobalString('SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD')) {
890 if ($obj->client > 0) {
891 header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id);
892 exit;
893 }
894 if ($obj->fournisseur > 0) {
895 header("Location: ".DOL_URL_ROOT.'/fourn/card.php?socid='.$id);
896 exit;
897 }
898 }
899
900 header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id);
901 exit;
902}
903
904// Output page
905// --------------------------------------------------------------------
906
907$paramsCat = '';
908foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
909 $paramsCat .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
910}
911foreach ($searchCategorySupplierList as $searchCategorySupplier) {
912 $paramsCat .= "&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
913}
914
915llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $paramsCat, 'bodyforlist');
916
917
918$arrayofselected = is_array($toselect) ? $toselect : array();
919
920$param = '';
921if (!empty($mode)) {
922 $param .= '&mode='.urlencode($mode);
923}
924if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
925 $param .= '&contextpage='.urlencode($contextpage);
926}
927if ($limit > 0 && $limit != $conf->liste_limit) {
928 $param .= '&limit='.((int) $limit);
929}
930if ($optioncss != '') {
931 $param .= '&optioncss='.urlencode($optioncss);
932}
933if ($search_all != '') {
934 $param = "&search_all=".urlencode($search_all);
935}
936if ($search_categ_cus > 0) {
937 $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
938}
939if ($search_categ_sup > 0) {
940 $param .= '&search_categ_sup='.urlencode((string) ($search_categ_sup));
941}
942if ($searchCategoryCustomerOperator == 1) {
943 $param .= "&search_category_customer_operator=".urlencode((string) ($searchCategoryCustomerOperator));
944}
945if ($searchCategorySupplierOperator == 1) {
946 $param .= "&search_category_supplier_operator=".urlencode((string) ($searchCategorySupplierOperator));
947}
948foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
949 $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
950}
951foreach ($searchCategorySupplierList as $searchCategorySupplier) {
952 $param .= "&search_category_supplier_list[]=".urlencode($searchCategorySupplier);
953}
954if (is_array($search_sale)) {
955 foreach ($search_sale as $sale_id) {
956 $param .= '&search_sale[]=' . urlencode($sale_id);
957 }
958}
959if ($search_id > 0) {
960 $param .= "&search_id=".((int) $search_id);
961}
962if ($search_nom != '') {
963 $param .= "&search_nom=".urlencode($search_nom);
964}
965if ($search_alias != '') {
966 $param .= "&search_alias=".urlencode($search_alias);
967}
968if ($search_address != '') {
969 $param .= '&search_address='.urlencode($search_address);
970}
971if ($search_zip != '') {
972 $param .= "&search_zip=".urlencode($search_zip);
973}
974if ($search_town != '') {
975 $param .= "&search_town=".urlencode($search_town);
976}
977if ($search_phone != '') {
978 $param .= "&search_phone=".urlencode($search_phone);
979}
980if ($search_phone_mobile != '') {
981 $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
982}
983if ($search_fax != '') {
984 $param .= "&search_fax=".urlencode($search_fax);
985}
986if ($search_email != '') {
987 $param .= "&search_email=".urlencode($search_email);
988}
989if ($search_url != '') {
990 $param .= "&search_url=".urlencode($search_url);
991}
992if ($search_state != '') {
993 $param .= "&search_state=".urlencode($search_state);
994}
995if ($search_region != '') {
996 $param .= "&search_region=".urlencode($search_region);
997}
998if ($search_country != '') {
999 $param .= "&search_country=".urlencode($search_country);
1000}
1001if ($search_customer_code != '') {
1002 $param .= "&search_customer_code=".urlencode($search_customer_code);
1003}
1004if ($search_supplier_code != '') {
1005 $param .= "&search_supplier_code=".urlencode($search_supplier_code);
1006}
1007if ($search_account_customer_code != '') {
1008 $param .= "&search_account_customer_code=".urlencode($search_account_customer_code);
1009}
1010if ($search_account_supplier_code != '') {
1011 $param .= "&search_account_supplier_code=".urlencode($search_account_supplier_code);
1012}
1013if ($search_barcode != '') {
1014 $param .= "&search_barcode=".urlencode($search_barcode);
1015}
1016if ($search_idprof1 != '') {
1017 $param .= '&search_idprof1='.urlencode($search_idprof1);
1018}
1019if ($search_idprof2 != '') {
1020 $param .= '&search_idprof2='.urlencode($search_idprof2);
1021}
1022if ($search_idprof3 != '') {
1023 $param .= '&search_idprof3='.urlencode($search_idprof3);
1024}
1025if ($search_idprof4 != '') {
1026 $param .= '&search_idprof4='.urlencode($search_idprof4);
1027}
1028if ($search_idprof5 != '') {
1029 $param .= '&search_idprof5='.urlencode($search_idprof5);
1030}
1031if ($search_idprof6 != '') {
1032 $param .= '&search_idprof6='.urlencode($search_idprof6);
1033}
1034if ($search_vat != '') {
1035 $param .= '&search_vat='.urlencode($search_vat);
1036}
1037if ($search_price_level != '') {
1038 $param .= '&search_price_level='.urlencode($search_price_level);
1039}
1040if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
1041 $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty));
1042}
1043if ($search_type != '') {
1044 $param .= '&search_type='.urlencode($search_type);
1045}
1046if ($search_status != '') {
1047 $param .= '&search_status='.urlencode((string) ($search_status));
1048}
1049if (is_array($search_level) && count($search_level)) {
1050 foreach ($search_level as $slevel) {
1051 $param .= '&search_level[]='.urlencode($slevel);
1052 }
1053}
1054if (is_array($search_stcomm) && count($search_stcomm)) {
1055 foreach ($search_stcomm as $slevel) {
1056 $param .= '&search_stcomm[]='.urlencode($slevel);
1057 }
1058}
1059if ($search_parent_name != '') {
1060 $param .= '&search_parent_name='.urlencode($search_parent_name);
1061}
1062if ($search_import_key != '') {
1063 $param .= '&search_import_key='.urlencode($search_import_key);
1064}
1065if ($type != '') {
1066 $param .= '&type='.urlencode($type);
1067}
1068if ($search_date_creation_startmonth) {
1069 $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth));
1070}
1071if ($search_date_creation_startyear) {
1072 $param .= '&search_date_creation_startyear='.urlencode((string) ($search_date_creation_startyear));
1073}
1074if ($search_date_creation_startday) {
1075 $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday));
1076}
1077if ($search_date_creation_start) {
1078 $param .= '&search_date_creation_start='.urlencode($search_date_creation_start);
1079}
1080if ($search_date_creation_endmonth) {
1081 $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth));
1082}
1083if ($search_date_creation_endyear) {
1084 $param .= '&search_date_creation_endyear='.urlencode((string) ($search_date_creation_endyear));
1085}
1086if ($search_date_creation_endday) {
1087 $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday));
1088}
1089if ($search_date_creation_end) {
1090 $param .= '&search_date_creation_end='.urlencode($search_date_creation_end);
1091}
1092if ($search_date_modif_startmonth) {
1093 $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth));
1094}
1095if ($search_date_modif_startyear) {
1096 $param .= '&search_date_modif_startyear='.urlencode((string) ($search_date_modif_startyear));
1097}
1098if ($search_date_modif_startday) {
1099 $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday));
1100}
1101if ($search_date_modif_start) {
1102 $param .= '&search_date_modif_start='.urlencode($search_date_modif_start);
1103}
1104if ($search_date_modif_endmonth) {
1105 $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth));
1106}
1107if ($search_date_modif_endyear) {
1108 $param .= '&search_date_modif_endyear='.urlencode((string) ($search_date_modif_endyear));
1109}
1110if ($search_date_modif_endday) {
1111 $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday));
1112}
1113if ($search_date_modif_end) {
1114 $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end);
1115}
1116
1117// Add $param from extra fields
1118include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1119// Add $param from hooks
1120$parameters = array('param' => &$param);
1121$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1122$param .= $hookmanager->resPrint;
1123
1124// Show delete result message
1125if (GETPOST('delsoc')) {
1126 setEventMessages($langs->trans("CompanyDeleted", GETPOST('delsoc')), null, 'mesgs');
1127}
1128
1129// List of mass actions available
1130$arrayofmassactions = array(
1131 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1132 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
1133);
1134//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
1135if (isModEnabled('category') && $user->hasRight("societe", "creer")) {
1136 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
1137}
1138if ($user->hasRight("societe", "creer")) {
1139 $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
1140}
1141if ($user->hasRight("societe", "creer")) {
1142 $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_CEASED));
1143}
1144if ($user->hasRight("societe", "creer")) {
1145 $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
1146 $arrayofmassactions['unsetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("UnallocateCommercial");
1147}
1148
1149if ($user->hasRight('societe', 'supprimer')) {
1150 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
1151}
1152if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
1153 $arrayofmassactions = array();
1154}
1155$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1156
1157$typefilter = '';
1158$label = 'MenuNewThirdParty';
1159
1160if (!empty($type)) {
1161 $typefilter = '&amp;type='.$type;
1162 if ($type == 'p') {
1163 $label = 'MenuNewProspect';
1164 }
1165 if ($type == 'c') {
1166 $label = 'MenuNewCustomer';
1167 }
1168 if ($type == 'f') {
1169 $label = 'NewSupplier';
1170 }
1171}
1172
1173if ($contextpage == 'poslist' && $type == 't' && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) {
1174 print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), [], 'warning', 1);
1175}
1176
1177// Show the new button only when this page is not opend from the Extended POS (pop-up window)
1178// but allow it too, when a user has the rights to create a new customer
1179if ($contextpage != 'poslist') {
1180 $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter;
1181 if (!empty($socid)) {
1182 $url .= '&socid='.$socid;
1183 }
1184 $newcardbutton = '';
1185 $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'));
1186 $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'));
1187 $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight('societe', 'creer'));
1188} elseif ($user->hasRight('societe', 'creer')) {
1189 $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);
1190 $label = 'MenuNewCustomer';
1191 $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url);
1192}
1193
1194print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">'."\n";
1195if ($optioncss != '') {
1196 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1197}
1198print '<input type="hidden" name="token" value="'.newToken().'">';
1199print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1200print '<input type="hidden" name="action" value="list">';
1201print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1202print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1203//print '<input type="hidden" name="page" value="'.$page.'">';
1204print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
1205if (!empty($place)) {
1206 print '<input type="hidden" name="place" value="'.$place.'">';
1207}
1208print '<input type="hidden" name="page_y" value="">';
1209print '<input type="hidden" name="mode" value="'.$mode.'">';
1210if (empty($arrayfields['customerorsupplier']['checked'])) {
1211 print '<input type="hidden" name="type" value="'.$type.'">';
1212}
1213if (!empty($place)) {
1214 print '<input type="hidden" name="place" value="'.$place.'">';
1215}
1216
1217print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1);
1218
1219$langs->load("other");
1220$textprofid = array();
1221foreach (array(1, 2, 3, 4, 5, 6) as $key) {
1222 $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code);
1223 $textprofid[$key] = '';
1224 if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between ()
1225 if (preg_match('/\‍((.*)\‍)/i', $label, $reg)) {
1226 $label = $reg[1];
1227 }
1228 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
1229 $textprofid[$key] = $langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label);
1230 }
1231}
1232
1233// Add code for pre mass action (confirmation or email presend form)
1234$topicmail = "Information";
1235$modelmail = "thirdparty";
1236$objecttmp = new Societe($db);
1237$trackid = 'thi'.$object->id;
1238include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1239
1240/*
1241if (!empty($search_categ_cus) || !empty($search_categ_sup)) {
1242 print "<div id='ways'>";
1243 $c = new Categorie($db);
1244 $ways = $c->print_all_ways(' &gt; ', 'societe/list.php');
1245 print " &gt; ".$ways[0]."<br>\n";
1246 print "</div><br>";
1247}
1248*/
1249
1250if ($search_all) {
1251 $setupstring = '';
1252 foreach ($fieldstosearchall as $key => $val) {
1253 $fieldstosearchall[$key] = $langs->trans($val);
1254 $setupstring .= $key."=".$val.";";
1255 }
1256 print '<!-- Search done like if SOCIETE_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
1257 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
1258}
1259
1260$moreforfilter = '';
1261
1262// Filter for customer categories
1263if (empty($type) || $type == 'c' || $type == 'p') {
1264 if (isModEnabled('category') && $user->hasRight('categorie', 'read')) {
1265 $formcategory = new FormCategory($db);
1266 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth300', $searchCategoryCustomerOperator ? $searchCategoryCustomerOperator : 0, 1, 1, $langs->transnoentities("CustomersProspectsCategoriesShort"));
1267 }
1268}
1269
1270// Filter for supplier categories
1271if (empty($type) || $type == 'f') {
1272 if (isModEnabled("fournisseur") && isModEnabled('category') && $user->hasRight('categorie', 'read')) {
1273 $formcategory = new FormCategory($db);
1274 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER, $searchCategorySupplierList, 'minwidth300', $searchCategorySupplierOperator ? $searchCategorySupplierOperator : 0, 1, 1, $langs->transnoentities("SuppliersCategoriesShort"));
1275 }
1276}
1277
1278// If the user can view prospects other than his'
1279$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
1280$userlist[-2] = $langs->trans("NoSalesRepresentativeAffected");
1281if ($user->hasRight("societe", "client", "voir") || $socid) {
1282 $moreforfilter .= '<div class="divsearchfield">';
1283 $tmptitle = $langs->trans('SalesRepresentatives');
1284 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
1285 $moreforfilter .= $form->multiselectarray('search_sale', $userlist, $search_sale, 0, 0, '', 0, 300, '', '', $langs->trans('SalesRepresentatives'), 1);
1286 $moreforfilter .= '</div>';
1287}
1288if (!empty($moreforfilter)) {
1289 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1290 print $moreforfilter;
1291 $parameters = array('type' => $type);
1292 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1293 print $hookmanager->resPrint;
1294 print '</div>';
1295}
1296
1297$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1298$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1299$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1300$selectedfields .= ((count($arrayofmassactions) && $contextpage != 'poslist') ? $form->showCheckAddButtons('checkforselect', 1) : '');
1301
1302print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
1303print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1304
1305// Fields title search
1306// --------------------------------------------------------------------
1307print '<tr class="liste_titre_filter">';
1308// Action column
1309if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1310 print '<td class="liste_titre maxwidthsearch center actioncolumn">';
1311 $searchpicto = $form->showFilterButtons('left');
1312 print $searchpicto;
1313 print '</td>';
1314}
1315if (!empty($arrayfields['s.rowid']['checked'])) {
1316 print '<td class="liste_titre" data-key="id">';
1317 print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
1318 print '</td>';
1319}
1320if (!empty($arrayfields['s.nom']['checked'])) {
1321 print '<td class="liste_titre" data-key="ref">';
1322 if (!empty($search_nom_only) && empty($search_nom)) {
1323 $search_nom = $search_nom_only;
1324 }
1325 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
1326 print '</td>';
1327}
1328if (!empty($arrayfields['s.name_alias']['checked'])) {
1329 print '<td class="liste_titre">';
1330 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).'">';
1331 print '</td>';
1332}
1333// Barcode
1334if (!empty($arrayfields['s.barcode']['checked'])) {
1335 print '<td class="liste_titre">';
1336 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).'">';
1337 print '</td>';
1338}
1339// Customer code
1340if (!empty($arrayfields['s.code_client']['checked'])) {
1341 print '<td class="liste_titre">';
1342 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
1343 print '</td>';
1344}
1345// Supplier code
1346if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1347 print '<td class="liste_titre">';
1348 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
1349 print '</td>';
1350}
1351// Account Customer code
1352if (!empty($arrayfields['s.code_compta']['checked'])) {
1353 print '<td class="liste_titre">';
1354 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
1355 print '</td>';
1356}
1357// Account Supplier code
1358if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1359 print '<td class="liste_titre">';
1360 print '<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">';
1361 print '</td>';
1362}
1363// Address
1364if (!empty($arrayfields['s.address']['checked'])) {
1365 print '<td class="liste_titre">';
1366 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'">';
1367 print '</td>';
1368}
1369// Sales representatives
1370if (!empty($arrayfields['sales.representative']['checked'])) {
1371 print '<td class="liste_titre">';
1372 print '</td>';
1373}
1374// Zip
1375if (!empty($arrayfields['s.zip']['checked'])) {
1376 print '<td class="liste_titre">';
1377 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
1378 print '</td>';
1379}
1380// Town
1381if (!empty($arrayfields['s.town']['checked'])) {
1382 print '<td class="liste_titre">';
1383 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
1384 print '</td>';
1385}
1386// State
1387if (!empty($arrayfields['state.nom']['checked'])) {
1388 print '<td class="liste_titre">';
1389 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1390 print '</td>';
1391}
1392// Region
1393if (!empty($arrayfields['region.nom']['checked'])) {
1394 print '<td class="liste_titre">';
1395 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
1396 print '</td>';
1397}
1398// Country
1399if (!empty($arrayfields['country.code_iso']['checked'])) {
1400 print '<td class="liste_titre center">';
1401 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1402 print '</td>';
1403}
1404// Company type
1405if (!empty($arrayfields['typent.code']['checked'])) {
1406 print '<td class="liste_titre maxwidthonsmartphone center">';
1407 // We use showempty=0 here because there is already an unknown value into dictionary.
1408 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);
1409 print '</td>';
1410}
1411// Multiprice level
1412if (!empty($arrayfields['s.price_level']['checked'])) {
1413 print '<td class="liste_titre">';
1414 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).'">';
1415 print '</td>';
1416}
1417// Staff
1418if (!empty($arrayfields['staff.code']['checked'])) {
1419 print '<td class="liste_titre maxwidthonsmartphone center">';
1420 print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100', 1);
1421 print '</td>';
1422}
1423// Legal form
1424if (!empty($arrayfields['legalform.code']['checked'])) {
1425 print '<td class="liste_titre maxwidthonsmartphone center">';
1426 //print $form->selectarray("search_legalform", $formcompany->effectif_array(0), $search_legalform, 0, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100', 1);
1427 print '</td>';
1428}
1429if (!empty($arrayfields['s.email']['checked'])) {
1430 // Email
1431 print '<td class="liste_titre">';
1432 print '<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
1433 print '</td>';
1434}
1435if (!empty($arrayfields['s.phone']['checked'])) {
1436 // Phone
1437 print '<td class="liste_titre">';
1438 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">';
1439 print '</td>';
1440}
1441if (!empty($arrayfields['s.phone_mobile']['checked'])) {
1442 // PhoneMobile
1443 print '<td class="liste_titre">';
1444 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'">';
1445 print '</td>';
1446}
1447if (!empty($arrayfields['s.fax']['checked'])) {
1448 // Fax
1449 print '<td class="liste_titre">';
1450 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).'">';
1451 print '</td>';
1452}
1453if (!empty($arrayfields['s.url']['checked'])) {
1454 // Url
1455 print '<td class="liste_titre">';
1456 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">';
1457 print '</td>';
1458}
1459if (!empty($arrayfields['s.siren']['checked'])) {
1460 // IdProf1
1461 print '<td class="liste_titre">';
1462 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
1463 print '</td>';
1464}
1465if (!empty($arrayfields['s.siret']['checked'])) {
1466 // IdProf2
1467 print '<td class="liste_titre">';
1468 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
1469 print '</td>';
1470}
1471if (!empty($arrayfields['s.ape']['checked'])) {
1472 // IdProf3
1473 print '<td class="liste_titre">';
1474 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
1475 print '</td>';
1476}
1477if (!empty($arrayfields['s.idprof4']['checked'])) {
1478 // IdProf4
1479 print '<td class="liste_titre">';
1480 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
1481 print '</td>';
1482}
1483if (!empty($arrayfields['s.idprof5']['checked'])) {
1484 // IdProf5
1485 print '<td class="liste_titre">';
1486 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
1487 print '</td>';
1488}
1489if (!empty($arrayfields['s.idprof6']['checked'])) {
1490 // IdProf6
1491 print '<td class="liste_titre">';
1492 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
1493 print '</td>';
1494}
1495if (!empty($arrayfields['s.tva_intra']['checked'])) {
1496 // Vat number
1497 print '<td class="liste_titre">';
1498 print '<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).'">';
1499 print '</td>';
1500}
1501
1502// Nature (customer/prospect/supplier)
1503if (!empty($arrayfields['customerorsupplier']['checked'])) {
1504 print '<td class="liste_titre maxwidthonsmartphone center">';
1505 if ($type != '') {
1506 print '<input type="hidden" name="type" value="'.$type.'">';
1507 }
1508 print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
1509 print '</td>';
1510}
1511// Prospect level
1512if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1513 print '<td class="liste_titre center">';
1514 print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
1515 print '</td>';
1516}
1517// Prospect status
1518if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1519 print '<td class="liste_titre maxwidthonsmartphone center">';
1520 $arraystcomm = array();
1521 foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1522 $arraystcomm[$val['id']] = ($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
1523 }
1524 //print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', '', 1);
1525 print $form->multiselectarray('search_stcomm', $arraystcomm, $search_stcomm, 0, 0, 'width100', 0, 0, '', '', '', 2);
1526 print '</td>';
1527}
1528if (!empty($arrayfields['s2.nom']['checked'])) {
1529 print '<td class="liste_titre center">';
1530 print '<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).'">';
1531 print '</td>';
1532}
1533// Extra fields
1534include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1535
1536// Fields from hook
1537$parameters = array('arrayfields' => $arrayfields);
1538$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1539print $hookmanager->resPrint;
1540// Creation date
1541if (!empty($arrayfields['s.datec']['checked'])) {
1542 print '<td class="liste_titre center nowraponall">';
1543 print '<div class="nowrapfordate">';
1544 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'));
1545 print '</div>';
1546 print '<div class="nowrapfordate">';
1547 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'));
1548 print '</div>';
1549 print '</td>';
1550}
1551// Modification date
1552if (!empty($arrayfields['s.tms']['checked'])) {
1553 print '<td class="liste_titre center nowraponall">';
1554 print '<div class="nowrapfordate">';
1555 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'));
1556 print '</div>';
1557 print '<div class="nowrapfordate">';
1558 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'));
1559 print '</div>';
1560 print '</td>';
1561}
1562if (!empty($arrayfields['s.note_public']['checked'])) {
1563 // Note public
1564 print '<td class="liste_titre">';
1565 print '</td>';
1566}
1567if (!empty($arrayfields['s.note_private']['checked'])) {
1568 // Note private
1569 print '<td class="liste_titre">';
1570 print '</td>';
1571}
1572// Status
1573if (!empty($arrayfields['s.status']['checked'])) {
1574 print '<td class="liste_titre center minwidth75imp parentonrightofpage">';
1575 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);
1576 print '</td>';
1577}
1578if (!empty($arrayfields['s.import_key']['checked'])) {
1579 print '<td class="liste_titre center">';
1580 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1581 print '</td>';
1582}
1583// Action column
1584if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1585 print '<td class="liste_titre center maxwidthsearch actioncolumn">';
1586 $searchpicto = $form->showFilterButtons();
1587 print $searchpicto;
1588 print '</td>';
1589}
1590
1591print '</tr>'."\n";
1592
1593$totalarray = array();
1594$totalarray['nbfield'] = 0;
1595
1596// Fields title label
1597// --------------------------------------------------------------------
1598print '<tr class="liste_titre">';
1599// Action column
1600if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1601 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1602 $totalarray['nbfield']++;
1603}
1604if (!empty($arrayfields['s.rowid']['checked'])) {
1605 print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder, '');
1606 $totalarray['nbfield']++;
1607}
1608if (!empty($arrayfields['s.nom']['checked'])) {
1609 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder, ' ');
1610 $totalarray['nbfield']++;
1611}
1612if (!empty($arrayfields['s.name_alias']['checked'])) {
1613 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1614 print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
1615 $totalarray['nbfield']++;
1616}
1617if (!empty($arrayfields['s.barcode']['checked'])) {
1618 print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder);
1619 $totalarray['nbfield']++;
1620}
1621if (!empty($arrayfields['s.code_client']['checked'])) {
1622 print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder);
1623 $totalarray['nbfield']++;
1624}
1625if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1626 print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder);
1627 $totalarray['nbfield']++;
1628}
1629if (!empty($arrayfields['s.code_compta']['checked'])) {
1630 print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder);
1631 $totalarray['nbfield']++;
1632}
1633if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1634 print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder);
1635 $totalarray['nbfield']++;
1636}
1637if (!empty($arrayfields['s.address']['checked'])) {
1638 print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder);
1639 $totalarray['nbfield']++;
1640}
1641if (!empty($arrayfields['sales.representative']['checked'])) {
1642 print_liste_field_titre($arrayfields['sales.representative']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
1643 $totalarray['nbfield']++;
1644}
1645if (!empty($arrayfields['s.zip']['checked'])) {
1646 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder);
1647 $totalarray['nbfield']++;
1648}
1649if (!empty($arrayfields['s.town']['checked'])) {
1650 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder);
1651 $totalarray['nbfield']++;
1652}
1653if (!empty($arrayfields['state.nom']['checked'])) {
1654 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1655 $totalarray['nbfield']++;
1656}
1657if (!empty($arrayfields['region.nom']['checked'])) {
1658 print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder);
1659 $totalarray['nbfield']++;
1660}
1661if (!empty($arrayfields['country.code_iso']['checked'])) {
1662 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1663 $totalarray['nbfield']++;
1664}
1665if (!empty($arrayfields['typent.code']['checked'])) {
1666 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, "", $sortfield, $sortorder, 'center ');
1667 $totalarray['nbfield']++;
1668}
1669if (!empty($arrayfields['staff.code']['checked'])) {
1670 print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center ');
1671 $totalarray['nbfield']++;
1672}
1673if (!empty($arrayfields['legalform.code']['checked'])) {
1674 // s.fk_forme_juridique as legalform_code
1675 print_liste_field_titre($arrayfields['legalform.code']['label'], $_SERVER["PHP_SELF"], "legalform_code", "", $param, '', $sortfield, $sortorder);
1676 $totalarray['nbfield']++;
1677}
1678if (!empty($arrayfields['s.price_level']['checked'])) {
1679 print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder);
1680 $totalarray['nbfield']++;
1681}
1682if (!empty($arrayfields['s.email']['checked'])) {
1683 print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
1684 $totalarray['nbfield']++;
1685}
1686if (!empty($arrayfields['s.phone']['checked'])) {
1687 print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder);
1688 $totalarray['nbfield']++;
1689}
1690if (!empty($arrayfields['s.phone_mobile']['checked'])) {
1691 print_liste_field_titre($arrayfields['s.phone_mobile']['label'], $_SERVER["PHP_SELF"], "s.phone_mobile", "", $param, '', $sortfield, $sortorder);
1692 $totalarray['nbfield']++;
1693}
1694if (!empty($arrayfields['s.fax']['checked'])) {
1695 print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder);
1696 $totalarray['nbfield']++;
1697}
1698if (!empty($arrayfields['s.url']['checked'])) {
1699 print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder);
1700 $totalarray['nbfield']++;
1701}
1702if (!empty($arrayfields['s.siren']['checked'])) {
1703 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1704 $totalarray['nbfield']++;
1705}
1706if (!empty($arrayfields['s.siret']['checked'])) {
1707 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1708 $totalarray['nbfield']++;
1709}
1710if (!empty($arrayfields['s.ape']['checked'])) {
1711 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1712 $totalarray['nbfield']++;
1713}
1714if (!empty($arrayfields['s.idprof4']['checked'])) {
1715 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1716 $totalarray['nbfield']++;
1717}
1718if (!empty($arrayfields['s.idprof5']['checked'])) {
1719 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1720 $totalarray['nbfield']++;
1721}
1722if (!empty($arrayfields['s.idprof6']['checked'])) {
1723 print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1724 $totalarray['nbfield']++;
1725}
1726if (!empty($arrayfields['s.tva_intra']['checked'])) {
1727 print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1728 $totalarray['nbfield']++;
1729}
1730if (!empty($arrayfields['customerorsupplier']['checked'])) {
1731 print_liste_field_titre($arrayfields['customerorsupplier']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); // type of customer
1732 $totalarray['nbfield']++;
1733}
1734if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1735 print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center ');
1736 $totalarray['nbfield']++;
1737}
1738if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1739 print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center ');
1740 $totalarray['nbfield']++;
1741}
1742if (!empty($arrayfields['s2.nom']['checked'])) {
1743 print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center ');
1744 $totalarray['nbfield']++;
1745}
1746// Extra fields
1747include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1748// Hook fields
1749$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
1750$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1751print $hookmanager->resPrint;
1752if (!empty($arrayfields['s.datec']['checked'])) {
1753 print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1754 $totalarray['nbfield']++; // For the column action
1755}
1756if (!empty($arrayfields['s.tms']['checked'])) {
1757 print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1758 $totalarray['nbfield']++; // For the column action
1759}
1760if (!empty($arrayfields['s.status']['checked'])) {
1761 print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center ');
1762 $totalarray['nbfield']++; // For the column action
1763}
1764if (!empty($arrayfields['s.note_public']['checked'])) {
1765 print_liste_field_titre($arrayfields['s.note_public']['label'], $_SERVER["PHP_SELF"], "s.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1766 $totalarray['nbfield']++;
1767}
1768if (!empty($arrayfields['s.note_private']['checked'])) {
1769 print_liste_field_titre($arrayfields['s.note_private']['label'], $_SERVER["PHP_SELF"], "s.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1770 $totalarray['nbfield']++;
1771}
1772if (!empty($arrayfields['s.import_key']['checked'])) {
1773 print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1774 $totalarray['nbfield']++; // For the column action
1775}
1776// Action column
1777if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1778 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1779 $totalarray['nbfield']++;
1780}
1781print '</tr>'."\n";
1782
1783
1784// Loop on record
1785// --------------------------------------------------------------------
1786$i = 0;
1787$savnbfield = $totalarray['nbfield'];
1788$totalarray = array();
1789$totalarray['nbfield'] = 0;
1790$imaxinloop = ($limit ? min($num, $limit) : $num);
1791while ($i < $imaxinloop) {
1792 $obj = $db->fetch_object($resql);
1793 if (empty($obj)) {
1794 break; // Should not happen
1795 }
1796
1797 $parameters = array('staticdata' => $obj);
1798 // Note that $action and $object may have been modified by hook
1799 // do companystatic fetch in hook if wanted or anything else
1800 $reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $companystatic, $action);
1801 if (empty($reshook)) {
1802 $companystatic->id = $obj->rowid;
1803 $companystatic->name = $obj->name;
1804 $companystatic->name_alias = $obj->name_alias;
1805 $companystatic->logo = $obj->logo;
1806 $companystatic->barcode = $obj->barcode;
1807 $companystatic->canvas = $obj->canvas;
1808 $companystatic->client = $obj->client;
1809 $companystatic->status = $obj->status;
1810 $companystatic->email = $obj->email;
1811 $companystatic->phone = $obj->phone;
1812 $companystatic->phone_mobile = $obj->phone_mobile;
1813 $companystatic->fax = $obj->fax;
1814 $companystatic->address = $obj->address;
1815 $companystatic->zip = $obj->zip;
1816 $companystatic->town = $obj->town;
1817 $companystatic->fournisseur = $obj->fournisseur;
1818 $companystatic->code_client = $obj->code_client;
1819 $companystatic->code_fournisseur = $obj->code_fournisseur;
1820 $companystatic->tva_intra = $obj->tva_intra;
1821 $companystatic->country_code = $obj->country_code;
1822
1823 $companystatic->code_compta_client = $obj->code_compta;
1824 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1825 $companystatic->note_public = $obj->note_public;
1826 $companystatic->note_private = $obj->note_private;
1827 $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1828 $companystatic->parent = $obj->fk_parent;
1829 $companystatic->entity = $obj->entity;
1830
1831 $object = $companystatic;
1832 }
1833
1834 if ($mode == 'kanban') {
1835 if ($i == 0) {
1836 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1837 print '<div class="box-flex-container kanban">';
1838 }
1839 // Output Kanban
1840 print $companystatic->getKanbanView('', array('selected' => in_array($obj->rowid, $arrayofselected)));
1841 if ($i == ($imaxinloop - 1)) {
1842 print '</div>';
1843 print '</td></tr>';
1844 }
1845 } else {
1846 // Show line of result
1847 $j = 0;
1848 print '<tr data-rowid="'.$companystatic->id.'" class="oddeven"';
1849 if ($contextpage == 'poslist') {
1850 print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.urlencode($place).'\'"';
1851 }
1852 print '>';
1853
1854 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1855 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1856 print '<td class="nowrap center actioncolumn">';
1857 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
1858 $selected = 0;
1859 if (in_array($obj->rowid, $arrayofselected)) {
1860 $selected = 1;
1861 }
1862 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1863 }
1864 print '</td>';
1865 if (!$i) {
1866 $totalarray['nbfield']++;
1867 }
1868 }
1869 if (!empty($arrayfields['s.rowid']['checked'])) {
1870 print '<td class="tdoverflowmax50" data-key="id">';
1871 print dol_escape_htmltag($obj->rowid);
1872 print "</td>\n";
1873 if (!$i) {
1874 $totalarray['nbfield']++;
1875 }
1876 }
1877 if (!empty($arrayfields['s.nom']['checked'])) {
1878 print '<td'.(getDolGlobalString('MAIN_SOCIETE_SHOW_COMPLETE_NAME') ? '' : ' class="tdoverflowmax200"').' data-key="ref">';
1879 if ($contextpage == 'poslist') {
1880 print dol_escape_htmltag($companystatic->name);
1881 } else {
1882 print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1883 }
1884 print "</td>\n";
1885 if (!$i) {
1886 $totalarray['nbfield']++;
1887 }
1888 }
1889 if (!empty($arrayfields['s.name_alias']['checked'])) {
1890 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1891 print dol_escape_htmltag($companystatic->name_alias);
1892 print "</td>\n";
1893 if (!$i) {
1894 $totalarray['nbfield']++;
1895 }
1896 }
1897 // Barcode
1898 if (!empty($arrayfields['s.barcode']['checked'])) {
1899 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
1900 if (!$i) {
1901 $totalarray['nbfield']++;
1902 }
1903 }
1904 // Customer code
1905 if (!empty($arrayfields['s.code_client']['checked'])) {
1906 print '<td class="nowraponall">'.dol_escape_htmltag($companystatic->code_client).'</td>';
1907 if (!$i) {
1908 $totalarray['nbfield']++;
1909 }
1910 }
1911 // Supplier code
1912 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1913 print '<td class="nowraponall">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
1914 if (!$i) {
1915 $totalarray['nbfield']++;
1916 }
1917 }
1918 // Account customer code
1919 if (!empty($arrayfields['s.code_compta']['checked'])) {
1920 print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
1921 if (!$i) {
1922 $totalarray['nbfield']++;
1923 }
1924 }
1925 // Account supplier code
1926 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1927 print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
1928 if (!$i) {
1929 $totalarray['nbfield']++;
1930 }
1931 }
1932 // Address
1933 if (!empty($arrayfields['s.address']['checked'])) {
1934 print '<td class="tdoverflowmax250" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
1935 if (!$i) {
1936 $totalarray['nbfield']++;
1937 }
1938 }
1939 // Sales Representative
1940 if (!empty($arrayfields['sales.representative']['checked'])) {
1941 print '<td class="nowraponall tdoverflowmax200">';
1942 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1943 $nbofsalesrepresentative = count($listsalesrepresentatives);
1944 if ($nbofsalesrepresentative > 6) {
1945 // We print only number
1946 print $nbofsalesrepresentative;
1947 } elseif ($nbofsalesrepresentative > 0) {
1948 $userstatic = new User($db);
1949 $j = 0;
1950 foreach ($listsalesrepresentatives as $val) {
1951 $userstatic->id = $val['id'];
1952 $userstatic->lastname = $val['lastname'];
1953 $userstatic->firstname = $val['firstname'];
1954 $userstatic->email = $val['email'];
1955 $userstatic->entity = $val['entity'];
1956 $userstatic->photo = $val['photo'];
1957 $userstatic->login = $val['login'];
1958 $userstatic->office_phone = $val['office_phone'];
1959 $userstatic->office_fax = $val['office_fax'];
1960 $userstatic->user_mobile = $val['user_mobile'];
1961 $userstatic->job = $val['job'];
1962 $userstatic->gender = $val['gender'];
1963 $userstatic->statut = $val['statut'];
1964 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
1965 $j++;
1966 if ($j < $nbofsalesrepresentative) {
1967 print ' ';
1968 }
1969 }
1970 } else {
1971 print '&nbsp;';
1972 }
1973 print '</td>';
1974 if (!$i) {
1975 $totalarray['nbfield']++;
1976 }
1977 }
1978 // Zip
1979 if (!empty($arrayfields['s.zip']['checked'])) {
1980 print "<td>".dol_escape_htmltag($companystatic->zip)."</td>\n";
1981 if (!$i) {
1982 $totalarray['nbfield']++;
1983 }
1984 }
1985 // Town
1986 if (!empty($arrayfields['s.town']['checked'])) {
1987 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n";
1988 if (!$i) {
1989 $totalarray['nbfield']++;
1990 }
1991 }
1992 // State
1993 if (!empty($arrayfields['state.nom']['checked'])) {
1994 print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
1995 if (!$i) {
1996 $totalarray['nbfield']++;
1997 }
1998 }
1999 // Region
2000 if (!empty($arrayfields['region.nom']['checked'])) {
2001 print "<td>".dol_escape_htmltag($obj->region_name)."</td>\n";
2002 if (!$i) {
2003 $totalarray['nbfield']++;
2004 }
2005 }
2006 // Country
2007 if (!empty($arrayfields['country.code_iso']['checked'])) {
2008 print '<td class="center tdoverflowmax100">';
2009 $labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label;
2010 print $labelcountry;
2011 print '</td>';
2012 if (!$i) {
2013 $totalarray['nbfield']++;
2014 }
2015 }
2016 // Type ent
2017 if (!empty($arrayfields['typent.code']['checked'])) {
2018 if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
2019 $typenArray = $formcompany->typent_array(1);
2020 }
2021 $labeltypeofcompany = empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
2022
2023 print '<td class="center tdoverflowmax125" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
2024 print dol_escape_htmltag($labeltypeofcompany);
2025 print '</td>';
2026 if (!$i) {
2027 $totalarray['nbfield']++;
2028 }
2029 }
2030 // Multiprice level
2031 if (!empty($arrayfields['s.price_level']['checked'])) {
2032 print '<td class="center">'.$obj->price_level."</td>\n";
2033 if (!$i) {
2034 $totalarray['nbfield']++;
2035 }
2036 }
2037 // Staff
2038 if (!empty($arrayfields['staff.code']['checked'])) {
2039 print '<td class="center">';
2040 if (!empty($obj->staff_code)) {
2041 if (empty($conf->cache['staffArray'])) {
2042 $conf->cache['staffArray'] = $formcompany->effectif_array(1);
2043 }
2044 print $conf->cache['staffArray'][$obj->staff_code];
2045 }
2046 print '</td>';
2047 if (!$i) {
2048 $totalarray['nbfield']++;
2049 }
2050 }
2051 // Legal form
2052 if (!empty($arrayfields['legalform.code']['checked'])) {
2053 $labeltoshow = '';
2054 if (!empty($obj->legalform_code)) {
2055 if (empty($conf->cache['legalformArray'][$obj->legalform_code])) {
2056 $conf->cache['legalformArray'][$obj->legalform_code] = getFormeJuridiqueLabel($obj->legalform_code);
2057 }
2058 $labeltoshow = $conf->cache['legalformArray'][$obj->legalform_code];
2059 }
2060 print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($labeltoshow).'">';
2061 print dol_escape_htmltag($labeltoshow);
2062 print '</td>';
2063 if (!$i) {
2064 $totalarray['nbfield']++;
2065 }
2066 }
2067 // Email
2068 if (!empty($arrayfields['s.email']['checked'])) {
2069 print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 1, 0, 0, 1)."</td>\n";
2070 if (!$i) {
2071 $totalarray['nbfield']++;
2072 }
2073 }
2074 if (!empty($arrayfields['s.phone']['checked'])) {
2075 print '<td class="nowraponall">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
2076 if (!$i) {
2077 $totalarray['nbfield']++;
2078 }
2079 }
2080 if (!empty($arrayfields['s.phone_mobile']['checked'])) {
2081 print '<td class="nowraponall">'.dol_print_phone($obj->phone_mobile, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone_mobile')."</td>\n";
2082 if (!$i) {
2083 $totalarray['nbfield']++;
2084 }
2085 }
2086 if (!empty($arrayfields['s.fax']['checked'])) {
2087 print '<td class="nowraponall">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n";
2088 if (!$i) {
2089 $totalarray['nbfield']++;
2090 }
2091 }
2092 if (!empty($arrayfields['s.url']['checked'])) {
2093 print "<td>".dol_print_url($obj->url, '', 0, 1)."</td>\n";
2094 if (!$i) {
2095 $totalarray['nbfield']++;
2096 }
2097 }
2098 if (!empty($arrayfields['s.siren']['checked'])) {
2099 print "<td>".$obj->idprof1."</td>\n";
2100 if (!$i) {
2101 $totalarray['nbfield']++;
2102 }
2103 }
2104 if (!empty($arrayfields['s.siret']['checked'])) {
2105 print "<td>".$obj->idprof2."</td>\n";
2106 if (!$i) {
2107 $totalarray['nbfield']++;
2108 }
2109 }
2110 if (!empty($arrayfields['s.ape']['checked'])) {
2111 print "<td>".$obj->idprof3."</td>\n";
2112 if (!$i) {
2113 $totalarray['nbfield']++;
2114 }
2115 }
2116 if (!empty($arrayfields['s.idprof4']['checked'])) {
2117 print "<td>".$obj->idprof4."</td>\n";
2118 if (!$i) {
2119 $totalarray['nbfield']++;
2120 }
2121 }
2122 if (!empty($arrayfields['s.idprof5']['checked'])) {
2123 print "<td>".$obj->idprof5."</td>\n";
2124 if (!$i) {
2125 $totalarray['nbfield']++;
2126 }
2127 }
2128 if (!empty($arrayfields['s.idprof6']['checked'])) {
2129 print "<td>".$obj->idprof6."</td>\n";
2130 if (!$i) {
2131 $totalarray['nbfield']++;
2132 }
2133 }
2134 // VAT
2135 if (!empty($arrayfields['s.tva_intra']['checked'])) {
2136 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
2137 if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
2138 print img_warning("BadVATNumber", '', 'pictofixedwidth');
2139 }
2140 print $companystatic->tva_intra;
2141 print "</td>\n";
2142 if (!$i) {
2143 $totalarray['nbfield']++;
2144 }
2145 }
2146 // Nature
2147 if (!empty($arrayfields['customerorsupplier']['checked'])) {
2148 print '<td class="center">';
2149 print $companystatic->getTypeUrl(1);
2150 print '</td>';
2151 if (!$i) {
2152 $totalarray['nbfield']++;
2153 }
2154 }
2155 // Prospect level
2156 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
2157 print '<td class="center nowraponall">';
2158 print $companystatic->getLibProspLevel();
2159 print "</td>";
2160 if (!$i) {
2161 $totalarray['nbfield']++;
2162 }
2163 }
2164 // Prospect status
2165 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
2166 print '<td class="center nowraponall">';
2167
2168 $prospectid = $obj->rowid;
2169 $statusprospect = $obj->stcomm_id;
2170
2171 $formcompany->selectProspectStatus('status_prospect', $prospectstatic, $statusprospect, $prospectid);
2172
2173 print '</td>';
2174 if (!$i) {
2175 $totalarray['nbfield']++;
2176 }
2177 }
2178 // Parent company
2179 if (!empty($arrayfields['s2.nom']['checked'])) {
2180 print '<td class="center tdoverflowmax100">';
2181 if ($companystatic->parent > 0) {
2182 $companyparent->fetch($companystatic->parent);
2183 print $companyparent->getNomUrl(1);
2184 }
2185 print "</td>";
2186 if (!$i) {
2187 $totalarray['nbfield']++;
2188 }
2189 }
2190 // Extra fields
2191 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2192 // Fields from hook
2193 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
2194 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2195 print $hookmanager->resPrint;
2196 // Date creation
2197 if (!empty($arrayfields['s.datec']['checked'])) {
2198 print '<td class="center nowraponall">';
2199 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2200 print '</td>';
2201 if (!$i) {
2202 $totalarray['nbfield']++;
2203 }
2204 }
2205 // Date modification
2206 if (!empty($arrayfields['s.tms']['checked'])) {
2207 print '<td class="center nowraponall">';
2208 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
2209 print '</td>';
2210 if (!$i) {
2211 $totalarray['nbfield']++;
2212 }
2213 }
2214 // Note public
2215 if (!empty($arrayfields['s.note_public']['checked'])) {
2216 print '<td class="flat maxwidth250imp">';
2217 print dolPrintHTML(dolGetFirstLineOfText($obj->note_public), 5);
2218 print '</td>';
2219 if (!$i) {
2220 $totalarray['nbfield']++;
2221 }
2222 }
2223 // Note private
2224 if (!empty($arrayfields['s.note_private']['checked'])) {
2225 print '<td class="flat maxwidth250imp">';
2226 print dolPrintHTML(dolGetFirstLineOfText($obj->note_private), 5);
2227 print '</td>';
2228 if (!$i) {
2229 $totalarray['nbfield']++;
2230 }
2231 }
2232 // Status
2233 if (!empty($arrayfields['s.status']['checked'])) {
2234 print '<td class="center nowraponall">'.$companystatic->getLibStatut(5).'</td>';
2235 if (!$i) {
2236 $totalarray['nbfield']++;
2237 }
2238 }
2239 // Import key
2240 if (!empty($arrayfields['s.import_key']['checked'])) {
2241 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).'">';
2242 print dol_escape_htmltag($obj->import_key);
2243 print "</td>\n";
2244 if (!$i) {
2245 $totalarray['nbfield']++;
2246 }
2247 }
2248 // Action column (Show the massaction button only when this page is not opend from the Extended POS)
2249 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2250 print '<td class="nowrap center actioncolumn">';
2251 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
2252 $selected = 0;
2253 if (in_array($obj->rowid, $arrayofselected)) {
2254 $selected = 1;
2255 }
2256 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2257 }
2258 print '</td>';
2259 if (!$i) {
2260 $totalarray['nbfield']++;
2261 }
2262 }
2263
2264 print '</tr>'."\n";
2265 }
2266 $i++;
2267}
2268
2269// Show total line
2270include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2271
2272// If no record found
2273if ($num == 0) {
2274 $colspan = 1;
2275 foreach ($arrayfields as $key => $val) {
2276 if (!empty($val['checked'])) {
2277 $colspan++;
2278 }
2279 }
2280 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
2281}
2282
2283$db->free($resql);
2284
2285$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
2286$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2287print $hookmanager->resPrint;
2288
2289print '</table>'."\n";
2290print '</div>'."\n";
2291
2292// Line that calls the select_status function by passing it js as the 5th parameter in order to activate the js script
2293$formcompany->selectProspectStatus('status_prospect', $prospectstatic, null, null, "js");
2294
2295print '</form>'."\n";
2296
2297// End of page
2298llxFooter();
2299$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
$object ref
Definition info.php:89
Class to manage customers or prospects.
Class to manage standard extra fields.
Class to manage invoices.
Class to manage forms for categories.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
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 information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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...
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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 the value of a given key, which produces ascending (default) or descending out...
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
get_htmloutput_mesg($mesgstring='', $mesgarray=[], $style='ok', $keepembedded=0)
Get formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.