dolibarr  16.0.5
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-2018 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 Frédéric France <frederic.france@netlogic.fr>
15  * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program. If not, see <https://www.gnu.org/licenses/>.
29  */
30 
37 require_once '../main.inc.php';
38 include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
41 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
44 
45 $langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk"));
46 
47 $action = GETPOST('action', 'aZ09');
48 $massaction = GETPOST('massaction', 'alpha');
49 $show_files = GETPOST('show_files', 'int');
50 $confirm = GETPOST('confirm', 'alpha');
51 $toselect = GETPOST('toselect', 'array');
52 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist';
53 $optioncss = GETPOST('optioncss', 'alpha');
54 if ($contextpage == 'poslist') {
55  $optioncss = 'print';
56 }
57 $mode = GETPOST("mode", 'alpha');
58 
59 $search_all = trim(GETPOST('search_all', 'alphanohtml') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
60 $search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
61 
62 $search_id = trim(GETPOST("search_id", "int"));
63 $search_nom = trim(GETPOST("search_nom", 'restricthtml'));
64 $search_alias = trim(GETPOST("search_alias", 'restricthtml'));
65 $search_nom_only = trim(GETPOST("search_nom_only", 'restricthtml'));
66 $search_barcode = trim(GETPOST("search_barcode", 'alpha'));
67 $search_customer_code = trim(GETPOST('search_customer_code', 'alpha'));
68 $search_supplier_code = trim(GETPOST('search_supplier_code', 'alpha'));
69 $search_account_customer_code = trim(GETPOST('search_account_customer_code', 'alpha'));
70 $search_account_supplier_code = trim(GETPOST('search_account_supplier_code', 'alpha'));
71 $search_address = trim(GETPOST('search_address', 'alpha'));
72 $search_town = trim(GETPOST("search_town", 'alpha'));
73 $search_zip = trim(GETPOST("search_zip", 'alpha'));
74 $search_state = trim(GETPOST("search_state", 'alpha'));
75 $search_region = trim(GETPOST("search_region", 'alpha'));
76 $search_email = trim(GETPOST('search_email', 'alpha'));
77 $search_phone = trim(GETPOST('search_phone', 'alpha'));
78 $search_fax = trim(GETPOST('search_fax', 'alpha'));
79 $search_url = trim(GETPOST('search_url', 'alpha'));
80 $search_idprof1 = trim(GETPOST('search_idprof1', 'alpha'));
81 $search_idprof2 = trim(GETPOST('search_idprof2', 'alpha'));
82 $search_idprof3 = trim(GETPOST('search_idprof3', 'alpha'));
83 $search_idprof4 = trim(GETPOST('search_idprof4', 'alpha'));
84 $search_idprof5 = trim(GETPOST('search_idprof5', 'alpha'));
85 $search_idprof6 = trim(GETPOST('search_idprof6', 'alpha'));
86 $search_vat = trim(GETPOST('search_vat', 'alpha'));
87 $search_sale = GETPOST("search_sale", 'int');
88 $search_categ_cus = GETPOST("search_categ_cus", 'int');
89 $search_categ_sup = GETPOST("search_categ_sup", 'int');
90 $search_country = GETPOST("search_country", 'intcomma');
91 $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
92 $search_price_level = GETPOST('search_price_level', 'int');
93 $search_staff = GETPOST("search_staff", 'int');
94 $search_status = GETPOST("search_status", 'int');
95 $search_type = GETPOST('search_type', 'alpha');
96 $search_level = GETPOST("search_level", "array");
97 $search_stcomm = GETPOST('search_stcomm', 'int');
98 $search_import_key = trim(GETPOST("search_import_key", "alpha"));
99 $search_parent_name = trim(GETPOST('search_parent_name', 'alpha'));
100 
101 $type = GETPOST('type', 'alpha');
102 $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant
103 
104 $diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id;
105 
106 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
107 $sortfield = GETPOST('sortfield', 'aZ09comma');
108 $sortorder = GETPOST('sortorder', 'aZ09comma');
109 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
110 if (!$sortorder) {
111  $sortorder = "ASC";
112 }
113 if (!$sortfield) {
114  $sortfield = "s.nom";
115 }
116 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
117  $page = 0;
118 } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
119 $offset = $limit * $page;
120 $pageprev = $page - 1;
121 $pagenext = $page + 1;
122 
123 if ($type == 'c') {
124  if (empty($contextpage) || $contextpage == 'thirdpartylist') {
125  $contextpage = 'customerlist';
126  } if ($search_type == '') {
127  $search_type = '1,3';
128  }
129 }
130 if ($type == 'p') {
131  if (empty($contextpage) || $contextpage == 'thirdpartylist') {
132  $contextpage = 'prospectlist';
133  } if ($search_type == '') {
134  $search_type = '2,3';
135  }
136 }
137 if ($type == 't') {
138  if (empty($contextpage) || $contextpage == 'poslist') {
139  $contextpage = 'poslist';
140  } if ($search_type == '') {
141  $search_type = '1,2,3';
142  }
143 }
144 if ($type == 'f') {
145  if (empty($contextpage) || $contextpage == 'thirdpartylist') {
146  $contextpage = 'supplierlist';
147  } if ($search_type == '') {
148  $search_type = '4';
149  }
150 }
151 
152 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
153 $object = new Societe($db);
154 $hookmanager->initHooks(array('thirdpartylist'));
155 $extrafields = new ExtraFields($db);
156 
157 // fetch optionals attributes and labels
158 $extrafields->fetch_name_optionals_label($object->table_element);
159 
160 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
161 
162 // List of fields to search into when doing a "search in all"
163 $fieldstosearchall = array(
164  's.nom'=>"ThirdPartyName",
165  's.name_alias'=>"AliasNameShort",
166  's.code_client'=>"CustomerCode",
167  's.code_fournisseur'=>"SupplierCode",
168  's.code_compta'=>"CustomerAccountancyCodeShort",
169  's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort",
170  's.zip'=>"Zip",
171  's.town'=>"Town",
172  's.email'=>"EMail",
173  's.url'=>"URL",
174  's.tva_intra'=>"VATIntra",
175  's.siren'=>"ProfId1",
176  's.siret'=>"ProfId2",
177  's.ape'=>"ProfId3",
178  's.phone'=>"Phone",
179  's.fax'=>"Fax",
180 );
181 if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') {
182  $fieldstosearchall['s.idprof4'] = 'ProfId4';
183 }
184 if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') {
185  $fieldstosearchall['s.idprof5'] = 'ProfId5';
186 }
187 if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') {
188  $fieldstosearchall['s.idprof6'] = 'ProfId6';
189 }
190 if (!empty($conf->barcode->enabled)) {
191  $fieldstosearchall['s.barcode'] = 'Gencod';
192 }
193 // Personalized search criterias. Example: $conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS = 's.nom=ThirdPartyName;s.name_alias=AliasNameShort;s.code_client=CustomerCode'
194 if (!empty($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS)) {
195  $fieldstosearchall = dolExplodeIntoArray($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS);
196 }
197 
198 
199 // Define list of fields to show into list
200 $checkedcustomercode = (in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0);
201 $checkedsuppliercode = (in_array($contextpage, array('supplierlist')) ? 1 : 0);
202 $checkedcustomeraccountcode = (in_array($contextpage, array('customerlist')) ? 1 : 0);
203 $checkedsupplieraccountcode = (in_array($contextpage, array('supplierlist')) ? 1 : 0);
204 $checkedtypetiers = 1;
205 $checkedprofid1 = 0;
206 $checkedprofid2 = 0;
207 $checkedprofid3 = 0;
208 $checkedprofid4 = 0;
209 $checkedprofid5 = 0;
210 $checkedprofid6 = 0;
211 //$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0);
212 //$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0);
213 //$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0);
214 $checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
215 $checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
216 $arrayfields = array(
217  's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))),
218  's.nom'=>array('label'=>"ThirdPartyName", 'position'=>2, 'checked'=>1),
219  's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1),
220  's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))),
221  's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode),
222  's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
223  's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode),
224  's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
225  's.address'=>array('label'=>"Address", 'position'=>19, 'checked'=>0),
226  's.zip'=>array('label'=>"Zip", 'position'=>20, 'checked'=>1),
227  's.town'=>array('label'=>"Town", 'position'=>21, 'checked'=>0),
228  'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0),
229  'region.nom'=>array('label'=>"Region", 'position'=>23, 'checked'=>0),
230  'country.code_iso'=>array('label'=>"Country", 'position'=>24, 'checked'=>0),
231  's.email'=>array('label'=>"Email", 'position'=>25, 'checked'=>0),
232  's.url'=>array('label'=>"Url", 'position'=>26, 'checked'=>0),
233  's.phone'=>array('label'=>"Phone", 'position'=>27, 'checked'=>1),
234  's.fax'=>array('label'=>"Fax", 'position'=>28, 'checked'=>0),
235  'typent.code'=>array('label'=>"ThirdPartyType", 'position'=>29, 'checked'=>$checkedtypetiers),
236  'staff.code'=>array('label'=>"Staff", 'position'=>31, 'checked'=>0),
237  's.siren'=>array('label'=>"ProfId1Short", 'position'=>40, 'checked'=>$checkedprofid1),
238  's.siret'=>array('label'=>"ProfId2Short", 'position'=>41, 'checked'=>$checkedprofid2),
239  's.ape'=>array('label'=>"ProfId3Short", 'position'=>42, 'checked'=>$checkedprofid3),
240  's.idprof4'=>array('label'=>"ProfId4Short", 'position'=>43, 'checked'=>$checkedprofid4),
241  's.idprof5'=>array('label'=>"ProfId5Short", 'position'=>44, 'checked'=>$checkedprofid5),
242  's.idprof6'=>array('label'=>"ProfId6Short", 'position'=>45, 'checked'=>$checkedprofid6),
243  's.tva_intra'=>array('label'=>"VATIntraShort", 'position'=>50, 'checked'=>0),
244  'customerorsupplier'=>array('label'=>'NatureOfThirdParty', 'position'=>61, 'checked'=>1),
245  's.fk_prospectlevel'=>array('label'=>"ProspectLevel", 'position'=>62, 'checked'=>$checkprospectlevel),
246  's.fk_stcomm'=>array('label'=>"StatusProsp", 'position'=>63, 'checked'=>$checkstcomm),
247  's2.nom'=>array('label'=>'ParentCompany', 'position'=>64, 'checked'=>0),
248  's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
249  's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
250  's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
251  's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
252 );
253 if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
254  $arrayfields['s.price_level'] = array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0);
255 }
256 
257 // Extra fields
258 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
259 
260 $object->fields = dol_sort_array($object->fields, 'position');
261 $arrayfields = dol_sort_array($arrayfields, 'position');
262 
263 // Security check
264 $socid = GETPOST('socid', 'int');
265 if ($user->socid) {
266  $socid = $user->socid;
267 }
268 $result = restrictedArea($user, 'societe', $socid, '');
269 
270 
271 
272 /*
273  * Actions
274  */
275 
276 if ($action == "change") { // Change customer for TakePOS
277  $idcustomer = GETPOST('idcustomer', 'int');
278 
279  // Check if draft invoice already exists, if not create it
280  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
281  $result = $db->query($sql);
282  $num_lines = $db->num_rows($result);
283  if ($num_lines == 0) {
284  require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
285  $invoice = new Facture($db);
286  $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
287  $invoice->socid = $conf->global->$constforthirdpartyid;
288  $invoice->date = dol_now();
289  $invoice->module_source = 'takepos';
290  $invoice->pos_source = $_SESSION["takeposterminal"];
291  $placeid = $invoice->create($user);
292  $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid);
293  $db->query($sql);
294  }
295 
296  $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".((int) $idcustomer)." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
297  $resql = $db->query($sql);
298  ?>
299  <script>
300  console.log("Reload page invoice.php with place=<?php print $place; ?>");
301  parent.$("#poslines").load("invoice.php?place=<?php print $place; ?>", function() {
302  //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
303  <?php if (!$resql) { ?>
304  alert('Error failed to update customer on draft invoice.');
305  <?php } ?>
306  parent.$.colorbox.close(); /* Close the popup */
307  });
308  </script>
309  <?php
310  exit;
311 }
312 
313 if (GETPOST('cancel', 'alpha')) {
314  $action = 'list'; $massaction = '';
315 }
316 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
317  $massaction = '';
318 }
319 
320 $parameters = array();
321 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
322 if ($reshook < 0) {
323  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
324 }
325 
326 if (empty($reshook)) {
327  // Selection of new fields
328  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
329 
330  // Did we click on purge search criteria ?
331  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
332  $search_id = '';
333  $search_nom = '';
334  $search_alias = '';
335  $search_categ_cus = 0;
336  $search_categ_sup = 0;
337  $search_sale = '';
338  $search_barcode = "";
339  $search_customer_code = '';
340  $search_supplier_code = '';
341  $search_account_customer_code = '';
342  $search_account_supplier_code = '';
343  $search_address = '';
344  $search_town = "";
345  $search_zip = "";
346  $search_state = "";
347  $search_region = "";
348  $search_country = '';
349  $search_email = '';
350  $search_phone = '';
351  $search_fax = '';
352  $search_url = '';
353  $search_idprof1 = '';
354  $search_idprof2 = '';
355  $search_idprof3 = '';
356  $search_idprof4 = '';
357  $search_idprof5 = '';
358  $search_idprof6 = '';
359  $search_vat = '';
360  $search_type = '';
361  $search_price_level = '';
362  $search_type_thirdparty = '';
363  $search_staff = '';
364  $search_status = -1;
365  $search_stcomm = '';
366  $search_level = '';
367  $search_parent_name = '';
368  $search_import_key = '';
369  $toselect = array();
370  $search_array_options = array();
371  }
372 
373  // Mass actions
374  $objectclass = 'Societe';
375  $objectlabel = 'ThirdParty';
376  $permissiontoread = $user->rights->societe->lire;
377  $permissiontodelete = $user->rights->societe->supprimer;
378  $permissiontoadd = $user->rights->societe->creer;
379  $uploaddir = $conf->societe->dir_output;
380  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
381 
382  if ($action == 'setstcomm') {
383  $object = new Client($db);
384  $result = $object->fetch(GETPOST('stcommsocid'));
385  $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm');
386  $result = $object->update($object->id, $user);
387  if ($result < 0) {
388  setEventMessages($object->error, $object->errors, 'errors');
389  }
390 
391  $action = '';
392  }
393 }
394 
395 if ($search_status == '') {
396  $search_status = 1; // always display active thirdparty first
397 }
398 
399 
400 
401 /*
402  * View
403  */
404 
405 /*
406  REM: Rules on permissions to see thirdparties
407  Internal or External user + No permission to see customers => See nothing
408  Internal user socid=0 + Permission to see ALL customers => See all thirdparties
409  Internal user socid=0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative
410  External user socid=x + Permission to see ALL customers => Can see only himself
411  External user socid=x + No permission to see ALL customers => Can see only himself
412  */
413 
414 $form = new Form($db);
415 $formother = new FormOther($db);
416 $companystatic = new Societe($db);
417 $companyparent = new Societe($db);
418 $formcompany = new FormCompany($db);
419 $prospectstatic = new Client($db);
420 $prospectstatic->client = 2;
421 $prospectstatic->loadCacheOfProspStatus();
422 
423 
424 $title = $langs->trans("ThirdParties");
425 if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) {
426  $title = $langs->trans("Customers");
427 }
428 if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) {
429  $title = $langs->trans("Prospects");
430 }
431 if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) {
432  $title = $langs->trans("Suppliers");
433 }
434 
435 // Select every potentiels, and note each potentiels which fit in search parameters
436 $tab_level = array();
437 $sql = "SELECT code, label, sortorder";
438 $sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
439 $sql .= " WHERE active > 0";
440 $sql .= " ORDER BY sortorder";
441 $resql = $db->query($sql);
442 if ($resql) {
443  while ($obj = $db->fetch_object($resql)) {
444  // Compute level text
445  $level = $langs->trans($obj->code);
446  if ($level == $obj->code) {
447  $level = $langs->trans($obj->label);
448  }
449  $tab_level[$obj->code] = $level;
450  }
451 } else {
452  dol_print_error($db);
453 }
454 
455 $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
456 $sql .= " s.entity,";
457 $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
458 $sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
459 $sql .= " s.tms as date_update, s.datec as date_creation, s.import_key,";
460 $sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
461 $sql .= " s2.nom as name2,";
462 $sql .= " typent.code as typent_code,";
463 $sql .= " staff.code as staff_code,";
464 $sql .= " country.code as country_code, country.label as country_label,";
465 $sql .= " state.code_departement as state_code, state.nom as state_name,";
466 $sql .= " region.code_region as region_code, region.nom as region_name";
467 // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
468 if ($search_sale && $search_sale != '-1') {
469  $sql .= ", sc.fk_soc, sc.fk_user";
470 }
471 // We'll need these fields in order to filter by categ
472 if ($search_categ_cus && $search_categ_cus != -1) {
473  $sql .= ", cc.fk_categorie, cc.fk_soc";
474 }
475 if ($search_categ_sup && $search_categ_sup != -1) {
476  $sql .= ", cs.fk_categorie, cs.fk_soc";
477 }
478 // Add fields from extrafields
479 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
480  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
481  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
482  }
483 }
484 // Add fields from hooks
485 $parameters = array();
486 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
487 $sql .= $hookmanager->resPrint;
488 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
489 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid";
490 if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
491  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)";
492 }
493 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
494 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
495 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
496 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
497 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)";
498 // We'll need this table joined to the select in order to filter by categ
499 if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
500  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
501 }
502 if (!empty($search_categ_sup) && $search_categ_sup != '-1') {
503  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
504 }
505 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
506 // We'll need this table joined to the select in order to filter by sale
507 if ($search_sale == -2) {
508  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
509  //elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
510 } elseif (!empty($search_sale) && $search_sale != '-1' || (empty($user->rights->societe->client->voir) && !$socid)) {
511  $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
512 }
513 // Add table from hooks
514 $parameters = array();
515 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
516 $sql .= $hookmanager->resPrint;
517 $sql .= " WHERE s.entity IN (".getEntity('societe').")";
518 //if (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
519 if (empty($user->rights->societe->client->voir) && !$socid) {
520  $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
521 }
522 if ($search_sale && $search_sale != '-1' && $search_sale != '-2') {
523  $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
524 }
525 if (empty($user->rights->fournisseur->lire)) {
526  $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
527 }
528 if ($search_sale == -2) {
529  $sql .= " AND sc.fk_user IS NULL";
530 } elseif ($search_sale > 0) {
531  $sql .= " AND sc.fk_user = ".((int) $search_sale);
532 }
533 if ($search_categ_cus > 0) {
534  $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
535 }
536 if ($search_categ_sup > 0) {
537  $sql .= " AND cs.fk_categorie = ".((int) $search_categ_sup);
538 }
539 if ($search_categ_cus == -2) {
540  $sql .= " AND cc.fk_categorie IS NULL";
541 }
542 if ($search_categ_sup == -2) {
543  $sql .= " AND cs.fk_categorie IS NULL";
544 }
545 
546 if ($search_all) {
547  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
548 }
549 if (strlen($search_cti)) {
550  $sql .= natural_search('s.phone', $search_cti);
551 }
552 
553 if ($search_id > 0) {
554  $sql .= natural_search("s.rowid", $search_id, 1);
555 }
556 if ($search_nom) {
557  $sql .= natural_search("s.nom", $search_nom);
558 }
559 if ($search_alias) {
560  $sql .= natural_search("s.name_alias", $search_alias);
561 }
562 if ($search_nom_only) {
563  $sql .= natural_search("s.nom", $search_nom_only);
564 }
565 if ($search_customer_code) {
566  $sql .= natural_search("s.code_client", $search_customer_code);
567 }
568 if ($search_supplier_code) {
569  $sql .= natural_search("s.code_fournisseur", $search_supplier_code);
570 }
571 if ($search_account_customer_code) {
572  $sql .= natural_search("s.code_compta", $search_account_customer_code);
573 }
574 if ($search_account_supplier_code) {
575  $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code);
576 }
577 if ($search_address) {
578  $sql .= natural_search('s.address', $search_address);
579 }
580 if ($search_town) {
581  $sql .= natural_search("s.town", $search_town);
582 }
583 if (strlen($search_zip)) {
584  $sql .= natural_search("s.zip", $search_zip);
585 }
586 if ($search_state) {
587  $sql .= natural_search("state.nom", $search_state);
588 }
589 if ($search_region) {
590  $sql .= natural_search("region.nom", $search_region);
591 }
592 if ($search_country && $search_country != '-1') {
593  $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
594 }
595 if ($search_email) {
596  $sql .= natural_search("s.email", $search_email);
597 }
598 if (strlen($search_phone)) {
599  $sql .= natural_search("s.phone", $search_phone);
600 }
601 if (strlen($search_fax)) {
602  $sql .= natural_search("s.fax", $search_fax);
603 }
604 if ($search_url) {
605  $sql .= natural_search("s.url", $search_url);
606 }
607 if (strlen($search_idprof1)) {
608  $sql .= natural_search("s.siren", $search_idprof1);
609 }
610 if (strlen($search_idprof2)) {
611  $sql .= natural_search("s.siret", $search_idprof2);
612 }
613 if (strlen($search_idprof3)) {
614  $sql .= natural_search("s.ape", $search_idprof3);
615 }
616 if (strlen($search_idprof4)) {
617  $sql .= natural_search("s.idprof4", $search_idprof4);
618 }
619 if (strlen($search_idprof5)) {
620  $sql .= natural_search("s.idprof5", $search_idprof5);
621 }
622 if (strlen($search_idprof6)) {
623  $sql .= natural_search("s.idprof6", $search_idprof6);
624 }
625 if (strlen($search_vat)) {
626  $sql .= natural_search("s.tva_intra", $search_vat);
627 }
628 // Filter on type of thirdparty
629 if ($search_type > 0 && in_array($search_type, array('1,3', '1,2,3', '2,3'))) {
630  $sql .= " AND s.client IN (".$db->sanitize($search_type).")";
631 }
632 if ($search_type > 0 && in_array($search_type, array('4'))) {
633  $sql .= " AND s.fournisseur = 1";
634 }
635 if ($search_type == '0') {
636  $sql .= " AND s.client = 0 AND s.fournisseur = 0";
637 }
638 if ($search_status != '' && $search_status >= 0) {
639  $sql .= natural_search("s.status", $search_status, 2);
640 }
641 if (!empty($conf->barcode->enabled) && $search_barcode) {
642  $sql .= natural_search("s.barcode", $search_barcode);
643 }
644 if ($search_price_level && $search_price_level != '-1') {
645  $sql .= natural_search("s.price_level", $search_price_level, 2);
646 }
647 if ($search_type_thirdparty && $search_type_thirdparty > 0) {
648  $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2);
649 }
650 if (!empty($search_staff) && $search_staff != '-1') {
651  $sql .= natural_search("s.fk_effectif", $search_staff, 2);
652 }
653 if ($search_level) {
654  $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3);
655 }
656 if ($search_parent_name) {
657  $sql .= natural_search("s2.nom", $search_parent_name);
658 }
659 if ($search_stcomm != '' && $search_stcomm != '-2') { // -2 is not filter
660  $sql .= natural_search("s.fk_stcomm", $search_stcomm, 1);
661 }
662 if ($search_import_key) {
663  $sql .= natural_search("s.import_key", $search_import_key);
664 }
665 // Add where from extra fields
666 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
667 // Add where from hooks
668 $parameters = array('socid' => $socid);
669 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
670 if (empty($reshook)) {
671  if ($socid) {
672  $sql .= " AND s.rowid = ".((int) $socid);
673  }
674 }
675 $sql .= $hookmanager->resPrint;
676 // Add GroupBy from hooks
677 $parameters = array('fieldstosearchall' => $fieldstosearchall);
678 $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
679 $sql .= $hookmanager->resPrint;
680 
681 // Count total nb of records with no order and no limits
682 $nbtotalofrecords = '';
683 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
684  $resql = $db->query($sql);
685  if ($resql) {
686  $nbtotalofrecords = $db->num_rows($resql);
687  } else {
688  dol_print_error($db);
689  }
690 
691  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
692  $page = 0;
693  $offset = 0;
694  }
695  $db->free($resql);
696 }
697 
698 // Complete request and execute it with limit
699 $sql .= $db->order($sortfield, $sortorder);
700 if ($limit) {
701  $sql .= $db->plimit($limit + 1, $offset);
702 }
703 
704 $resql = $db->query($sql);
705 if (!$resql) {
706  dol_print_error($db);
707  exit;
708 }
709 
710 $num = $db->num_rows($resql);
711 
712 
713 $arrayofselected = is_array($toselect) ? $toselect : array();
714 
715 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') {
716  $obj = $db->fetch_object($resql);
717  $id = $obj->rowid;
718  if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
719  if ($obj->client > 0) {
720  header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id);
721  exit;
722  }
723  if ($obj->fournisseur > 0) {
724  header("Location: ".DOL_URL_ROOT.'/fourn/card.php?socid='.$id);
725  exit;
726  }
727  }
728 
729  header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id);
730  exit;
731 }
732 
733 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
734 llxHeader('', $langs->trans("ThirdParty"), $help_url);
735 
736 $param = '';
737 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
738  $param .= '&contextpage='.urlencode($contextpage);
739 }
740 if ($limit > 0 && $limit != $conf->liste_limit) {
741  $param .= '&limit='.urlencode($limit);
742 }
743 if ($search_all != '') {
744  $param = "&sall=".urlencode($search_all);
745 }
746 if ($search_categ_cus > 0) {
747  $param .= '&search_categ_cus='.urlencode($search_categ_cus);
748 }
749 if ($search_categ_sup > 0) {
750  $param .= '&search_categ_sup='.urlencode($search_categ_sup);
751 }
752 if ($search_sale > 0) {
753  $param .= '&search_sale='.urlencode($search_sale);
754 }
755 if ($search_id > 0) {
756  $param .= "&search_id=".urlencode($search_id);
757 }
758 if ($search_nom != '') {
759  $param .= "&search_nom=".urlencode($search_nom);
760 }
761 if ($search_alias != '') {
762  $param .= "&search_alias=".urlencode($search_alias);
763 }
764 if ($search_address != '') {
765  $param .= '&search_address='.urlencode($search_address);
766 }
767 if ($search_town != '') {
768  $param .= "&search_town=".urlencode($search_town);
769 }
770 if ($search_zip != '') {
771  $param .= "&search_zip=".urlencode($search_zip);
772 }
773 if ($search_phone != '') {
774  $param .= "&search_phone=".urlencode($search_phone);
775 }
776 if ($search_fax != '') {
777  $param .= "&search_fax=".urlencode($search_fax);
778 }
779 if ($search_email != '') {
780  $param .= "&search_email=".urlencode($search_email);
781 }
782 if ($search_url != '') {
783  $param .= "&search_url=".urlencode($search_url);
784 }
785 if ($search_state != '') {
786  $param .= "&search_state=".urlencode($search_state);
787 }
788 if ($search_region != '') {
789  $param .= "&search_region=".urlencode($search_region);
790 }
791 if ($search_country != '') {
792  $param .= "&search_country=".urlencode($search_country);
793 }
794 if ($search_customer_code != '') {
795  $param .= "&search_customer_code=".urlencode($search_customer_code);
796 }
797 if ($search_supplier_code != '') {
798  $param .= "&search_supplier_code=".urlencode($search_supplier_code);
799 }
800 if ($search_account_customer_code != '') {
801  $param .= "&search_account_customer_code=".urlencode($search_account_customer_code);
802 }
803 if ($search_account_supplier_code != '') {
804  $param .= "&search_account_supplier_code=".urlencode($search_account_supplier_code);
805 }
806 if ($search_barcode != '') {
807  $param .= "&search_barcode=".urlencode($search_barcode);
808 }
809 if ($search_idprof1 != '') {
810  $param .= '&search_idprof1='.urlencode($search_idprof1);
811 }
812 if ($search_idprof2 != '') {
813  $param .= '&search_idprof2='.urlencode($search_idprof2);
814 }
815 if ($search_idprof3 != '') {
816  $param .= '&search_idprof3='.urlencode($search_idprof3);
817 }
818 if ($search_idprof4 != '') {
819  $param .= '&search_idprof4='.urlencode($search_idprof4);
820 }
821 if ($search_idprof5 != '') {
822  $param .= '&search_idprof5='.urlencode($search_idprof5);
823 }
824 if ($search_idprof6 != '') {
825  $param .= '&search_idprof6='.urlencode($search_idprof6);
826 }
827 if ($search_vat != '') {
828  $param .= '&search_vat='.urlencode($search_vat);
829 }
830 if ($search_price_level != '') {
831  $param .= '&search_price_level='.urlencode($search_price_level);
832 }
833 if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
834  $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
835 }
836 if ($search_type != '') {
837  $param .= '&search_type='.urlencode($search_type);
838 }
839 if (is_array($search_level) && count($search_level)) {
840  foreach ($search_level as $slevel) {
841  $param .= '&search_level[]='.urlencode($slevel);
842  }
843 }
844 if ($search_status != '') {
845  $param .= '&search_status='.urlencode($search_status);
846 }
847 if ($search_stcomm != '' && $search_stcomm != '-2') { // -2 is no filter
848  $param .= '&search_stcomm='.urlencode($search_stcomm);
849 }
850 if ($search_parent_name != '') {
851  $param .= '&search_parent_name='.urlencode($search_parent_name);
852 }
853 if ($search_import_key != '') {
854  $param .= '&search_import_key='.urlencode($search_import_key);
855 }
856 if ($type != '') {
857  $param .= '&type='.urlencode($type);
858 }
859 if ($optioncss != '') {
860  $param .= '&optioncss='.urlencode($optioncss);
861 }
862 // Add $param from extra fields
863 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
864 
865 // Show delete result message
866 if (GETPOST('delsoc')) {
867  setEventMessages($langs->trans("CompanyDeleted", GETPOST('delsoc')), null, 'mesgs');
868 }
869 
870 // List of mass actions available
871 $arrayofmassactions = array(
872  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
873  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
874 );
875 //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
876 if (isModEnabled('category') && $user->rights->societe->creer) {
877  $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
878 }
879 if ($user->rights->societe->creer) {
880  $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
881 }
882 if ($user->rights->societe->creer) {
883  $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
884 }
885 if ($user->rights->societe->creer) {
886  $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
887 }
888 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
889  $arrayofmassactions = array();
890 }
891 if ($user->rights->societe->supprimer) {
892  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
893 }
894 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
895 
896 $typefilter = '';
897 $label = 'MenuNewThirdParty';
898 
899 if (!empty($type)) {
900  $typefilter = '&amp;type='.$type;
901  if ($type == 'p') {
902  $label = 'MenuNewProspect';
903  }
904  if ($type == 'c') {
905  $label = 'MenuNewCustomer';
906  }
907  if ($type == 'f') {
908  $label = 'NewSupplier';
909  }
910 }
911 
912 if ($contextpage == 'poslist' && $type == 't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
913  print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1);
914 }
915 
916 // Show the new button only when this page is not opend from the Extended POS (pop-up window)
917 // but allow it too, when a user has the rights to create a new customer
918 if ($contextpage != 'poslist') {
919  $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter;
920  if (!empty($socid)) {
921  $url .= '&socid='.$socid;
922  }
923  $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer);
924 } elseif ($user->rights->societe->creer) {
925  $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
926  $label = 'MenuNewCustomer';
927  $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url);
928 }
929 
930 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
931 if ($optioncss != '') {
932  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
933 }
934 print '<input type="hidden" name="token" value="'.newToken().'">';
935 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
936 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
937 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
938 //print '<input type="hidden" name="page" value="'.$page.'">';
939 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
940 
941 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1);
942 
943 $langs->load("other");
944 $textprofid = array();
945 foreach (array(1, 2, 3, 4, 5, 6) as $key) {
946  $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code);
947  $textprofid[$key] = '';
948  if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between ()
949  if (preg_match('/\((.*)\)/i', $label, $reg)) {
950  $label = $reg[1];
951  }
952  $textprofid[$key] = $langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label);
953  }
954 }
955 
956 $topicmail = "Information";
957 $modelmail = "thirdparty";
958 $objecttmp = new Societe($db);
959 $trackid = 'thi'.$object->id;
960 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
961 
962 if ($search_all) {
963  foreach ($fieldstosearchall as $key => $val) {
964  $fieldstosearchall[$key] = $langs->trans($val);
965  }
966  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
967 }
968 
969 // Filter on categories
970 $moreforfilter = '';
971 if (empty($type) || $type == 'c' || $type == 'p') {
972  if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
973  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
974  $moreforfilter .= '<div class="divsearchfield">';
975  $tmptitle = $langs->trans('Categories');
976  $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
977  $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort'));
978  $moreforfilter .= '</div>';
979  }
980 }
981 
982 if (empty($type) || $type == 'f') {
983  if (!empty($conf->fournisseur->enabled) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
984  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
985  $moreforfilter .= '<div class="divsearchfield">';
986  $tmptitle = $langs->trans('Categories');
987  $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
988  $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1, $langs->trans('SuppliersCategoriesShort'));
989  $moreforfilter .= '</div>';
990  }
991 }
992 
993 // If the user can view prospects other than his'
994 if ($user->rights->societe->client->voir || $socid) {
995  $moreforfilter .= '<div class="divsearchfield">';
996  $tmptitle = $langs->trans('SalesRepresentatives');
997  $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
998  $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $langs->trans('SalesRepresentatives'), ($conf->dol_optimize_smallscreen ? 'maxwidth200' : 'maxwidth300'), 1);
999  $moreforfilter .= '</div>';
1000 }
1001 if ($moreforfilter) {
1002  print '<div class="liste_titre liste_titre_bydiv centpercent">';
1003  print $moreforfilter;
1004  $parameters = array('type'=>$type);
1005  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1006  print $hookmanager->resPrint;
1007  print '</div>';
1008 }
1009 
1010 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1011 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
1012 // Show the massaction checkboxes only when this page is not opend from the Extended POS
1013 if ($massactionbutton && $contextpage != 'poslist') {
1014  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
1015 }
1016 
1017 if (empty($arrayfields['customerorsupplier']['checked'])) {
1018  print '<input type="hidden" name="type" value="'.$type.'">';
1019 }
1020 
1021 print '<div class="div-table-responsive">';
1022 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1023 
1024 // Fields title search
1025 print '<tr class="liste_titre_filter">';
1026 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1027  // Action column
1028  print '<td class="liste_titre center actioncolumn">';
1029  $searchpicto = $form->showFilterButtons('left');
1030  print $searchpicto;
1031  print '</td>';
1032 }
1033 if (!empty($arrayfields['s.rowid']['checked'])) {
1034  print '<td class="liste_titre" data-key="id">';
1035  print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
1036  print '</td>';
1037 }
1038 if (!empty($arrayfields['s.nom']['checked'])) {
1039  print '<td class="liste_titre" data-key="ref">';
1040  if (!empty($search_nom_only) && empty($search_nom)) {
1041  $search_nom = $search_nom_only;
1042  }
1043  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
1044  print '</td>';
1045 }
1046 if (!empty($arrayfields['s.name_alias']['checked'])) {
1047  print '<td class="liste_titre">';
1048  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_alias" value="'.dol_escape_htmltag($search_alias).'">';
1049  print '</td>';
1050 }
1051 // Barcode
1052 if (!empty($arrayfields['s.barcode']['checked'])) {
1053  print '<td class="liste_titre">';
1054  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_barcode" value="'.dol_escape_htmltag($search_barcode).'">';
1055  print '</td>';
1056 }
1057 // Customer code
1058 if (!empty($arrayfields['s.code_client']['checked'])) {
1059  print '<td class="liste_titre">';
1060  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_customer_code" value="'.dol_escape_htmltag($search_customer_code).'">';
1061  print '</td>';
1062 }
1063 // Supplier code
1064 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1065  print '<td class="liste_titre">';
1066  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_supplier_code" value="'.dol_escape_htmltag($search_supplier_code).'">';
1067  print '</td>';
1068 }
1069 // Account Customer code
1070 if (!empty($arrayfields['s.code_compta']['checked'])) {
1071  print '<td class="liste_titre">';
1072  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_account_customer_code" value="'.dol_escape_htmltag($search_account_customer_code).'">';
1073  print '</td>';
1074 }
1075 // Account Supplier code
1076 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1077  print '<td class="liste_titre">';
1078  print '<input class="flat maxwidth75imp" type="text" name="search_account_supplier_code" value="'.dol_escape_htmltag($search_account_supplier_code).'">';
1079  print '</td>';
1080 }
1081 // Address
1082 if (!empty($arrayfields['s.address']['checked'])) {
1083  print '<td class="liste_titre">';
1084  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'">';
1085  print '</td>';
1086 }
1087 // Zip
1088 if (!empty($arrayfields['s.zip']['checked'])) {
1089  print '<td class="liste_titre">';
1090  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
1091  print '</td>';
1092 }
1093 // Town
1094 if (!empty($arrayfields['s.town']['checked'])) {
1095  print '<td class="liste_titre">';
1096  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
1097  print '</td>';
1098 }
1099 // State
1100 if (!empty($arrayfields['state.nom']['checked'])) {
1101  print '<td class="liste_titre">';
1102  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1103  print '</td>';
1104 }
1105 // Region
1106 if (!empty($arrayfields['region.nom']['checked'])) {
1107  print '<td class="liste_titre">';
1108  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
1109  print '</td>';
1110 }
1111 // Country
1112 if (!empty($arrayfields['country.code_iso']['checked'])) {
1113  print '<td class="liste_titre center">';
1114  print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1115  print '</td>';
1116 }
1117 // Company type
1118 if (!empty($arrayfields['typent.code']['checked'])) {
1119  print '<td class="liste_titre maxwidthonsmartphone center">';
1120  // We use showempty=0 here because there is already an unknown value into dictionary.
1121  print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'minwidth50 maxwidth125', 1);
1122  print '</td>';
1123 }
1124 // Multiprice level
1125 if (!empty($arrayfields['s.price_level']['checked'])) {
1126  print '<td class="liste_titre">';
1127  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_price_level" value="'.dol_escape_htmltag($search_price_level).'">';
1128  print '</td>';
1129 }
1130 // Staff
1131 if (!empty($arrayfields['staff.code']['checked'])) {
1132  print '<td class="liste_titre maxwidthonsmartphone center">';
1133  print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100', 1);
1134  print '</td>';
1135 }
1136 if (!empty($arrayfields['s.email']['checked'])) {
1137  // Email
1138  print '<td class="liste_titre">';
1139  print '<input class="flat searchemail maxwidth50imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
1140  print '</td>';
1141 }
1142 if (!empty($arrayfields['s.phone']['checked'])) {
1143  // Phone
1144  print '<td class="liste_titre">';
1145  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'">';
1146  print '</td>';
1147 }
1148 if (!empty($arrayfields['s.fax']['checked'])) {
1149  // Fax
1150  print '<td class="liste_titre">';
1151  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_fax" value="'.dol_escape_htmltag($search_fax).'">';
1152  print '</td>';
1153 }
1154 if (!empty($arrayfields['s.url']['checked'])) {
1155  // Url
1156  print '<td class="liste_titre">';
1157  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_url" value="'.dol_escape_htmltag($search_url).'">';
1158  print '</td>';
1159 }
1160 if (!empty($arrayfields['s.siren']['checked'])) {
1161  // IdProf1
1162  print '<td class="liste_titre">';
1163  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
1164  print '</td>';
1165 }
1166 if (!empty($arrayfields['s.siret']['checked'])) {
1167  // IdProf2
1168  print '<td class="liste_titre">';
1169  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
1170  print '</td>';
1171 }
1172 if (!empty($arrayfields['s.ape']['checked'])) {
1173  // IdProf3
1174  print '<td class="liste_titre">';
1175  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
1176  print '</td>';
1177 }
1178 if (!empty($arrayfields['s.idprof4']['checked'])) {
1179  // IdProf4
1180  print '<td class="liste_titre">';
1181  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
1182  print '</td>';
1183 }
1184 if (!empty($arrayfields['s.idprof5']['checked'])) {
1185  // IdProf5
1186  print '<td class="liste_titre">';
1187  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof5" value="'.dol_escape_htmltag($search_idprof5).'">';
1188  print '</td>';
1189 }
1190 if (!empty($arrayfields['s.idprof6']['checked'])) {
1191  // IdProf6
1192  print '<td class="liste_titre">';
1193  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
1194  print '</td>';
1195 }
1196 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1197  // Vat number
1198  print '<td class="liste_titre">';
1199  print '<input class="flat searchstring maxwidth50imp" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).'">';
1200  print '</td>';
1201 }
1202 
1203 // Nature (customer/prospect/supplier)
1204 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1205  print '<td class="liste_titre maxwidthonsmartphone center">';
1206  if ($type != '') {
1207  print '<input type="hidden" name="type" value="'.$type.'">';
1208  }
1209  print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
1210  print '</td>';
1211 }
1212 // Prospect level
1213 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1214  print '<td class="liste_titre center">';
1215  print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
1216  print '</td>';
1217 }
1218 // Prospect status
1219 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1220  print '<td class="liste_titre maxwidthonsmartphone center">';
1221  $arraystcomm = array();
1222  foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1223  $arraystcomm[$val['id']] = ($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
1224  }
1225  print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', '', 1);
1226  print '</td>';
1227 }
1228 if (!empty($arrayfields['s2.nom']['checked'])) {
1229  print '<td class="liste_titre center">';
1230  print '<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).'">';
1231  print '</td>';
1232 }
1233 // Extra fields
1234 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1235 
1236 // Fields from hook
1237 $parameters = array('arrayfields'=>$arrayfields);
1238 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1239 print $hookmanager->resPrint;
1240 // Date creation
1241 if (!empty($arrayfields['s.datec']['checked'])) {
1242  print '<td class="liste_titre">';
1243  print '</td>';
1244 }
1245 // Date modification
1246 if (!empty($arrayfields['s.tms']['checked'])) {
1247  print '<td class="liste_titre">';
1248  print '</td>';
1249 }
1250 // Status
1251 if (!empty($arrayfields['s.status']['checked'])) {
1252  print '<td class="liste_titre center minwidth75imp">';
1253  print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
1254  print '</td>';
1255 }
1256 if (!empty($arrayfields['s.import_key']['checked'])) {
1257  print '<td class="liste_titre center">';
1258  print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1259  print '</td>';
1260 }
1261 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1262  // Action column
1263  print '<td class="liste_titre center actioncolumn">';
1264  $searchpicto = $form->showFilterButtons();
1265  print $searchpicto;
1266  print '</td>';
1267 }
1268 
1269 print "</tr>\n";
1270 print '<tr class="liste_titre">';
1271 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1272  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
1273 }
1274 if (!empty($arrayfields['s.rowid']['checked'])) {
1275  print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder, 'actioncolumn ');
1276 }
1277 if (!empty($arrayfields['s.nom']['checked'])) {
1278  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder, 'actioncolumn ');
1279 }
1280 if (!empty($arrayfields['s.name_alias']['checked'])) {
1281  print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder);
1282 }
1283 if (!empty($arrayfields['s.barcode']['checked'])) {
1284  print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder);
1285 }
1286 if (!empty($arrayfields['s.code_client']['checked'])) {
1287  print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder);
1288 }
1289 if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1290  print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder);
1291 }
1292 if (!empty($arrayfields['s.code_compta']['checked'])) {
1293  print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder);
1294 }
1295 if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1296  print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder);
1297 }
1298 if (!empty($arrayfields['s.address']['checked'])) {
1299  print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder);
1300 }
1301 if (!empty($arrayfields['s.zip']['checked'])) {
1302  print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder);
1303 }
1304 if (!empty($arrayfields['s.town']['checked'])) {
1305  print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder);
1306 }
1307 if (!empty($arrayfields['state.nom']['checked'])) {
1308  print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1309 }
1310 if (!empty($arrayfields['region.nom']['checked'])) {
1311  print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder);
1312 }
1313 if (!empty($arrayfields['country.code_iso']['checked'])) {
1314  print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1315 }
1316 if (!empty($arrayfields['typent.code']['checked'])) {
1317  print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, "", $sortfield, $sortorder, 'center ');
1318 }
1319 if (!empty($arrayfields['staff.code']['checked'])) {
1320  print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center ');
1321 }
1322 if (!empty($arrayfields['s.price_level']['checked'])) {
1323  print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder);
1324 }
1325 if (!empty($arrayfields['s.email']['checked'])) {
1326  print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
1327 }
1328 if (!empty($arrayfields['s.phone']['checked'])) {
1329  print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder);
1330 }
1331 if (!empty($arrayfields['s.fax']['checked'])) {
1332  print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder);
1333 }
1334 if (!empty($arrayfields['s.url']['checked'])) {
1335  print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder);
1336 }
1337 if (!empty($arrayfields['s.siren']['checked'])) {
1338  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1339 }
1340 if (!empty($arrayfields['s.siret']['checked'])) {
1341  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1342 }
1343 if (!empty($arrayfields['s.ape']['checked'])) {
1344  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1345 }
1346 if (!empty($arrayfields['s.idprof4']['checked'])) {
1347  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1348 }
1349 if (!empty($arrayfields['s.idprof5']['checked'])) {
1350  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1351 }
1352 if (!empty($arrayfields['s.idprof6']['checked'])) {
1353  print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1354 }
1355 if (!empty($arrayfields['s.tva_intra']['checked'])) {
1356  print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap ');
1357 }
1358 if (!empty($arrayfields['customerorsupplier']['checked'])) {
1359  print_liste_field_titre($arrayfields['customerorsupplier']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); // type of customer
1360 }
1361 if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1362  print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center ');
1363 }
1364 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1365  print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center ');
1366 }
1367 if (!empty($arrayfields['s2.nom']['checked'])) {
1368  print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center ');
1369 }
1370 // Extra fields
1371 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1372 // Hook fields
1373 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
1374 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1375 print $hookmanager->resPrint;
1376 if (!empty($arrayfields['s.datec']['checked'])) {
1377  print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1378 }
1379 if (!empty($arrayfields['s.tms']['checked'])) {
1380  print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1381 }
1382 if (!empty($arrayfields['s.status']['checked'])) {
1383  print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center ');
1384 }
1385 if (!empty($arrayfields['s.import_key']['checked'])) {
1386  print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1387 }
1388 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1389  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
1390 }
1391 print "</tr>\n";
1392 
1393 
1394 $i = 0;
1395 $totalarray = array();
1396 $totalarray['nbfield'] = 0;
1397 while ($i < min($num, $limit)) {
1398  $obj = $db->fetch_object($resql);
1399 
1400  $companystatic->id = $obj->rowid;
1401  $companystatic->name = $obj->name;
1402  $companystatic->name_alias = $obj->name_alias;
1403  $companystatic->logo = $obj->logo;
1404  $companystatic->canvas = $obj->canvas;
1405  $companystatic->client = $obj->client;
1406  $companystatic->status = $obj->status;
1407  $companystatic->email = $obj->email;
1408  $companystatic->fournisseur = $obj->fournisseur;
1409  $companystatic->code_client = $obj->code_client;
1410  $companystatic->code_fournisseur = $obj->code_fournisseur;
1411  $companystatic->tva_intra = $obj->tva_intra;
1412  $companystatic->country_code = $obj->country_code;
1413 
1414  $companystatic->code_compta_client = $obj->code_compta;
1415  $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1416 
1417  $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
1418  $companystatic->fk_parent = $obj->fk_parent;
1419  $companystatic->entity = $obj->entity;
1420 
1421  print '<tr class="oddeven"';
1422  if ($contextpage == 'poslist') {
1423  print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.urlencode($place).'\'"';
1424  }
1425  print '>';
1426 
1427  // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1428  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1429  print '<td class="nowrap center actioncolumn">';
1430  if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1431  $selected = 0;
1432  if (in_array($obj->rowid, $arrayofselected)) {
1433  $selected = 1;
1434  }
1435  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1436  }
1437  print '</td>';
1438  }
1439  if (!empty($arrayfields['s.rowid']['checked'])) {
1440  print '<td class="tdoverflowmax50" data-key="id">';
1441  print $obj->rowid;
1442  print "</td>\n";
1443  if (!$i) {
1444  $totalarray['nbfield']++;
1445  }
1446  }
1447  if (!empty($arrayfields['s.nom']['checked'])) {
1448  print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">';
1449  if ($contextpage == 'poslist') {
1450  print dol_escape_htmltag($obj->name);
1451  } else {
1452  print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1453  }
1454  print "</td>\n";
1455  if (!$i) {
1456  $totalarray['nbfield']++;
1457  }
1458  }
1459  if (!empty($arrayfields['s.name_alias']['checked'])) {
1460  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).'">';
1461  print dol_escape_htmltag($companystatic->name_alias);
1462  print "</td>\n";
1463  if (!$i) {
1464  $totalarray['nbfield']++;
1465  }
1466  }
1467  // Barcode
1468  if (!empty($arrayfields['s.barcode']['checked'])) {
1469  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->barcode).'">'.dol_escape_htmltag($obj->barcode).'</td>';
1470  if (!$i) {
1471  $totalarray['nbfield']++;
1472  }
1473  }
1474  // Customer code
1475  if (!empty($arrayfields['s.code_client']['checked'])) {
1476  print '<td class="nowraponall">'.dol_escape_htmltag($obj->code_client).'</td>';
1477  if (!$i) {
1478  $totalarray['nbfield']++;
1479  }
1480  }
1481  // Supplier code
1482  if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
1483  print '<td class="nowraponall">'.dol_escape_htmltag($obj->code_fournisseur).'</td>';
1484  if (!$i) {
1485  $totalarray['nbfield']++;
1486  }
1487  }
1488  // Account customer code
1489  if (!empty($arrayfields['s.code_compta']['checked'])) {
1490  print '<td>'.dol_escape_htmltag($obj->code_compta).'</td>';
1491  if (!$i) {
1492  $totalarray['nbfield']++;
1493  }
1494  }
1495  // Account supplier code
1496  if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
1497  print '<td>'.dol_escape_htmltag($obj->code_compta_fournisseur).'</td>';
1498  if (!$i) {
1499  $totalarray['nbfield']++;
1500  }
1501  }
1502  // Address
1503  if (!empty($arrayfields['s.address']['checked'])) {
1504  print '<td class="tdoverflowmax250" title="'.dol_escape_htmltag($obj->address).'">'.dol_escape_htmltag($obj->address).'</td>';
1505  if (!$i) {
1506  $totalarray['nbfield']++;
1507  }
1508  }
1509  // Zip
1510  if (!empty($arrayfields['s.zip']['checked'])) {
1511  print "<td>".dol_escape_htmltag($obj->zip)."</td>\n";
1512  if (!$i) {
1513  $totalarray['nbfield']++;
1514  }
1515  }
1516  // Town
1517  if (!empty($arrayfields['s.town']['checked'])) {
1518  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town)."</td>\n";
1519  if (!$i) {
1520  $totalarray['nbfield']++;
1521  }
1522  }
1523  // State
1524  if (!empty($arrayfields['state.nom']['checked'])) {
1525  print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
1526  if (!$i) {
1527  $totalarray['nbfield']++;
1528  }
1529  }
1530  // Region
1531  if (!empty($arrayfields['region.nom']['checked'])) {
1532  print "<td>".dol_escape_htmltag($obj->region_name)."</td>\n";
1533  if (!$i) {
1534  $totalarray['nbfield']++;
1535  }
1536  }
1537  // Country
1538  if (!empty($arrayfields['country.code_iso']['checked'])) {
1539  print '<td class="center tdoverflowmax100">';
1540  $labelcountry = ($obj->country_code && ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)) ? $langs->trans("Country".$obj->country_code) : $obj->country_label;
1541  print $labelcountry;
1542  print '</td>';
1543  if (!$i) {
1544  $totalarray['nbfield']++;
1545  }
1546  }
1547  // Type ent
1548  if (!empty($arrayfields['typent.code']['checked'])) {
1549  if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1550  $typenArray = $formcompany->typent_array(1);
1551  }
1552  $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
1553 
1554  print '<td class="center tdoverflowmax125" title="'.dol_escape_htmltag($labeltypeofcompany).'">';
1555  print dol_escape_htmltag($labeltypeofcompany);
1556  print '</td>';
1557  if (!$i) {
1558  $totalarray['nbfield']++;
1559  }
1560  }
1561  // Multiprice level
1562  if (!empty($arrayfields['s.price_level']['checked'])) {
1563  print '<td class="center">'.$obj->price_level."</td>\n";
1564  if (!$i) {
1565  $totalarray['nbfield']++;
1566  }
1567  }
1568  // Staff
1569  if (!empty($arrayfields['staff.code']['checked'])) {
1570  print '<td class="center">';
1571  if (!is_array($staffArray) || count($staffArray) == 0) {
1572  $staffArray = $formcompany->effectif_array(1);
1573  }
1574  print $staffArray[$obj->staff_code];
1575  print '</td>';
1576  if (!$i) {
1577  $totalarray['nbfield']++;
1578  }
1579  }
1580  if (!empty($arrayfields['s.email']['checked'])) {
1581  print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."</td>\n";
1582  if (!$i) {
1583  $totalarray['nbfield']++;
1584  }
1585  }
1586  if (!empty($arrayfields['s.phone']['checked'])) {
1587  print '<td class="nowraponall">'.dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
1588  if (!$i) {
1589  $totalarray['nbfield']++;
1590  }
1591  }
1592  if (!empty($arrayfields['s.fax']['checked'])) {
1593  print '<td class="nowraponall">'.dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n";
1594  if (!$i) {
1595  $totalarray['nbfield']++;
1596  }
1597  }
1598  if (!empty($arrayfields['s.url']['checked'])) {
1599  print "<td>".dol_print_url($obj->url, '', '', 1)."</td>\n";
1600  if (!$i) {
1601  $totalarray['nbfield']++;
1602  }
1603  }
1604  if (!empty($arrayfields['s.siren']['checked'])) {
1605  print "<td>".$obj->idprof1."</td>\n";
1606  if (!$i) {
1607  $totalarray['nbfield']++;
1608  }
1609  }
1610  if (!empty($arrayfields['s.siret']['checked'])) {
1611  print "<td>".$obj->idprof2."</td>\n";
1612  if (!$i) {
1613  $totalarray['nbfield']++;
1614  }
1615  }
1616  if (!empty($arrayfields['s.ape']['checked'])) {
1617  print "<td>".$obj->idprof3."</td>\n";
1618  if (!$i) {
1619  $totalarray['nbfield']++;
1620  }
1621  }
1622  if (!empty($arrayfields['s.idprof4']['checked'])) {
1623  print "<td>".$obj->idprof4."</td>\n";
1624  if (!$i) {
1625  $totalarray['nbfield']++;
1626  }
1627  }
1628  if (!empty($arrayfields['s.idprof5']['checked'])) {
1629  print "<td>".$obj->idprof5."</td>\n";
1630  if (!$i) {
1631  $totalarray['nbfield']++;
1632  }
1633  }
1634  if (!empty($arrayfields['s.idprof6']['checked'])) {
1635  print "<td>".$obj->idprof6."</td>\n";
1636  if (!$i) {
1637  $totalarray['nbfield']++;
1638  }
1639  }
1640  // VAT
1641  if (!empty($arrayfields['s.tva_intra']['checked'])) {
1642  print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->tva_intra).'">';
1643  if ($obj->tva_intra && !isValidVATID($companystatic)) {
1644  print img_warning("BadVATNumber", '', 'pictofixedwidth');
1645  }
1646  print $obj->tva_intra;
1647  print "</td>\n";
1648  if (!$i) {
1649  $totalarray['nbfield']++;
1650  }
1651  }
1652  // Type
1653  if (!empty($arrayfields['customerorsupplier']['checked'])) {
1654  print '<td class="center">';
1655  print $companystatic->getTypeUrl(1);
1656  print '</td>';
1657  if (!$i) {
1658  $totalarray['nbfield']++;
1659  }
1660  }
1661 
1662  if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) {
1663  // Prospect level
1664  print '<td class="center">';
1665  print $companystatic->getLibProspLevel();
1666  print "</td>";
1667  if (!$i) {
1668  $totalarray['nbfield']++;
1669  }
1670  }
1671 
1672  if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
1673  // Prospect status
1674  print '<td class="center nowrap"><div class="nowrap">';
1675  print '<div class="inline-block">';
1676  print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
1677  print '</div> - <div class="inline-block">';
1678  foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
1679  $titlealt = 'default';
1680  if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
1681  $titlealt = $val['label'];
1682  }
1683  if ($obj->stcomm_id != $val['id']) {
1684  print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.urlencode($val['code']).'&action=setstcomm&token='.newToken().$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
1685  }
1686  }
1687  print '</div></div></td>';
1688  if (!$i) {
1689  $totalarray['nbfield']++;
1690  }
1691  }
1692  // Parent company
1693  if (!empty($arrayfields['s2.nom']['checked'])) {
1694  print '<td class="center tdoverflowmax100">';
1695  if ($companystatic->fk_parent > 0) {
1696  $companyparent->fetch($companystatic->fk_parent);
1697  print $companyparent->getNomUrl(1);
1698  }
1699  print "</td>";
1700  if (!$i) {
1701  $totalarray['nbfield']++;
1702  }
1703  }
1704  // Extra fields
1705  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1706  // Fields from hook
1707  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1708  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1709  print $hookmanager->resPrint;
1710  // Date creation
1711  if (!empty($arrayfields['s.datec']['checked'])) {
1712  print '<td class="center nowraponall">';
1713  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1714  print '</td>';
1715  if (!$i) {
1716  $totalarray['nbfield']++;
1717  }
1718  }
1719  // Date modification
1720  if (!empty($arrayfields['s.tms']['checked'])) {
1721  print '<td class="center nowraponall">';
1722  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1723  print '</td>';
1724  if (!$i) {
1725  $totalarray['nbfield']++;
1726  }
1727  }
1728  // Status
1729  if (!empty($arrayfields['s.status']['checked'])) {
1730  print '<td class="center nowraponall">'.$companystatic->getLibStatut(5).'</td>';
1731  if (!$i) {
1732  $totalarray['nbfield']++;
1733  }
1734  }
1735  // Import key
1736  if (!empty($arrayfields['s.import_key']['checked'])) {
1737  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->import_key).'">';
1738  print dol_escape_htmltag($obj->import_key);
1739  print "</td>\n";
1740  if (!$i) {
1741  $totalarray['nbfield']++;
1742  }
1743  }
1744  // Action column (Show the massaction button only when this page is not opend from the Extended POS)
1745  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1746  print '<td class="nowrap center actioncolumn">';
1747  if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1748  $selected = 0;
1749  if (in_array($obj->rowid, $arrayofselected)) {
1750  $selected = 1;
1751  }
1752  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1753  }
1754  print '</td>';
1755  }
1756  if (!$i) {
1757  $totalarray['nbfield']++;
1758  }
1759 
1760  print '</tr>'."\n";
1761  $i++;
1762 }
1763 
1764 // If no record found
1765 if ($num == 0) {
1766  $colspan = 1;
1767  foreach ($arrayfields as $key => $val) {
1768  if (!empty($val['checked'])) {
1769  $colspan++;
1770  }
1771  }
1772  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1773 }
1774 
1775 $db->free($resql);
1776 
1777 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1778 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1779 print $hookmanager->resPrint;
1780 
1781 print "</table>";
1782 print "</div>";
1783 
1784 print '</form>';
1785 
1786 // End of page
1787 llxFooter();
1788 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
dol_sort_array
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
Definition: functions.lib.php:8385
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
ref
$object ref
Definition: info.php:77
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
Facture
Class to manage invoices.
Definition: facture.class.php:60
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
dolExplodeIntoArray
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
Definition: functions.lib.php:9354
FormCompany
Class to build HTML component for third parties management Only common components are here.
Definition: html.formcompany.class.php:40
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
dol_getIdFromCode
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
Definition: functions.lib.php:8535
getEntity
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
Definition: functions.lib.php:148
code
print *****$script_file(".$version.") pid code
! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge,...
Definition: sync_members_ldap2dolibarr.php:60
dolGetButtonTitle
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.
Definition: functions.lib.php:10605
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5257
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:80
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5026
natural_search
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...
Definition: functions.lib.php:9420
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
Client
Class to manage customers or prospects.
Definition: client.class.php:31
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
get_htmloutput_mesg
get_htmloutput_mesg($mesgstring='', $mesgarray='', $style='ok', $keepembedded=0)
Get formated messages to output (Used to show messages on html output).
Definition: functions.lib.php:8212