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