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