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