42 require
'../../main.inc.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
60 $langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
62 $langs->loadLangs(array(
'sendings'));
66 $socid =
GETPOST(
'socid',
'int');
68 $action =
GETPOST(
'action',
'aZ09');
69 $massaction =
GETPOST(
'massaction',
'alpha');
70 $show_files =
GETPOST(
'show_files',
'int');
71 $confirm =
GETPOST(
'confirm',
'alpha');
72 $cancel =
GETPOST(
'cancel',
'alpha');
73 $toselect =
GETPOST(
'toselect',
'array');
74 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
75 $mode =
GETPOST(
'mode',
'alpha');
78 $search_user =
GETPOST(
'search_user',
'int');
79 $search_sale =
GETPOST(
'search_sale',
'int');
81 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
82 $search_refproject =
GETPOST(
'search_refproject',
'alpha');
83 $search_project =
GETPOST(
'search_project',
'alpha');
85 $search_societe =
GETPOST(
'search_societe',
'alpha');
86 $search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
87 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
88 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
89 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
90 $search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
91 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
92 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
93 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
94 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
95 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
96 $search_login =
GETPOST(
'search_login',
'alpha');
97 $search_product_category =
GETPOST(
'search_product_category',
'int');
98 $search_town =
GETPOST(
'search_town',
'alpha');
99 $search_zip =
GETPOST(
'search_zip',
'alpha');
100 $search_state =
GETPOST(
"search_state");
101 $search_country =
GETPOST(
"search_country",
'int');
102 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
103 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
104 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
105 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
106 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
107 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
108 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
109 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
110 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
111 $search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
112 $search_date_end_startmonth =
GETPOST(
'search_date_end_startmonth',
'int');
113 $search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
114 $search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
115 $search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
116 $search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
117 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
118 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
119 $search_date_delivery_startday =
GETPOST(
'search_date_delivery_startday',
'int');
120 $search_date_delivery_startmonth =
GETPOST(
'search_date_delivery_startmonth',
'int');
121 $search_date_delivery_startyear =
GETPOST(
'search_date_delivery_startyear',
'int');
122 $search_date_delivery_endday =
GETPOST(
'search_date_delivery_endday',
'int');
123 $search_date_delivery_endmonth =
GETPOST(
'search_date_delivery_endmonth',
'int');
124 $search_date_delivery_endyear =
GETPOST(
'search_date_delivery_endyear',
'int');
125 $search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
126 $search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
127 $search_availability =
GETPOST(
'search_availability',
'int');
128 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
129 $search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'int');
130 $search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'int');
131 $search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'int');
132 $search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'int');
133 $search_btn =
GETPOST(
'button_search',
'alpha');
134 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
135 $search_date_signature_startday =
GETPOST(
'search_date_signature_startday',
'int');
136 $search_date_signature_startmonth =
GETPOST(
'search_date_signature_startmonth',
'int');
137 $search_date_signature_startyear =
GETPOST(
'search_date_signature_startyear',
'int');
138 $search_date_signature_endday =
GETPOST(
'search_date_signature_endday',
'int');
139 $search_date_signature_endmonth =
GETPOST(
'search_date_signature_endmonth',
'int');
140 $search_date_signature_endyear =
GETPOST(
'search_date_signature_endyear',
'int');
141 $search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
142 $search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
144 $search_status =
GETPOST(
'search_status',
'alpha');
146 $optioncss =
GETPOST(
'optioncss',
'alpha');
147 $object_statut =
GETPOST(
'search_statut',
'alpha');
149 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
153 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
154 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
155 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
157 if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
160 $offset = $limit * $page;
161 $pageprev = $page - 1;
162 $pagenext = $page + 1;
164 $sortfield =
'p.ref';
174 if (!empty($user->socid)) {
175 $socid = $user->socid;
177 if (!empty($socid)) {
180 $dbtable =
'&societe';
184 $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
187 $object =
new Propal($db);
188 $hookmanager->initHooks(array(
'propallist'));
192 $extrafields->fetch_name_optionals_label($object->table_element);
194 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
197 $fieldstosearchall = array(
199 'p.ref_client'=>
'RefCustomer',
200 'pd.description'=>
'Description',
201 's.nom'=>
"ThirdParty",
202 's.name_alias'=>
"AliasNameShort",
205 'p.note_public'=>
'NotePublic',
207 if (empty($user->socid)) {
208 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
212 $checkedtypetiers = 0;
213 $arrayfields = array(
214 'p.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
215 'p.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1),
216 'pr.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(
isModEnabled(
'project') ? 1 : 0)),
217 'pr.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(
isModEnabled(
'project') ? 1 : 0)),
218 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
219 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1),
220 's.town'=>array(
'label'=>
"Town",
'checked'=>-1),
221 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1),
222 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0),
223 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0),
224 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers),
225 'p.date'=>array(
'label'=>
"DatePropal",
'checked'=>1),
226 'p.fin_validite'=>array(
'label'=>
"DateEnd",
'checked'=>1),
227 'p.date_livraison'=>array(
'label'=>
"DeliveryDate",
'checked'=>0),
228 'p.date_signature'=>array(
'label'=>
"DateSigning",
'checked'=>0),
229 'ava.rowid'=>array(
'label'=>
"AvailabilityPeriod",
'checked'=>0),
230 'p.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>0,
'enabled'=>
isModEnabled(
"expedition")),
231 'p.fk_input_reason'=>array(
'label'=>
"Origin",
'checked'=>0,
'enabled'=>1),
232 'p.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>0),
233 'p.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>0),
234 'p.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1),
235 'p.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0),
236 'p.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0),
237 'p.total_ht_invoiced'=>array(
'label'=>
"AmountInvoicedHT",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
238 'p.total_invoiced'=>array(
'label'=>
"AmountInvoicedTTC",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
239 'p.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
240 'p.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
241 'p.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
242 'p.multicurrency_total_tva'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
243 'p.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
244 'p.multicurrency_total_ht_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedHT',
'checked'=>0,
'enabled'=>
isModEnabled(
"multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
245 'p.multicurrency_total_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedTTC',
'checked'=>0,
'enabled'=>
isModEnabled(
"multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
246 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>10),
247 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>-1),
248 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
249 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
250 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
251 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
252 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
253 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
254 'p.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>500),
255 'p.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
256 'p.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
257 'p.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
285 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
288 $permissiontoread = $user->hasRight(
'propal',
'lire');
289 $permissiontoadd = $user->hasRight(
'propal',
'creer');
290 $permissiontodelete = $user->hasRight(
'propal',
'supprimer');
291 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
292 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
293 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
294 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
296 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
297 $permissiontoclose = $user->hasRight(
'propal',
'creer');
298 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
306 if (
GETPOST(
'cancel',
'alpha')) {
310 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
314 $parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
315 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
320 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
323 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
328 $search_refcustomer =
'';
329 $search_refproject =
'';
330 $search_project =
'';
331 $search_societe =
'';
332 $search_societe_alias =
'';
333 $search_montant_ht =
'';
334 $search_montant_vat =
'';
335 $search_montant_ttc =
'';
336 $search_warehouse =
'';
337 $search_multicurrency_code =
'';
338 $search_multicurrency_tx =
'';
339 $search_multicurrency_montant_ht =
'';
340 $search_multicurrency_montant_vat =
'';
341 $search_multicurrency_montant_ttc =
'';
343 $search_product_category =
'';
348 $search_country =
'';
349 $search_type_thirdparty =
'';
350 $search_date_startday =
'';
351 $search_date_startmonth =
'';
352 $search_date_startyear =
'';
353 $search_date_endday =
'';
354 $search_date_endmonth =
'';
355 $search_date_endyear =
'';
356 $search_date_start =
'';
357 $search_date_end =
'';
358 $search_date_end_startday =
'';
359 $search_date_end_startmonth =
'';
360 $search_date_end_startyear =
'';
361 $search_date_end_endday =
'';
362 $search_date_end_endmonth =
'';
363 $search_date_end_endyear =
'';
364 $search_date_end_start =
'';
365 $search_date_end_end =
'';
366 $search_date_delivery_startday =
'';
367 $search_date_delivery_startmonth =
'';
368 $search_date_delivery_startyear =
'';
369 $search_date_delivery_endday =
'';
370 $search_date_delivery_endmonth =
'';
371 $search_date_delivery_endyear =
'';
372 $search_date_delivery_start =
'';
373 $search_date_delivery_end =
'';
374 $search_availability =
'';
378 $search_array_options = array();
379 $search_categ_cus = 0;
380 $search_fk_cond_reglement =
'';
381 $search_fk_shipping_method =
'';
382 $search_fk_input_reason =
'';
383 $search_fk_mode_reglement =
'';
384 $search_date_signature_startday =
'';
385 $search_date_signature_startmonth =
'';
386 $search_date_signature_startyear =
'';
387 $search_date_signature_endday =
'';
388 $search_date_signature_endmonth =
'';
389 $search_date_signature_endyear =
'';
390 $search_date_signature_start =
'';
391 $search_date_signature_end =
'';
393 if ($object_statut !=
'') {
394 $search_status = $object_statut;
398 if (empty($reshook)) {
399 $objectclass =
'Propal';
400 $objectlabel =
'Proposals';
401 $uploaddir = $conf->propal->multidir_output[$conf->entity];
402 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
405 if ($action ==
'validate' && $permissiontovalidate) {
406 if (
GETPOST(
'confirm') ==
'yes') {
407 $tmpproposal =
new Propal($db);
410 foreach ($toselect as $checked) {
411 if ($tmpproposal->fetch($checked) > 0) {
412 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
413 if ($tmpproposal->valid($user) > 0) {
414 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
420 $langs->load(
"errors");
421 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
437 if ($action ==
"sign" && $permissiontoclose) {
438 if (
GETPOST(
'confirm') ==
'yes') {
439 $tmpproposal =
new Propal($db);
442 foreach ($toselect as $checked) {
443 if ($tmpproposal->fetch($checked) > 0) {
444 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
445 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
446 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
447 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
453 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
469 if ($action ==
"nosign" && $permissiontoclose) {
470 if (
GETPOST(
'confirm') ==
'yes') {
471 $tmpproposal =
new Propal($db);
474 foreach ($toselect as $checked) {
475 if ($tmpproposal->fetch($checked) > 0) {
476 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (!empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
477 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
478 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
479 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
485 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
502 if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
505 $objecttmp =
new $objectclass($db);
507 foreach ($toselect as $toselectid) {
508 $result = $objecttmp->fetch($toselectid);
510 $result = $objecttmp->classifyBilled($user, 0);
553 $companystatic =
new Societe($db);
554 $projectstatic =
new Project($db);
557 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
558 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
561 if ($sall || $search_user > 0) {
562 $sql =
'SELECT DISTINCT';
564 $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, ';
565 $sql .=
" typent.code as typent_code,";
566 $sql .=
" ava.rowid as availability,";
567 $sql .=
" country.code as country_code,";
568 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
569 $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,';
570 $sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
571 $sql .=
' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
572 $sql .=
' p.date_signature as dsignature,';
573 $sql .=
' p.note_public, p.note_private,';
574 $sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
575 $sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
576 $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';
577 if (empty($user->rights->societe->client->voir) && !$socid) {
578 $sql .=
", sc.fk_soc, sc.fk_user";
580 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
581 $sql .=
", cc.fk_categorie, cc.fk_soc";
584 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
585 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
586 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
590 $parameters = array();
591 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
592 $sql .= $hookmanager->resPrint;
593 $sql = preg_replace(
'/, $/',
'',
$sql);
597 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
598 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
599 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
600 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
601 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
602 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
604 $sql .=
', '.MAIN_DB_PREFIX.
'propal as p';
605 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
606 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
609 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid=pd.fk_propal';
611 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
612 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
613 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
615 if ($search_sale == -2) {
616 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON (sc.fk_soc = p.fk_soc)";
617 } elseif ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
618 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
620 if ($search_user > 0) {
621 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
622 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
626 $parameters = array();
627 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
628 $sql .= $hookmanager->resPrint;
630 $sql .=
' WHERE p.fk_soc = s.rowid';
631 $sql .=
' AND p.entity IN ('.getEntity(
'propal').
')';
632 if (empty($user->rights->societe->client->voir) && !$socid) {
633 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
645 if ($search_country) {
646 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
648 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
649 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
654 if ($search_refcustomer) {
657 if ($search_refproject) {
660 if ($search_project) {
663 if ($search_availability) {
664 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
666 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
669 if ($search_societe) {
672 if ($search_societe_alias) {
679 if ($search_montant_ht !=
'') {
682 if ($search_montant_vat !=
'') {
685 if ($search_montant_ttc !=
'') {
688 if ($search_warehouse !=
'' && $search_warehouse > 0) {
691 if ($search_multicurrency_code !=
'') {
692 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
694 if ($search_multicurrency_tx !=
'') {
697 if ($search_multicurrency_montant_ht !=
'') {
698 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
700 if ($search_multicurrency_montant_vat !=
'') {
701 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
703 if ($search_multicurrency_montant_ttc !=
'') {
704 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
710 if ($search_categ_cus > 0) {
711 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
713 if ($search_categ_cus == -2) {
714 $sql .=
" AND cc.fk_categorie IS NULL";
717 if ($search_fk_cond_reglement > 0) {
718 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
720 if ($search_fk_shipping_method > 0) {
721 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
723 if ($search_fk_input_reason > 0) {
724 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
726 if ($search_fk_mode_reglement > 0) {
727 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
730 $sql .=
' AND s.rowid = '.((int) $socid);
732 if ($search_status !=
'' && $search_status !=
'-1') {
733 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
735 if ($search_date_start) {
736 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
738 if ($search_date_end) {
739 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
741 if ($search_date_end_start) {
742 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
744 if ($search_date_end_end) {
745 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
747 if ($search_date_delivery_start) {
748 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
750 if ($search_date_delivery_end) {
751 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
753 if ($search_sale == -2) {
754 $sql .=
" AND sc.fk_user IS NULL";
755 } elseif ($search_sale > 0) {
756 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
758 if ($search_user > 0) {
759 $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);
761 if ($search_date_signature_start) {
762 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
764 if ($search_date_signature_end) {
765 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
768 $searchCategoryProductOperator = -1;
769 $searchCategoryProductList = array($search_product_category);
770 if (!empty($searchCategoryProductList)) {
771 $searchCategoryProductSqlList = array();
772 $listofcategoryid =
'';
773 foreach ($searchCategoryProductList as $searchCategoryProduct) {
774 if (intval($searchCategoryProduct) == -2) {
775 $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)";
776 } elseif (intval($searchCategoryProduct) > 0) {
777 if ($searchCategoryProductOperator == 0) {
778 $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).
")";
780 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
784 if ($listofcategoryid) {
785 $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).
"))";
787 if ($searchCategoryProductOperator == 1) {
788 if (!empty($searchCategoryProductSqlList)) {
789 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
792 if (!empty($searchCategoryProductSqlList)) {
793 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
798 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
801 $parameters = array();
802 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
803 $sql .= $hookmanager->resPrint;
806 $parameters = array();
807 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
808 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
811 $nbtotalofrecords =
'';
814 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
815 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
816 $resql = $db->query($sqlforcount);
818 $objforcount = $db->fetch_object($resql);
819 $nbtotalofrecords = $objforcount->nbtotalofrecords;
824 if (($page * $limit) > $nbtotalofrecords) {
831 $sql .= $db->order($sortfield, $sortorder);
832 $sql .=
', p.ref DESC';
834 $sql .= $db->plimit($limit + 1, $offset);
837 $resql = $db->query(
$sql);
840 $objectstatic =
new Propal($db);
841 $userstatic =
new User($db);
846 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
847 if (empty($search_societe)) {
848 $search_societe = $soc->name;
851 $title = $langs->trans(
'Proposals');
854 $num = $db->num_rows($resql);
856 $arrayofselected = is_array($toselect) ? $toselect : array();
858 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
859 $obj = $db->fetch_object($resql);
863 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.$id);
867 $help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
870 $param =
'&search_status='.urlencode($search_status);
872 $param .=
'&mode='.urlencode($mode);
874 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
875 $param .=
'&contextpage='.urlencode($contextpage);
877 if ($limit > 0 && $limit != $conf->liste_limit) {
878 $param .=
'&limit='.((int) $limit);
881 $param .=
'&sall='.urlencode($sall);
883 if ($search_date_startday) {
884 $param .=
'&search_date_startday='.urlencode($search_date_startday);
886 if ($search_date_startmonth) {
887 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
889 if ($search_date_startyear) {
890 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
892 if ($search_date_endday) {
893 $param .=
'&search_date_endday='.urlencode($search_date_endday);
895 if ($search_date_endmonth) {
896 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
898 if ($search_date_endyear) {
899 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
901 if ($search_date_end_startday) {
902 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
904 if ($search_date_end_startmonth) {
905 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
907 if ($search_date_end_startyear) {
908 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
910 if ($search_date_end_endday) {
911 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
913 if ($search_date_end_endmonth) {
914 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
916 if ($search_date_end_endyear) {
917 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
919 if ($search_date_delivery_startday) {
920 $param .=
'&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
922 if ($search_date_delivery_startmonth) {
923 $param .=
'&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
925 if ($search_date_delivery_startyear) {
926 $param .=
'&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
928 if ($search_date_delivery_endday) {
929 $param .=
'&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
931 if ($search_date_delivery_endmonth) {
932 $param .=
'&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
934 if ($search_date_delivery_endyear) {
935 $param .=
'&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
938 $param .=
'&search_ref='.urlencode($search_ref);
940 if ($search_refcustomer) {
941 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
943 if ($search_refproject) {
944 $param .=
'&search_refproject='.urlencode($search_refproject);
946 if ($search_societe) {
947 $param .=
'&search_societe='.urlencode($search_societe);
949 if ($search_societe_alias) {
950 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
952 if ($search_user > 0) {
953 $param .=
'&search_user='.urlencode($search_user);
955 if ($search_sale > 0) {
956 $param .=
'&search_sale='.urlencode($search_sale);
958 if ($search_montant_ht) {
959 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
961 if ($search_multicurrency_code !=
'') {
962 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
964 if ($search_multicurrency_tx !=
'') {
965 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
967 if ($search_multicurrency_montant_ht !=
'') {
968 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
970 if ($search_multicurrency_montant_vat !=
'') {
971 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
973 if ($search_multicurrency_montant_ttc !=
'') {
974 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
977 $param .=
'&search_login='.urlencode($search_login);
980 $param .=
'&search_town='.urlencode($search_town);
983 $param .=
'&search_zip='.urlencode($search_zip);
986 $param .=
'&socid='.urlencode($socid);
988 if ($optioncss !=
'') {
989 $param .=
'&optioncss='.urlencode($optioncss);
991 if ($search_categ_cus > 0) {
992 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
994 if ($search_product_category !=
'') {
995 $param .=
'&search_product_category='.urlencode($search_product_category);
997 if ($search_fk_cond_reglement > 0) {
998 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1000 if ($search_fk_shipping_method > 0) {
1001 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1003 if ($search_fk_input_reason > 0) {
1004 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1006 if ($search_fk_mode_reglement > 0) {
1007 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1009 if ($search_type_thirdparty > 0) {
1010 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1013 $param .=
'&search_town='.urlencode($search_town);
1016 $param .=
'&search_zip='.urlencode($search_zip);
1018 if ($search_state) {
1019 $param .=
'&search_state='.urlencode($search_state);
1022 $param .=
'&search_town='.urlencode($search_town);
1024 if ($search_country) {
1025 $param .=
'&search_country='.urlencode($search_country);
1027 if ($search_date_signature_startday) {
1028 $param .=
'&search_date_signature_startday='.urlencode($search_date_signature_startday);
1030 if ($search_date_signature_startmonth) {
1031 $param .=
'&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
1033 if ($search_date_signature_startyear) {
1034 $param .=
'&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
1036 if ($search_date_signature_endday) {
1037 $param .=
'&search_date_signature_endday='.urlencode($search_date_signature_endday);
1039 if ($search_date_signature_endmonth) {
1040 $param .=
'&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
1042 if ($search_date_signature_endyear) {
1043 $param .=
'&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
1047 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1049 $parameters = array();
1050 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1051 $param .= $hookmanager->resPrint;
1054 $arrayofmassactions = array(
1055 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1056 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1058 if ($permissiontosendbymail) {
1059 $arrayofmassactions[
'presend']=
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1061 if ($permissiontovalidate) {
1062 $arrayofmassactions[
'prevalidate']=
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1064 if ($permissiontoclose) {
1065 $arrayofmassactions[
'presign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1066 $arrayofmassactions[
'nopresign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1067 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1069 if ($permissiontodelete) {
1070 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1073 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1074 $arrayofmassactions = array();
1076 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1078 $url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1079 if (!empty($socid)) {
1080 $url .=
'&socid='.$socid;
1082 $newcardbutton =
'';
1083 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
1084 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
1085 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1088 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1089 if ($optioncss !=
'') {
1090 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1092 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1093 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1094 print
'<input type="hidden" name="action" value="list">';
1095 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1096 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1097 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1098 print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1100 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1102 $topicmail =
"SendPropalRef";
1103 $modelmail =
"propal_send";
1104 $objecttmp =
new Propal($db);
1105 $trackid =
'pro'.$object->id;
1106 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1108 if ($massaction ==
'prevalidate') {
1109 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1112 if ($massaction ==
'presign') {
1113 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1116 if ($massaction ==
'nopresign') {
1117 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1121 foreach ($fieldstosearchall as $key => $val) {
1122 $fieldstosearchall[$key] = $langs->trans($val);
1124 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1129 $moreforfilter =
'';
1132 if ($user->rights->user->user->lire) {
1133 $langs->load(
"commercial");
1134 $moreforfilter .=
'<div class="divsearchfield">';
1135 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1136 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1137 $moreforfilter .=
'</div>';
1140 if ($user->rights->user->user->lire) {
1141 $moreforfilter .=
'<div class="divsearchfield">';
1142 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1143 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1144 $moreforfilter .=
'</div>';
1147 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1148 $searchCategoryProductOperator = -1;
1149 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1150 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1152 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1154 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1155 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1156 $moreforfilter .=
'<div class="divsearchfield">';
1157 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1158 $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'));
1159 $moreforfilter .=
'</div>';
1161 if (
isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
1162 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1164 $moreforfilter .=
'<div class="divsearchfield">';
1165 $tmptitle = $langs->trans(
'Warehouse');
1166 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1167 $moreforfilter .=
'</div>';
1169 $parameters = array();
1170 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1171 if (empty($reshook)) {
1172 $moreforfilter .= $hookmanager->resPrint;
1174 $moreforfilter = $hookmanager->resPrint;
1177 if (!empty($moreforfilter)) {
1178 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1179 print $moreforfilter;
1183 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1184 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1185 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1187 print
'<div class="div-table-responsive">';
1188 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1190 print
'<tr class="liste_titre_filter">';
1193 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1194 print
'<td class="liste_titre" align="middle">';
1195 $searchpicto =
$form->showFilterButtons(
'left');
1200 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1201 print
'<td class="liste_titre">';
1202 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1205 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1206 print
'<td class="liste_titre">';
1207 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1210 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1211 print
'<td class="liste_titre">';
1212 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1215 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1216 print
'<td class="liste_titre">';
1217 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1220 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1221 print
'<td class="liste_titre" align="left">';
1222 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
1225 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1226 print
'<td class="liste_titre" align="left">';
1227 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1230 if (!empty($arrayfields[
's.town'][
'checked'])) {
1231 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1233 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1234 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1237 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1238 print
'<td class="liste_titre">';
1239 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1243 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1244 print
'<td class="liste_titre" align="center">';
1245 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1249 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1250 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1251 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);
1256 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1257 print
'<td class="liste_titre center">';
1258 print
'<div class="nowrap">';
1259 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1261 print
'<div class="nowrap">';
1262 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1267 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1268 print
'<td class="liste_titre center">';
1269 print
'<div class="nowrap">';
1270 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'));
1272 print
'<div class="nowrap">';
1273 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'));
1278 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1279 print
'<td class="liste_titre center">';
1280 print
'<div class="nowrap">';
1281 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'));
1283 print
'<div class="nowrap">';
1284 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'));
1289 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1290 print
'<td class="liste_titre center">';
1291 print
'<div class="nowrap">';
1292 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'));
1294 print
'<div class="nowrap">';
1295 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'));
1300 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1301 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1302 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1307 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1308 print
'<td class="liste_titre">';
1309 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1313 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1314 print
'<td class="liste_titre">';
1315 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1319 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1320 print
'<td class="liste_titre">';
1321 print
$form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1325 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1326 print
'<td class="liste_titre">';
1327 print
$form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1330 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1332 print
'<td class="liste_titre right">';
1333 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1336 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1338 print
'<td class="liste_titre right">';
1339 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1342 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1344 print
'<td class="liste_titre right">';
1345 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1348 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1350 print
'<td class="liste_titre right">';
1353 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1355 print
'<td class="liste_titre right">';
1358 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1360 print
'<td class="liste_titre">';
1361 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1364 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1366 print
'<td class="liste_titre">';
1367 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1370 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1372 print
'<td class="liste_titre right">';
1373 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1376 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1378 print
'<td class="liste_titre right">';
1379 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1382 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1384 print
'<td class="liste_titre right">';
1385 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1388 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1390 print
'<td class="liste_titre right">';
1393 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1395 print
'<td class="liste_titre right">';
1398 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1404 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1405 print
'<td class="liste_titre"></td>';
1407 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1408 print
'<td class="liste_titre right">';
1411 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1412 print
'<td class="liste_titre right">';
1415 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1416 print
'<td class="liste_titre right">';
1419 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1420 print
'<td class="liste_titre right">';
1424 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1427 $parameters = array(
'arrayfields'=>$arrayfields);
1428 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1429 print $hookmanager->resPrint;
1431 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1432 print
'<td class="liste_titre">';
1436 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1437 print
'<td class="liste_titre">';
1441 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1442 print
'<td class="liste_titre">';
1445 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1447 print
'<td class="liste_titre">';
1450 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1452 print
'<td class="liste_titre">';
1456 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1457 print
'<td class="liste_titre right parentonrightofpage">';
1458 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_statut',
'search_status width100 onrightofpage');
1462 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1463 print
'<td class="liste_titre" align="middle">';
1464 $searchpicto =
$form->showFilterButtons();
1470 $totalarray = array(
1480 print
'<tr class="liste_titre">';
1481 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1482 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1484 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1485 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1487 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1488 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1490 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1491 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1493 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1494 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1496 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1497 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1499 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1500 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1502 if (!empty($arrayfields[
's.town'][
'checked'])) {
1503 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1505 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1506 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1508 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1509 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1511 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1512 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'class="center"', $sortfield, $sortorder);
1514 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1515 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'class="center"', $sortfield, $sortorder);
1517 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'class="center"', $sortfield, $sortorder);
1520 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1521 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'class="center"', $sortfield, $sortorder);
1523 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1524 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'class="center"', $sortfield, $sortorder);
1526 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'class="center"', $sortfield, $sortorder);
1529 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1530 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1532 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1533 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1535 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1536 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1538 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1539 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1541 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1542 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1544 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1545 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1547 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1548 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1550 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1551 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1553 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1554 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1556 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1557 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1559 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1562 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1563 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1565 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1566 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1568 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1569 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1571 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1574 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1575 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1577 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1578 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1580 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1581 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'class="center"', $sortfield, $sortorder);
1583 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1584 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1586 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1587 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1589 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1590 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1592 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1593 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1595 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1596 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1599 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1601 $parameters = array(
1602 'arrayfields' => $arrayfields,
1604 'sortfield' => $sortfield,
1605 'sortorder' => $sortorder,
1606 'totalarray' => &$totalarray,
1609 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1611 print $hookmanager->resPrint;
1612 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1613 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1615 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1616 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1618 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1619 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1621 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1622 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1624 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1625 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1627 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1628 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'class="right"', $sortfield, $sortorder);
1630 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1631 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1639 $with_margin_info =
false;
1641 !empty($arrayfields[
'total_pa'][
'checked'])
1642 || !empty($arrayfields[
'total_margin'][
'checked'])
1643 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1644 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1647 $with_margin_info =
true;
1652 $savnbfield = $totalarray[
'nbfield'];
1653 $totalarray = array();
1654 $totalarray[
'nbfield'] = 0;
1656 $imaxinloop = ($limit ? min($num, $limit) : $num);
1657 while ($i < $imaxinloop) {
1658 $obj = $db->fetch_object($resql);
1660 $objectstatic->id = $obj->rowid;
1661 $objectstatic->ref = $obj->ref;
1662 $objectstatic->ref_client = $obj->ref_client;
1663 $objectstatic->note_public = $obj->note_public;
1664 $objectstatic->note_private = $obj->note_private;
1665 $objectstatic->statut = $obj->status;
1666 $objectstatic->status = $obj->status;
1668 $companystatic->id = $obj->socid;
1669 $companystatic->name = $obj->name;
1670 $companystatic->name_alias = $obj->alias;
1671 $companystatic->client = $obj->client;
1672 $companystatic->fournisseur = $obj->fournisseur;
1673 $companystatic->code_client = $obj->code_client;
1674 $companystatic->email = $obj->email;
1675 $companystatic->phone = $obj->phone;
1676 $companystatic->address = $obj->address;
1677 $companystatic->zip = $obj->zip;
1678 $companystatic->town = $obj->town;
1679 $companystatic->country_code = $obj->country_code;
1681 $projectstatic->id = $obj->project_id;
1682 $projectstatic->ref = $obj->project_ref;
1683 $projectstatic->title = $obj->project_label;
1685 $totalInvoicedHT = 0;
1686 $totalInvoicedTTC = 0;
1687 $multicurrency_totalInvoicedHT = 0;
1688 $multicurrency_totalInvoicedTTC = 0;
1690 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1692 if (!empty($TInvoiceData)) {
1693 foreach ($TInvoiceData as $invoiceData) {
1695 $invoice->fetch($invoiceData->facid);
1697 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type ==
Facture::TYPE_DEPOSIT) {
1701 $totalInvoicedHT += $invoice->total_ht;
1702 $totalInvoicedTTC += $invoice->total_ttc;
1703 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1704 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1708 $marginInfo = array();
1709 if ($with_margin_info ===
true) {
1710 $objectstatic->fetch_lines();
1711 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1712 $total_ht += $obj->total_ht;
1713 $total_margin += $marginInfo[
'total_margin'];
1716 if ($mode ==
'kanban') {
1718 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1719 print
'<div class="box-flex-container kanban">';
1722 $userstatic->fetch($obj->fk_user_author);
1723 $objectstatic->author = $userstatic->getNomUrl(1);
1724 $objectstatic->fk_project = $projectstatic->getNomUrl(1);
1725 print $objectstatic->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
1726 if ($i == ($imaxinloop - 1)) {
1731 print
'<tr class="oddeven">';
1734 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1735 print
'<td class="nowrap" align="center">';
1736 if ($massactionbutton || $massaction) {
1738 if (in_array($obj->rowid, $arrayofselected)) {
1741 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1745 $totalarray[
'nbfield']++;
1749 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1750 print
'<td class="nowraponall">';
1752 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1754 print
'<td class="nobordernopadding nowraponall">';
1755 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1759 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1760 $warnornote .=
img_warning($langs->trans(
"Late"));
1763 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1768 print
'<td width="16" class="nobordernopadding right">';
1770 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1771 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1772 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1773 print
'</td></tr></table>';
1777 $totalarray[
'nbfield']++;
1781 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1783 print
'<td class="nowrap tdoverflowmax200">';
1787 $totalarray[
'nbfield']++;
1791 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1793 print
'<td class="nowraponall">';
1794 if ($obj->project_id > 0) {
1795 print $projectstatic->getNomUrl(1);
1799 $totalarray[
'nbfield']++;
1803 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1805 print
'<td class="nowrap">';
1806 if ($obj->project_id > 0) {
1811 $totalarray[
'nbfield']++;
1816 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1817 print
'<td class="tdoverflowmax150">';
1818 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1821 $totalarray[
'nbfield']++;
1826 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1827 print
'<td class="tdoverflowmax200">';
1831 $totalarray[
'nbfield']++;
1836 if (!empty($arrayfields[
's.town'][
'checked'])) {
1837 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1841 $totalarray[
'nbfield']++;
1845 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1846 print
'<td class="nocellnopadd">';
1850 $totalarray[
'nbfield']++;
1854 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1855 print
"<td>".$obj->state_name.
"</td>\n";
1857 $totalarray[
'nbfield']++;
1861 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1862 print
'<td class="center">';
1863 $tmparray =
getCountry($obj->fk_pays,
'all');
1864 print $tmparray[
'label'];
1867 $totalarray[
'nbfield']++;
1871 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1872 if (!is_array($typenArray) || empty($typenArray)) {
1873 $typenArray = $formcompany->typent_array(1);
1876 print
'<td class="center">';
1877 print $typenArray[$obj->typent_code];
1880 $totalarray[
'nbfield']++;
1885 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1886 print
'<td class="center">';
1890 $totalarray[
'nbfield']++;
1895 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1897 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1900 print
'<td> </td>';
1903 $totalarray[
'nbfield']++;
1907 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1908 if ($obj->ddelivery) {
1909 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
1912 print
'<td> </td>';
1915 $totalarray[
'nbfield']++;
1919 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1920 if ($obj->dsignature) {
1921 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
1924 print
'<td> </td>';
1927 $totalarray[
'nbfield']++;
1931 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1932 print
'<td class="center">';
1933 $form->form_availability(
'', $obj->availability,
'none', 1);
1936 $totalarray[
'nbfield']++;
1940 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1942 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1945 $totalarray[
'nbfield']++;
1949 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1950 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag(
$form->cache_demand_reason[$obj->fk_input_reason][
'label']).
'">';
1951 if ($obj->fk_input_reason > 0) {
1952 print
$form->cache_demand_reason[$obj->fk_input_reason][
'label'];
1956 $totalarray[
'nbfield']++;
1960 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1962 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1965 $totalarray[
'nbfield']++;
1969 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1971 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1974 $totalarray[
'nbfield']++;
1978 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1979 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1981 $totalarray[
'nbfield']++;
1984 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
1986 if (empty($totalarray[
'val'][
'p.total_ht'])) {
1987 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
1989 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
1993 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1994 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1996 $totalarray[
'nbfield']++;
1999 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2001 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2002 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2004 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2008 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2009 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2011 $totalarray[
'nbfield']++;
2014 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2016 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2017 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2019 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2023 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2024 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2026 $totalarray[
'nbfield']++;
2029 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2031 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2032 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2034 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2038 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2039 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2041 $totalarray[
'nbfield']++;
2044 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2046 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2047 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2049 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2053 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2054 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2056 $totalarray[
'nbfield']++;
2061 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2062 print
'<td class="nowrap">';
2063 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2066 $totalarray[
'nbfield']++;
2070 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2071 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2073 $totalarray[
'nbfield']++;
2077 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2078 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2080 $totalarray[
'nbfield']++;
2084 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2085 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2087 $totalarray[
'nbfield']++;
2091 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2092 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2094 $totalarray[
'nbfield']++;
2098 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2099 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2101 $totalarray[
'nbfield']++;
2105 $userstatic->id = $obj->fk_user_author;
2106 $userstatic->login = $obj->login;
2107 $userstatic->lastname = $obj->lastname;
2108 $userstatic->firstname = $obj->firstname;
2109 $userstatic->email = $obj->user_email;
2110 $userstatic->statut = $obj->user_statut;
2111 $userstatic->entity = $obj->user_entity;
2112 $userstatic->photo = $obj->photo;
2113 $userstatic->office_phone = $obj->office_phone;
2114 $userstatic->office_fax = $obj->office_fax;
2115 $userstatic->user_mobile = $obj->user_mobile;
2116 $userstatic->job = $obj->job;
2117 $userstatic->gender = $obj->gender;
2120 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2121 print
'<td class="tdoverflowmax150">';
2122 if ($userstatic->id) {
2123 print $userstatic->getNomUrl(-1);
2127 $totalarray[
'nbfield']++;
2131 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2133 print
'<td class="tdoverflowmax150">';
2134 if ($obj->socid > 0) {
2135 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2136 if ($listsalesrepresentatives < 0) {
2139 $nbofsalesrepresentative = count($listsalesrepresentatives);
2140 if ($nbofsalesrepresentative > 6) {
2142 print $nbofsalesrepresentative;
2143 } elseif ($nbofsalesrepresentative > 0) {
2144 $userstatic =
new User($db);
2146 foreach ($listsalesrepresentatives as $val) {
2147 $userstatic->id = $val[
'id'];
2148 $userstatic->lastname = $val[
'lastname'];
2149 $userstatic->firstname = $val[
'firstname'];
2150 $userstatic->email = $val[
'email'];
2151 $userstatic->statut = $val[
'statut'];
2152 $userstatic->entity = $val[
'entity'];
2153 $userstatic->photo = $val[
'photo'];
2154 $userstatic->login = $val[
'login'];
2155 $userstatic->office_phone = $val[
'office_phone'];
2156 $userstatic->office_fax = $val[
'office_fax'];
2157 $userstatic->user_mobile = $val[
'user_mobile'];
2158 $userstatic->job = $val[
'job'];
2159 $userstatic->gender = $val[
'gender'];
2161 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2163 if ($j < $nbofsalesrepresentative) {
2175 $totalarray[
'nbfield']++;
2180 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2181 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2183 $totalarray[
'nbfield']++;
2187 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2188 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2190 $totalarray[
'nbfield']++;
2193 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2195 $totalarray[
'val'][
'total_margin'] = $total_margin;
2198 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2199 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2201 $totalarray[
'nbfield']++;
2205 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2206 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2208 $totalarray[
'nbfield']++;
2211 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2213 if ($i >= $imaxinloop - 1) {
2214 if (!empty($total_ht)) {
2215 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2217 $totalarray[
'val'][
'total_mark_rate'] =
'';
2223 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2225 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2226 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2227 print $hookmanager->resPrint;
2229 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2230 print
'<td align="center" class="nowrap">';
2231 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2234 $totalarray[
'nbfield']++;
2238 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2239 print
'<td align="center" class="nowrap">';
2240 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2243 $totalarray[
'nbfield']++;
2247 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2248 print
'<td align="center" class="nowrap">';
2249 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2252 $totalarray[
'nbfield']++;
2256 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2257 print
'<td class="center">';
2261 $totalarray[
'nbfield']++;
2265 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2266 print
'<td class="center">';
2270 $totalarray[
'nbfield']++;
2274 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2275 print
'<td class="nowrap right">'.$objectstatic->getLibStatut(5).
'</td>';
2277 $totalarray[
'nbfield']++;
2281 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2282 print
'<td class="nowrap" align="center">';
2283 if ($massactionbutton || $massaction) {
2285 if (in_array($obj->rowid, $arrayofselected)) {
2288 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2292 $totalarray[
'nbfield']++;
2304 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2309 foreach ($arrayfields as $key => $val) {
2310 if (!empty($val[
'checked'])) {
2314 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2319 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
2320 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2321 print $hookmanager->resPrint;
2323 print
'</table>'.
"\n";
2324 print
'</div>'.
"\n";
2326 print
'</form>'.
"\n";
2328 $hidegeneratedfilelistifempty = 1;
2329 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2330 $hidegeneratedfilelistifempty = 0;
2334 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2335 $urlsource .= str_replace(
'&',
'&', $param);
2337 $filedir = $diroutputmassaction;
2338 $genallowed = $user->hasRight(
'propal',
'lire');
2339 $delallowed = $user->hasRight(
'propal',
'creer');
2341 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);