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