dolibarr 21.0.0-alpha
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-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
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_societe = GETPOST('search_societe', 'alpha');
69$search_societe_alias = GETPOST('search_societe_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 < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
113 // If $page is not defined, or '' or -1 or if we click on clear filters
114 $page = 0;
115}
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 a technical object to manage hooks of page. Note that conf->hooks_modules contains an 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'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
201
202if (!$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_societe = '';
241 $search_societe_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
298$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
299$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
300
301$title = $langs->trans('ListOfSupplierProposals');
302$help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
303
304
305// Build and execute select
306// --------------------------------------------------------------------
307$sql = 'SELECT';
308if ($search_all || $search_user > 0) {
309 $sql = 'SELECT DISTINCT';
310}
311$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,';
312$sql .= " typent.code as typent_code,";
313$sql .= " state.code_departement as state_code, state.nom as state_name,";
314$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,';
315$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,';
316$sql .= ' sp.datec as date_creation, sp.tms as date_modification,';
317$sql .= " p.rowid as project_id, p.ref as project_ref,";
318$sql .= " u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
319// Add fields from extrafields
320if (!empty($extrafields->attributes[$object->table_element]['label'])) {
321 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
322 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
323 }
324}
325// Add fields from hooks
326$parameters = array();
327$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
328$sql .= $hookmanager->resPrint;
329$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
330$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
331$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
332$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
333$sql .= ', '.MAIN_DB_PREFIX.'supplier_proposal as sp';
334if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
335 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (sp.rowid = ef.fk_object)";
336}
337if ($search_all) {
338 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
339}
340$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sp.fk_user_author = u.rowid';
341$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = sp.fk_projet";
342if ($search_user > 0) {
343 $sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
344 $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
345}
346$sql .= ' WHERE sp.fk_soc = s.rowid';
347$sql .= ' AND sp.entity IN ('.getEntity('supplier_proposal').')';
348if ($search_town) {
349 $sql .= natural_search('s.town', $search_town);
350}
351if ($search_zip) {
352 $sql .= natural_search("s.zip", $search_zip);
353}
354if ($search_state) {
355 $sql .= natural_search("state.nom", $search_state);
356}
357if ($search_country) {
358 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
359}
360if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
361 $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
362}
363if ($search_ref) {
364 $sql .= natural_search('sp.ref', $search_ref);
365}
366if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
367 $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
368} else {
369 if ($search_societe) {
370 $sql .= natural_search('s.nom', $search_societe);
371 }
372 if ($search_societe_alias) {
373 $sql .= natural_search('s.name_alias', $search_societe_alias);
374 }
375}
376if ($search_login) {
377 $sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_login);
378}
379if ($search_montant_ht) {
380 $sql .= natural_search('sp.total_ht', $search_montant_ht, 1);
381}
382if ($search_montant_vat != '') {
383 $sql .= natural_search("sp.total_tva", $search_montant_vat, 1);
384}
385if ($search_montant_ttc != '') {
386 $sql .= natural_search("sp.total_ttc", $search_montant_ttc, 1);
387}
388if ($search_multicurrency_code != '') {
389 $sql .= " AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code)."'";
390}
391if ($search_multicurrency_tx != '') {
392 $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1);
393}
394if ($search_multicurrency_montant_ht != '') {
395 $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
396}
397if ($search_multicurrency_montant_vat != '') {
398 $sql .= natural_search('sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
399}
400if ($search_multicurrency_montant_ttc != '') {
401 $sql .= natural_search('sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
402}
403if ($search_all) {
404 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
405}
406if ($socid > 0) {
407 $sql .= ' AND s.rowid = '.((int) $socid);
408}
409if ($search_status >= 0 && $search_status != '') {
410 $sql .= ' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).')';
411}
412if ($search_date_start) {
413 $sql .= " AND sp.date_livraison >= '".$db->idate($search_date_start)."'";
414}
415if ($search_date_end) {
416 $sql .= " AND sp.date_livraison <= '".$db->idate($search_date_end)."'";
417}
418if ($search_date_valid_start) {
419 $sql .= " AND sp.date_valid >= '".$db->idate($search_date_valid_start)."'";
420}
421if ($search_date_valid_end) {
422 $sql .= " AND sp.date_valid <= '".$db->idate($search_date_valid_end)."'";
423}
424/*
425if ($search_sale > 0) {
426 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
427}*/
428if ($search_user > 0) {
429 $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);
430}
431// Search on sale representative
432if ($search_sale && $search_sale != '-1') {
433 if ($search_sale == -2) {
434 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)";
435 } elseif ($search_sale > 0) {
436 $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).")";
437 }
438}
439// Search for tag/category ($searchCategoryProductList is an array of ID)
440$searchCategoryProductOperator = -1;
441$searchCategoryProductList = array($search_product_category);
442if (!empty($searchCategoryProductList)) {
443 $searchCategoryProductSqlList = array();
444 $listofcategoryid = '';
445 foreach ($searchCategoryProductList as $searchCategoryProduct) {
446 if (intval($searchCategoryProduct) == -2) {
447 $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)";
448 } elseif (intval($searchCategoryProduct) > 0) {
449 if ($searchCategoryProductOperator == 0) {
450 $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).")";
451 } else {
452 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
453 }
454 }
455 }
456 if ($listofcategoryid) {
457 $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)."))";
458 }
459 if ($searchCategoryProductOperator == 1) {
460 if (!empty($searchCategoryProductSqlList)) {
461 $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
462 }
463 } else {
464 if (!empty($searchCategoryProductSqlList)) {
465 $sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
466 }
467 }
468}
469// Add where from extra fields
470include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
471// Add where from hooks
472$parameters = array();
473$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
474$sql .= $hookmanager->resPrint;
475
476$sql .= $db->order($sortfield, $sortorder);
477$sql .= ', sp.ref DESC';
478
479// Count total nb of records
480$nbtotalofrecords = '';
481if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
482 $resql = $db->query($sql);
483 $nbtotalofrecords = $db->num_rows($resql);
484 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
485 $page = 0;
486 $offset = 0;
487 }
488}
489
490$sql .= $db->plimit($limit + 1, $offset);
491
492$resql = $db->query($sql);
493if ($resql) {
494 $objectstatic = new SupplierProposal($db);
495 $userstatic = new User($db);
496
497 if ($socid > 0) {
498 $soc = new Societe($db);
499 $soc->fetch($socid);
500 $title = $langs->trans('SupplierProposals').' - '.$soc->name;
501 } else {
502 $title = $langs->trans('SupplierProposals');
503 }
504
505 $num = $db->num_rows($resql);
506
507 $arrayofselected = is_array($toselect) ? $toselect : array();
508
509 if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
510 $obj = $db->fetch_object($resql);
511
512 $id = $obj->rowid;
513
514 header("Location: ".DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$id);
515 exit;
516 }
517
518 // Output page
519 // --------------------------------------------------------------------
520
521 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-supplierproposal page-list');
522
523 $param = '';
524 if (!empty($mode)) {
525 $param .= '&mode='.urlencode($mode);
526 }
527 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
528 $param .= '&contextpage='.urlencode($contextpage);
529 }
530 if ($limit > 0 && $limit != $conf->liste_limit) {
531 $param .= '&limit='.((int) $limit);
532 }
533 if ($search_all) {
534 $param .= '&search_all='.urlencode($search_all);
535 }
536 if ($search_date_startday) {
537 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
538 }
539 if ($search_date_startmonth) {
540 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
541 }
542 if ($search_date_startyear) {
543 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
544 }
545 if ($search_date_endday) {
546 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
547 }
548 if ($search_date_endmonth) {
549 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
550 }
551 if ($search_date_endyear) {
552 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
553 }
554 if ($search_date_valid_startday) {
555 $param .= '&search_date_valid_startday='.urlencode((string) ($search_date_valid_startday));
556 }
557 if ($search_date_valid_startmonth) {
558 $param .= '&search_date_valid_startmonth='.urlencode((string) ($search_date_valid_startmonth));
559 }
560 if ($search_date_valid_startyear) {
561 $param .= '&search_date_valid_startyear='.urlencode((string) ($search_date_valid_startyear));
562 }
563 if ($search_date_valid_endday) {
564 $param .= '&search_date_valid_endday='.urlencode((string) ($search_date_valid_endday));
565 }
566 if ($search_date_valid_endmonth) {
567 $param .= '&search_date_valid_endmonth='.urlencode((string) ($search_date_valid_endmonth));
568 }
569 if ($search_date_valid_endyear) {
570 $param .= '&search_date_valid_endyear='.urlencode((string) ($search_date_valid_endyear));
571 }
572 if ($search_ref) {
573 $param .= '&search_ref='.urlencode($search_ref);
574 }
575 if ($search_societe) {
576 $param .= '&search_societe='.urlencode($search_societe);
577 }
578 if ($search_societe_alias) {
579 $param .= '&search_societe_alias='.urlencode($search_societe_alias);
580 }
581 if ($search_user > 0) {
582 $param .= '&search_user='.urlencode((string) ($search_user));
583 }
584 if ($search_sale > 0) {
585 $param .= '&search_sale='.urlencode($search_sale);
586 }
587 if ($search_montant_ht) {
588 $param .= '&search_montant_ht='.urlencode($search_montant_ht);
589 }
590 if ($search_multicurrency_code != '') {
591 $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
592 }
593 if ($search_multicurrency_tx != '') {
594 $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
595 }
596 if ($search_multicurrency_montant_ht != '') {
597 $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
598 }
599 if ($search_multicurrency_montant_vat != '') {
600 $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
601 }
602 if ($search_multicurrency_montant_ttc != '') {
603 $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
604 }
605 if ($search_login) {
606 $param .= '&search_login='.urlencode($search_login);
607 }
608 if ($search_town) {
609 $param .= '&search_town='.urlencode($search_town);
610 }
611 if ($search_zip) {
612 $param .= '&search_zip='.urlencode($search_zip);
613 }
614 if ($socid > 0) {
615 $param .= '&socid='.urlencode((string) ($socid));
616 }
617 if ($search_status != '') {
618 $param .= '&search_status='.urlencode($search_status);
619 }
620 if ($optioncss != '') {
621 $param .= '&optioncss='.urlencode($optioncss);
622 }
623 if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
624 $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty));
625 }
626 // Add $param from extra fields
627 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
628
629 // List of mass actions available
630 $arrayofmassactions = array(
631 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
632 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
633 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
634 );
635 if ($user->hasRight('supplier_proposal', 'supprimer')) {
636 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
637 }
638 if (in_array($massaction, array('presend', 'predelete'))) {
639 $arrayofmassactions = array();
640 }
641 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
642
643 $url = DOL_URL_ROOT.'/supplier_proposal/card.php?action=create';
644 if (!empty($socid)) {
645 $url .= '&socid='.$socid;
646 }
647 $newcardbutton = '';
648 $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'));
649 $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'));
650 $newcardbutton .= dolGetButtonTitleSeparator();
651 $newcardbutton .= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('supplier_proposal', 'creer'));
652
653 // Fields title search
654 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
655 if ($optioncss != '') {
656 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
657 }
658 print '<input type="hidden" name="token" value="'.newToken().'">';
659 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
660 print '<input type="hidden" name="action" value="list">';
661 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
662 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
663 print '<input type="hidden" name="mode" value="'.$mode.'">';
664
665 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_proposal', 0, $newcardbutton, '', $limit, 0, 0, 1);
666
667 $topicmail = "SendSupplierProposalRef";
668 $modelmail = "supplier_proposal_send";
669 $objecttmp = new SupplierProposal($db);
670 $trackid = 'spro'.$object->id;
671 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
672
673 if ($search_all) {
674 foreach ($fieldstosearchall as $key => $val) {
675 $fieldstosearchall[$key] = $langs->trans($val);
676 }
677 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
678 }
679
680 $i = 0;
681
682 $moreforfilter = '';
683
684 // If the user can view prospects other than his'
685 if ($user->hasRight('user', 'user', 'lire')) {
686 $langs->load("commercial");
687 $moreforfilter .= '<div class="divsearchfield">';
688 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
689 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx');
690 $moreforfilter .= '</div>';
691 }
692 // If the user can view prospects other than his'
693 if ($user->hasRight('user', 'user', 'lire')) {
694 $moreforfilter .= '<div class="divsearchfield">';
695 $tmptitle = $langs->trans('LinkedToSpecificUsers');
696 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
697 $moreforfilter .= '</div>';
698 }
699 // If the user can view products
700 if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
701 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
702 $moreforfilter .= '<div class="divsearchfield">';
703 $tmptitle = $langs->trans('IncludingProductWithTag');
704 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
705 $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);
706 $moreforfilter .= '</div>';
707 }
708 $parameters = array();
709 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
710 if (empty($reshook)) {
711 $moreforfilter .= $hookmanager->resPrint;
712 } else {
713 $moreforfilter = $hookmanager->resPrint;
714 }
715
716 if (!empty($moreforfilter)) {
717 print '<div class="liste_titre liste_titre_bydiv centpercent">';
718 print $moreforfilter;
719 print '</div>';
720 }
721
722 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
723 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
724 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
725
726 print '<div class="div-table-responsive">';
727 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
728
729 // Fields title search
730 // --------------------------------------------------------------------
731 print '<tr class="liste_titre_filter">';
732 // Action column
733 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
734 print '<td class="liste_titre maxwidthsearch">';
735 $searchpicto = $form->showFilterButtons('left');
736 print $searchpicto;
737 print '</td>';
738 }
739 if (!empty($arrayfields['sp.ref']['checked'])) {
740 print '<td class="liste_titre">';
741 print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
742 print '</td>';
743 }
744 if (!empty($arrayfields['s.nom']['checked'])) {
745 print '<td class="liste_titre left">';
746 print '<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
747 print '</td>';
748 }
749 if (!empty($arrayfields['s.name_alias']['checked'])) {
750 print '<td class="liste_titre left">';
751 print '<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).'">';
752 print '</td>';
753 }
754 if (!empty($arrayfields['s.town']['checked'])) {
755 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
756 }
757 if (!empty($arrayfields['s.zip']['checked'])) {
758 print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
759 }
760 // State
761 if (!empty($arrayfields['state.nom']['checked'])) {
762 print '<td class="liste_titre">';
763 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
764 print '</td>';
765 }
766 // Country
767 if (!empty($arrayfields['country.code_iso']['checked'])) {
768 print '<td class="liste_titre center">';
769 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
770 print '</td>';
771 }
772 // Company type
773 if (!empty($arrayfields['typent.code']['checked'])) {
774 print '<td class="liste_titre maxwidthonsmartphone center">';
775 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);
776 print '</td>';
777 }
778 // Date
779 if (!empty($arrayfields['sp.date_valid']['checked'])) {
780 print '<td class="liste_titre center">';
781 print '<div class="nowrapfordate">';
782 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'));
783 print '</div>';
784 print '<div class="nowrapfordate">';
785 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'));
786 print '</div>';
787 print '</td>';
788 }
789 // Date
790 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
791 print '<td class="liste_titre center">';
792 print '<div class="nowrapfordate">';
793 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
794 print '</div>';
795 print '<div class="nowrapfordate">';
796 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
797 print '</div>';
798 print '</td>';
799 }
800
801 if (!empty($arrayfields['sp.total_ht']['checked'])) {
802 // Amount
803 print '<td class="liste_titre right">';
804 print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
805 print '</td>';
806 }
807 if (!empty($arrayfields['sp.total_tva']['checked'])) {
808 // Amount
809 print '<td class="liste_titre right">';
810 print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
811 print '</td>';
812 }
813 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
814 // Amount
815 print '<td class="liste_titre right">';
816 print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
817 print '</td>';
818 }
819 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
820 // Currency
821 print '<td class="liste_titre">';
822 print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
823 print '</td>';
824 }
825 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
826 // Currency rate
827 print '<td class="liste_titre">';
828 print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
829 print '</td>';
830 }
831 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
832 // Amount
833 print '<td class="liste_titre right">';
834 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
835 print '</td>';
836 }
837 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
838 // Amount
839 print '<td class="liste_titre right">';
840 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
841 print '</td>';
842 }
843 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
844 // Amount
845 print '<td class="liste_titre right">';
846 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
847 print '</td>';
848 }
849 if (!empty($arrayfields['u.login']['checked'])) {
850 // Author
851 print '<td class="liste_titre center">';
852 print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
853 print '</td>';
854 }
855 // Extra fields
856 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
857 // Fields from hook
858 $parameters = array('arrayfields' => $arrayfields);
859 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
860 print $hookmanager->resPrint;
861 // Date creation
862 if (!empty($arrayfields['sp.datec']['checked'])) {
863 print '<td class="liste_titre">';
864 print '</td>';
865 }
866 // Date modification
867 if (!empty($arrayfields['sp.tms']['checked'])) {
868 print '<td class="liste_titre">';
869 print '</td>';
870 }
871 // Status
872 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
873 print '<td class="liste_titre center parentonrightofpage">';
874 $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'supplier', 'search_status', 'search_status width100 onrightofpage');
875 print '</td>';
876 }
877 // Action column
878 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
879 print '<td class="liste_titre maxwidthsearch">';
880 $searchpicto = $form->showFilterButtons();
881 print $searchpicto;
882 print '</td>';
883 }
884
885 print "</tr>\n";
886
887 $totalarray = array();
888 $totalarray['nbfield'] = 0;
889
890 // Fields title
891 print '<tr class="liste_titre">';
892 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
893 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
894 $totalarray['nbfield']++;
895 }
896 if (!empty($arrayfields['sp.ref']['checked'])) {
897 print_liste_field_titre($arrayfields['sp.ref']['label'], $_SERVER["PHP_SELF"], 'sp.ref', '', $param, '', $sortfield, $sortorder);
898 $totalarray['nbfield']++;
899 }
900 if (!empty($arrayfields['s.nom']['checked'])) {
901 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
902 $totalarray['nbfield']++;
903 }
904 if (!empty($arrayfields['s.name_alias']['checked'])) {
905 // @phan-suppress-next-line PhanTypeInvalidDimOffset
906 print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder);
907 $totalarray['nbfield']++;
908 }
909 if (!empty($arrayfields['s.town']['checked'])) {
910 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
911 $totalarray['nbfield']++;
912 }
913 if (!empty($arrayfields['s.zip']['checked'])) {
914 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
915 $totalarray['nbfield']++;
916 }
917 if (!empty($arrayfields['state.nom']['checked'])) {
918 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
919 $totalarray['nbfield']++;
920 }
921 if (!empty($arrayfields['country.code_iso']['checked'])) {
922 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
923 $totalarray['nbfield']++;
924 }
925 if (!empty($arrayfields['typent.code']['checked'])) {
926 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
927 $totalarray['nbfield']++;
928 }
929 if (!empty($arrayfields['sp.date_valid']['checked'])) {
930 print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center ');
931 $totalarray['nbfield']++;
932 }
933 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
934 print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center ');
935 $totalarray['nbfield']++;
936 }
937 if (!empty($arrayfields['sp.total_ht']['checked'])) {
938 print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
939 $totalarray['nbfield']++;
940 }
941 if (!empty($arrayfields['sp.total_tva']['checked'])) {
942 print_liste_field_titre($arrayfields['sp.total_tva']['label'], $_SERVER["PHP_SELF"], 'sp.total_tva', '', $param, '', $sortfield, $sortorder, 'right ');
943 $totalarray['nbfield']++;
944 }
945 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
946 print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
947 $totalarray['nbfield']++;
948 }
949 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
950 print_liste_field_titre($arrayfields['sp.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_code', '', $param, '', $sortfield, $sortorder);
951 $totalarray['nbfield']++;
952 }
953 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
954 print_liste_field_titre($arrayfields['sp.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
955 $totalarray['nbfield']++;
956 }
957 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
958 print_liste_field_titre($arrayfields['sp.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
959 $totalarray['nbfield']++;
960 }
961 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
962 print_liste_field_titre($arrayfields['sp.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
963 $totalarray['nbfield']++;
964 }
965 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
966 print_liste_field_titre($arrayfields['sp.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
967 $totalarray['nbfield']++;
968 }
969 if (!empty($arrayfields['u.login']['checked'])) {
970 print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center ');
971 $totalarray['nbfield']++;
972 }
973 // Extra fields
974 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
975 // Hook fields
976 $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
977 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
978 print $hookmanager->resPrint;
979 if (!empty($arrayfields['sp.datec']['checked'])) {
980 print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
981 $totalarray['nbfield']++;
982 }
983 if (!empty($arrayfields['sp.tms']['checked'])) {
984 print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap');
985 $totalarray['nbfield']++;
986 }
987 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
988 print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
989 $totalarray['nbfield']++;
990 }
991 // Action
992 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
993 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
994 $totalarray['nbfield']++;
995 }
996 print '</tr>'."\n";
997
998 $now = dol_now();
999 $i = 0;
1000 $total = 0;
1001 $subtotal = 0;
1002 $savnbfield = $totalarray['nbfield'];
1003 $totalarray = array();
1004 $totalarray['nbfield'] = 0;
1005 $totalarray['val'] = array();
1006 $totalarray['val']['sp.total_ht'] = 0;
1007 $totalarray['val']['sp.total_tva'] = 0;
1008 $totalarray['val']['sp.total_ttc'] = 0;
1009
1010 $imaxinloop = ($limit ? min($num, $limit) : $num);
1011 while ($i < $imaxinloop) {
1012 $obj = $db->fetch_object($resql);
1013
1014 $objectstatic->id = $obj->rowid;
1015 $objectstatic->ref = $obj->ref;
1016 $objectstatic->note_public = $obj->note_public;
1017 $objectstatic->note_private = $obj->note_private;
1018 $objectstatic->status = $obj->status;
1019
1020 // Company
1021 $companystatic->id = $obj->socid;
1022 $companystatic->name = $obj->name;
1023 $companystatic->name_alias = $obj->alias;
1024 $companystatic->client = $obj->client;
1025 $companystatic->code_client = $obj->code_client;
1026
1027 if ($mode == 'kanban') {
1028 if ($i == 0) {
1029 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1030 print '<div class="box-flex-container kanban">';
1031 }
1032 // Output Kanban
1033 // TODO Use a cache on user
1034 $userstatic->fetch($obj->fk_user_author);
1035 $objectstatic->delivery_date = $obj->dp;
1036 print $objectstatic->getKanbanView('', array('thirdparty' => $companystatic, 'userauthor' => $userstatic, 'selected' => in_array($obj->rowid, $arrayofselected)));
1037 if ($i == ($imaxinloop - 1)) {
1038 print '</div>';
1039 print '</td></tr>';
1040 }
1041 } else {
1042 print '<tr class="oddeven '.((getDolGlobalInt('MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ? 'opacitymedium' : '').'">';
1043 // Action column
1044 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1045 print '<td class="nowrap center">';
1046 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1047 $selected = 0;
1048 if (in_array($obj->rowid, $arrayofselected)) {
1049 $selected = 1;
1050 }
1051 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1052 }
1053 print '</td>';
1054 }
1055 if (!empty($arrayfields['sp.ref']['checked'])) {
1056 print '<td class="nowraponall">';
1057
1058 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
1059 // Picto + Ref
1060 print '<td class="nobordernopadding nowraponall">';
1061 print $objectstatic->getNomUrl(1, '', '', 0, -1, 1);
1062 print '</td>';
1063 // Warning
1064 $warnornote = '';
1065 //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
1066 if ($warnornote) {
1067 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
1068 print $warnornote;
1069 print '</td>';
1070 }
1071 // Other picto tool
1072 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
1073 $filename = dol_sanitizeFileName($obj->ref);
1074 $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref);
1075 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
1076 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1077 print '</td></tr></table>';
1078
1079 print "</td>\n";
1080 if (!$i) {
1081 $totalarray['nbfield']++;
1082 }
1083 }
1084
1085 // Thirdparty
1086 if (!empty($arrayfields['s.nom']['checked'])) {
1087 print '<td class="tdoverflowmax150">';
1088 print $companystatic->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1089 print '</td>';
1090 if (!$i) {
1091 $totalarray['nbfield']++;
1092 }
1093 }
1094
1095 // Alias
1096 if (!empty($arrayfields['s.name_alias']['checked'])) {
1097 print '<td class="tdoverflowmax200">';
1098 print $companystatic->name_alias;
1099 print '</td>';
1100 if (!$i) {
1101 $totalarray['nbfield']++;
1102 }
1103 }
1104
1105 // Town
1106 if (!empty($arrayfields['s.town']['checked'])) {
1107 print '<td class="nocellnopadd">';
1108 print $obj->town;
1109 print '</td>';
1110 if (!$i) {
1111 $totalarray['nbfield']++;
1112 }
1113 }
1114 // Zip
1115 if (!empty($arrayfields['s.zip']['checked'])) {
1116 print '<td class="nocellnopadd">';
1117 print $obj->zip;
1118 print '</td>';
1119 if (!$i) {
1120 $totalarray['nbfield']++;
1121 }
1122 }
1123 // State
1124 if (!empty($arrayfields['state.nom']['checked'])) {
1125 print "<td>".$obj->state_name."</td>\n";
1126 if (!$i) {
1127 $totalarray['nbfield']++;
1128 }
1129 }
1130 // Country
1131 if (!empty($arrayfields['country.code_iso']['checked'])) {
1132 print '<td class="center">';
1133 $tmparray = getCountry($obj->fk_pays, 'all');
1134 print $tmparray['label'];
1135 print '</td>';
1136 if (!$i) {
1137 $totalarray['nbfield']++;
1138 }
1139 }
1140 // Type ent
1141 if (!empty($arrayfields['typent.code']['checked'])) {
1142 print '<td class="center">';
1143 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1144 $typenArray = $formcompany->typent_array(1);
1145 }
1146 print $typenArray[$obj->typent_code];
1147 print '</td>';
1148 if (!$i) {
1149 $totalarray['nbfield']++;
1150 }
1151 }
1152
1153 // Date proposal
1154 if (!empty($arrayfields['sp.date_valid']['checked'])) {
1155 print '<td class="center">';
1156 print dol_print_date($db->jdate($obj->date_valid), 'day');
1157 print "</td>\n";
1158 if (!$i) {
1159 $totalarray['nbfield']++;
1160 }
1161 }
1162
1163 // Date delivery
1164 if (!empty($arrayfields['sp.date_livraison']['checked'])) {
1165 print '<td class="center">';
1166 print dol_print_date($db->jdate($obj->dp), 'day');
1167 print "</td>\n";
1168 if (!$i) {
1169 $totalarray['nbfield']++;
1170 }
1171 }
1172
1173 // Amount HT
1174 if (!empty($arrayfields['sp.total_ht']['checked'])) {
1175 print '<td class="right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
1176 if (!$i) {
1177 $totalarray['nbfield']++;
1178 }
1179 if (!$i) {
1180 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht';
1181 }
1182 $totalarray['val']['sp.total_ht'] += $obj->total_ht;
1183 }
1184 // Amount VAT
1185 if (!empty($arrayfields['sp.total_tva']['checked'])) {
1186 print '<td class="right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
1187 if (!$i) {
1188 $totalarray['nbfield']++;
1189 }
1190 if (!$i) {
1191 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva';
1192 }
1193 $totalarray['val']['sp.total_tva'] += $obj->total_tva;
1194 }
1195 // Amount TTC
1196 if (!empty($arrayfields['sp.total_ttc']['checked'])) {
1197 print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
1198 if (!$i) {
1199 $totalarray['nbfield']++;
1200 }
1201 if (!$i) {
1202 $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc';
1203 }
1204 $totalarray['val']['sp.total_ttc'] += $obj->total_ttc;
1205 }
1206
1207 // Currency
1208 if (!empty($arrayfields['sp.multicurrency_code']['checked'])) {
1209 print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
1210 if (!$i) {
1211 $totalarray['nbfield']++;
1212 }
1213 }
1214
1215 // Currency rate
1216 if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) {
1217 print '<td class="nowrap">';
1218 $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
1219 print "</td>\n";
1220 if (!$i) {
1221 $totalarray['nbfield']++;
1222 }
1223 }
1224 // Amount HT
1225 if (!empty($arrayfields['sp.multicurrency_total_ht']['checked'])) {
1226 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
1227 if (!$i) {
1228 $totalarray['nbfield']++;
1229 }
1230 }
1231 // Amount VAT
1232 if (!empty($arrayfields['sp.multicurrency_total_vat']['checked'])) {
1233 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n";
1234 if (!$i) {
1235 $totalarray['nbfield']++;
1236 }
1237 }
1238 // Amount TTC
1239 if (!empty($arrayfields['sp.multicurrency_total_ttc']['checked'])) {
1240 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
1241 if (!$i) {
1242 $totalarray['nbfield']++;
1243 }
1244 }
1245
1246 $userstatic->id = $obj->fk_user_author;
1247 $userstatic->login = $obj->login;
1248 $userstatic->status = $obj->ustatus;
1249 $userstatic->lastname = $obj->name;
1250 $userstatic->firstname = $obj->firstname;
1251 $userstatic->photo = $obj->photo;
1252 $userstatic->admin = $obj->admin;
1253 $userstatic->ref = $obj->fk_user_author;
1254 $userstatic->employee = $obj->employee;
1255 $userstatic->email = $obj->uemail;
1256
1257 // Author
1258 if (!empty($arrayfields['u.login']['checked'])) {
1259 print '<td class="tdoverflowmax125">';
1260 if ($userstatic->id > 0) {
1261 print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
1262 }
1263 print "</td>\n";
1264 if (!$i) {
1265 $totalarray['nbfield']++;
1266 }
1267 }
1268
1269 // Extra fields
1270 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1271 // Fields from hook
1272 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1273 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1274 print $hookmanager->resPrint;
1275 // Date creation
1276 if (!empty($arrayfields['sp.datec']['checked'])) {
1277 print '<td class="center nowraponall">';
1278 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1279 print '</td>';
1280 if (!$i) {
1281 $totalarray['nbfield']++;
1282 }
1283 }
1284 // Date modification
1285 if (!empty($arrayfields['sp.tms']['checked'])) {
1286 print '<td class="center nowraponall">';
1287 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1288 print '</td>';
1289 if (!$i) {
1290 $totalarray['nbfield']++;
1291 }
1292 }
1293 // Status
1294 if (!empty($arrayfields['sp.fk_statut']['checked'])) {
1295 print '<td class="center">'.$objectstatic->getLibStatut(5)."</td>\n";
1296 if (!$i) {
1297 $totalarray['nbfield']++;
1298 }
1299 }
1300
1301 // Action column
1302 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1303 print '<td class="nowrap center">';
1304 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1305 $selected = 0;
1306 if (in_array($obj->rowid, $arrayofselected)) {
1307 $selected = 1;
1308 }
1309 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1310 }
1311 print '</td>';
1312 }
1313 if (!$i) {
1314 $totalarray['nbfield']++;
1315 }
1316
1317 print "</tr>\n";
1318
1319 $total += $obj->total_ht;
1320 $subtotal += $obj->total_ht;
1321 }
1322 $i++;
1323 }
1324
1325 // Show total line
1326 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1327
1328 // If no record found
1329 if ($num == 0) {
1330 $colspan = 1;
1331 foreach ($arrayfields as $key => $val) {
1332 if (!empty($val['checked'])) {
1333 $colspan++;
1334 }
1335 }
1336 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1337 }
1338
1339 $db->free($resql);
1340
1341 $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1342 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1343 print $hookmanager->resPrint;
1344
1345 print '</table>'."\n";
1346 print '</div>'."\n";
1347
1348 print '</form>'."\n";
1349
1350 $hidegeneratedfilelistifempty = 1;
1351 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1352 $hidegeneratedfilelistifempty = 0;
1353 }
1354
1355 // Show list of available documents
1356 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1357 $urlsource .= str_replace('&amp;', '&', $param);
1358
1359 $filedir = $diroutputmassaction;
1360
1361 $genallowed = $user->hasRight('supplier_proposal', 'lire');
1362 $delallowed = $user->hasRight('supplier_proposal', 'creer');
1363
1364 print $formfile->showdocuments('massfilesarea_supplier_proposal', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1365} else {
1366 dol_print_error($db);
1367}
1368
1369// End of page
1370llxFooter();
1371$db->close();
$id
Definition account.php:39
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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.
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.
llxFooter()
Footer empty.
Definition document.php:107
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 a 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.