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