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