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