dolibarr 18.0.6
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-2016 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-2022 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) 2015 Jean-François Ferry <jfefe@aternatik.fr>
13 * Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
14 * Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
15 * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
16 * Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
17 * Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
18 * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
19 * Copyright (C) 2022 Josep Lluís Amador <joseplluis@lliuretic.cat>
20 * Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
21 *
22 * This program is free software; you can redistribute it and/or modify
23 * it under the terms of the GNU General Public License as published by
24 * the Free Software Foundation; either version 3 of the License, or
25 * (at your option) any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program. If not, see <https://www.gnu.org/licenses/>.
34 */
35
42// Load Dolibarr environment
43require '../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
48if (isModEnabled('margin')) {
49 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
50}
51require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
54require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
55if (isModEnabled('categorie')) {
56 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
57 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
58}
59
60// Load translation files required by the page
61$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories'));
62if (isModEnabled("expedition")) {
63 $langs->loadLangs(array('sendings'));
64}
65
66// Get Parameters
67$socid = GETPOST('socid', 'int');
68
69$action = GETPOST('action', 'aZ09');
70$massaction = GETPOST('massaction', 'alpha');
71$show_files = GETPOST('show_files', 'int');
72$confirm = GETPOST('confirm', 'alpha');
73$cancel = GETPOST('cancel', 'alpha');
74$toselect = GETPOST('toselect', 'array');
75$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist';
76$mode = GETPOST('mode', 'alpha');
77
78// Search Fields
79$search_user = GETPOST('search_user', 'int');
80$search_sale = GETPOST('search_sale', 'int');
81$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
82$search_refcustomer = GETPOST('search_refcustomer', 'alpha');
83$search_refproject = GETPOST('search_refproject', 'alpha');
84$search_project = GETPOST('search_project', 'alpha');
85
86$search_societe = GETPOST('search_societe', 'alpha');
87$search_societe_alias = GETPOST('search_societe_alias', 'alpha');
88$search_montant_ht = GETPOST('search_montant_ht', 'alpha');
89$search_montant_vat = GETPOST('search_montant_vat', 'alpha');
90$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
91$search_warehouse = GETPOST('search_warehouse', 'alpha');
92$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
93$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
94$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
95$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
96$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
97$search_login = GETPOST('search_login', 'alpha');
98$search_product_category = GETPOST('search_product_category', 'int');
99$search_town = GETPOST('search_town', 'alpha');
100$search_zip = GETPOST('search_zip', 'alpha');
101$search_state = GETPOST("search_state");
102$search_country = GETPOST("search_country", 'int');
103$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
104$search_date_startday = GETPOST('search_date_startday', 'int');
105$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
106$search_date_startyear = GETPOST('search_date_startyear', 'int');
107$search_date_endday = GETPOST('search_date_endday', 'int');
108$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
109$search_date_endyear = GETPOST('search_date_endyear', 'int');
110$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
111$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
112$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
113$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
114$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
115$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
116$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
117$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int');
118$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
119$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
120$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
121$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
122$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
123$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
124$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int');
125$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int');
126$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
127$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
128$search_availability = GETPOST('search_availability', 'int');
129$search_categ_cus = GETPOST("search_categ_cus", 'int');
130$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
131$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int');
132$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
133$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
134$search_btn = GETPOST('button_search', 'alpha');
135$search_remove_btn = GETPOST('button_removefilter', 'alpha');
136$search_date_signature_startday = GETPOST('search_date_signature_startday', 'int');
137$search_date_signature_startmonth = GETPOST('search_date_signature_startmonth', 'int');
138$search_date_signature_startyear = GETPOST('search_date_signature_startyear', 'int');
139$search_date_signature_endday = GETPOST('search_date_signature_endday', 'int');
140$search_date_signature_endmonth = GETPOST('search_date_signature_endmonth', 'int');
141$search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int');
142$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
143$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
144
145$search_status = GETPOST('search_status', 'alpha');
146
147$optioncss = GETPOST('optioncss', 'alpha');
148$object_statut = GETPOST('search_statut', 'alpha');
149
150$search_option = GETPOST('search_option', 'alpha');
151if ($search_option == 'late') {
152 $search_status = '1';
153 $object_statut = '1';
154}
155
156$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
157$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
158
159// Pagination
160$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
161$sortfield = GETPOST('sortfield', 'aZ09comma');
162$sortorder = GETPOST('sortorder', 'aZ09comma');
163$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
164if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) {
165 $page = 0;
166} // If $page is not defined, or '' or -1
167$offset = $limit * $page;
168$pageprev = $page - 1;
169$pagenext = $page + 1;
170if (!$sortfield) {
171 $sortfield = 'p.ref';
172}
173if (!$sortorder) {
174 $sortorder = 'DESC';
175}
176
177// Security check
178$module = 'propal';
179$dbtable = '';
180$objectid = '';
181if (!empty($user->socid)) {
182 $socid = $user->socid;
183}
184if (!empty($socid)) {
185 $objectid = $socid;
186 $module = 'societe';
187 $dbtable = '&societe';
188}
189$result = restrictedArea($user, $module, $objectid, $dbtable);
190
191$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
192
193// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
194$object = new Propal($db);
195$hookmanager->initHooks(array('propallist'));
196$extrafields = new ExtraFields($db);
197
198// fetch optionals attributes and labels
199$extrafields->fetch_name_optionals_label($object->table_element);
200
201$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
202
203// List of fields to search into when doing a "search in all"
204$fieldstosearchall = array(
205 'p.ref'=>'Ref',
206 'p.ref_client'=>'RefCustomer',
207 'pd.description'=>'Description',
208 's.nom'=>"ThirdParty",
209 's.name_alias'=>"AliasNameShort",
210 's.zip'=>"Zip",
211 's.town'=>"Town",
212 'p.note_public'=>'NotePublic',
213);
214if (empty($user->socid)) {
215 $fieldstosearchall["p.note_private"] = "NotePrivate";
216}
217
218
219$checkedtypetiers = 0;
220$arrayfields = array(
221 'p.ref'=>array('label'=>"Ref", 'checked'=>1),
222 'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1),
223 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
224 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
225 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
226 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1),
227 's.town'=>array('label'=>"Town", 'checked'=>-1),
228 's.zip'=>array('label'=>"Zip", 'checked'=>-1),
229 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
230 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
231 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
232 'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
233 'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
234 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
235 'p.date_signature'=>array('label'=>"DateSigning", 'checked'=>0),
236 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
237 'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>isModEnabled("expedition")),
238 'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
239 'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0),
240 'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
241 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
242 'p.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0),
243 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
244 'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
245 'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
246 'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
247 'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
248 'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
249 'p.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
250 'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)),
251 'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
252 'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
253 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
254 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
255 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
256 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
257 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
258 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
259 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
260 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
261 'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
262 'p.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
263 'p.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
264 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
265);
266
267// List of fields to search into when doing a "search in all"
268/*$fieldstosearchall = array();
269foreach ($object->fields as $key => $val) {
270 if (!empty($val['searchall'])) {
271 $fieldstosearchall['t.'.$key] = $val['label'];
272 }
273}*/
274
275// Definition of array of fields for columns
276/*$arrayfields = array();
277foreach ($object->fields as $key => $val) {
278 // If $val['visible']==0, then we never show the field
279 if (!empty($val['visible'])) {
280 $visible = (int) dol_eval($val['visible'], 1);
281 $arrayfields['t.'.$key] = array(
282 'label'=>$val['label'],
283 'checked'=>(($visible < 0) ? 0 : 1),
284 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
285 'position'=>$val['position'],
286 'help'=> isset($val['help']) ? $val['help'] : ''
287 );
288 }
289}*/
290
291// Extra fields
292include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
293
294// Permissions
295$permissiontoread = $user->hasRight('propal', 'lire');
296$permissiontoadd = $user->hasRight('propal', 'creer');
297$permissiontodelete = $user->hasRight('propal', 'supprimer');
298if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
299 $permissiontovalidate = $user->hasRight('propal', 'propal_advance', 'validate');
300 $permissiontoclose = $user->hasRight('propal', 'propal_advance', 'close');
301 $permissiontosendbymail = $user->hasRight('propal', 'propal_advance', 'send');
302} else {
303 $permissiontovalidate = $user->hasRight('propal', 'creer');
304 $permissiontoclose = $user->hasRight('propal', 'creer');
305 $permissiontosendbymail = $user->hasRight('propal', 'lire');
306}
307
308
309/*
310 * Actions
311 */
312
313if (GETPOST('cancel', 'alpha')) {
314 $action = 'list';
315 $massaction = '';
316}
317if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
318 $massaction = '';
319}
320
321$parameters = array('socid'=>$socid, 'arrayfields'=>&$arrayfields);
322$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
323if ($reshook < 0) {
324 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
325}
326
327include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
328
329// Do we click on purge search criteria ?
330if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
331 $search_categ = '';
332 $search_user = '';
333 $search_sale = '';
334 $search_ref = '';
335 $search_refcustomer = '';
336 $search_refproject = '';
337 $search_project = '';
338 $search_societe = '';
339 $search_societe_alias = '';
340 $search_montant_ht = '';
341 $search_montant_vat = '';
342 $search_montant_ttc = '';
343 $search_warehouse = '';
344 $search_multicurrency_code = '';
345 $search_multicurrency_tx = '';
346 $search_multicurrency_montant_ht = '';
347 $search_multicurrency_montant_vat = '';
348 $search_multicurrency_montant_ttc = '';
349 $search_login = '';
350 $search_product_category = '';
351 $search_town = '';
352 $search_zip = "";
353 $search_state = "";
354 $search_type = '';
355 $search_country = '';
356 $search_type_thirdparty = '';
357 $search_date_startday = '';
358 $search_date_startmonth = '';
359 $search_date_startyear = '';
360 $search_date_endday = '';
361 $search_date_endmonth = '';
362 $search_date_endyear = '';
363 $search_date_start = '';
364 $search_date_end = '';
365 $search_date_end_startday = '';
366 $search_date_end_startmonth = '';
367 $search_date_end_startyear = '';
368 $search_date_end_endday = '';
369 $search_date_end_endmonth = '';
370 $search_date_end_endyear = '';
371 $search_date_end_start = '';
372 $search_date_end_end = '';
373 $search_date_delivery_startday = '';
374 $search_date_delivery_startmonth = '';
375 $search_date_delivery_startyear = '';
376 $search_date_delivery_endday = '';
377 $search_date_delivery_endmonth = '';
378 $search_date_delivery_endyear = '';
379 $search_date_delivery_start = '';
380 $search_date_delivery_end = '';
381 $search_availability = '';
382 $search_status = '';
383 $object_statut = '';
384 $toselect = array();
385 $search_array_options = array();
386 $search_categ_cus = 0;
387 $search_fk_cond_reglement = '';
388 $search_fk_shipping_method = '';
389 $search_fk_input_reason = '';
390 $search_fk_mode_reglement = '';
391 $search_date_signature_startday = '';
392 $search_date_signature_startmonth = '';
393 $search_date_signature_startyear = '';
394 $search_date_signature_endday = '';
395 $search_date_signature_endmonth = '';
396 $search_date_signature_endyear = '';
397 $search_date_signature_start = '';
398 $search_date_signature_end = '';
399 $search_option = '';
400}
401if ($object_statut != '') {
402 $search_status = $object_statut;
403}
404
405
406if (empty($reshook)) {
407 $objectclass = 'Propal';
408 $objectlabel = 'Proposals';
409 $uploaddir = $conf->propal->multidir_output[$conf->entity];
410 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
411}
412
413if ($action == 'validate' && $permissiontovalidate) {
414 if (GETPOST('confirm') == 'yes') {
415 $tmpproposal = new Propal($db);
416 $db->begin();
417 $error = 0;
418 foreach ($toselect as $checked) {
419 if ($tmpproposal->fetch($checked) > 0) {
420 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
421 if ($tmpproposal->valid($user) > 0) {
422 setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
423 } else {
424 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
425 $error++;
426 }
427 } else {
428 $langs->load("errors");
429 setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
430 $error++;
431 }
432 } else {
433 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
434 $error++;
435 }
436 }
437 if ($error) {
438 $db->rollback();
439 } else {
440 $db->commit();
441 }
442 }
443}
444
445if ($action == "sign" && $permissiontoclose) {
446 if (GETPOST('confirm') == 'yes') {
447 $tmpproposal = new Propal($db);
448 $db->begin();
449 $error = 0;
450 foreach ($toselect as $checked) {
451 if ($tmpproposal->fetch($checked) > 0) {
452 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
453 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
454 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
455 setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
456 } else {
457 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
458 $error++;
459 }
460 } else {
461 setEventMessage($langs->trans('MustBeValidatedToBeSigned', $tmpproposal->ref), 'errors');
462 $error++;
463 }
464 } else {
465 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
466 $error++;
467 }
468 }
469 if ($error) {
470 $db->rollback();
471 } else {
472 $db->commit();
473 }
474 }
475}
476
477if ($action == "nosign" && $permissiontoclose) {
478 if (GETPOST('confirm') == 'yes') {
479 $tmpproposal = new Propal($db);
480 $db->begin();
481 $error = 0;
482 foreach ($toselect as $checked) {
483 if ($tmpproposal->fetch($checked) > 0) {
484 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (!empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
485 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
486 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
487 setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
488 } else {
489 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
490 $error++;
491 }
492 } else {
493 setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
494 $error++;
495 }
496 } else {
497 setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
498 $error++;
499 }
500 }
501 if ($error) {
502 $db->rollback();
503 } else {
504 $db->commit();
505 }
506 }
507}
508
509// Closed records
510if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
511 $db->begin();
512
513 $objecttmp = new $objectclass($db);
514 $nbok = 0;
515 foreach ($toselect as $toselectid) {
516 $result = $objecttmp->fetch($toselectid);
517 if ($result > 0) {
518 $result = $objecttmp->classifyBilled($user, 0);
519 if ($result <= 0) {
520 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
521 $error++;
522 break;
523 } else {
524 $nbok++;
525 }
526 } else {
527 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
528 $error++;
529 break;
530 }
531 }
532
533 if (!$error) {
534 if ($nbok > 1) {
535 setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
536 } else {
537 setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
538 }
539 $db->commit();
540 } else {
541 $db->rollback();
542 }
543}
544
545
546
547/*
548 * View
549 */
550
551$now = dol_now();
552
553$form = new Form($db);
554$formother = new FormOther($db);
555$formfile = new FormFile($db);
556$formpropal = new FormPropal($db);
557$formmargin = null;
558if (isModEnabled('margin')) {
559 $formmargin = new FormMargin($db);
560}
561$companystatic = new Societe($db);
562$projectstatic = new Project($db);
563$formcompany = new FormCompany($db);
564
565$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
566$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
567
568$sql = 'SELECT';
569if ($sall || $search_user > 0) {
570 $sql = 'SELECT DISTINCT';
571}
572$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, ';
573$sql .= " typent.code as typent_code,";
574$sql .= " ava.rowid as availability,";
575$sql .= " country.code as country_code,";
576$sql .= " state.code_departement as state_code, state.nom as state_name,";
577$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
578$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
579$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
580$sql .= ' p.date_signature as dsignature,';
581$sql .= ' p.note_public, p.note_private,';
582$sql .= ' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
583$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
584$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
585if (empty($user->rights->societe->client->voir) && !$socid) {
586 $sql .= ", sc.fk_soc, sc.fk_user";
587}
588if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
589 $sql .= ", cc.fk_categorie, cc.fk_soc";
590}
591// Add fields from extrafields
592if (!empty($extrafields->attributes[$object->table_element]['label'])) {
593 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
594 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
595 }
596}
597// Add fields from hooks
598$parameters = array();
599$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
600$sql .= $hookmanager->resPrint;
601$sql = preg_replace('/, $/', '', $sql);
602
603$sqlfields = $sql; // $sql fields to remove for count total
604
605$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
606$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
607$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
608$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
609if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
610 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
611}
612$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
613if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
614 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
615}
616if ($sall) {
617 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
618}
619$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
620$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
621$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
622// We'll need this table joined to the select in order to filter by sale
623if ($search_sale == -2) {
624 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON (sc.fk_soc = p.fk_soc)";
625} elseif ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
626 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
627}
628if ($search_user > 0) {
629 $sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
630 $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
631}
632
633// Add table from hooks
634$parameters = array();
635$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
636$sql .= $hookmanager->resPrint;
637
638$sql .= ' WHERE p.fk_soc = s.rowid';
639$sql .= ' AND p.entity IN ('.getEntity('propal').')';
640if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
641 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
642}
643
644if ($search_town) {
645 $sql .= natural_search('s.town', $search_town);
646}
647if ($search_zip) {
648 $sql .= natural_search("s.zip", $search_zip);
649}
650if ($search_state) {
651 $sql .= natural_search("state.nom", $search_state);
652}
653if ($search_country) {
654 $sql .= " AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).')';
655}
656if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
657 $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
658}
659if ($search_ref) {
660 $sql .= natural_search('p.ref', $search_ref);
661}
662if ($search_refcustomer) {
663 $sql .= natural_search('p.ref_client', $search_refcustomer);
664}
665if ($search_refproject) {
666 $sql .= natural_search('pr.ref', $search_refproject);
667}
668if ($search_project) {
669 $sql .= natural_search('pr.title', $search_project);
670}
671if ($search_availability) {
672 $sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')';
673}
674if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
675 $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
676} else {
677 if ($search_societe) {
678 $sql .= natural_search('s.nom', $search_societe);
679 }
680 if ($search_societe_alias) {
681 $sql .= natural_search('s.name_alias', $search_societe_alias);
682 }
683}
684if ($search_login) {
685 $sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login);
686}
687if ($search_montant_ht != '') {
688 $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
689}
690if ($search_montant_vat != '') {
691 $sql .= natural_search("p.total_tva", $search_montant_vat, 1);
692}
693if ($search_montant_ttc != '') {
694 $sql .= natural_search("p.total_ttc", $search_montant_ttc, 1);
695}
696if ($search_warehouse != '' && $search_warehouse > 0) {
697 $sql .= natural_search("p.fk_warehouse", $search_warehouse, 1);
698}
699if ($search_multicurrency_code != '') {
700 $sql .= " AND p.multicurrency_code = '".$db->escape($search_multicurrency_code)."'";
701}
702if ($search_multicurrency_tx != '') {
703 $sql .= natural_search('p.multicurrency_tx', $search_multicurrency_tx, 1);
704}
705if ($search_multicurrency_montant_ht != '') {
706 $sql .= natural_search('p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
707}
708if ($search_multicurrency_montant_vat != '') {
709 $sql .= natural_search('p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
710}
711if ($search_multicurrency_montant_ttc != '') {
712 $sql .= natural_search('p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
713}
714if ($sall) {
715 $sql .= natural_search(array_keys($fieldstosearchall), $sall);
716}
717
718if ($search_categ_cus > 0) {
719 $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
720}
721if ($search_categ_cus == -2) {
722 $sql .= " AND cc.fk_categorie IS NULL";
723}
724
725if ($search_fk_cond_reglement > 0) {
726 $sql .= " AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
727}
728if ($search_fk_shipping_method > 0) {
729 $sql .= " AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
730}
731if ($search_fk_input_reason > 0) {
732 $sql .= " AND p.fk_input_reason = ".((int) $search_fk_input_reason);
733}
734if ($search_fk_mode_reglement > 0) {
735 $sql .= " AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
736}
737if ($socid > 0) {
738 $sql .= ' AND s.rowid = '.((int) $socid);
739}
740if ($search_status != '' && $search_status != '-1') {
741 $sql .= ' AND p.fk_statut IN ('.$db->sanitize($search_status).')';
742}
743if ($search_date_start) {
744 $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
745}
746if ($search_date_end) {
747 $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
748}
749if ($search_date_end_start) {
750 $sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'";
751}
752if ($search_date_end_end) {
753 $sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'";
754}
755if ($search_date_delivery_start) {
756 $sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'";
757}
758if ($search_date_delivery_end) {
759 $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
760}
761if ($search_sale == -2) {
762 $sql .= " AND sc.fk_user IS NULL";
763} elseif ($search_sale > 0) {
764 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
765}
766if ($search_user > 0) {
767 $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
768}
769if ($search_date_signature_start) {
770 $sql .= " AND p.date_signature >= '".$db->idate($search_date_signature_start)."'";
771}
772if ($search_date_signature_end) {
773 $sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
774}
775if ($search_option == 'late') {
776 $sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'";
777}
778// Search for tag/category ($searchCategoryProductList is an array of ID)
779$searchCategoryProductOperator = -1;
780$searchCategoryProductList = array($search_product_category);
781if (!empty($searchCategoryProductList)) {
782 $searchCategoryProductSqlList = array();
783 $listofcategoryid = '';
784 foreach ($searchCategoryProductList as $searchCategoryProduct) {
785 if (intval($searchCategoryProduct) == -2) {
786 $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product)";
787 } elseif (intval($searchCategoryProduct) > 0) {
788 if ($searchCategoryProductOperator == 0) {
789 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
790 } else {
791 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
792 }
793 }
794 }
795 if ($listofcategoryid) {
796 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
797 }
798 if ($searchCategoryProductOperator == 1) {
799 if (!empty($searchCategoryProductSqlList)) {
800 $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
801 }
802 } else {
803 if (!empty($searchCategoryProductSqlList)) {
804 $sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
805 }
806 }
807}
808// Add where from extra fields
809include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
810
811// Add where from hooks
812$parameters = array();
813$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
814$sql .= $hookmanager->resPrint;
815
816// Add HAVING from hooks
817$parameters = array();
818$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
819$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
820
821// Count total nb of records
822$nbtotalofrecords = '';
823if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
824 /* The fast and low memory method to get and count full list converts the sql into a sql count */
825 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
826 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
827 $resql = $db->query($sqlforcount);
828 if ($resql) {
829 $objforcount = $db->fetch_object($resql);
830 $nbtotalofrecords = $objforcount->nbtotalofrecords;
831 } else {
832 dol_print_error($db);
833 }
834
835 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
836 $page = 0;
837 $offset = 0;
838 }
839 $db->free($resql);
840}
841
842$sql .= $db->order($sortfield, $sortorder);
843$sql .= ', p.ref DESC';
844if ($limit) {
845 $sql .= $db->plimit($limit + 1, $offset);
846}
847
848$resql = $db->query($sql);
849
850if ($resql) {
851 $objectstatic = new Propal($db);
852 $userstatic = new User($db);
853
854 if ($socid > 0) {
855 $soc = new Societe($db);
856 $soc->fetch($socid);
857 $title = $langs->trans('Proposals').' - '.$soc->name;
858 if (empty($search_societe)) {
859 $search_societe = $soc->name;
860 }
861 } else {
862 $title = $langs->trans('Proposals');
863 }
864
865 $num = $db->num_rows($resql);
866
867 $arrayofselected = is_array($toselect) ? $toselect : array();
868
869 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
870 $obj = $db->fetch_object($resql);
871
872 $id = $obj->rowid;
873
874 header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id);
875 exit;
876 }
877
878 $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
879 llxHeader('', $title, $help_url);
880
881 $param = '&search_status='.urlencode($search_status);
882 if (!empty($mode)) {
883 $param .= '&mode='.urlencode($mode);
884 }
885 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
886 $param .= '&contextpage='.urlencode($contextpage);
887 }
888 if ($limit > 0 && $limit != $conf->liste_limit) {
889 $param .= '&limit='.((int) $limit);
890 }
891 if ($sall) {
892 $param .= '&sall='.urlencode($sall);
893 }
894 if ($search_date_startday) {
895 $param .= '&search_date_startday='.urlencode($search_date_startday);
896 }
897 if ($search_date_startmonth) {
898 $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
899 }
900 if ($search_date_startyear) {
901 $param .= '&search_date_startyear='.urlencode($search_date_startyear);
902 }
903 if ($search_date_endday) {
904 $param .= '&search_date_endday='.urlencode($search_date_endday);
905 }
906 if ($search_date_endmonth) {
907 $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
908 }
909 if ($search_date_endyear) {
910 $param .= '&search_date_endyear='.urlencode($search_date_endyear);
911 }
912 if ($search_date_end_startday) {
913 $param .= '&search_date_end_startday='.urlencode($search_date_end_startday);
914 }
915 if ($search_date_end_startmonth) {
916 $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
917 }
918 if ($search_date_end_startyear) {
919 $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear);
920 }
921 if ($search_date_end_endday) {
922 $param .= '&search_date_end_endday='.urlencode($search_date_end_endday);
923 }
924 if ($search_date_end_endmonth) {
925 $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
926 }
927 if ($search_date_end_endyear) {
928 $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear);
929 }
930 if ($search_date_delivery_startday) {
931 $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
932 }
933 if ($search_date_delivery_startmonth) {
934 $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
935 }
936 if ($search_date_delivery_startyear) {
937 $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
938 }
939 if ($search_date_delivery_endday) {
940 $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
941 }
942 if ($search_date_delivery_endmonth) {
943 $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
944 }
945 if ($search_date_delivery_endyear) {
946 $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
947 }
948 if ($search_ref) {
949 $param .= '&search_ref='.urlencode($search_ref);
950 }
951 if ($search_refcustomer) {
952 $param .= '&search_refcustomer='.urlencode($search_refcustomer);
953 }
954 if ($search_refproject) {
955 $param .= '&search_refproject='.urlencode($search_refproject);
956 }
957 if ($search_societe) {
958 $param .= '&search_societe='.urlencode($search_societe);
959 }
960 if ($search_societe_alias) {
961 $param .= '&search_societe_alias='.urlencode($search_societe_alias);
962 }
963 if ($search_user > 0) {
964 $param .= '&search_user='.urlencode($search_user);
965 }
966 if ($search_sale > 0) {
967 $param .= '&search_sale='.urlencode($search_sale);
968 }
969 if ($search_montant_ht) {
970 $param .= '&search_montant_ht='.urlencode($search_montant_ht);
971 }
972 if ($search_multicurrency_code != '') {
973 $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
974 }
975 if ($search_multicurrency_tx != '') {
976 $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
977 }
978 if ($search_multicurrency_montant_ht != '') {
979 $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
980 }
981 if ($search_multicurrency_montant_vat != '') {
982 $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
983 }
984 if ($search_multicurrency_montant_ttc != '') {
985 $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
986 }
987 if ($search_login) {
988 $param .= '&search_login='.urlencode($search_login);
989 }
990 if ($search_town) {
991 $param .= '&search_town='.urlencode($search_town);
992 }
993 if ($search_zip) {
994 $param .= '&search_zip='.urlencode($search_zip);
995 }
996 if ($socid > 0) {
997 $param .= '&socid='.urlencode($socid);
998 }
999 if ($optioncss != '') {
1000 $param .= '&optioncss='.urlencode($optioncss);
1001 }
1002 if ($search_categ_cus > 0) {
1003 $param .= '&search_categ_cus='.urlencode($search_categ_cus);
1004 }
1005 if ($search_product_category != '') {
1006 $param .= '&search_product_category='.urlencode($search_product_category);
1007 }
1008 if ($search_fk_cond_reglement > 0) {
1009 $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1010 }
1011 if ($search_fk_shipping_method > 0) {
1012 $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1013 }
1014 if ($search_fk_input_reason > 0) {
1015 $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason);
1016 }
1017 if ($search_fk_mode_reglement > 0) {
1018 $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1019 }
1020 if ($search_type_thirdparty > 0) {
1021 $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
1022 }
1023 if ($search_town) {
1024 $param .= '&search_town='.urlencode($search_town);
1025 }
1026 if ($search_zip) {
1027 $param .= '&search_zip='.urlencode($search_zip);
1028 }
1029 if ($search_state) {
1030 $param .= '&search_state='.urlencode($search_state);
1031 }
1032 if ($search_town) {
1033 $param .= '&search_town='.urlencode($search_town);
1034 }
1035 if ($search_country) {
1036 $param .= '&search_country='.urlencode($search_country);
1037 }
1038 if ($search_date_signature_startday) {
1039 $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday);
1040 }
1041 if ($search_date_signature_startmonth) {
1042 $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
1043 }
1044 if ($search_date_signature_startyear) {
1045 $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
1046 }
1047 if ($search_date_signature_endday) {
1048 $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday);
1049 }
1050 if ($search_date_signature_endmonth) {
1051 $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
1052 }
1053 if ($search_date_signature_endyear) {
1054 $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
1055 }
1056 if ($search_option) {
1057 $param .= "&search_option=".urlencode($search_option);
1058 }
1059
1060 // Add $param from extra fields
1061 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1062 // Add $param from hooks
1063 $parameters = array();
1064 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1065 $param .= $hookmanager->resPrint;
1066
1067 // List of mass actions available
1068 $arrayofmassactions = array(
1069 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
1070 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
1071 );
1072 if ($permissiontosendbymail) {
1073 $arrayofmassactions['presend']=img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail");
1074 }
1075 if ($permissiontovalidate) {
1076 $arrayofmassactions['prevalidate']=img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
1077 }
1078 if ($permissiontoclose) {
1079 $arrayofmassactions['presign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("Sign");
1080 $arrayofmassactions['nopresign']=img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans("NoSign");
1081 $arrayofmassactions['setbilled'] =img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled");
1082 }
1083 if ($permissiontodelete) {
1084 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
1085 }
1086
1087 if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
1088 $arrayofmassactions = array();
1089 }
1090 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1091
1092 $url = DOL_URL_ROOT.'/comm/propal/card.php?action=create';
1093 if (!empty($socid)) {
1094 $url .= '&socid='.$socid;
1095 }
1096 $newcardbutton = '';
1097 $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'));
1098 $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'));
1099 $newcardbutton = dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('propal', 'creer'));
1100
1101 // Fields title search
1102 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
1103 if ($optioncss != '') {
1104 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1105 }
1106 print '<input type="hidden" name="token" value="'.newToken().'">';
1107 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1108 print '<input type="hidden" name="action" value="list">';
1109 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1110 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1111 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
1112 print '<input type="hidden" name="mode"value="'.$mode.'">';
1113
1114 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1);
1115
1116 $topicmail = "SendPropalRef";
1117 $modelmail = "propal_send";
1118 $objecttmp = new Propal($db);
1119 $trackid = 'pro'.$object->id;
1120 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1121
1122 if ($massaction == 'prevalidate') {
1123 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1);
1124 }
1125
1126 if ($massaction == 'presign') {
1127 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
1128 }
1129
1130 if ($massaction == 'nopresign') {
1131 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1);
1132 }
1133
1134 if ($sall) {
1135 foreach ($fieldstosearchall as $key => $val) {
1136 $fieldstosearchall[$key] = $langs->trans($val);
1137 }
1138 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
1139 }
1140
1141 $i = 0;
1142
1143 $moreforfilter = '';
1144
1145 // If the user can view prospects other than his'
1146 if ($user->rights->user->user->lire) {
1147 $langs->load("commercial");
1148 $moreforfilter .= '<div class="divsearchfield">';
1149 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
1150 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx', 1);
1151 $moreforfilter .= '</div>';
1152 }
1153 // If the user can view prospects other than his'
1154 if ($user->rights->user->user->lire) {
1155 $moreforfilter .= '<div class="divsearchfield">';
1156 $tmptitle = $langs->trans('LinkedToSpecificUsers');
1157 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
1158 $moreforfilter .= '</div>';
1159 }
1160 // If the user can view products
1161 if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->hasRight('product', 'read') || $user->hasRight('service', 'read'))) {
1162 $searchCategoryProductOperator = -1;
1163 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1164 $tmptitle = $langs->trans('IncludingProductWithTag');
1165 $formcategory = new FormCategory($db);
1166 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category), 'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1167 }
1168 if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
1169 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1170 $moreforfilter .= '<div class="divsearchfield">';
1171 $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
1172 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx'));
1173 $moreforfilter .= '</div>';
1174 }
1175 if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
1176 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
1177 $formproduct = new FormProduct($db);
1178 $moreforfilter .= '<div class="divsearchfield">';
1179 $tmptitle = $langs->trans('Warehouse');
1180 $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle);
1181 $moreforfilter .= '</div>';
1182 }
1183
1184 $parameters = array();
1185 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1186 if (empty($reshook)) {
1187 $moreforfilter .= $hookmanager->resPrint;
1188 } else {
1189 $moreforfilter = $hookmanager->resPrint;
1190 }
1191
1192 if (!empty($moreforfilter)) {
1193 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1194 print $moreforfilter;
1195 print '</div>';
1196 }
1197
1198 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1199 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
1200 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1201
1202 print '<div class="div-table-responsive">';
1203 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1204
1205 print '<tr class="liste_titre_filter">';
1206
1207 // Action column
1208 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1209 print '<td class="liste_titre" align="middle">';
1210 $searchpicto = $form->showFilterButtons('left');
1211 print $searchpicto;
1212 print '</td>';
1213 }
1214
1215 if (!empty($arrayfields['p.ref']['checked'])) {
1216 print '<td class="liste_titre">';
1217 print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
1218 print '</td>';
1219 }
1220 if (!empty($arrayfields['p.ref_client']['checked'])) {
1221 print '<td class="liste_titre">';
1222 print '<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
1223 print '</td>';
1224 }
1225 if (!empty($arrayfields['pr.ref']['checked'])) {
1226 print '<td class="liste_titre">';
1227 print '<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
1228 print '</td>';
1229 }
1230 if (!empty($arrayfields['pr.title']['checked'])) {
1231 print '<td class="liste_titre">';
1232 print '<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">';
1233 print '</td>';
1234 }
1235 if (!empty($arrayfields['s.nom']['checked'])) {
1236 print '<td class="liste_titre" align="left">';
1237 print '<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
1238 print '</td>';
1239 }
1240 if (!empty($arrayfields['s.name_alias']['checked'])) {
1241 print '<td class="liste_titre" align="left">';
1242 print '<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).'">';
1243 print '</td>';
1244 }
1245 if (!empty($arrayfields['s.town']['checked'])) {
1246 print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.'"></td>';
1247 }
1248 if (!empty($arrayfields['s.zip']['checked'])) {
1249 print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.'"></td>';
1250 }
1251 // State
1252 if (!empty($arrayfields['state.nom']['checked'])) {
1253 print '<td class="liste_titre">';
1254 print '<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1255 print '</td>';
1256 }
1257 // Country
1258 if (!empty($arrayfields['country.code_iso']['checked'])) {
1259 print '<td class="liste_titre" align="center">';
1260 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1261 print '</td>';
1262 }
1263 // Company type
1264 if (!empty($arrayfields['typent.code']['checked'])) {
1265 print '<td class="liste_titre maxwidth100onsmartphone" align="center">';
1266 print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
1267 print ajax_combobox('search_type_thirdparty');
1268 print '</td>';
1269 }
1270 // Date
1271 if (!empty($arrayfields['p.date']['checked'])) {
1272 print '<td class="liste_titre center">';
1273 print '<div class="nowrap">';
1274 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1275 print '</div>';
1276 print '<div class="nowrap">';
1277 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1278 print '</div>';
1279 print '</td>';
1280 }
1281 // Date end
1282 if (!empty($arrayfields['p.fin_validite']['checked'])) {
1283 print '<td class="liste_titre center">';
1284 print '<div class="nowrap">';
1285 print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1286 print '</div>';
1287 print '<div class="nowrap">';
1288 print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1289 print '</div>';
1290 print '</td>';
1291 }
1292 // Date delivery
1293 if (!empty($arrayfields['p.date_livraison']['checked'])) {
1294 print '<td class="liste_titre center">';
1295 print '<div class="nowrap">';
1296 print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1297 print '</div>';
1298 print '<div class="nowrap">';
1299 print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1300 print '</div>';
1301 print '</td>';
1302 }
1303 // Date Signature
1304 if (!empty($arrayfields['p.date_signature']['checked'])) {
1305 print '<td class="liste_titre center">';
1306 print '<div class="nowrap">';
1307 print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1308 print '</div>';
1309 print '<div class="nowrap">';
1310 print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1311 print '</div>';
1312 print '</td>';
1313 }
1314 // Availability
1315 if (!empty($arrayfields['ava.rowid']['checked'])) {
1316 print '<td class="liste_titre maxwidth100onsmartphone center">';
1317 $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
1318 print ajax_combobox('search_availability');
1319 print '</td>';
1320 }
1321 // Shipping Method
1322 if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
1323 print '<td class="liste_titre">';
1324 $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1);
1325 print '</td>';
1326 }
1327 // Source - Input reason
1328 if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
1329 print '<td class="liste_titre">';
1330 $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1);
1331 print '</td>';
1332 }
1333 // Payment term
1334 if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
1335 print '<td class="liste_titre">';
1336 print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
1337 print '</td>';
1338 }
1339 // Payment mode
1340 if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) {
1341 print '<td class="liste_titre">';
1342 print $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1, '', 1);
1343 print '</td>';
1344 }
1345 if (!empty($arrayfields['p.total_ht']['checked'])) {
1346 // Amount
1347 print '<td class="liste_titre right">';
1348 print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
1349 print '</td>';
1350 }
1351 if (!empty($arrayfields['p.total_tva']['checked'])) {
1352 // Amount
1353 print '<td class="liste_titre right">';
1354 print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
1355 print '</td>';
1356 }
1357 if (!empty($arrayfields['p.total_ttc']['checked'])) {
1358 // Amount
1359 print '<td class="liste_titre right">';
1360 print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
1361 print '</td>';
1362 }
1363 if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
1364 // Amount invoiced
1365 print '<td class="liste_titre right">';
1366 print '</td>';
1367 }
1368 if (!empty($arrayfields['p.total_invoiced']['checked'])) {
1369 // Amount invoiced
1370 print '<td class="liste_titre right">';
1371 print '</td>';
1372 }
1373 if (!empty($arrayfields['p.multicurrency_code']['checked'])) {
1374 // Currency
1375 print '<td class="liste_titre">';
1376 print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
1377 print '</td>';
1378 }
1379 if (!empty($arrayfields['p.multicurrency_tx']['checked'])) {
1380 // Currency rate
1381 print '<td class="liste_titre">';
1382 print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
1383 print '</td>';
1384 }
1385 if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) {
1386 // Amount
1387 print '<td class="liste_titre right">';
1388 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
1389 print '</td>';
1390 }
1391 if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) {
1392 // Amount
1393 print '<td class="liste_titre right">';
1394 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
1395 print '</td>';
1396 }
1397 if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) {
1398 // Amount
1399 print '<td class="liste_titre right">';
1400 print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
1401 print '</td>';
1402 }
1403 if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) {
1404 // Amount invoiced
1405 print '<td class="liste_titre right">';
1406 print '</td>';
1407 }
1408 if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) {
1409 // Amount invoiced
1410 print '<td class="liste_titre right">';
1411 print '</td>';
1412 }
1413 if (!empty($arrayfields['u.login']['checked'])) {
1414 // Author
1415 print '<td class="liste_titre">';
1416 print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
1417 print '</td>';
1418 }
1419 if (!empty($arrayfields['sale_representative']['checked'])) {
1420 print '<td class="liste_titre"></td>';
1421 }
1422 if (!empty($arrayfields['total_pa']['checked'])) {
1423 print '<td class="liste_titre right">';
1424 print '</td>';
1425 }
1426 if (!empty($arrayfields['total_margin']['checked'])) {
1427 print '<td class="liste_titre right">';
1428 print '</td>';
1429 }
1430 if (!empty($arrayfields['total_margin_rate']['checked'])) {
1431 print '<td class="liste_titre right">';
1432 print '</td>';
1433 }
1434 if (!empty($arrayfields['total_mark_rate']['checked'])) {
1435 print '<td class="liste_titre right">';
1436 print '</td>';
1437 }
1438 // Extra fields
1439 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1440
1441 // Fields from hook
1442 $parameters = array('arrayfields'=>$arrayfields);
1443 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1444 print $hookmanager->resPrint;
1445 // Date creation
1446 if (!empty($arrayfields['p.datec']['checked'])) {
1447 print '<td class="liste_titre">';
1448 print '</td>';
1449 }
1450 // Date modification
1451 if (!empty($arrayfields['p.tms']['checked'])) {
1452 print '<td class="liste_titre">';
1453 print '</td>';
1454 }
1455 // Date cloture
1456 if (!empty($arrayfields['p.date_cloture']['checked'])) {
1457 print '<td class="liste_titre">';
1458 print '</td>';
1459 }
1460 if (!empty($arrayfields['p.note_public']['checked'])) {
1461 // Note public
1462 print '<td class="liste_titre">';
1463 print '</td>';
1464 }
1465 if (!empty($arrayfields['p.note_private']['checked'])) {
1466 // Note private
1467 print '<td class="liste_titre">';
1468 print '</td>';
1469 }
1470 // Status
1471 if (!empty($arrayfields['p.fk_statut']['checked'])) {
1472 print '<td class="liste_titre right parentonrightofpage">';
1473 $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_statut', 'search_status width100 onrightofpage');
1474 print '</td>';
1475 }
1476 // Action column
1477 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1478 print '<td class="liste_titre" align="middle">';
1479 $searchpicto = $form->showFilterButtons();
1480 print $searchpicto;
1481 print '</td>';
1482 }
1483 print "</tr>\n";
1484
1485 $totalarray = array(
1486 'nbfield' => 0,
1487 'val' => array(
1488 'p.total_ht' => 0,
1489 'p.total_tva' => 0,
1490 'p.total_ttc' => 0,
1491 ),
1492 );
1493
1494 // Fields title
1495 print '<tr class="liste_titre">';
1496 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1497 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
1498 }
1499 if (!empty($arrayfields['p.ref']['checked'])) {
1500 print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
1501 }
1502 if (!empty($arrayfields['p.ref_client']['checked'])) {
1503 print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder);
1504 }
1505 if (!empty($arrayfields['pr.ref']['checked'])) {
1506 print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
1507 }
1508 if (!empty($arrayfields['pr.title']['checked'])) {
1509 print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder);
1510 }
1511 if (!empty($arrayfields['s.nom']['checked'])) {
1512 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
1513 }
1514 if (!empty($arrayfields['s.name_alias']['checked'])) {
1515 print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder);
1516 }
1517 if (!empty($arrayfields['s.town']['checked'])) {
1518 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1519 }
1520 if (!empty($arrayfields['s.zip']['checked'])) {
1521 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1522 }
1523 if (!empty($arrayfields['state.nom']['checked'])) {
1524 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1525 }
1526 if (!empty($arrayfields['country.code_iso']['checked'])) {
1527 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder);
1528 }
1529 if (!empty($arrayfields['typent.code']['checked'])) {
1530 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder);
1531 }
1532 if (!empty($arrayfields['p.date']['checked'])) {
1533 print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder);
1534 }
1535 if (!empty($arrayfields['p.fin_validite']['checked'])) {
1536 print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder);
1537 }
1538 if (!empty($arrayfields['p.date_livraison']['checked'])) {
1539 print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder);
1540 }
1541 if (!empty($arrayfields['p.date_signature']['checked'])) {
1542 print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder);
1543 }
1544 if (!empty($arrayfields['ava.rowid']['checked'])) {
1545 print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
1546 }
1547 if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
1548 print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder);
1549 }
1550 if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
1551 print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder);
1552 }
1553 if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
1554 print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
1555 }
1556 if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) {
1557 print_liste_field_titre($arrayfields['p.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
1558 }
1559 if (!empty($arrayfields['p.total_ht']['checked'])) {
1560 print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
1561 }
1562 if (!empty($arrayfields['p.total_tva']['checked'])) {
1563 print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
1564 }
1565 if (!empty($arrayfields['p.total_ttc']['checked'])) {
1566 print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
1567 }
1568 if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
1569 print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
1570 }
1571 if (!empty($arrayfields['p.total_invoiced']['checked'])) {
1572 print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
1573 }
1574 if (!empty($arrayfields['p.multicurrency_code']['checked'])) {
1575 print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder);
1576 }
1577 if (!empty($arrayfields['p.multicurrency_tx']['checked'])) {
1578 print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
1579 }
1580 if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) {
1581 print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
1582 }
1583 if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) {
1584 print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
1585 }
1586 if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) {
1587 print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
1588 }
1589 if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) {
1590 print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
1591 }
1592 if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) {
1593 print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
1594 }
1595 if (!empty($arrayfields['u.login']['checked'])) {
1596 print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'class="center"', $sortfield, $sortorder);
1597 }
1598 if (!empty($arrayfields['sale_representative']['checked'])) {
1599 print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
1600 }
1601 if (!empty($arrayfields['total_pa']['checked'])) {
1602 print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
1603 }
1604 if (!empty($arrayfields['total_margin']['checked'])) {
1605 print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
1606 }
1607 if (!empty($arrayfields['total_margin_rate']['checked'])) {
1608 print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
1609 }
1610 if (!empty($arrayfields['total_mark_rate']['checked'])) {
1611 print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
1612 }
1613 // Extra fields
1614 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1615 // Hook fields
1616 $parameters = array(
1617 'arrayfields' => $arrayfields,
1618 'param' => $param,
1619 'sortfield' => $sortfield,
1620 'sortorder' => $sortorder,
1621 'totalarray' => &$totalarray,
1622 );
1623
1624 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1625
1626 print $hookmanager->resPrint;
1627 if (!empty($arrayfields['p.datec']['checked'])) {
1628 print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
1629 }
1630 if (!empty($arrayfields['p.tms']['checked'])) {
1631 print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
1632 }
1633 if (!empty($arrayfields['p.date_cloture']['checked'])) {
1634 print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
1635 }
1636 if (!empty($arrayfields['p.note_public']['checked'])) {
1637 print_liste_field_titre($arrayfields['p.note_public']['label'], $_SERVER["PHP_SELF"], "p.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1638 }
1639 if (!empty($arrayfields['p.note_private']['checked'])) {
1640 print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1641 }
1642 if (!empty($arrayfields['p.fk_statut']['checked'])) {
1643 print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
1644 }
1645 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1646 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
1647 }
1648 print '</tr>'."\n";
1649
1650 $now = dol_now();
1651 $i = 0;
1652 $typenArray = null;
1653
1654 $with_margin_info = false;
1655 if (isModEnabled('margin') && (
1656 !empty($arrayfields['total_pa']['checked'])
1657 || !empty($arrayfields['total_margin']['checked'])
1658 || !empty($arrayfields['total_margin_rate']['checked'])
1659 || !empty($arrayfields['total_mark_rate']['checked'])
1660 )
1661 ) {
1662 $with_margin_info = true;
1663 }
1664 $total_ht = 0;
1665 $total_margin = 0;
1666
1667 $savnbfield = $totalarray['nbfield'];
1668 $totalarray = array();
1669 $totalarray['nbfield'] = 0;
1670
1671 $imaxinloop = ($limit ? min($num, $limit) : $num);
1672 while ($i < $imaxinloop) {
1673 $obj = $db->fetch_object($resql);
1674
1675 $objectstatic->id = $obj->rowid;
1676 $objectstatic->ref = $obj->ref;
1677 $objectstatic->ref_client = $obj->ref_client;
1678 $objectstatic->note_public = $obj->note_public;
1679 $objectstatic->note_private = $obj->note_private;
1680 $objectstatic->statut = $obj->status;
1681 $objectstatic->status = $obj->status;
1682
1683 $companystatic->id = $obj->socid;
1684 $companystatic->name = $obj->name;
1685 $companystatic->name_alias = $obj->alias;
1686 $companystatic->client = $obj->client;
1687 $companystatic->fournisseur = $obj->fournisseur;
1688 $companystatic->code_client = $obj->code_client;
1689 $companystatic->email = $obj->email;
1690 $companystatic->phone = $obj->phone;
1691 $companystatic->address = $obj->address;
1692 $companystatic->zip = $obj->zip;
1693 $companystatic->town = $obj->town;
1694 $companystatic->country_code = $obj->country_code;
1695
1696 $projectstatic->id = $obj->project_id;
1697 $projectstatic->ref = $obj->project_ref;
1698 $projectstatic->title = $obj->project_label;
1699
1700 $totalInvoicedHT = 0;
1701 $totalInvoicedTTC = 0;
1702 $multicurrency_totalInvoicedHT = 0;
1703 $multicurrency_totalInvoicedTTC = 0;
1704
1705 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1706
1707 if (!empty($TInvoiceData)) {
1708 foreach ($TInvoiceData as $invoiceData) {
1709 $invoice = new Facture($db);
1710 $invoice->fetch($invoiceData->facid);
1711
1712 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) {
1713 continue;
1714 }
1715
1716 $totalInvoicedHT += $invoice->total_ht;
1717 $totalInvoicedTTC += $invoice->total_ttc;
1718 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1719 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1720 }
1721 }
1722
1723 $marginInfo = array();
1724 if ($with_margin_info === true) {
1725 $objectstatic->fetch_lines();
1726 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1727 $total_ht += $obj->total_ht;
1728 $total_margin += $marginInfo['total_margin'];
1729 }
1730
1731 if ($mode == 'kanban') {
1732 if ($i == 0) {
1733 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1734 print '<div class="box-flex-container kanban">';
1735 }
1736 // Output Kanban
1737 $userstatic->fetch($obj->fk_user_author);
1738 $objectstatic->author = $userstatic->getNomUrl(1);
1739 $objectstatic->fk_project = $projectstatic->getNomUrl(1);
1740 print $objectstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
1741 if ($i == ($imaxinloop - 1)) {
1742 print '</div>';
1743 print '</td></tr>';
1744 }
1745 } else {
1746 print '<tr class="oddeven">';
1747
1748 // Action column
1749 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1750 print '<td class="nowrap" align="center">';
1751 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1752 $selected = 0;
1753 if (in_array($obj->rowid, $arrayofselected)) {
1754 $selected = 1;
1755 }
1756 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1757 }
1758 print '</td>';
1759 if (!$i) {
1760 $totalarray['nbfield']++;
1761 }
1762 }
1763
1764 if (!empty($arrayfields['p.ref']['checked'])) {
1765 print '<td class="nowraponall">';
1766
1767 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
1768 // Picto + Ref
1769 print '<td class="nobordernopadding nowraponall">';
1770 print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1771 print '</td>';
1772 // Warning
1773 $warnornote = '';
1774 if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1775 $warnornote .= img_warning($langs->trans("Late"));
1776 }
1777 if ($warnornote) {
1778 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
1779 print $warnornote;
1780 print '</td>';
1781 }
1782 // Other picto tool
1783 print '<td width="16" class="nobordernopadding right">';
1784 $filename = dol_sanitizeFileName($obj->ref);
1785 $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref);
1786 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
1787 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1788 print '</td></tr></table>';
1789
1790 print "</td>\n";
1791 if (!$i) {
1792 $totalarray['nbfield']++;
1793 }
1794 }
1795
1796 if (!empty($arrayfields['p.ref_client']['checked'])) {
1797 // Customer ref
1798 print '<td class="nowrap tdoverflowmax200">';
1799 print dol_escape_htmltag($obj->ref_client);
1800 print '</td>';
1801 if (!$i) {
1802 $totalarray['nbfield']++;
1803 }
1804 }
1805
1806 if (!empty($arrayfields['pr.ref']['checked'])) {
1807 // Project ref
1808 print '<td class="nowraponall">';
1809 if ($obj->project_id > 0) {
1810 print $projectstatic->getNomUrl(1);
1811 }
1812 print '</td>';
1813 if (!$i) {
1814 $totalarray['nbfield']++;
1815 }
1816 }
1817
1818 if (!empty($arrayfields['pr.title']['checked'])) {
1819 // Project label
1820 print '<td class="nowrap">';
1821 if ($obj->project_id > 0) {
1822 print dol_escape_htmltag($projectstatic->title);
1823 }
1824 print '</td>';
1825 if (!$i) {
1826 $totalarray['nbfield']++;
1827 }
1828 }
1829
1830 // Thirdparty
1831 if (!empty($arrayfields['s.nom']['checked'])) {
1832 print '<td class="tdoverflowmax150">';
1833 print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
1834 print '</td>';
1835 if (!$i) {
1836 $totalarray['nbfield']++;
1837 }
1838 }
1839
1840 // Alias
1841 if (!empty($arrayfields['s.name_alias']['checked'])) {
1842 print '<td class="tdoverflowmax200">';
1843 print $obj->alias;
1844 print '</td>';
1845 if (!$i) {
1846 $totalarray['nbfield']++;
1847 }
1848 }
1849
1850 // Town
1851 if (!empty($arrayfields['s.town']['checked'])) {
1852 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).'">';
1853 print dol_escape_htmltag($obj->town);
1854 print '</td>';
1855 if (!$i) {
1856 $totalarray['nbfield']++;
1857 }
1858 }
1859 // Zip
1860 if (!empty($arrayfields['s.zip']['checked'])) {
1861 print '<td class="nocellnopadd">';
1862 print $obj->zip;
1863 print '</td>';
1864 if (!$i) {
1865 $totalarray['nbfield']++;
1866 }
1867 }
1868 // State
1869 if (!empty($arrayfields['state.nom']['checked'])) {
1870 print "<td>".$obj->state_name."</td>\n";
1871 if (!$i) {
1872 $totalarray['nbfield']++;
1873 }
1874 }
1875 // Country
1876 if (!empty($arrayfields['country.code_iso']['checked'])) {
1877 print '<td class="center">';
1878 $tmparray = getCountry($obj->fk_pays, 'all');
1879 print $tmparray['label'];
1880 print '</td>';
1881 if (!$i) {
1882 $totalarray['nbfield']++;
1883 }
1884 }
1885 // Type ent
1886 if (!empty($arrayfields['typent.code']['checked'])) {
1887 if (!is_array($typenArray) || empty($typenArray)) {
1888 $typenArray = $formcompany->typent_array(1);
1889 }
1890
1891 print '<td class="center">';
1892 print $typenArray[$obj->typent_code];
1893 print '</td>';
1894 if (!$i) {
1895 $totalarray['nbfield']++;
1896 }
1897 }
1898
1899 // Date proposal
1900 if (!empty($arrayfields['p.date']['checked'])) {
1901 print '<td class="center">';
1902 print dol_print_date($db->jdate($obj->dp), 'day');
1903 print "</td>\n";
1904 if (!$i) {
1905 $totalarray['nbfield']++;
1906 }
1907 }
1908
1909 // Date end validity
1910 if (!empty($arrayfields['p.fin_validite']['checked'])) {
1911 if ($obj->dfv) {
1912 print '<td class="center">'.dol_print_date($db->jdate($obj->dfv), 'day');
1913 print '</td>';
1914 } else {
1915 print '<td>&nbsp;</td>';
1916 }
1917 if (!$i) {
1918 $totalarray['nbfield']++;
1919 }
1920 }
1921 // Date delivery
1922 if (!empty($arrayfields['p.date_livraison']['checked'])) {
1923 if ($obj->ddelivery) {
1924 print '<td class="center">'.dol_print_date($db->jdate($obj->ddelivery), 'day');
1925 print '</td>';
1926 } else {
1927 print '<td>&nbsp;</td>';
1928 }
1929 if (!$i) {
1930 $totalarray['nbfield']++;
1931 }
1932 }
1933 // Date Signature
1934 if (!empty($arrayfields['p.date_signature']['checked'])) {
1935 if ($obj->dsignature) {
1936 print '<td class="center">'.dol_print_date($db->jdate($obj->dsignature), 'day');
1937 print '</td>';
1938 } else {
1939 print '<td>&nbsp;</td>';
1940 }
1941 if (!$i) {
1942 $totalarray['nbfield']++;
1943 }
1944 }
1945 // Availability
1946 if (!empty($arrayfields['ava.rowid']['checked'])) {
1947 print '<td class="center">';
1948 $form->form_availability('', $obj->availability, 'none', 1);
1949 print '</td>';
1950 if (!$i) {
1951 $totalarray['nbfield']++;
1952 }
1953 }
1954 // Shipping Method
1955 if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
1956 print '<td>';
1957 $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
1958 print '</td>';
1959 if (!$i) {
1960 $totalarray['nbfield']++;
1961 }
1962 }
1963 // Source - input reason
1964 if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
1965 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($form->cache_demand_reason[$obj->fk_input_reason]['label']).'">';
1966 if ($obj->fk_input_reason > 0) {
1967 print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
1968 }
1969 print '</td>';
1970 if (!$i) {
1971 $totalarray['nbfield']++;
1972 }
1973 }
1974 // Payment terms
1975 if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
1976 print '<td>';
1977 $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
1978 print '</td>';
1979 if (!$i) {
1980 $totalarray['nbfield']++;
1981 }
1982 }
1983 // Payment mode
1984 if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) {
1985 print '<td>';
1986 $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
1987 print '</td>';
1988 if (!$i) {
1989 $totalarray['nbfield']++;
1990 }
1991 }
1992 // Amount HT
1993 if (!empty($arrayfields['p.total_ht']['checked'])) {
1994 print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
1995 if (!$i) {
1996 $totalarray['nbfield']++;
1997 }
1998 if (!$i) {
1999 $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
2000 }
2001 if (empty($totalarray['val']['p.total_ht'])) {
2002 $totalarray['val']['p.total_ht'] = $obj->total_ht;
2003 } else {
2004 $totalarray['val']['p.total_ht'] += $obj->total_ht;
2005 }
2006 }
2007 // Amount VAT
2008 if (!empty($arrayfields['p.total_tva']['checked'])) {
2009 print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
2010 if (!$i) {
2011 $totalarray['nbfield']++;
2012 }
2013 if (!$i) {
2014 $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva';
2015 }
2016 if (empty($totalarray['val']['p.total_tva'])) {
2017 $totalarray['val']['p.total_tva'] = $obj->total_tva;
2018 } else {
2019 $totalarray['val']['p.total_tva'] += $obj->total_tva;
2020 }
2021 }
2022 // Amount TTC
2023 if (!empty($arrayfields['p.total_ttc']['checked'])) {
2024 print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
2025 if (!$i) {
2026 $totalarray['nbfield']++;
2027 }
2028 if (!$i) {
2029 $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
2030 }
2031 if (empty($totalarray['val']['p.total_ttc'])) {
2032 $totalarray['val']['p.total_ttc'] = $obj->total_ttc;
2033 } else {
2034 $totalarray['val']['p.total_ttc'] += $obj->total_ttc;
2035 }
2036 }
2037 // Amount invoiced HT
2038 if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
2039 print '<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT)."</span></td>\n";
2040 if (!$i) {
2041 $totalarray['nbfield']++;
2042 }
2043 if (!$i) {
2044 $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
2045 }
2046 if (empty($totalarray['val']['p.total_ht_invoiced'])) {
2047 $totalarray['val']['p.total_ht_invoiced'] = $totalInvoicedHT;
2048 } else {
2049 $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
2050 }
2051 }
2052 // Amount invoiced TTC
2053 if (!empty($arrayfields['p.total_invoiced']['checked'])) {
2054 print '<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC)."</span></td>\n";
2055 if (!$i) {
2056 $totalarray['nbfield']++;
2057 }
2058 if (!$i) {
2059 $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
2060 }
2061 if (empty($totalarray['val']['p.total_invoiced'])) {
2062 $totalarray['val']['p.total_invoiced'] = $totalInvoicedTTC;
2063 } else {
2064 $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC;
2065 }
2066 }
2067 // Currency
2068 if (!empty($arrayfields['p.multicurrency_code']['checked'])) {
2069 print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
2070 if (!$i) {
2071 $totalarray['nbfield']++;
2072 }
2073 }
2074
2075 // Currency rate
2076 if (!empty($arrayfields['p.multicurrency_tx']['checked'])) {
2077 print '<td class="nowrap">';
2078 $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
2079 print "</td>\n";
2080 if (!$i) {
2081 $totalarray['nbfield']++;
2082 }
2083 }
2084 // Amount HT
2085 if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) {
2086 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
2087 if (!$i) {
2088 $totalarray['nbfield']++;
2089 }
2090 }
2091 // Amount VAT
2092 if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) {
2093 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva)."</span></td>\n";
2094 if (!$i) {
2095 $totalarray['nbfield']++;
2096 }
2097 }
2098 // Amount TTC
2099 if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) {
2100 print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
2101 if (!$i) {
2102 $totalarray['nbfield']++;
2103 }
2104 }
2105 // Amount invoiced
2106 if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) {
2107 print '<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT)."</span></td>\n";
2108 if (!$i) {
2109 $totalarray['nbfield']++;
2110 }
2111 }
2112 // Amount invoiced
2113 if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) {
2114 print '<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC)."</span></td>\n";
2115 if (!$i) {
2116 $totalarray['nbfield']++;
2117 }
2118 }
2119
2120 $userstatic->id = $obj->fk_user_author;
2121 $userstatic->login = $obj->login;
2122 $userstatic->lastname = $obj->lastname;
2123 $userstatic->firstname = $obj->firstname;
2124 $userstatic->email = $obj->user_email;
2125 $userstatic->statut = $obj->user_statut;
2126 $userstatic->entity = $obj->user_entity;
2127 $userstatic->photo = $obj->photo;
2128 $userstatic->office_phone = $obj->office_phone;
2129 $userstatic->office_fax = $obj->office_fax;
2130 $userstatic->user_mobile = $obj->user_mobile;
2131 $userstatic->job = $obj->job;
2132 $userstatic->gender = $obj->gender;
2133
2134 // Author
2135 if (!empty($arrayfields['u.login']['checked'])) {
2136 print '<td class="tdoverflowmax150">';
2137 if ($userstatic->id) {
2138 print $userstatic->getNomUrl(-1);
2139 }
2140 print "</td>\n";
2141 if (!$i) {
2142 $totalarray['nbfield']++;
2143 }
2144 }
2145
2146 if (!empty($arrayfields['sale_representative']['checked'])) {
2147 // Sales representatives
2148 print '<td class="tdoverflowmax125">';
2149 if ($obj->socid > 0) {
2150 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2151 if ($listsalesrepresentatives < 0) {
2152 dol_print_error($db);
2153 }
2154 $nbofsalesrepresentative = count($listsalesrepresentatives);
2155 if ($nbofsalesrepresentative > 6) {
2156 // We print only number
2157 print $nbofsalesrepresentative;
2158 } elseif ($nbofsalesrepresentative > 0) {
2159 $userstatic = new User($db);
2160 $j = 0;
2161 foreach ($listsalesrepresentatives as $val) {
2162 $userstatic->id = $val['id'];
2163 $userstatic->lastname = $val['lastname'];
2164 $userstatic->firstname = $val['firstname'];
2165 $userstatic->email = $val['email'];
2166 $userstatic->statut = $val['statut'];
2167 $userstatic->entity = $val['entity'];
2168 $userstatic->photo = $val['photo'];
2169 $userstatic->login = $val['login'];
2170 $userstatic->office_phone = $val['office_phone'];
2171 $userstatic->office_fax = $val['office_fax'];
2172 $userstatic->user_mobile = $val['user_mobile'];
2173 $userstatic->job = $val['job'];
2174 $userstatic->gender = $val['gender'];
2175 //print '<div class="float">':
2176 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
2177 $j++;
2178 if ($j < $nbofsalesrepresentative) {
2179 print ' ';
2180 }
2181 //print '</div>';
2182 }
2183 }
2184 //else print $langs->trans("NoSalesRepresentativeAffected");
2185 } else {
2186 print '&nbsp;';
2187 }
2188 print '</td>';
2189 if (!$i) {
2190 $totalarray['nbfield']++;
2191 }
2192 }
2193
2194 // Total buying or cost price
2195 if (!empty($arrayfields['total_pa']['checked'])) {
2196 print '<td class="right nowrap">'.price($marginInfo['pa_total']).'</td>';
2197 if (!$i) {
2198 $totalarray['nbfield']++;
2199 }
2200 }
2201 // Total margin
2202 if (!empty($arrayfields['total_margin']['checked'])) {
2203 print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>';
2204 if (!$i) {
2205 $totalarray['nbfield']++;
2206 }
2207 if (!$i) {
2208 $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
2209 }
2210 $totalarray['val']['total_margin'] = $total_margin;
2211 }
2212 // Total margin rate
2213 if (!empty($arrayfields['total_margin_rate']['checked'])) {
2214 print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
2215 if (!$i) {
2216 $totalarray['nbfield']++;
2217 }
2218 }
2219 // Total mark rate
2220 if (!empty($arrayfields['total_mark_rate']['checked'])) {
2221 print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
2222 if (!$i) {
2223 $totalarray['nbfield']++;
2224 }
2225 if (!$i) {
2226 $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
2227 }
2228 if ($i >= $imaxinloop - 1) {
2229 if (!empty($total_ht)) {
2230 $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
2231 } else {
2232 $totalarray['val']['total_mark_rate'] = '';
2233 }
2234 }
2235 }
2236
2237 // Extra fields
2238 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
2239 // Fields from hook
2240 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
2241 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2242 print $hookmanager->resPrint;
2243 // Date creation
2244 if (!empty($arrayfields['p.datec']['checked'])) {
2245 print '<td align="center" class="nowrap">';
2246 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
2247 print '</td>';
2248 if (!$i) {
2249 $totalarray['nbfield']++;
2250 }
2251 }
2252 // Date modification
2253 if (!empty($arrayfields['p.tms']['checked'])) {
2254 print '<td align="center" class="nowrap">';
2255 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
2256 print '</td>';
2257 if (!$i) {
2258 $totalarray['nbfield']++;
2259 }
2260 }
2261 // Date cloture
2262 if (!empty($arrayfields['p.date_cloture']['checked'])) {
2263 print '<td align="center" class="nowrap">';
2264 print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
2265 print '</td>';
2266 if (!$i) {
2267 $totalarray['nbfield']++;
2268 }
2269 }
2270 // Note public
2271 if (!empty($arrayfields['p.note_public']['checked'])) {
2272 print '<td class="center">';
2273 print dol_string_nohtmltag($obj->note_public);
2274 print '</td>';
2275 if (!$i) {
2276 $totalarray['nbfield']++;
2277 }
2278 }
2279 // Note private
2280 if (!empty($arrayfields['p.note_private']['checked'])) {
2281 print '<td class="center">';
2282 print dol_string_nohtmltag($obj->note_private);
2283 print '</td>';
2284 if (!$i) {
2285 $totalarray['nbfield']++;
2286 }
2287 }
2288 // Status
2289 if (!empty($arrayfields['p.fk_statut']['checked'])) {
2290 print '<td class="nowrap right">'.$objectstatic->getLibStatut(5).'</td>';
2291 if (!$i) {
2292 $totalarray['nbfield']++;
2293 }
2294 }
2295 // Action column
2296 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2297 print '<td class="nowrap" align="center">';
2298 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
2299 $selected = 0;
2300 if (in_array($obj->rowid, $arrayofselected)) {
2301 $selected = 1;
2302 }
2303 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2304 }
2305 print '</td>';
2306 if (!$i) {
2307 $totalarray['nbfield']++;
2308 }
2309 }
2310
2311
2312 print '</tr>'."\n";
2313 }
2314
2315 $i++;
2316 }
2317
2318 // Show total line
2319 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
2320
2321 // If no record found
2322 if ($num == 0) {
2323 $colspan = 1;
2324 foreach ($arrayfields as $key => $val) {
2325 if (!empty($val['checked'])) {
2326 $colspan++;
2327 }
2328 }
2329 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
2330 }
2331
2332 $db->free($resql);
2333
2334 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
2335 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2336 print $hookmanager->resPrint;
2337
2338 print '</table>'."\n";
2339 print '</div>'."\n";
2340
2341 print '</form>'."\n";
2342
2343 $hidegeneratedfilelistifempty = 1;
2344 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
2345 $hidegeneratedfilelistifempty = 0;
2346 }
2347
2348 // Show list of available documents
2349 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
2350 $urlsource .= str_replace('&amp;', '&', $param);
2351
2352 $filedir = $diroutputmassaction;
2353 $genallowed = $user->hasRight('propal', 'lire');
2354 $delallowed = $user->hasRight('propal', 'creer');
2355
2356 print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
2357} else {
2358 dol_print_error($db);
2359}
2360
2361// End of page
2362llxFooter();
2363$db->close();
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:464
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage standard extra fields.
Class to manage invoices.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage forms for categories.
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.
Classe permettant la generation de composants html autre Only common components are here.
Classe permettant la generation de composants html autre Only common components are here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage generation of HTML components for proposal management.
Class to manage projects.
Class to manage proposals.
const STATUS_VALIDATED
Validated status.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $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 informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($titre, $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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.