dolibarr 18.0.6
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
5 * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
6 * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
8 * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2010-2019 Philippe Grand <philippe.grand@atoo-net.com>
10 * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
11 * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
12 * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
13 * Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
14 * Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 */
29
36// Load Dolibarr environment
37require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
45if (isModEnabled('project')) {
46 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
47}
48
49// Load translation files required by the page
50$langs->loadLangs(array('companies', 'propal', 'supplier_proposal', 'compta', 'bills', 'orders', 'products'));
51
52$socid = GETPOST('socid', 'int');
53
54$action = GETPOST('action', 'aZ09');
55$massaction = GETPOST('massaction', 'alpha');
56$show_files = GETPOST('show_files', 'int');
57$confirm = GETPOST('confirm', 'alpha');
58$toselect = GETPOST('toselect', 'array');
59$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'supplierproposallist';
60$mode = GETPOST('mode', 'alpha');
61
62$search_user = GETPOST('search_user', 'int');
63$search_sale = GETPOST('search_sale', 'int');
64$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
65$search_societe = GETPOST('search_societe', 'alpha');
66$search_societe_alias = GETPOST('search_societe_alias', 'alpha');
67$search_login = GETPOST('search_login', 'alpha');
68$search_town = GETPOST('search_town', 'alpha');
69$search_zip = GETPOST('search_zip', 'alpha');
70$search_state = GETPOST("search_state");
71$search_country = GETPOST("search_country", 'int');
72$search_date_startday = GETPOST('search_date_startday', 'int');
73$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
74$search_date_startyear = GETPOST('search_date_startyear', 'int');
75$search_date_endday = GETPOST('search_date_endday', 'int');
76$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
77$search_date_endyear = GETPOST('search_date_endyear', 'int');
78$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
79$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
80$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int');
81$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int');
82$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int');
83$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int');
84$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int');
85$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int');
86$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
87$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
88$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
89$search_montant_ht = GETPOST('search_montant_ht', 'alpha');
90$search_montant_vat = GETPOST('search_montant_vat', 'alpha');
91$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
92$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
93$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
94$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
95$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
96$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
97$search_status = GETPOST('search_status', 'int');
98$search_product_category = GETPOST('search_product_category', 'int');
99
100$object_statut = $db->escape(GETPOST('supplier_proposal_statut'));
101$search_btn = GETPOST('button_search', 'alpha');
102$search_remove_btn = GETPOST('button_removefilter', 'alpha');
103
104$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
105
106$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
107
108$optioncss = GETPOST('optioncss', 'alpha');
109$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
110$sortfield = GETPOST('sortfield', 'aZ09comma');
111$sortorder = GETPOST('sortorder', 'aZ09comma');
112$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
113if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) {
114 $page = 0;
115} // If $page is not defined, or '' or -1
116$offset = $limit * $page;
117$pageprev = $page - 1;
118$pagenext = $page + 1;
119if (!$sortfield) {
120 $sortfield = 'sp.date_livraison';
121}
122if (!$sortorder) {
123 $sortorder = 'DESC';
124}
125
126if ($object_statut != '') {
127 $search_status = $object_statut;
128}
129
130// Nombre de ligne pour choix de produit/service predefinis
131$NBLINES = 4;
132
133// Security check
134$module = 'supplier_proposal';
135$dbtable = '';
136$objectid = '';
137if (!empty($user->socid)) {
138 $socid = $user->socid;
139}
140if (!empty($socid)) {
141 $objectid = $socid;
142 $module = 'societe';
143 $dbtable = '&societe';
144}
145
146$diroutputmassaction = $conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id;
147
148// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
149$object = new SupplierProposal($db);
150$hookmanager->initHooks(array('supplier_proposallist'));
151$extrafields = new ExtraFields($db);
152
153// fetch optionals attributes and labels
154$extrafields->fetch_name_optionals_label($object->table_element);
155
156$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
157
158
159// List of fields to search into when doing a "search in all"
160$fieldstosearchall = array(
161 'sp.ref'=>'Ref',
162 's.nom'=>'Supplier',
163 'pd.description'=>'Description',
164 'sp.note_public'=>'NotePublic',
165);
166if (empty($user->socid)) {
167 $fieldstosearchall["p.note_private"] = "NotePrivate";
168}
169
170$checkedtypetiers = 0;
171$arrayfields = array(
172 'sp.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
173 's.nom'=>array('label'=>$langs->trans("Supplier"), 'checked'=>1),
174 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>0),
175 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
176 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
177 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
178 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
179 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
180 'sp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1),
181 'sp.date_livraison'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
182 'sp.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
183 'sp.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
184 'sp.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
185 'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
186 'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
187 'sp.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
188 'sp.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
189 'sp.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
190 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10),
191 'sp.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
192 'sp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
193 'sp.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
194);
195// Extra fields
196include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
197
198$object->fields = dol_sort_array($object->fields, 'position');
199$arrayfields = dol_sort_array($arrayfields, 'position');
200
201$result = restrictedArea($user, $module, $objectid, $dbtable);
202
203$permissiontoread = $user->rights->supplier_proposal->lire;
204$permissiontodelete = $user->rights->supplier_proposal->supprimer;
205
206
207/*
208 * Actions
209 */
210
211if (GETPOST('cancel', 'alpha')) {
212 $action = 'list';
213 $massaction = '';
214}
215if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
216 $massaction = '';
217}
218
219$parameters = array('socid'=>$socid);
220$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
221if ($reshook < 0) {
222 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
223}
224
225if (empty($reshook)) {
226 // Selection of new fields
227 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
228
229 // Purge search criteria
230 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
231 $search_categ = '';
232 $search_user = '';
233 $search_sale = '';
234 $search_ref = '';
235 $search_societe = '';
236 $search_societe_alias = '';
237 $search_montant_ht = '';
238 $search_montant_vat = '';
239 $search_montant_ttc = '';
240 $search_multicurrency_code = '';
241 $search_multicurrency_tx = '';
242 $search_multicurrency_montant_ht = '';
243 $search_multicurrency_montant_vat = '';
244 $search_multicurrency_montant_ttc = '';
245 $search_login = '';
246 $search_product_category = '';
247 $search_town = '';
248 $search_zip = "";
249 $search_state = "";
250 $search_type = '';
251 $search_country = '';
252 $search_type_thirdparty = '';
253 $search_date_startday = '';
254 $search_date_startmonth = '';
255 $search_date_startyear = '';
256 $search_date_endday = '';
257 $search_date_endmonth = '';
258 $search_date_endyear = '';
259 $search_date_start = '';
260 $search_date_end = '';
261 $search_date_valid_startday = '';
262 $search_date_valid_startmonth = '';
263 $search_date_valid_startyear = '';
264 $search_date_valid_endday = '';
265 $search_date_valid_endmonth = '';
266 $search_date_valid_endyear = '';
267 $search_date_valid_start = '';
268 $search_date_valid_end = '';
269 $search_status = '';
270 $object_statut = '';
271 }
272
273 $objectclass = 'SupplierProposal';
274 $objectlabel = 'SupplierProposals';
275 $uploaddir = $conf->supplier_proposal->dir_output;
276 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
277}
278
279
280/*
281 * View
282 */
283
284$form = new Form($db);
285$formother = new FormOther($db);
286$formfile = new FormFile($db);
287$formpropal = new FormPropal($db);
288$companystatic = new Societe($db);
289$formcompany = new FormCompany($db);
290
291$now = dol_now();
292
293$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
294$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
295
296$title = $langs->trans('ListOfSupplierProposals');
297$help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
298
299
300// Build and execute select
301// --------------------------------------------------------------------
302$sql = 'SELECT';
303if ($sall || $search_user > 0) {
304 $sql = 'SELECT DISTINCT';
305}
306$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
307$sql .= " typent.code as typent_code,";
308$sql .= " state.code_departement as state_code, state.nom as state_name,";
309$sql .= ' sp.rowid, sp.note_public, sp.note_private, sp.total_ht, sp.total_tva, sp.total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,';
310$sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,';
311$sql .= ' sp.datec as date_creation, sp.tms as date_update,';
312$sql .= " p.rowid as project_id, p.ref as project_ref,";
313if (empty($user->rights->societe->client->voir) && !$socid) {
314 $sql .= " sc.fk_soc, sc.fk_user,";
315}
316$sql .= " u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
317// Add fields from extrafields
318if (!empty($extrafields->attributes[$object->table_element]['label'])) {
319 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
320 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
321 }
322}
323// Add fields from hooks
324$parameters = array();
325$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
326$sql .= $hookmanager->resPrint;
327$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
328$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
329$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
330$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
331$sql .= ', '.MAIN_DB_PREFIX.'supplier_proposal as sp';
332if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
333 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (sp.rowid = ef.fk_object)";
334}
335if ($sall) {
336 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
337}
338$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sp.fk_user_author = u.rowid';
339$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = sp.fk_projet";
340// We'll need this table joined to the select in order to filter by sale
341if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
342 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
343}
344if ($search_user > 0) {
345 $sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
346 $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
347}
348$sql .= ' WHERE sp.fk_soc = s.rowid';
349$sql .= ' AND sp.entity IN ('.getEntity('supplier_proposal').')';
350if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
351 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
352}
353if ($search_town) {
354 $sql .= natural_search('s.town', $search_town);
355}
356if ($search_zip) {
357 $sql .= natural_search("s.zip", $search_zip);
358}
359if ($search_state) {
360 $sql .= natural_search("state.nom", $search_state);
361}
362if ($search_country) {
363 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
364}
365if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
366 $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
367}
368if ($search_ref) {
369 $sql .= natural_search('sp.ref', $search_ref);
370}
371if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
372 $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
373} else {
374 if ($search_societe) {
375 $sql .= natural_search('s.nom', $search_societe);
376 }
377 if ($search_societe_alias) {
378 $sql .= natural_search('s.name_alias', $search_societe_alias);
379 }
380}
381if ($search_login) {
382 $sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_login);
383}
384if ($search_montant_ht) {
385 $sql .= natural_search('sp.total_ht', $search_montant_ht, 1);
386}
387if ($search_montant_vat != '') {
388 $sql .= natural_search("sp.total_tva", $search_montant_vat, 1);
389}
390if ($search_montant_ttc != '') {
391 $sql .= natural_search("sp.total_ttc", $search_montant_ttc, 1);
392}
393if ($search_multicurrency_code != '') {
394 $sql .= " AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code)."'";
395}
396if ($search_multicurrency_tx != '') {
397 $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1);
398}
399if ($search_multicurrency_montant_ht != '') {
400 $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
401}
402if ($search_multicurrency_montant_vat != '') {
403 $sql .= natural_search('sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
404}
405if ($search_multicurrency_montant_ttc != '') {
406 $sql .= natural_search('sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
407}
408if ($sall) {
409 $sql .= natural_search(array_keys($fieldstosearchall), $sall);
410}
411if ($socid) {
412 $sql .= ' AND s.rowid = '.((int) $socid);
413}
414if ($search_status >= 0 && $search_status != '') {
415 $sql .= ' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).')';
416}
417if ($search_date_start) {
418 $sql .= " AND sp.date_livraison >= '".$db->idate($search_date_start)."'";
419}
420if ($search_date_end) {
421 $sql .= " AND sp.date_livraison <= '".$db->idate($search_date_end)."'";
422}
423if ($search_date_valid_start) {
424 $sql .= " AND sp.date_valid >= '".$db->idate($search_date_valid_start)."'";
425}
426if ($search_date_valid_end) {
427 $sql .= " AND sp.date_valid <= '".$db->idate($search_date_valid_end)."'";
428}
429if ($search_sale > 0) {
430 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
431}
432if ($search_user > 0) {
433 $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".((int) $search_user);
434}
435// Search for tag/category ($searchCategoryProductList is an array of ID)
436$searchCategoryProductOperator = -1;
437$searchCategoryProductList = array($search_product_category);
438if (!empty($searchCategoryProductList)) {
439 $searchCategoryProductSqlList = array();
440 $listofcategoryid = '';
441 foreach ($searchCategoryProductList as $searchCategoryProduct) {
442 if (intval($searchCategoryProduct) == -2) {
443 $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product)";
444 } elseif (intval($searchCategoryProduct) > 0) {
445 if ($searchCategoryProductOperator == 0) {
446 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
447 } else {
448 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
449 }
450 }
451 }
452 if ($listofcategoryid) {
453 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
454 }
455 if ($searchCategoryProductOperator == 1) {
456 if (!empty($searchCategoryProductSqlList)) {
457 $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
458 }
459 } else {
460 if (!empty($searchCategoryProductSqlList)) {
461 $sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
462 }
463 }
464}
465// Add where from extra fields
466include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
467// Add where from hooks
468$parameters = array();
469$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
470$sql .= $hookmanager->resPrint;
471
472$sql .= $db->order($sortfield, $sortorder);
473$sql .= ', sp.ref DESC';
474
475// Count total nb of records
476$nbtotalofrecords = '';
477if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
478 $resql = $db->query($sql);
479 $nbtotalofrecords = $db->num_rows($resql);
480 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
481 $page = 0;
482 $offset = 0;
483 }
484}
485
486$sql .= $db->plimit($limit + 1, $offset);
487
488$resql = $db->query($sql);
489if ($resql) {
490 $objectstatic = new SupplierProposal($db);
491 $userstatic = new User($db);
492
493 if ($socid > 0) {
494 $soc = new Societe($db);
495 $soc->fetch($socid);
496 $title = $langs->trans('SupplierProposals').' - '.$soc->name;
497 } else {
498 $title = $langs->trans('SupplierProposals');
499 }
500
501 $num = $db->num_rows($resql);
502
503 $arrayofselected = is_array($toselect) ? $toselect : array();
504
505 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
506 $obj = $db->fetch_object($resql);
507
508 $id = $obj->rowid;
509
510 header("Location: ".DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$id);
511 exit;
512 }
513
514 // Output page
515 // --------------------------------------------------------------------
516
517 llxHeader('', $title, $help_url);
518
519 $param = '';
520 if (!empty($mode)) {
521 $param .= '&mode='.urlencode($mode);
522 }
523 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
524 $param .= '&contextpage='.urlencode($contextpage);
525 }
526 if ($limit > 0 && $limit != $conf->liste_limit) {
527 $param .= '&limit='.((int) $limit);
528 }
529 if ($sall) {
530 $param .= '&sall='.urlencode($sall);
531 }
532 if ($search_date_startday) {
533 $param .= '&search_date_startday='.urlencode($search_date_startday);
534 }
535 if ($search_date_startmonth) {
536 $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
537 }
538 if ($search_date_startyear) {
539 $param .= '&search_date_startyear='.urlencode($search_date_startyear);
540 }
541 if ($search_date_endday) {
542 $param .= '&search_date_endday='.urlencode($search_date_endday);
543 }
544 if ($search_date_endmonth) {
545 $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
546 }
547 if ($search_date_endyear) {
548 $param .= '&search_date_endyear='.urlencode($search_date_endyear);
549 }
550 if ($search_date_valid_startday) {
551 $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday);
552 }
553 if ($search_date_valid_startmonth) {
554 $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
555 }
556 if ($search_date_valid_startyear) {
557 $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
558 }
559 if ($search_date_valid_endday) {
560 $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday);
561 }
562 if ($search_date_valid_endmonth) {
563 $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
564 }
565 if ($search_date_valid_endyear) {
566 $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
567 }
568 if ($search_ref) {
569 $param .= '&search_ref='.urlencode($search_ref);
570 }
571 if ($search_societe) {
572 $param .= '&search_societe='.urlencode($search_societe);
573 }
574 if ($search_societe_alias) {
575 $param .= '&search_societe_alias='.urlencode($search_societe_alias);
576 }
577 if ($search_user > 0) {
578 $param .= '&search_user='.urlencode($search_user);
579 }
580 if ($search_sale > 0) {
581 $param .= '&search_sale='.urlencode($search_sale);
582 }
583 if ($search_montant_ht) {
584 $param .= '&search_montant_ht='.urlencode($search_montant_ht);
585 }
586 if ($search_multicurrency_code != '') {
587 $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
588 }
589 if ($search_multicurrency_tx != '') {
590 $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
591 }
592 if ($search_multicurrency_montant_ht != '') {
593 $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
594 }
595 if ($search_multicurrency_montant_vat != '') {
596 $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
597 }
598 if ($search_multicurrency_montant_ttc != '') {
599 $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
600 }
601 if ($search_login) {
602 $param .= '&search_login='.urlencode($search_login);
603 }
604 if ($search_town) {
605 $param .= '&search_town='.urlencode($search_town);
606 }
607 if ($search_zip) {
608 $param .= '&search_zip='.urlencode($search_zip);
609 }
610 if ($socid > 0) {
611 $param .= '&socid='.urlencode($socid);
612 }
613 if ($search_status != '') {
614 $param .= '&search_status='.urlencode($search_status);
615 }
616 if ($optioncss != '') {
617 $param .= '&optioncss='.urlencode($optioncss);
618 }
619 if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
620 $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
621 }
622 // Add $param from extra fields
623 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
624
625 // List of mass actions available
626 $arrayofmassactions = array(
627 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
628 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
629 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
630 );
631 if ($user->rights->supplier_proposal->supprimer) {
632 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
633 }
634 if (in_array($massaction, array('presend', 'predelete'))) {
635 $arrayofmassactions = array();
636 }
637 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
638
639 $url = DOL_URL_ROOT.'/supplier_proposal/card.php?action=create';
640 if (!empty($socid)) {
641 $url .= '&socid='.$socid;
642 }
643 $newcardbutton = '';
644 $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'));
645 $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'));
646 $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->rights->supplier_proposal->creer);
647
648 // Fields title search
649 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
650 if ($optioncss != '') {
651 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
652 }
653 print '<input type="hidden" name="token" value="'.newToken().'">';
654 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
655 print '<input type="hidden" name="action" value="list">';
656 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
657 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
658 print '<input type="hidden" name="mode" value="'.$mode.'">';
659
660 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_proposal', 0, $newcardbutton, '', $limit, 0, 0, 1);
661
662 $topicmail = "SendSupplierProposalRef";
663 $modelmail = "supplier_proposal_send";
664 $objecttmp = new SupplierProposal($db);
665 $trackid = 'spro'.$object->id;
666 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
667
668 if ($sall) {
669 foreach ($fieldstosearchall as $key => $val) {
670 $fieldstosearchall[$key] = $langs->trans($val);
671 }
672 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
673 }
674
675 $i = 0;
676
677 $moreforfilter = '';
678
679 // If the user can view prospects other than his'
680 if ($user->rights->user->user->lire) {
681 $langs->load("commercial");
682 $moreforfilter .= '<div class="divsearchfield">';
683 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
684 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx');
685 $moreforfilter .= '</div>';
686 }
687 // If the user can view prospects other than his'
688 if ($user->rights->user->user->lire) {
689 $moreforfilter .= '<div class="divsearchfield">';
690 $tmptitle = $langs->trans('LinkedToSpecificUsers');
691 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
692 $moreforfilter .= '</div>';
693 }
694 // If the user can view products
695 if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
696 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
697 $moreforfilter .= '<div class="divsearchfield">';
698 $tmptitle = $langs->trans('IncludingProductWithTag');
699 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
700 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
701 $moreforfilter .= '</div>';
702 }
703 $parameters = array();
704 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
705 if (empty($reshook)) {
706 $moreforfilter .= $hookmanager->resPrint;
707 } else {
708 $moreforfilter = $hookmanager->resPrint;
709 }
710
711 if (!empty($moreforfilter)) {
712 print '<div class="liste_titre liste_titre_bydiv centpercent">';
713 print $moreforfilter;
714 print '</div>';
715 }
716
717 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
718 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
719 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
720
721 print '<div class="div-table-responsive">';
722 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
723
724 // Fields title search
725 // --------------------------------------------------------------------
726 print '<tr class="liste_titre_filter">';
727 // Action column
728 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
729 print '<td class="liste_titre maxwidthsearch">';
730 $searchpicto = $form->showFilterButtons('left');
731 print $searchpicto;
732 print '</td>';
733 }
734 if (!empty($arrayfields['sp.ref']['checked'])) {
735 print '<td class="liste_titre">';
736 print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
737 print '</td>';
738 }
739 if (!empty($arrayfields['s.nom']['checked'])) {
740 print '<td class="liste_titre left">';
741 print '<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
742 print '</td>';
743 }
744 if (!empty($arrayfields['s.name_alias']['checked'])) {
745 print '<td class="liste_titre left">';
746 print '<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).'">';
747 print '</td>';
748 }
749 if (!empty($arrayfields['s.town']['checked'])) {
750 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
751 }
752 if (!empty($arrayfields['s.zip']['checked'])) {
753 print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
754 }
755 // State
756 if (!empty($arrayfields['state.nom']['checked'])) {
757 print '<td class="liste_titre">';
758 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
759 print '</td>';
760 }
761 // Country
762 if (!empty($arrayfields['country.code_iso']['checked'])) {
763 print '<td class="liste_titre center">';
764 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
765 print '</td>';
766 }
767 // Company type
768 if (!empty($arrayfields['typent.code']['checked'])) {
769 print '<td class="liste_titre maxwidthonsmartphone center">';
770 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), '', 1);
771 print '</td>';
772 }
773 // Date
774 if (!empty($arrayfields['sp.date_valid']['checked'])) {
775 print '<td class="liste_titre center">';
776 print '<div class="nowrap">';
777 print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1, 'search_date_valid_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
778 print '</div>';
779 print '<div class="nowrap">';
780 print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1, 'search_date_valid_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
781 print '</div>';
782 print '</td>';
783 }
784 // Date
785 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
786 print '<td class="liste_titre center">';
787 print '<div class="nowrap">';
788 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
789 print '</div>';
790 print '<div class="nowrap">';
791 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
792 print '</div>';
793 print '</td>';
794 }
795
796 if (!empty($arrayfields['sp.total_ht']['checked'])) {
797 // Amount
798 print '<td class="liste_titre right">';
799 print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
800 print '</td>';
801 }
802 if (!empty($arrayfields['sp.total_tva']['checked'])) {
803 // Amount
804 print '<td class="liste_titre right">';
805 print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
806 print '</td>';
807 }
808 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
809 // Amount
810 print '<td class="liste_titre right">';
811 print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
812 print '</td>';
813 }
814 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
815 // Currency
816 print '<td class="liste_titre">';
817 print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
818 print '</td>';
819 }
820 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
821 // Currency rate
822 print '<td class="liste_titre">';
823 print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
824 print '</td>';
825 }
826 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
827 // Amount
828 print '<td class="liste_titre right">';
829 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
830 print '</td>';
831 }
832 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
833 // Amount
834 print '<td class="liste_titre right">';
835 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
836 print '</td>';
837 }
838 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
839 // Amount
840 print '<td class="liste_titre right">';
841 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
842 print '</td>';
843 }
844 if (!empty($arrayfields['u.login']['checked'])) {
845 // Author
846 print '<td class="liste_titre center">';
847 print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
848 print '</td>';
849 }
850 // Extra fields
851 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
852 // Fields from hook
853 $parameters = array('arrayfields'=>$arrayfields);
854 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
855 print $hookmanager->resPrint;
856 // Date creation
857 if (!empty($arrayfields['sp.datec']['checked'])) {
858 print '<td class="liste_titre">';
859 print '</td>';
860 }
861 // Date modification
862 if (!empty($arrayfields['sp.tms']['checked'])) {
863 print '<td class="liste_titre">';
864 print '</td>';
865 }
866 // Status
867 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
868 print '<td class="liste_titre right parentonrightofpage">';
869 $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'supplier', 'search_status', 'search_status width100 onrightofpage');
870 print '</td>';
871 }
872 // Action column
873 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
874 print '<td class="liste_titre maxwidthsearch">';
875 $searchpicto = $form->showFilterButtons();
876 print $searchpicto;
877 print '</td>';
878 }
879
880 print "</tr>\n";
881
882 $totalarray = array();
883 $totalarray['nbfield'] = 0;
884
885 // Fields title
886 print '<tr class="liste_titre">';
887 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
888 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
889 $totalarray['nbfield']++;
890 }
891 if (!empty($arrayfields['sp.ref']['checked'])) {
892 print_liste_field_titre($arrayfields['sp.ref']['label'], $_SERVER["PHP_SELF"], 'sp.ref', '', $param, '', $sortfield, $sortorder);
893 $totalarray['nbfield']++;
894 }
895 if (!empty($arrayfields['s.nom']['checked'])) {
896 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
897 $totalarray['nbfield']++;
898 }
899 if (!empty($arrayfields['s.name_alias']['checked'])) {
900 print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder);
901 $totalarray['nbfield']++;
902 }
903 if (!empty($arrayfields['s.town']['checked'])) {
904 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
905 $totalarray['nbfield']++;
906 }
907 if (!empty($arrayfields['s.zip']['checked'])) {
908 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
909 $totalarray['nbfield']++;
910 }
911 if (!empty($arrayfields['state.nom']['checked'])) {
912 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
913 $totalarray['nbfield']++;
914 }
915 if (!empty($arrayfields['country.code_iso']['checked'])) {
916 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
917 $totalarray['nbfield']++;
918 }
919 if (!empty($arrayfields['typent.code']['checked'])) {
920 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
921 $totalarray['nbfield']++;
922 }
923 if (!empty($arrayfields['sp.date_valid']['checked'])) {
924 print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center ');
925 $totalarray['nbfield']++;
926 }
927 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
928 print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center ');
929 $totalarray['nbfield']++;
930 }
931 if (!empty($arrayfields['sp.total_ht']['checked'])) {
932 print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
933 $totalarray['nbfield']++;
934 }
935 if (!empty($arrayfields['sp.total_tva']['checked'])) {
936 print_liste_field_titre($arrayfields['sp.total_tva']['label'], $_SERVER["PHP_SELF"], 'sp.total_tva', '', $param, '', $sortfield, $sortorder, 'right ');
937 $totalarray['nbfield']++;
938 }
939 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
940 print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
941 $totalarray['nbfield']++;
942 }
943 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
944 print_liste_field_titre($arrayfields['sp.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_code', '', $param, '', $sortfield, $sortorder);
945 $totalarray['nbfield']++;
946 }
947 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
948 print_liste_field_titre($arrayfields['sp.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
949 $totalarray['nbfield']++;
950 }
951 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
952 print_liste_field_titre($arrayfields['sp.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
953 $totalarray['nbfield']++;
954 }
955 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
956 print_liste_field_titre($arrayfields['sp.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
957 $totalarray['nbfield']++;
958 }
959 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
960 print_liste_field_titre($arrayfields['sp.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
961 $totalarray['nbfield']++;
962 }
963 if (!empty($arrayfields['u.login']['checked'])) {
964 print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center ');
965 $totalarray['nbfield']++;
966 }
967 // Extra fields
968 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
969 // Hook fields
970 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
971 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
972 print $hookmanager->resPrint;
973 if (!empty($arrayfields['sp.datec']['checked'])) {
974 print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
975 $totalarray['nbfield']++;
976 }
977 if (!empty($arrayfields['sp.tms']['checked'])) {
978 print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap');
979 $totalarray['nbfield']++;
980 }
981 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
982 print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
983 $totalarray['nbfield']++;
984 }
985 // Action
986 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
987 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
988 $totalarray['nbfield']++;
989 }
990 print '</tr>'."\n";
991
992 $now = dol_now();
993 $i = 0;
994 $total = 0;
995 $subtotal = 0;
996 $savnbfield = $totalarray['nbfield'];
997 $totalarray = array();
998 $totalarray['nbfield'] = 0;
999 $totalarray['val'] = array();
1000 $totalarray['val']['sp.total_ht'] = 0;
1001 $totalarray['val']['sp.total_tva'] = 0;
1002 $totalarray['val']['sp.total_ttc'] = 0;
1003
1004 $imaxinloop = ($limit ? min($num, $limit) : $num);
1005 while ($i < $imaxinloop) {
1006 $obj = $db->fetch_object($resql);
1007
1008 $objectstatic->id = $obj->rowid;
1009 $objectstatic->ref = $obj->ref;
1010 $objectstatic->note_public = $obj->note_public;
1011 $objectstatic->note_private = $obj->note_private;
1012 $objectstatic->status = $obj->status;
1013
1014 // Company
1015 $companystatic->id = $obj->socid;
1016 $companystatic->name = $obj->name;
1017 $companystatic->name_alias = $obj->alias;
1018 $companystatic->client = $obj->client;
1019 $companystatic->code_client = $obj->code_client;
1020
1021 if ($mode == 'kanban') {
1022 if ($i == 0) {
1023 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1024 print '<div class="box-flex-container kanban">';
1025 }
1026 // Output Kanban
1027 // TODO Use a cahe on user
1028 $userstatic->fetch($obj->fk_user_author);
1029 $objectstatic->delivery_date = $obj->dp;
1030 print $objectstatic->getKanbanView('', array('thirdparty'=>$companystatic, 'userauthor'=>$userstatic, 'selected' => in_array($obj->id, $arrayofselected)));
1031 if ($i == ($imaxinloop - 1)) {
1032 print '</div>';
1033 print '</td></tr>';
1034 }
1035 } else {
1036 print '<tr class="oddeven">';
1037 // Action column
1038 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1039 print '<td class="nowrap center">';
1040 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1041 $selected = 0;
1042 if (in_array($obj->rowid, $arrayofselected)) {
1043 $selected = 1;
1044 }
1045 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1046 }
1047 print '</td>';
1048 }
1049 if (!empty($arrayfields['sp.ref']['checked'])) {
1050 print '<td class="nowraponall">';
1051
1052 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
1053 // Picto + Ref
1054 print '<td class="nobordernopadding nowraponall">';
1055 print $objectstatic->getNomUrl(1, '', '', 0, -1, 1);
1056 print '</td>';
1057 // Warning
1058 $warnornote = '';
1059 //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
1060 if ($warnornote) {
1061 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
1062 print $warnornote;
1063 print '</td>';
1064 }
1065 // Other picto tool
1066 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
1067 $filename = dol_sanitizeFileName($obj->ref);
1068 $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref);
1069 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
1070 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1071 print '</td></tr></table>';
1072
1073 print "</td>\n";
1074 if (!$i) {
1075 $totalarray['nbfield']++;
1076 }
1077 }
1078
1079 // Thirdparty
1080 if (!empty($arrayfields['s.nom']['checked'])) {
1081 print '<td class="tdoverflowmax200">';
1082 print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1083 print '</td>';
1084 if (!$i) {
1085 $totalarray['nbfield']++;
1086 }
1087 }
1088
1089 // Alias
1090 if (!empty($arrayfields['s.name_alias']['checked'])) {
1091 print '<td class="tdoverflowmax200">';
1092 print $companystatic->name_alias;
1093 print '</td>';
1094 if (!$i) {
1095 $totalarray['nbfield']++;
1096 }
1097 }
1098
1099 // Town
1100 if (!empty($arrayfields['s.town']['checked'])) {
1101 print '<td class="nocellnopadd">';
1102 print $obj->town;
1103 print '</td>';
1104 if (!$i) {
1105 $totalarray['nbfield']++;
1106 }
1107 }
1108 // Zip
1109 if (!empty($arrayfields['s.zip']['checked'])) {
1110 print '<td class="nocellnopadd">';
1111 print $obj->zip;
1112 print '</td>';
1113 if (!$i) {
1114 $totalarray['nbfield']++;
1115 }
1116 }
1117 // State
1118 if (!empty($arrayfields['state.nom']['checked'])) {
1119 print "<td>".$obj->state_name."</td>\n";
1120 if (!$i) {
1121 $totalarray['nbfield']++;
1122 }
1123 }
1124 // Country
1125 if (!empty($arrayfields['country.code_iso']['checked'])) {
1126 print '<td class="center">';
1127 $tmparray = getCountry($obj->fk_pays, 'all');
1128 print $tmparray['label'];
1129 print '</td>';
1130 if (!$i) {
1131 $totalarray['nbfield']++;
1132 }
1133 }
1134 // Type ent
1135 if (!empty($arrayfields['typent.code']['checked'])) {
1136 print '<td class="center">';
1137 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1138 $typenArray = $formcompany->typent_array(1);
1139 }
1140 print $typenArray[$obj->typent_code];
1141 print '</td>';
1142 if (!$i) {
1143 $totalarray['nbfield']++;
1144 }
1145 }
1146
1147 // Date proposal
1148 if (!empty($arrayfields['sp.date_valid']['checked'])) {
1149 print '<td class="center">';
1150 print dol_print_date($db->jdate($obj->date_valid), 'day');
1151 print "</td>\n";
1152 if (!$i) {
1153 $totalarray['nbfield']++;
1154 }
1155 }
1156
1157 // Date delivery
1158 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
1159 print '<td class="center">';
1160 print dol_print_date($db->jdate($obj->dp), 'day');
1161 print "</td>\n";
1162 if (!$i) {
1163 $totalarray['nbfield']++;
1164 }
1165 }
1166
1167 // Amount HT
1168 if (!empty($arrayfields['sp.total_ht']['checked'])) {
1169 print '<td class="right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
1170 if (!$i) {
1171 $totalarray['nbfield']++;
1172 }
1173 if (!$i) {
1174 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht';
1175 }
1176 $totalarray['val']['sp.total_ht'] += $obj->total_ht;
1177 }
1178 // Amount VAT
1179 if (!empty($arrayfields['sp.total_tva']['checked'])) {
1180 print '<td class="right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
1181 if (!$i) {
1182 $totalarray['nbfield']++;
1183 }
1184 if (!$i) {
1185 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva';
1186 }
1187 $totalarray['val']['sp.total_tva'] += $obj->total_tva;
1188 }
1189 // Amount TTC
1190 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
1191 print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
1192 if (!$i) {
1193 $totalarray['nbfield']++;
1194 }
1195 if (!$i) {
1196 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc';
1197 }
1198 $totalarray['val']['sp.total_ttc'] += $obj->total_ttc;
1199 }
1200
1201 // Currency
1202 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
1203 print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
1204 if (!$i) {
1205 $totalarray['nbfield']++;
1206 }
1207 }
1208
1209 // Currency rate
1210 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
1211 print '<td class="nowrap">';
1212 $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
1213 print "</td>\n";
1214 if (!$i) {
1215 $totalarray['nbfield']++;
1216 }
1217 }
1218 // Amount HT
1219 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
1220 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
1221 if (!$i) {
1222 $totalarray['nbfield']++;
1223 }
1224 }
1225 // Amount VAT
1226 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
1227 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n";
1228 if (!$i) {
1229 $totalarray['nbfield']++;
1230 }
1231 }
1232 // Amount TTC
1233 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
1234 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
1235 if (!$i) {
1236 $totalarray['nbfield']++;
1237 }
1238 }
1239
1240 $userstatic->id = $obj->fk_user_author;
1241 $userstatic->login = $obj->login;
1242 $userstatic->status = $obj->ustatus;
1243 $userstatic->lastname = $obj->name;
1244 $userstatic->firstname = $obj->firstname;
1245 $userstatic->photo = $obj->photo;
1246 $userstatic->admin = $obj->admin;
1247 $userstatic->ref = $obj->fk_user_author;
1248 $userstatic->employee = $obj->employee;
1249 $userstatic->email = $obj->uemail;
1250
1251 // Author
1252 if (!empty($arrayfields['u.login']['checked'])) {
1253 print '<td class="center">';
1254 if ($userstatic->id > 0) {
1255 print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
1256 } else {
1257 print '&nbsp;';
1258 }
1259 print "</td>\n";
1260 if (!$i) {
1261 $totalarray['nbfield']++;
1262 }
1263 }
1264
1265 // Extra fields
1266 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1267 // Fields from hook
1268 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1269 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1270 print $hookmanager->resPrint;
1271 // Date creation
1272 if (!empty($arrayfields['sp.datec']['checked'])) {
1273 print '<td class="center nowrap">';
1274 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1275 print '</td>';
1276 if (!$i) {
1277 $totalarray['nbfield']++;
1278 }
1279 }
1280 // Date modification
1281 if (!empty($arrayfields['sp.tms']['checked'])) {
1282 print '<td class="center nowrap">';
1283 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1284 print '</td>';
1285 if (!$i) {
1286 $totalarray['nbfield']++;
1287 }
1288 }
1289 // Status
1290 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
1291 print '<td class="right">'.$objectstatic->getLibStatut(5)."</td>\n";
1292 if (!$i) {
1293 $totalarray['nbfield']++;
1294 }
1295 }
1296
1297 // Action column
1298 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1299 print '<td class="nowrap center">';
1300 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1301 $selected = 0;
1302 if (in_array($obj->rowid, $arrayofselected)) {
1303 $selected = 1;
1304 }
1305 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1306 }
1307 print '</td>';
1308 }
1309 if (!$i) {
1310 $totalarray['nbfield']++;
1311 }
1312
1313 print "</tr>\n";
1314
1315 $total += $obj->total_ht;
1316 $subtotal += $obj->total_ht;
1317 }
1318 $i++;
1319 }
1320
1321 // Show total line
1322 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1323
1324 // If no record found
1325 if ($num == 0) {
1326 $colspan = 1;
1327 foreach ($arrayfields as $key => $val) {
1328 if (!empty($val['checked'])) {
1329 $colspan++;
1330 }
1331 }
1332 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1333 }
1334
1335 $db->free($resql);
1336
1337 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1338 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1339 print $hookmanager->resPrint;
1340
1341 print '</table>'."\n";
1342 print '</div>'."\n";
1343
1344 print '</form>'."\n";
1345
1346 $hidegeneratedfilelistifempty = 1;
1347 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1348 $hidegeneratedfilelistifempty = 0;
1349 }
1350
1351 // Show list of available documents
1352 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1353 $urlsource .= str_replace('&amp;', '&', $param);
1354
1355 $filedir = $diroutputmassaction;
1356
1357 $genallowed = $user->rights->supplier_proposal->lire;
1358 $delallowed = $user->rights->supplier_proposal->creer;
1359
1360 print $formfile->showdocuments('massfilesarea_supplier_proposal', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1361} else {
1362 dol_print_error($db);
1363}
1364
1365// End of page
1366llxFooter();
1367$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage standard extra fields.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage generation of HTML components for proposal management.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.