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