44require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49if (isModEnabled(
'margin')) {
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
56if (isModEnabled(
'category')) {
57 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
70$langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
71if (isModEnabled(
"shipping")) {
72 $langs->loadLangs(array(
'sendings'));
78$action =
GETPOST(
'action',
'aZ09');
79$massaction =
GETPOST(
'massaction',
'alpha');
81$confirm =
GETPOST(
'confirm',
'alpha');
82$cancel =
GETPOST(
'cancel',
'alpha');
83$toselect =
GETPOST(
'toselect',
'array');
84$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
85$optioncss =
GETPOST(
'optioncss',
'alpha');
86$mode =
GETPOST(
'mode',
'alpha');
89$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
91if ($search_user == -1) {
96$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
97$search_refproject =
GETPOST(
'search_refproject',
'alpha');
98$search_project =
GETPOST(
'search_project',
'alpha');
99$search_societe =
GETPOST(
'search_societe',
'alpha');
100$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
101$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
102$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
103$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
104$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
105$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
106$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
107$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
108$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
109$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
110$search_login =
GETPOST(
'search_login',
'alpha');
111$search_product_category =
GETPOSTINT(
'search_product_category');
112$search_town =
GETPOST(
'search_town',
'alpha');
113$search_zip =
GETPOST(
'search_zip',
'alpha');
114$search_state =
GETPOST(
"search_state");
115$search_country =
GETPOST(
"search_country",
'aZ09');
116$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
117$search_date_startday =
GETPOSTINT(
'search_date_startday');
118$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
119$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
120$search_date_endday =
GETPOSTINT(
'search_date_endday');
121$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
122$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
123$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
124$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
125$search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
126$search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
127$search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
128$search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
129$search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
130$search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
131$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
132$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
133$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
134$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
135$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
136$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
137$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
138$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
139$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
140$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
141$search_availability =
GETPOST(
'search_availability',
'intcomma');
142$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
143$search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'intcomma');
144$search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'intcomma');
145$search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'intcomma');
146$search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'intcomma');
147$search_date_signature_startday =
GETPOSTINT(
'search_date_signature_startday');
148$search_date_signature_startmonth =
GETPOSTINT(
'search_date_signature_startmonth');
149$search_date_signature_startyear =
GETPOSTINT(
'search_date_signature_startyear');
150$search_date_signature_endday =
GETPOSTINT(
'search_date_signature_endday');
151$search_date_signature_endmonth =
GETPOSTINT(
'search_date_signature_endmonth');
152$search_date_signature_endyear =
GETPOSTINT(
'search_date_signature_endyear');
153$search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
154$search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
155$search_status =
GETPOST(
'search_status',
'alpha');
156$search_note_public =
GETPOST(
'search_note_public',
'alpha');
157$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
159$search_option =
GETPOST(
'search_option',
'alpha');
160if ($search_option ==
'late') {
161 $search_status =
'1';
162 $object_statut =
'1';
167$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
168$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
170if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
174$offset = $limit * $page;
175$pageprev = $page - 1;
176$pagenext = $page + 1;
178 $sortfield =
'p.ref';
188if (!empty($user->socid)) {
189 $socid = $user->socid;
194 $dbtable =
'&societe';
196$hookmanager->initHooks(array(
'propallist'));
199$diroutputmassaction =
$conf->propal->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
206$extrafields->fetch_name_optionals_label(
$object->table_element);
208$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
211$fieldstosearchall = array(
213 'p.ref_client' =>
'RefCustomer',
214 'pd.description' =>
'Description',
215 's.nom' =>
"ThirdParty",
216 's.name_alias' =>
"AliasNameShort",
219 'p.note_public' =>
'NotePublic',
221if (empty($user->socid)) {
222 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
226$checkedtypetiers = 0;
228 'p.ref' => array(
'label' =>
"Ref",
'checked' => 1),
229 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1),
230 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
231 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
232 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
233 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1),
234 's.town' => array(
'label' =>
"Town",
'checked' => -1),
235 's.zip' => array(
'label' =>
"Zip",
'checked' => -1),
236 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0),
237 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0),
238 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers),
239 'p.date' => array(
'label' =>
"DatePropal",
'checked' => 1),
240 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' => 1),
241 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' => 0),
242 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' => 0),
243 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' => 0),
244 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => 0,
'enabled' => isModEnabled(
"shipping")),
245 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => 0,
'enabled' => 1),
246 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 0),
247 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 0),
248 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1),
249 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0),
250 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0),
251 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
252 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
253 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
254 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
255 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
256 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
257 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
258 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
259 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
260 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 10),
261 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => -1),
262 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
263 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
264 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
265 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
266 'p.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
267 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
268 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 500),
269 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
270 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
271 'p.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
272 'p.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
300if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
301 $search_sale = $user->id;
305include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
308$permissiontoread = $user->hasRight(
'propal',
'lire');
309$permissiontoadd = $user->hasRight(
'propal',
'creer');
310$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
312 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
313 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
314 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
316 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
317 $permissiontoclose = $user->hasRight(
'propal',
'creer');
318 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
327if (
GETPOST(
'cancel',
'alpha')) {
331if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
336$search_code_client =
'';
338$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
339$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
344if (empty($reshook)) {
346 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
349 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
353 $search_refcustomer =
'';
354 $search_refproject =
'';
355 $search_project =
'';
356 $search_societe =
'';
357 $search_societe_alias =
'';
358 $search_montant_ht =
'';
359 $search_montant_vat =
'';
360 $search_montant_ttc =
'';
361 $search_warehouse =
'';
362 $search_multicurrency_code =
'';
363 $search_multicurrency_tx =
'';
364 $search_multicurrency_montant_ht =
'';
365 $search_multicurrency_montant_vat =
'';
366 $search_multicurrency_montant_ttc =
'';
368 $search_product_category =
'';
373 $search_country =
'';
374 $search_type_thirdparty =
'';
375 $search_date_startday =
'';
376 $search_date_startmonth =
'';
377 $search_date_startyear =
'';
378 $search_date_endday =
'';
379 $search_date_endmonth =
'';
380 $search_date_endyear =
'';
381 $search_date_start =
'';
382 $search_date_end =
'';
383 $search_date_end_startday =
'';
384 $search_date_end_startmonth =
'';
385 $search_date_end_startyear =
'';
386 $search_date_end_endday =
'';
387 $search_date_end_endmonth =
'';
388 $search_date_end_endyear =
'';
389 $search_date_end_start =
'';
390 $search_date_end_end =
'';
391 $search_date_delivery_startday =
'';
392 $search_date_delivery_startmonth =
'';
393 $search_date_delivery_startyear =
'';
394 $search_date_delivery_endday =
'';
395 $search_date_delivery_endmonth =
'';
396 $search_date_delivery_endyear =
'';
397 $search_date_delivery_start =
'';
398 $search_date_delivery_end =
'';
399 $search_availability =
'';
402 $search_fk_cond_reglement =
'';
403 $search_fk_shipping_method =
'';
404 $search_fk_input_reason =
'';
405 $search_fk_mode_reglement =
'';
406 $search_date_signature_startday =
'';
407 $search_date_signature_startmonth =
'';
408 $search_date_signature_startyear =
'';
409 $search_date_signature_endday =
'';
410 $search_date_signature_endmonth =
'';
411 $search_date_signature_endyear =
'';
412 $search_date_signature_start =
'';
413 $search_date_signature_end =
'';
414 $search_import_key =
'';
415 $search_categ_cus = 0;
419 $search_array_options = array();
425 $objectclass =
'Propal';
426 $objectlabel =
'Proposals';
427 $uploaddir =
$conf->propal->multidir_output[
$conf->entity];
428 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
431if ($action ==
'validate' && $permissiontovalidate) {
432 if (
GETPOST(
'confirm') ==
'yes') {
433 $tmpproposal =
new Propal($db);
435 foreach ($toselect as $checked) {
436 if ($tmpproposal->fetch($checked) > 0) {
437 if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
438 if ($tmpproposal->valid($user) > 0) {
439 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
445 $langs->load(
"errors");
446 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
462if ($action ==
"sign" && $permissiontoclose) {
463 if (
GETPOST(
'confirm') ==
'yes') {
464 $tmpproposal =
new Propal($db);
466 foreach ($toselect as $checked) {
467 if ($tmpproposal->fetch($checked) > 0) {
468 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
469 $tmpproposal->status = $tmpproposal::STATUS_SIGNED;
470 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
471 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
477 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
493if ($action ==
"nosign" && $permissiontoclose) {
494 if (
GETPOST(
'confirm') ==
'yes') {
495 $tmpproposal =
new Propal($db);
497 foreach ($toselect as $checked) {
498 if ($tmpproposal->fetch($checked) > 0) {
499 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
500 $tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
501 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
502 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
508 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
525if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
528 $objecttmp =
new $objectclass($db);
530 foreach ($toselect as $toselectid) {
531 $result = $objecttmp->fetch($toselectid);
533 $result = $objecttmp->classifyBilled($user, 0);
564$form =
new Form($db);
569if (isModEnabled(
'margin')) {
572$companystatic =
new Societe($db);
573$projectstatic =
new Project($db);
576$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
577$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
580if ($search_all !==
'') {
581 $sql =
'SELECT DISTINCT';
583$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,';
584$sql .=
" typent.code as typent_code,";
585$sql .=
" ava.rowid as availability,";
586$sql .=
" country.code as country_code,";
587$sql .=
" state.code_departement as state_code, state.nom as state_name,";
588$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.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,';
589$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
590$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
591$sql .=
' p.date_signature as dsignature,';
592$sql .=
' p.note_public, p.note_private,';
593$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
594$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
595$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';
597if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
598 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
599 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
603$parameters = array();
604$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
605$sql .= $hookmanager->resPrint;
606$sql = preg_replace(
'/, $/',
'', $sql);
610$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
611$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
612$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
613$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
615$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
616if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
617 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
620 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
622$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
624$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
626$parameters = array();
627$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
628$sql .= $hookmanager->resPrint;
631$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
641if ($search_country) {
642 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
644if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
645 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
650if ($search_refcustomer) {
653if ($search_refproject) {
656if ($search_project) {
659if ($search_availability) {
660 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
663if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
664 if ($societe_add_ref_in_list == 1) {
665 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
667 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
670 if ($search_societe) {
671 if ($societe_add_ref_in_list == 1) {
672 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
677 if ($search_societe_alias) {
682if ($societe_add_ref_in_list == 1 && $search_code_client && !$search_societe) {
686 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
688if ($search_montant_ht !=
'') {
691if ($search_montant_vat !=
'') {
694if ($search_montant_ttc !=
'') {
697if ($search_warehouse !=
'' && $search_warehouse > 0) {
700if ($search_multicurrency_code !=
'') {
701 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
703if ($search_multicurrency_tx !=
'') {
704 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
706if ($search_multicurrency_montant_ht !=
'') {
707 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
709if ($search_multicurrency_montant_vat !=
'') {
710 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
712if ($search_multicurrency_montant_ttc !=
'') {
713 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
716 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
718if ($search_fk_cond_reglement > 0) {
719 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
721if ($search_fk_shipping_method > 0) {
722 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
724if ($search_fk_input_reason > 0) {
725 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
727if ($search_fk_mode_reglement > 0) {
728 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
731 $sql .=
' AND s.rowid = '.((int) $socid);
733if ($search_status !=
'' && $search_status !=
'-1') {
734 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
736if ($search_date_start) {
737 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
739if ($search_date_end) {
740 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
742if ($search_date_end_start) {
743 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
745if ($search_date_end_end) {
746 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
748if ($search_date_delivery_start) {
749 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
751if ($search_date_delivery_end) {
752 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
754if ($search_date_signature_start) {
755 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
757if ($search_date_signature_end) {
758 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
760if ($search_note_public) {
761 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
763if ($search_import_key) {
767if ($search_user > 0) {
768 $sql .=
" AND EXISTS (";
769 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
770 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
771 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
772 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
773 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
776if ($search_sale && $search_sale !=
'-1') {
777 if ($search_sale == -2) {
778 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
779 } elseif ($search_sale > 0) {
780 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
784$searchCategoryCustomerOperator = -1;
785$searchCategoryCustomerList = array($search_categ_cus);
786if (!empty($searchCategoryCustomerList)) {
787 $searchCategoryCustomerSqlList = array();
788 $listofcategoryid =
'';
789 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
790 if (intval($searchCategoryCustomer) == -2) {
791 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
792 } elseif (intval($searchCategoryCustomer) > 0) {
793 if ($searchCategoryCustomerOperator == 0) {
794 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).
")";
796 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
800 if ($listofcategoryid) {
801 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
803 if ($searchCategoryCustomerOperator == 1) {
804 if (!empty($searchCategoryCustomerSqlList)) {
805 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
808 if (!empty($searchCategoryCustomerSqlList)) {
809 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
814$searchCategoryProductOperator = -1;
815$searchCategoryProductList = array($search_product_category);
816if (!empty($searchCategoryProductList)) {
817 $searchCategoryProductSqlList = array();
818 $listofcategoryid =
'';
819 foreach ($searchCategoryProductList as $searchCategoryProduct) {
820 if (intval($searchCategoryProduct) == -2) {
821 $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)";
822 } elseif (intval($searchCategoryProduct) > 0) {
823 if ($searchCategoryProductOperator == 0) {
824 $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).
")";
826 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
830 if ($listofcategoryid) {
831 $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).
"))";
833 if ($searchCategoryProductOperator == 1) {
834 if (!empty($searchCategoryProductSqlList)) {
835 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
838 if (!empty($searchCategoryProductSqlList)) {
839 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
843if ($search_option ==
'late') {
844 $sql .=
" AND p.fin_validite < '".$db->idate(
dol_now() -
$conf->propal->cloture->warning_delay).
"'";
847include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
851$parameters = array();
852$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
853$sql .= $hookmanager->resPrint;
856$parameters = array();
857$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
858$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
861$nbtotalofrecords =
'';
864 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
865 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
866 $resql = $db->query($sqlforcount);
868 $objforcount = $db->fetch_object($resql);
869 $nbtotalofrecords = $objforcount->nbtotalofrecords;
874 if (($page * $limit) > $nbtotalofrecords) {
882$sql .= $db->order($sortfield, $sortorder);
883$sql .=
', p.ref DESC';
885 $sql .= $db->plimit($limit + 1, $offset);
888$resql = $db->query($sql);
894$objectstatic =
new Propal($db);
895$userstatic =
new User($db);
900 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
901 if (empty($search_societe)) {
902 $search_societe = $soc->name;
905 $title = $langs->trans(
'Proposals');
908$num = $db->num_rows($resql);
910$arrayofselected = is_array($toselect) ? $toselect : array();
912if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
913 $obj = $db->fetch_object($resql);
917 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
921$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
922llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
924$param =
'&search_status='.urlencode($search_status);
926 $param .=
'&mode='.urlencode($mode);
928if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
929 $param .=
'&contextpage='.urlencode($contextpage);
931if ($limit > 0 && $limit !=
$conf->liste_limit) {
932 $param .=
'&limit='.((int) $limit);
934if ($optioncss !=
'') {
935 $param .=
'&optioncss='.urlencode($optioncss);
938 $param .=
'&socid='.urlencode((
string) ($socid));
941 $param .=
'&search_all='.urlencode($search_all);
943if ($search_date_startday) {
944 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
946if ($search_date_startmonth) {
947 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
949if ($search_date_startyear) {
950 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
952if ($search_date_endday) {
953 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
955if ($search_date_endmonth) {
956 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
958if ($search_date_endyear) {
959 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
961if ($search_date_end_startday) {
962 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
964if ($search_date_end_startmonth) {
965 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
967if ($search_date_end_startyear) {
968 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
970if ($search_date_end_endday) {
971 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
973if ($search_date_end_endmonth) {
974 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
976if ($search_date_end_endyear) {
977 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
979if ($search_date_delivery_startday) {
980 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
982if ($search_date_delivery_startmonth) {
983 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
985if ($search_date_delivery_startyear) {
986 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
988if ($search_date_delivery_endday) {
989 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
991if ($search_date_delivery_endmonth) {
992 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
994if ($search_date_delivery_endyear) {
995 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
998 $param .=
'&search_ref='.urlencode($search_ref);
1000if ($search_refcustomer) {
1001 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1003if ($search_refproject) {
1004 $param .=
'&search_refproject='.urlencode($search_refproject);
1006if ($search_societe) {
1007 $param .=
'&search_societe='.urlencode($search_societe);
1009if ($search_societe_alias) {
1010 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1012if ($search_user > 0) {
1013 $param .=
'&search_user='.urlencode((
string) ($search_user));
1015if ($search_sale > 0) {
1016 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1018if ($search_montant_ht) {
1019 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1021if ($search_multicurrency_code !=
'') {
1022 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1024if ($search_multicurrency_tx !=
'') {
1025 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1027if ($search_multicurrency_montant_ht !=
'') {
1028 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1030if ($search_multicurrency_montant_vat !=
'') {
1031 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1033if ($search_multicurrency_montant_ttc !=
'') {
1034 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1037 $param .=
'&search_login='.urlencode($search_login);
1040 $param .=
'&search_town='.urlencode($search_town);
1043 $param .=
'&search_zip='.urlencode($search_zip);
1045if ($search_categ_cus > 0) {
1046 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1048if ($search_product_category !=
'') {
1049 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1051if ($search_fk_cond_reglement > 0) {
1052 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1054if ($search_fk_shipping_method > 0) {
1055 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1057if ($search_fk_input_reason > 0) {
1058 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1060if ($search_fk_mode_reglement > 0) {
1061 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1063if ($search_type_thirdparty > 0) {
1064 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1067 $param .=
'&search_town='.urlencode($search_town);
1070 $param .=
'&search_zip='.urlencode($search_zip);
1073 $param .=
'&search_state='.urlencode($search_state);
1076 $param .=
'&search_town='.urlencode($search_town);
1078if ($search_country) {
1079 $param .=
'&search_country='.urlencode((
string) ($search_country));
1081if ($search_date_signature_startday) {
1082 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1084if ($search_date_signature_startmonth) {
1085 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1087if ($search_date_signature_startyear) {
1088 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1090if ($search_date_signature_endday) {
1091 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1093if ($search_date_signature_endmonth) {
1094 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1096if ($search_date_signature_endyear) {
1097 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1099if ($search_import_key !=
'') {
1100 $param .=
'&search_import_key='.urlencode($search_import_key);
1104include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1106$parameters = array(
'param' => &$param);
1107$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1108$param .= $hookmanager->resPrint;
1111$arrayofmassactions = array(
1112 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1113 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1115if ($permissiontosendbymail) {
1116 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1118if ($permissiontovalidate) {
1119 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1121if ($permissiontoclose) {
1122 $arrayofmassactions[
'presign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1123 $arrayofmassactions[
'nopresign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1124 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1126if ($permissiontodelete) {
1127 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1130if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1131 $arrayofmassactions = array();
1133$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1135$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1136if (!empty($socid)) {
1137 $url .=
'&socid='.$socid;
1140$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'));
1141$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'));
1143$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1146print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1147if ($optioncss !=
'') {
1148 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1150print
'<input type="hidden" name="token" value="'.newToken().
'">';
1151print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1152print
'<input type="hidden" name="action" value="list">';
1153print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1154print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1155print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1156print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1157print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1159print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1161$topicmail =
"SendPropalRef";
1162$modelmail =
"propal_send";
1163$objecttmp =
new Propal($db);
1164$trackid =
'pro'.$object->id;
1165include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1167if ($massaction ==
'prevalidate') {
1168 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1171if ($massaction ==
'presign') {
1172 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1175if ($massaction ==
'nopresign') {
1176 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1180 foreach ($fieldstosearchall as $key => $val) {
1181 $fieldstosearchall[$key] = $langs->trans($val);
1183 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1191if ($user->hasRight(
'user',
'user',
'lire')) {
1192 $langs->load(
"commercial");
1193 $moreforfilter .=
'<div class="divsearchfield">';
1194 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1195 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1196 $moreforfilter .=
'</div>';
1199if ($user->hasRight(
'user',
'user',
'lire')) {
1200 $moreforfilter .=
'<div class="divsearchfield">';
1201 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1202 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers((empty($search_user) ? -2 : 0),
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1203 $moreforfilter .=
'</div>';
1206if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1207 $searchCategoryProductOperator = -1;
1208 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1209 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1211 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1213if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1214 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1215 $moreforfilter .=
'<div class="divsearchfield">';
1216 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1217 $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'));
1218 $moreforfilter .=
'</div>';
1220if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) {
1221 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1223 $moreforfilter .=
'<div class="divsearchfield">';
1224 $tmptitle = $langs->trans(
'Warehouse');
1225 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1226 $moreforfilter .=
'</div>';
1228$parameters = array();
1229$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1230if (empty($reshook)) {
1231 $moreforfilter .= $hookmanager->resPrint;
1233 $moreforfilter = $hookmanager->resPrint;
1236if (!empty($moreforfilter)) {
1237 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1238 print $moreforfilter;
1242$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1243$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1244$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1246print
'<div class="div-table-responsive">';
1247print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1249print
'<tr class="liste_titre_filter">';
1253 print
'<td class="liste_titre" align="middle">';
1254 $searchpicto = $form->showFilterButtons(
'left');
1259if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1260 print
'<td class="liste_titre">';
1261 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1264if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1265 print
'<td class="liste_titre">';
1266 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1269if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1270 print
'<td class="liste_titre">';
1271 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1274if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1275 print
'<td class="liste_titre">';
1276 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1279if (!empty($arrayfields[
's.nom'][
'checked'])) {
1280 print
'<td class="liste_titre" align="left">';
1281 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1284if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1285 print
'<td class="liste_titre" align="left">';
1286 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1289if (!empty($arrayfields[
's.town'][
'checked'])) {
1290 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1292if (!empty($arrayfields[
's.zip'][
'checked'])) {
1293 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1296if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1297 print
'<td class="liste_titre">';
1298 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1302if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1303 print
'<td class="liste_titre" align="center">';
1304 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1308if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1309 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1310 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'maxwidth100', 1);
1315if (!empty($arrayfields[
'p.date'][
'checked'])) {
1316 print
'<td class="liste_titre center">';
1317 print
'<div class="nowrapfordate">';
1318 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1320 print
'<div class="nowrapfordate">';
1321 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1326if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1327 print
'<td class="liste_titre center">';
1328 print
'<div class="nowrapfordate">';
1329 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'));
1331 print
'<div class="nowrapfordate">';
1332 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'));
1337if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1338 print
'<td class="liste_titre center">';
1339 print
'<div class="nowrapfordate">';
1340 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'));
1342 print
'<div class="nowrapfordate">';
1343 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'));
1348if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1349 print
'<td class="liste_titre center">';
1350 print
'<div class="nowrapfordate">';
1351 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'));
1353 print
'<div class="nowrapfordate">';
1354 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'));
1359if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1360 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1361 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1366if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1367 print
'<td class="liste_titre">';
1368 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1372if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1373 print
'<td class="liste_titre">';
1374 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1378if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1379 print
'<td class="liste_titre">';
1380 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1384if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1385 print
'<td class="liste_titre">';
1386 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1389if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1391 print
'<td class="liste_titre right">';
1392 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1395if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1397 print
'<td class="liste_titre right">';
1398 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1401if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1403 print
'<td class="liste_titre right">';
1404 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1407if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1409 print
'<td class="liste_titre right">';
1412if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1414 print
'<td class="liste_titre right">';
1417if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1419 print
'<td class="liste_titre">';
1420 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1423if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1425 print
'<td class="liste_titre">';
1426 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1429if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1431 print
'<td class="liste_titre right">';
1432 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1435if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1437 print
'<td class="liste_titre right">';
1438 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1441if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1443 print
'<td class="liste_titre right">';
1444 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1447if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1449 print
'<td class="liste_titre right">';
1452if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1454 print
'<td class="liste_titre right">';
1457if (!empty($arrayfields[
'u.login'][
'checked'])) {
1459 print
'<td class="liste_titre">';
1460 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1463if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1464 print
'<td class="liste_titre"></td>';
1466if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1467 print
'<td class="liste_titre right">';
1470if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1471 print
'<td class="liste_titre right">';
1474if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1475 print
'<td class="liste_titre right">';
1478if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1479 print
'<td class="liste_titre right">';
1483include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1486$parameters = array(
'arrayfields' => $arrayfields);
1487$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1488print $hookmanager->resPrint;
1490if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1491 print
'<td class="liste_titre">';
1495if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1496 print
'<td class="liste_titre">';
1500if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1501 print
'<td class="liste_titre">';
1504if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1506 print
'<td class="liste_titre">';
1507 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1510if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1512 print
'<td class="liste_titre">';
1516if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1517 print
'<td class="liste_titre maxwidthonsmartphone center">';
1518 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1522if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1523 print
'<td class="liste_titre center parentonrightofpage">';
1524 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1529 print
'<td class="liste_titre" align="middle">';
1530 $searchpicto = $form->showFilterButtons();
1546print
'<tr class="liste_titre">';
1548 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1549 $totalarray[
'nbfield']++;
1551if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1552 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1553 $totalarray[
'nbfield']++;
1555if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1556 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1557 $totalarray[
'nbfield']++;
1559if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1561 $totalarray[
'nbfield']++;
1563if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1565 $totalarray[
'nbfield']++;
1567if (!empty($arrayfields[
's.nom'][
'checked'])) {
1568 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1569 $totalarray[
'nbfield']++;
1571if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1573 $totalarray[
'nbfield']++;
1575if (!empty($arrayfields[
's.town'][
'checked'])) {
1576 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1577 $totalarray[
'nbfield']++;
1579if (!empty($arrayfields[
's.zip'][
'checked'])) {
1580 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1581 $totalarray[
'nbfield']++;
1583if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1584 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1585 $totalarray[
'nbfield']++;
1587if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1588 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1589 $totalarray[
'nbfield']++;
1591if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1592 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1593 $totalarray[
'nbfield']++;
1595if (!empty($arrayfields[
'p.date'][
'checked'])) {
1596 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1597 $totalarray[
'nbfield']++;
1599if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1600 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1601 $totalarray[
'nbfield']++;
1603if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1604 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1605 $totalarray[
'nbfield']++;
1607if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1608 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1609 $totalarray[
'nbfield']++;
1611if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1612 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1613 $totalarray[
'nbfield']++;
1615if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1616 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1617 $totalarray[
'nbfield']++;
1619if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1620 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1621 $totalarray[
'nbfield']++;
1623if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1624 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1625 $totalarray[
'nbfield']++;
1627if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1628 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1629 $totalarray[
'nbfield']++;
1631if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1632 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1633 $totalarray[
'nbfield']++;
1635if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1636 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1637 $totalarray[
'nbfield']++;
1639if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1640 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1641 $totalarray[
'nbfield']++;
1643if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1644 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1645 $totalarray[
'nbfield']++;
1647if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1648 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1649 $totalarray[
'nbfield']++;
1651if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1652 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1653 $totalarray[
'nbfield']++;
1655if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1657 $totalarray[
'nbfield']++;
1659if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1660 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1661 $totalarray[
'nbfield']++;
1663if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1664 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1665 $totalarray[
'nbfield']++;
1667if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1669 $totalarray[
'nbfield']++;
1671if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1672 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1673 $totalarray[
'nbfield']++;
1675if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1676 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1677 $totalarray[
'nbfield']++;
1679if (!empty($arrayfields[
'u.login'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1681 $totalarray[
'nbfield']++;
1683if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1685 $totalarray[
'nbfield']++;
1687if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1688 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1689 $totalarray[
'nbfield']++;
1691if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1693 $totalarray[
'nbfield']++;
1695if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1697 $totalarray[
'nbfield']++;
1699if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1700 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1701 $totalarray[
'nbfield']++;
1704include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1707 'arrayfields' => $arrayfields,
1709 'sortfield' => $sortfield,
1710 'sortorder' => $sortorder,
1711 'totalarray' => &$totalarray,
1714$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1716print $hookmanager->resPrint;
1717if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1718 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1719 $totalarray[
'nbfield']++;
1721if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1723 $totalarray[
'nbfield']++;
1725if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1726 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1727 $totalarray[
'nbfield']++;
1729if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1730 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1731 $totalarray[
'nbfield']++;
1733if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1734 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1735 $totalarray[
'nbfield']++;
1738if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1739 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1742if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1743 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1744 $totalarray[
'nbfield']++;
1747 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1748 $totalarray[
'nbfield']++;
1757$with_margin_info =
false;
1758if (isModEnabled(
'margin') && (
1759 !empty($arrayfields[
'total_pa'][
'checked'])
1760 || !empty($arrayfields[
'total_margin'][
'checked'])
1761 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1762 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1765 $with_margin_info =
true;
1772$savnbfield = $totalarray[
'nbfield'];
1773$totalarray = array();
1774$totalarray[
'nbfield'] = 0;
1775$imaxinloop = ($limit ? min($num, $limit) : $num);
1776while ($i < $imaxinloop) {
1777 $obj = $db->fetch_object($resql);
1781 if ($search_option) {
1782 $param .=
"&search_option=".urlencode($search_option);
1785 $objectstatic->id = $obj->rowid;
1786 $objectstatic->ref = $obj->ref;
1787 $objectstatic->ref_customer = $obj->ref_client;
1788 $objectstatic->note_public = $obj->note_public;
1789 $objectstatic->note_private = $obj->note_private;
1790 $objectstatic->statut = $obj->status;
1791 $objectstatic->status = $obj->status;
1793 $companystatic->id = $obj->socid;
1794 $companystatic->name = $obj->name;
1795 $companystatic->name_alias = $obj->alias;
1796 $companystatic->client = $obj->client;
1797 $companystatic->fournisseur = $obj->fournisseur;
1798 $companystatic->code_client = $obj->code_client;
1799 $companystatic->email = $obj->email;
1800 $companystatic->phone = $obj->phone;
1801 $companystatic->address = $obj->address;
1802 $companystatic->zip = $obj->zip;
1803 $companystatic->town = $obj->town;
1804 $companystatic->country_code = $obj->country_code;
1806 $projectstatic->id = $obj->project_id;
1807 $projectstatic->ref = $obj->project_ref;
1808 $projectstatic->title = $obj->project_label;
1810 $totalInvoicedHT = 0;
1811 $totalInvoicedTTC = 0;
1812 $multicurrency_totalInvoicedHT = 0;
1813 $multicurrency_totalInvoicedTTC = 0;
1815 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1817 if (!empty($TInvoiceData)) {
1818 foreach ($TInvoiceData as $invoiceData) {
1820 $invoice->fetch($invoiceData->facid);
1826 $totalInvoicedHT += $invoice->total_ht;
1827 $totalInvoicedTTC += $invoice->total_ttc;
1828 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1829 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1833 $marginInfo = array();
1834 if ($with_margin_info) {
1835 $objectstatic->fetch_lines();
1836 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1837 $total_ht += $obj->total_ht;
1838 $total_margin += $marginInfo[
'total_margin'];
1841 if ($mode ==
'kanban') {
1843 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1844 print
'<div class="box-flex-container kanban">';
1847 $objectstatic->thirdparty = $companystatic;
1848 $userstatic->fetch($obj->fk_user_author);
1849 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1850 print $objectstatic->getKanbanView(
'', $arrayofparams);
1851 if ($i == ($imaxinloop - 1)) {
1856 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1860 print
'<td class="nowrap" align="center">';
1861 if ($massactionbutton || $massaction) {
1863 if (in_array($obj->rowid, $arrayofselected)) {
1866 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1870 $totalarray[
'nbfield']++;
1874 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1875 print
'<td class="nowraponall">';
1877 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1879 print
'<td class="nobordernopadding nowraponall">';
1880 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset(
$conf->global->PROPAL_LIST_SHOW_NOTES) ?
$conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1885 $warnornote .=
img_warning($langs->trans(
"Late"));
1888 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1893 print
'<td width="16" class="nobordernopadding right">';
1896 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1897 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1898 print
'</td></tr></table>';
1902 $totalarray[
'nbfield']++;
1906 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1908 print
'<td class="nowrap tdoverflowmax200">';
1912 $totalarray[
'nbfield']++;
1916 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1918 print
'<td class="nowraponall">';
1919 if ($obj->project_id > 0) {
1920 print $projectstatic->getNomUrl(1);
1924 $totalarray[
'nbfield']++;
1928 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1930 print
'<td class="nowrap">';
1931 if ($obj->project_id > 0) {
1936 $totalarray[
'nbfield']++;
1941 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1942 print
'<td class="tdoverflowmax150">';
1943 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1946 $totalarray[
'nbfield']++;
1951 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1952 print
'<td class="tdoverflowmax200">';
1956 $totalarray[
'nbfield']++;
1961 if (!empty($arrayfields[
's.town'][
'checked'])) {
1962 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1966 $totalarray[
'nbfield']++;
1970 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1971 print
'<td class="nocellnopadd">';
1975 $totalarray[
'nbfield']++;
1979 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1980 print
"<td>".$obj->state_name.
"</td>\n";
1982 $totalarray[
'nbfield']++;
1986 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1987 $tmparray =
getCountry($obj->fk_pays,
'all');
1988 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray[
'label']).
'">';
1989 print $tmparray[
'label'];
1992 $totalarray[
'nbfield']++;
1996 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1997 if (!is_array($typenArray) || empty($typenArray)) {
1998 $typenArray = $formcompany->typent_array(1);
2001 print
'<td class="center">';
2002 if (!empty($obj->typent_code)) {
2003 print $typenArray[$obj->typent_code];
2007 $totalarray[
'nbfield']++;
2012 if (!empty($arrayfields[
'p.date'][
'checked'])) {
2013 print
'<td class="center">';
2017 $totalarray[
'nbfield']++;
2022 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
2024 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
2027 print
'<td> </td>';
2030 $totalarray[
'nbfield']++;
2034 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2035 if ($obj->ddelivery) {
2036 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2039 print
'<td> </td>';
2042 $totalarray[
'nbfield']++;
2046 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2047 if ($obj->dsignature) {
2048 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2051 print
'<td> </td>';
2054 $totalarray[
'nbfield']++;
2058 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2059 print
'<td class="center">';
2060 $form->form_availability(0, $obj->availability,
'none', 1);
2063 $totalarray[
'nbfield']++;
2067 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2069 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2072 $totalarray[
'nbfield']++;
2076 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2077 $labelInputReason =
'';
2078 if ($obj->fk_input_reason > 0) {
2079 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2081 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2085 $totalarray[
'nbfield']++;
2089 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2091 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2094 $totalarray[
'nbfield']++;
2098 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2100 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2103 $totalarray[
'nbfield']++;
2107 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2108 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2110 $totalarray[
'nbfield']++;
2113 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2115 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2116 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2118 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2122 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2123 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2125 $totalarray[
'nbfield']++;
2128 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2130 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2131 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2133 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2137 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2138 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2140 $totalarray[
'nbfield']++;
2143 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2145 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2146 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2148 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2152 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2153 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2155 $totalarray[
'nbfield']++;
2158 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2160 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2161 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2163 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2167 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2168 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2170 $totalarray[
'nbfield']++;
2173 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2175 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2176 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2178 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2182 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2183 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2185 $totalarray[
'nbfield']++;
2190 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2191 print
'<td class="nowrap">';
2192 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2195 $totalarray[
'nbfield']++;
2199 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2200 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2202 $totalarray[
'nbfield']++;
2206 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2207 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2209 $totalarray[
'nbfield']++;
2213 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2214 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2216 $totalarray[
'nbfield']++;
2220 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2221 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2223 $totalarray[
'nbfield']++;
2227 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2228 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2230 $totalarray[
'nbfield']++;
2234 $userstatic->id = $obj->fk_user_author;
2235 $userstatic->login = $obj->login;
2236 $userstatic->lastname = $obj->lastname;
2237 $userstatic->firstname = $obj->firstname;
2238 $userstatic->email = $obj->user_email;
2239 $userstatic->status = $obj->user_statut;
2240 $userstatic->entity = $obj->user_entity;
2241 $userstatic->photo = $obj->photo;
2242 $userstatic->office_phone = $obj->office_phone;
2243 $userstatic->office_fax = $obj->office_fax;
2244 $userstatic->user_mobile = $obj->user_mobile;
2245 $userstatic->job = $obj->job;
2246 $userstatic->gender = $obj->gender;
2249 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2250 print
'<td class="tdoverflowmax150">';
2251 if ($userstatic->id) {
2252 print $userstatic->getNomUrl(-1);
2256 $totalarray[
'nbfield']++;
2260 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2262 print
'<td class="tdoverflowmax125">';
2263 if ($obj->socid > 0) {
2264 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2265 if ($listsalesrepresentatives < 0) {
2268 $nbofsalesrepresentative = count($listsalesrepresentatives);
2269 if ($nbofsalesrepresentative > 6) {
2271 print $nbofsalesrepresentative;
2272 } elseif ($nbofsalesrepresentative > 0) {
2273 $userstatic =
new User($db);
2275 foreach ($listsalesrepresentatives as $val) {
2276 $userstatic->id = $val[
'id'];
2277 $userstatic->lastname = $val[
'lastname'];
2278 $userstatic->firstname = $val[
'firstname'];
2279 $userstatic->email = $val[
'email'];
2280 $userstatic->status = $val[
'statut'];
2281 $userstatic->entity = $val[
'entity'];
2282 $userstatic->photo = $val[
'photo'];
2283 $userstatic->login = $val[
'login'];
2284 $userstatic->office_phone = $val[
'office_phone'];
2285 $userstatic->office_fax = $val[
'office_fax'];
2286 $userstatic->user_mobile = $val[
'user_mobile'];
2287 $userstatic->job = $val[
'job'];
2288 $userstatic->gender = $val[
'gender'];
2290 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2292 if ($j < $nbofsalesrepresentative) {
2304 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2310 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2312 $totalarray[
'nbfield']++;
2316 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2317 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2319 $totalarray[
'nbfield']++;
2322 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2324 $totalarray[
'val'][
'total_margin'] = $total_margin;
2327 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2328 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2330 $totalarray[
'nbfield']++;
2334 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2335 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2337 $totalarray[
'nbfield']++;
2340 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2342 if ($i >= $imaxinloop - 1) {
2343 if (!empty($total_ht)) {
2344 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2346 $totalarray[
'val'][
'total_mark_rate'] =
'';
2352 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2354 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2355 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2356 print $hookmanager->resPrint;
2358 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2359 print
'<td align="center" class="nowrap">';
2360 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2363 $totalarray[
'nbfield']++;
2367 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2368 print
'<td align="center" class="nowrap">';
2369 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2372 $totalarray[
'nbfield']++;
2376 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2377 print
'<td align="center" class="nowrap">';
2378 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2381 $totalarray[
'nbfield']++;
2385 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2386 print
'<td class="sensiblehtmlcontent center">';
2390 $totalarray[
'nbfield']++;
2394 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2395 print
'<td class="sensiblehtmlcontent center">';
2399 $totalarray[
'nbfield']++;
2404 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2405 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2407 $totalarray[
'nbfield']++;
2412 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2413 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2415 $totalarray[
'nbfield']++;
2420 print
'<td class="nowrap" align="center">';
2421 if ($massactionbutton || $massaction) {
2423 if (in_array($obj->rowid, $arrayofselected)) {
2426 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2430 $totalarray[
'nbfield']++;
2442include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2447 foreach ($arrayfields as $key => $val) {
2448 if (!empty($val[
'checked'])) {
2452 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2457$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2458$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2459print $hookmanager->resPrint;
2461print
'</table>'.
"\n";
2464print
'</form>'.
"\n";
2466if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2467 $hidegeneratedfilelistifempty = 1;
2468 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2469 $hidegeneratedfilelistifempty = 0;
2472 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2476 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2477 $urlsource .= str_replace(
'&',
'&', $param);
2479 $filedir = $diroutputmassaction;
2480 $genallowed = $permissiontoread;
2481 $delallowed = $permissiontoadd;
2483 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage projects.
Class to manage proposals.
const STATUS_VALIDATED
Validated status.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.