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