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),
299if (!$user->hasRight(
'societe',
'client',
'voir')) {
300 $search_sale = $user->id;
304include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
307$permissiontoread = $user->hasRight(
'propal',
'lire');
308$permissiontoadd = $user->hasRight(
'propal',
'creer');
309$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
311 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
312 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
313 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
315 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
316 $permissiontoclose = $user->hasRight(
'propal',
'creer');
317 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
326if (
GETPOST(
'cancel',
'alpha')) {
330if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
335$search_code_client =
'';
337$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
338$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
343if (empty($reshook)) {
345 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
348 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
352 $search_refcustomer =
'';
353 $search_refproject =
'';
354 $search_project =
'';
355 $search_societe =
'';
356 $search_societe_alias =
'';
357 $search_montant_ht =
'';
358 $search_montant_vat =
'';
359 $search_montant_ttc =
'';
360 $search_warehouse =
'';
361 $search_multicurrency_code =
'';
362 $search_multicurrency_tx =
'';
363 $search_multicurrency_montant_ht =
'';
364 $search_multicurrency_montant_vat =
'';
365 $search_multicurrency_montant_ttc =
'';
367 $search_product_category =
'';
372 $search_country =
'';
373 $search_type_thirdparty =
'';
374 $search_date_startday =
'';
375 $search_date_startmonth =
'';
376 $search_date_startyear =
'';
377 $search_date_endday =
'';
378 $search_date_endmonth =
'';
379 $search_date_endyear =
'';
380 $search_date_start =
'';
381 $search_date_end =
'';
382 $search_date_end_startday =
'';
383 $search_date_end_startmonth =
'';
384 $search_date_end_startyear =
'';
385 $search_date_end_endday =
'';
386 $search_date_end_endmonth =
'';
387 $search_date_end_endyear =
'';
388 $search_date_end_start =
'';
389 $search_date_end_end =
'';
390 $search_date_delivery_startday =
'';
391 $search_date_delivery_startmonth =
'';
392 $search_date_delivery_startyear =
'';
393 $search_date_delivery_endday =
'';
394 $search_date_delivery_endmonth =
'';
395 $search_date_delivery_endyear =
'';
396 $search_date_delivery_start =
'';
397 $search_date_delivery_end =
'';
398 $search_availability =
'';
401 $search_fk_cond_reglement =
'';
402 $search_fk_shipping_method =
'';
403 $search_fk_input_reason =
'';
404 $search_fk_mode_reglement =
'';
405 $search_date_signature_startday =
'';
406 $search_date_signature_startmonth =
'';
407 $search_date_signature_startyear =
'';
408 $search_date_signature_endday =
'';
409 $search_date_signature_endmonth =
'';
410 $search_date_signature_endyear =
'';
411 $search_date_signature_start =
'';
412 $search_date_signature_end =
'';
413 $search_import_key =
'';
414 $search_categ_cus = 0;
418 $search_array_options = array();
424 $objectclass =
'Propal';
425 $objectlabel =
'Proposals';
426 $uploaddir =
$conf->propal->multidir_output[
$conf->entity];
427 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
430if ($action ==
'validate' && $permissiontovalidate) {
431 if (
GETPOST(
'confirm') ==
'yes') {
432 $tmpproposal =
new Propal($db);
434 foreach ($toselect as $checked) {
435 if ($tmpproposal->fetch($checked) > 0) {
436 if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
437 if ($tmpproposal->valid($user) > 0) {
438 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
444 $langs->load(
"errors");
445 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
461if ($action ==
"sign" && $permissiontoclose) {
462 if (
GETPOST(
'confirm') ==
'yes') {
463 $tmpproposal =
new Propal($db);
465 foreach ($toselect as $checked) {
466 if ($tmpproposal->fetch($checked) > 0) {
467 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
468 $tmpproposal->status = $tmpproposal::STATUS_SIGNED;
469 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
470 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
476 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
492if ($action ==
"nosign" && $permissiontoclose) {
493 if (
GETPOST(
'confirm') ==
'yes') {
494 $tmpproposal =
new Propal($db);
496 foreach ($toselect as $checked) {
497 if ($tmpproposal->fetch($checked) > 0) {
498 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
499 $tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
500 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
501 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
507 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
524if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
527 $objecttmp =
new $objectclass($db);
529 foreach ($toselect as $toselectid) {
530 $result = $objecttmp->fetch($toselectid);
532 $result = $objecttmp->classifyBilled($user, 0);
563$form =
new Form($db);
568if (isModEnabled(
'margin')) {
571$companystatic =
new Societe($db);
572$projectstatic =
new Project($db);
575$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
576$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
579if ($search_all !==
'') {
580 $sql =
'SELECT DISTINCT';
582$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,';
583$sql .=
" typent.code as typent_code,";
584$sql .=
" ava.rowid as availability,";
585$sql .=
" country.code as country_code,";
586$sql .=
" state.code_departement as state_code, state.nom as state_name,";
587$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,';
588$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
589$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
590$sql .=
' p.date_signature as dsignature,';
591$sql .=
' p.note_public, p.note_private,';
592$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
593$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
594$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';
596if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
597 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
598 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
602$parameters = array();
603$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
604$sql .= $hookmanager->resPrint;
605$sql = preg_replace(
'/, $/',
'', $sql);
609$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
610$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
611$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
612$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
614$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
615if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
616 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
619 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
621$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
623$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
625$parameters = array();
626$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
627$sql .= $hookmanager->resPrint;
630$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
640if ($search_country) {
641 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
643if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
644 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
649if ($search_refcustomer) {
652if ($search_refproject) {
655if ($search_project) {
658if ($search_availability) {
659 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
662if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
663 if ($societe_add_ref_in_list == 1) {
664 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
666 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
669 if ($search_societe) {
670 if ($societe_add_ref_in_list == 1) {
671 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
676 if ($search_societe_alias) {
681if ($societe_add_ref_in_list == 1 && $search_code_client && !$search_societe) {
685 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
687if ($search_montant_ht !=
'') {
690if ($search_montant_vat !=
'') {
693if ($search_montant_ttc !=
'') {
696if ($search_warehouse !=
'' && $search_warehouse > 0) {
699if ($search_multicurrency_code !=
'') {
700 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
702if ($search_multicurrency_tx !=
'') {
703 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
705if ($search_multicurrency_montant_ht !=
'') {
706 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
708if ($search_multicurrency_montant_vat !=
'') {
709 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
711if ($search_multicurrency_montant_ttc !=
'') {
712 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
715 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
717if ($search_fk_cond_reglement > 0) {
718 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
720if ($search_fk_shipping_method > 0) {
721 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
723if ($search_fk_input_reason > 0) {
724 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
726if ($search_fk_mode_reglement > 0) {
727 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
730 $sql .=
' AND s.rowid = '.((int) $socid);
732if ($search_status !=
'' && $search_status !=
'-1') {
733 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
735if ($search_date_start) {
736 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
738if ($search_date_end) {
739 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
741if ($search_date_end_start) {
742 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
744if ($search_date_end_end) {
745 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
747if ($search_date_delivery_start) {
748 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
750if ($search_date_delivery_end) {
751 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
753if ($search_date_signature_start) {
754 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
756if ($search_date_signature_end) {
757 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
759if ($search_note_public) {
760 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
762if ($search_import_key) {
766if ($search_user > 0) {
767 $sql .=
" AND EXISTS (";
768 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
769 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
770 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
771 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
772 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
775if ($search_sale && $search_sale !=
'-1') {
776 if ($search_sale == -2) {
777 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
778 } elseif ($search_sale > 0) {
779 $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).
")";
783$searchCategoryCustomerOperator = -1;
784$searchCategoryCustomerList = array($search_categ_cus);
785if (!empty($searchCategoryCustomerList)) {
786 $searchCategoryCustomerSqlList = array();
787 $listofcategoryid =
'';
788 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
789 if (intval($searchCategoryCustomer) == -2) {
790 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
791 } elseif (intval($searchCategoryCustomer) > 0) {
792 if ($searchCategoryCustomerOperator == 0) {
793 $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).
")";
795 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
799 if ($listofcategoryid) {
800 $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).
"))";
802 if ($searchCategoryCustomerOperator == 1) {
803 if (!empty($searchCategoryCustomerSqlList)) {
804 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
807 if (!empty($searchCategoryCustomerSqlList)) {
808 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
813$searchCategoryProductOperator = -1;
814$searchCategoryProductList = array($search_product_category);
815if (!empty($searchCategoryProductList)) {
816 $searchCategoryProductSqlList = array();
817 $listofcategoryid =
'';
818 foreach ($searchCategoryProductList as $searchCategoryProduct) {
819 if (intval($searchCategoryProduct) == -2) {
820 $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)";
821 } elseif (intval($searchCategoryProduct) > 0) {
822 if ($searchCategoryProductOperator == 0) {
823 $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).
")";
825 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
829 if ($listofcategoryid) {
830 $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).
"))";
832 if ($searchCategoryProductOperator == 1) {
833 if (!empty($searchCategoryProductSqlList)) {
834 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
837 if (!empty($searchCategoryProductSqlList)) {
838 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
842if ($search_option ==
'late') {
843 $sql .=
" AND p.fin_validite < '".$db->idate(
dol_now() -
$conf->propal->cloture->warning_delay).
"'";
846include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
850$parameters = array();
851$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
852$sql .= $hookmanager->resPrint;
855$parameters = array();
856$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
857$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
860$nbtotalofrecords =
'';
863 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
864 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
865 $resql = $db->query($sqlforcount);
867 $objforcount = $db->fetch_object($resql);
868 $nbtotalofrecords = $objforcount->nbtotalofrecords;
873 if (($page * $limit) > $nbtotalofrecords) {
881$sql .= $db->order($sortfield, $sortorder);
882$sql .=
', p.ref DESC';
884 $sql .= $db->plimit($limit + 1, $offset);
887$resql = $db->query($sql);
893$objectstatic =
new Propal($db);
894$userstatic =
new User($db);
899 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
900 if (empty($search_societe)) {
901 $search_societe = $soc->name;
904 $title = $langs->trans(
'Proposals');
907$num = $db->num_rows($resql);
909$arrayofselected = is_array($toselect) ? $toselect : array();
911if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
912 $obj = $db->fetch_object($resql);
916 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
920$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
921llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
923$param =
'&search_status='.urlencode($search_status);
925 $param .=
'&mode='.urlencode($mode);
927if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
928 $param .=
'&contextpage='.urlencode($contextpage);
930if ($limit > 0 && $limit !=
$conf->liste_limit) {
931 $param .=
'&limit='.((int) $limit);
933if ($optioncss !=
'') {
934 $param .=
'&optioncss='.urlencode($optioncss);
937 $param .=
'&socid='.urlencode((
string) ($socid));
940 $param .=
'&search_all='.urlencode($search_all);
942if ($search_date_startday) {
943 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
945if ($search_date_startmonth) {
946 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
948if ($search_date_startyear) {
949 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
951if ($search_date_endday) {
952 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
954if ($search_date_endmonth) {
955 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
957if ($search_date_endyear) {
958 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
960if ($search_date_end_startday) {
961 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
963if ($search_date_end_startmonth) {
964 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
966if ($search_date_end_startyear) {
967 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
969if ($search_date_end_endday) {
970 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
972if ($search_date_end_endmonth) {
973 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
975if ($search_date_end_endyear) {
976 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
978if ($search_date_delivery_startday) {
979 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
981if ($search_date_delivery_startmonth) {
982 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
984if ($search_date_delivery_startyear) {
985 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
987if ($search_date_delivery_endday) {
988 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
990if ($search_date_delivery_endmonth) {
991 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
993if ($search_date_delivery_endyear) {
994 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
997 $param .=
'&search_ref='.urlencode($search_ref);
999if ($search_refcustomer) {
1000 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1002if ($search_refproject) {
1003 $param .=
'&search_refproject='.urlencode($search_refproject);
1005if ($search_societe) {
1006 $param .=
'&search_societe='.urlencode($search_societe);
1008if ($search_societe_alias) {
1009 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1011if ($search_user > 0) {
1012 $param .=
'&search_user='.urlencode((
string) ($search_user));
1014if ($search_sale > 0) {
1015 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1017if ($search_montant_ht) {
1018 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1020if ($search_multicurrency_code !=
'') {
1021 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1023if ($search_multicurrency_tx !=
'') {
1024 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1026if ($search_multicurrency_montant_ht !=
'') {
1027 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1029if ($search_multicurrency_montant_vat !=
'') {
1030 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1032if ($search_multicurrency_montant_ttc !=
'') {
1033 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1036 $param .=
'&search_login='.urlencode($search_login);
1039 $param .=
'&search_town='.urlencode($search_town);
1042 $param .=
'&search_zip='.urlencode($search_zip);
1044if ($search_categ_cus > 0) {
1045 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1047if ($search_product_category !=
'') {
1048 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1050if ($search_fk_cond_reglement > 0) {
1051 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1053if ($search_fk_shipping_method > 0) {
1054 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1056if ($search_fk_input_reason > 0) {
1057 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1059if ($search_fk_mode_reglement > 0) {
1060 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1062if ($search_type_thirdparty > 0) {
1063 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1066 $param .=
'&search_town='.urlencode($search_town);
1069 $param .=
'&search_zip='.urlencode($search_zip);
1072 $param .=
'&search_state='.urlencode($search_state);
1075 $param .=
'&search_town='.urlencode($search_town);
1077if ($search_country) {
1078 $param .=
'&search_country='.urlencode((
string) ($search_country));
1080if ($search_date_signature_startday) {
1081 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1083if ($search_date_signature_startmonth) {
1084 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1086if ($search_date_signature_startyear) {
1087 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1089if ($search_date_signature_endday) {
1090 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1092if ($search_date_signature_endmonth) {
1093 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1095if ($search_date_signature_endyear) {
1096 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1098if ($search_import_key !=
'') {
1099 $param .=
'&search_import_key='.urlencode($search_import_key);
1103include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1105$parameters = array(
'param' => &$param);
1106$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1107$param .= $hookmanager->resPrint;
1110$arrayofmassactions = array(
1111 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1112 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1114if ($permissiontosendbymail) {
1115 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1117if ($permissiontovalidate) {
1118 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1120if ($permissiontoclose) {
1121 $arrayofmassactions[
'presign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1122 $arrayofmassactions[
'nopresign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1123 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1125if ($permissiontodelete) {
1126 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1129if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1130 $arrayofmassactions = array();
1132$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1134$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1135if (!empty($socid)) {
1136 $url .=
'&socid='.$socid;
1139$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'));
1140$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'));
1142$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1145print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1146if ($optioncss !=
'') {
1147 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1149print
'<input type="hidden" name="token" value="'.newToken().
'">';
1150print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1151print
'<input type="hidden" name="action" value="list">';
1152print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1153print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1154print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1155print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1156print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1158print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1160$topicmail =
"SendPropalRef";
1161$modelmail =
"propal_send";
1162$objecttmp =
new Propal($db);
1163$trackid =
'pro'.$object->id;
1164include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1166if ($massaction ==
'prevalidate') {
1167 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1170if ($massaction ==
'presign') {
1171 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1174if ($massaction ==
'nopresign') {
1175 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1179 foreach ($fieldstosearchall as $key => $val) {
1180 $fieldstosearchall[$key] = $langs->trans($val);
1182 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1190if ($user->hasRight(
'user',
'user',
'lire')) {
1191 $langs->load(
"commercial");
1192 $moreforfilter .=
'<div class="divsearchfield">';
1193 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1194 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1195 $moreforfilter .=
'</div>';
1198if ($user->hasRight(
'user',
'user',
'lire')) {
1199 $moreforfilter .=
'<div class="divsearchfield">';
1200 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1201 $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');
1202 $moreforfilter .=
'</div>';
1205if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1206 $searchCategoryProductOperator = -1;
1207 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1208 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1210 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1212if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1213 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1214 $moreforfilter .=
'<div class="divsearchfield">';
1215 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1216 $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'));
1217 $moreforfilter .=
'</div>';
1219if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) {
1220 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1222 $moreforfilter .=
'<div class="divsearchfield">';
1223 $tmptitle = $langs->trans(
'Warehouse');
1224 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1225 $moreforfilter .=
'</div>';
1227$parameters = array();
1228$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1229if (empty($reshook)) {
1230 $moreforfilter .= $hookmanager->resPrint;
1232 $moreforfilter = $hookmanager->resPrint;
1235if (!empty($moreforfilter)) {
1236 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1237 print $moreforfilter;
1241$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1242$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1243$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1245print
'<div class="div-table-responsive">';
1246print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1248print
'<tr class="liste_titre_filter">';
1252 print
'<td class="liste_titre" align="middle">';
1253 $searchpicto = $form->showFilterButtons(
'left');
1258if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1259 print
'<td class="liste_titre">';
1260 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1263if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1264 print
'<td class="liste_titre">';
1265 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1268if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1269 print
'<td class="liste_titre">';
1270 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1273if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1274 print
'<td class="liste_titre">';
1275 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1278if (!empty($arrayfields[
's.nom'][
'checked'])) {
1279 print
'<td class="liste_titre" align="left">';
1280 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1283if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1284 print
'<td class="liste_titre" align="left">';
1285 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1288if (!empty($arrayfields[
's.town'][
'checked'])) {
1289 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1291if (!empty($arrayfields[
's.zip'][
'checked'])) {
1292 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1295if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1296 print
'<td class="liste_titre">';
1297 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1301if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1302 print
'<td class="liste_titre" align="center">';
1303 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1307if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1308 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1309 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);
1314if (!empty($arrayfields[
'p.date'][
'checked'])) {
1315 print
'<td class="liste_titre center">';
1316 print
'<div class="nowrapfordate">';
1317 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1319 print
'<div class="nowrapfordate">';
1320 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1325if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1326 print
'<td class="liste_titre center">';
1327 print
'<div class="nowrapfordate">';
1328 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'));
1330 print
'<div class="nowrapfordate">';
1331 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'));
1336if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1337 print
'<td class="liste_titre center">';
1338 print
'<div class="nowrapfordate">';
1339 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'));
1341 print
'<div class="nowrapfordate">';
1342 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'));
1347if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1348 print
'<td class="liste_titre center">';
1349 print
'<div class="nowrapfordate">';
1350 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'));
1352 print
'<div class="nowrapfordate">';
1353 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'));
1358if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1359 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1360 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1365if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1366 print
'<td class="liste_titre">';
1367 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1371if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1372 print
'<td class="liste_titre">';
1373 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1377if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1378 print
'<td class="liste_titre">';
1379 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1383if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1384 print
'<td class="liste_titre">';
1385 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1388if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1390 print
'<td class="liste_titre right">';
1391 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1394if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1396 print
'<td class="liste_titre right">';
1397 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1400if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1402 print
'<td class="liste_titre right">';
1403 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1406if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1408 print
'<td class="liste_titre right">';
1411if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1413 print
'<td class="liste_titre right">';
1416if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1418 print
'<td class="liste_titre">';
1419 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1422if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1424 print
'<td class="liste_titre">';
1425 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1428if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1430 print
'<td class="liste_titre right">';
1431 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1434if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1436 print
'<td class="liste_titre right">';
1437 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1440if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1442 print
'<td class="liste_titre right">';
1443 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1446if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1448 print
'<td class="liste_titre right">';
1451if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1453 print
'<td class="liste_titre right">';
1456if (!empty($arrayfields[
'u.login'][
'checked'])) {
1458 print
'<td class="liste_titre">';
1459 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1462if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1463 print
'<td class="liste_titre"></td>';
1465if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1466 print
'<td class="liste_titre right">';
1469if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1470 print
'<td class="liste_titre right">';
1473if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1474 print
'<td class="liste_titre right">';
1477if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1478 print
'<td class="liste_titre right">';
1482include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1485$parameters = array(
'arrayfields' => $arrayfields);
1486$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1487print $hookmanager->resPrint;
1489if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1490 print
'<td class="liste_titre">';
1494if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1495 print
'<td class="liste_titre">';
1499if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1500 print
'<td class="liste_titre">';
1503if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1505 print
'<td class="liste_titre">';
1506 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1509if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1511 print
'<td class="liste_titre">';
1515if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1516 print
'<td class="liste_titre maxwidthonsmartphone center">';
1517 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1521if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1522 print
'<td class="liste_titre center parentonrightofpage">';
1523 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1528 print
'<td class="liste_titre" align="middle">';
1529 $searchpicto = $form->showFilterButtons();
1545print
'<tr class="liste_titre">';
1547 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1548 $totalarray[
'nbfield']++;
1550if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1551 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1552 $totalarray[
'nbfield']++;
1554if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1555 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1556 $totalarray[
'nbfield']++;
1558if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1559 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1560 $totalarray[
'nbfield']++;
1562if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1563 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1564 $totalarray[
'nbfield']++;
1566if (!empty($arrayfields[
's.nom'][
'checked'])) {
1567 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1568 $totalarray[
'nbfield']++;
1570if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1571 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1572 $totalarray[
'nbfield']++;
1574if (!empty($arrayfields[
's.town'][
'checked'])) {
1575 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1576 $totalarray[
'nbfield']++;
1578if (!empty($arrayfields[
's.zip'][
'checked'])) {
1579 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1580 $totalarray[
'nbfield']++;
1582if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1583 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1584 $totalarray[
'nbfield']++;
1586if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1587 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1588 $totalarray[
'nbfield']++;
1590if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1591 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1592 $totalarray[
'nbfield']++;
1594if (!empty($arrayfields[
'p.date'][
'checked'])) {
1595 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1596 $totalarray[
'nbfield']++;
1598if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1599 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1600 $totalarray[
'nbfield']++;
1602if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1603 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1604 $totalarray[
'nbfield']++;
1606if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1607 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1608 $totalarray[
'nbfield']++;
1610if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1611 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1612 $totalarray[
'nbfield']++;
1614if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1615 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1616 $totalarray[
'nbfield']++;
1618if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1619 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1620 $totalarray[
'nbfield']++;
1622if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1623 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1624 $totalarray[
'nbfield']++;
1626if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1627 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1628 $totalarray[
'nbfield']++;
1630if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1631 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1632 $totalarray[
'nbfield']++;
1634if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1635 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1636 $totalarray[
'nbfield']++;
1638if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1639 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1640 $totalarray[
'nbfield']++;
1642if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1643 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1644 $totalarray[
'nbfield']++;
1646if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1647 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1648 $totalarray[
'nbfield']++;
1650if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1651 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1652 $totalarray[
'nbfield']++;
1654if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1655 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1656 $totalarray[
'nbfield']++;
1658if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1660 $totalarray[
'nbfield']++;
1662if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1663 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1664 $totalarray[
'nbfield']++;
1666if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1667 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1668 $totalarray[
'nbfield']++;
1670if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1671 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1672 $totalarray[
'nbfield']++;
1674if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1675 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1676 $totalarray[
'nbfield']++;
1678if (!empty($arrayfields[
'u.login'][
'checked'])) {
1679 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1680 $totalarray[
'nbfield']++;
1682if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1683 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1684 $totalarray[
'nbfield']++;
1686if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1687 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1688 $totalarray[
'nbfield']++;
1690if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1691 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1692 $totalarray[
'nbfield']++;
1694if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1696 $totalarray[
'nbfield']++;
1698if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1700 $totalarray[
'nbfield']++;
1703include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1706 'arrayfields' => $arrayfields,
1708 'sortfield' => $sortfield,
1709 'sortorder' => $sortorder,
1710 'totalarray' => &$totalarray,
1713$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1715print $hookmanager->resPrint;
1716if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1717 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1718 $totalarray[
'nbfield']++;
1720if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1721 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1722 $totalarray[
'nbfield']++;
1724if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1726 $totalarray[
'nbfield']++;
1728if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1729 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1730 $totalarray[
'nbfield']++;
1732if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1733 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1734 $totalarray[
'nbfield']++;
1737if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1738 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1741if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1742 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1743 $totalarray[
'nbfield']++;
1746 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1747 $totalarray[
'nbfield']++;
1756$with_margin_info =
false;
1757if (isModEnabled(
'margin') && (
1758 !empty($arrayfields[
'total_pa'][
'checked'])
1759 || !empty($arrayfields[
'total_margin'][
'checked'])
1760 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1761 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1764 $with_margin_info =
true;
1771$savnbfield = $totalarray[
'nbfield'];
1772$totalarray = array();
1773$totalarray[
'nbfield'] = 0;
1774$imaxinloop = ($limit ? min($num, $limit) : $num);
1775while ($i < $imaxinloop) {
1776 $obj = $db->fetch_object($resql);
1780 if ($search_option) {
1781 $param .=
"&search_option=".urlencode($search_option);
1784 $objectstatic->id = $obj->rowid;
1785 $objectstatic->ref = $obj->ref;
1786 $objectstatic->ref_customer = $obj->ref_client;
1787 $objectstatic->note_public = $obj->note_public;
1788 $objectstatic->note_private = $obj->note_private;
1789 $objectstatic->statut = $obj->status;
1790 $objectstatic->status = $obj->status;
1792 $companystatic->id = $obj->socid;
1793 $companystatic->name = $obj->name;
1794 $companystatic->name_alias = $obj->alias;
1795 $companystatic->client = $obj->client;
1796 $companystatic->fournisseur = $obj->fournisseur;
1797 $companystatic->code_client = $obj->code_client;
1798 $companystatic->email = $obj->email;
1799 $companystatic->phone = $obj->phone;
1800 $companystatic->address = $obj->address;
1801 $companystatic->zip = $obj->zip;
1802 $companystatic->town = $obj->town;
1803 $companystatic->country_code = $obj->country_code;
1805 $projectstatic->id = $obj->project_id;
1806 $projectstatic->ref = $obj->project_ref;
1807 $projectstatic->title = $obj->project_label;
1809 $totalInvoicedHT = 0;
1810 $totalInvoicedTTC = 0;
1811 $multicurrency_totalInvoicedHT = 0;
1812 $multicurrency_totalInvoicedTTC = 0;
1814 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1816 if (!empty($TInvoiceData)) {
1817 foreach ($TInvoiceData as $invoiceData) {
1819 $invoice->fetch($invoiceData->facid);
1825 $totalInvoicedHT += $invoice->total_ht;
1826 $totalInvoicedTTC += $invoice->total_ttc;
1827 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1828 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1832 $marginInfo = array();
1833 if ($with_margin_info) {
1834 $objectstatic->fetch_lines();
1835 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1836 $total_ht += $obj->total_ht;
1837 $total_margin += $marginInfo[
'total_margin'];
1840 if ($mode ==
'kanban') {
1842 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1843 print
'<div class="box-flex-container kanban">';
1846 $objectstatic->thirdparty = $companystatic;
1847 $userstatic->fetch($obj->fk_user_author);
1848 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1849 print $objectstatic->getKanbanView(
'', $arrayofparams);
1850 if ($i == ($imaxinloop - 1)) {
1855 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1859 print
'<td class="nowrap" align="center">';
1860 if ($massactionbutton || $massaction) {
1862 if (in_array($obj->rowid, $arrayofselected)) {
1865 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1869 $totalarray[
'nbfield']++;
1873 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1874 print
'<td class="nowraponall">';
1876 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1878 print
'<td class="nobordernopadding nowraponall">';
1879 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset(
$conf->global->PROPAL_LIST_SHOW_NOTES) ?
$conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1884 $warnornote .=
img_warning($langs->trans(
"Late"));
1887 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1892 print
'<td width="16" class="nobordernopadding right">';
1895 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1896 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1897 print
'</td></tr></table>';
1901 $totalarray[
'nbfield']++;
1905 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1907 print
'<td class="nowrap tdoverflowmax200">';
1911 $totalarray[
'nbfield']++;
1915 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1917 print
'<td class="nowraponall">';
1918 if ($obj->project_id > 0) {
1919 print $projectstatic->getNomUrl(1);
1923 $totalarray[
'nbfield']++;
1927 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1929 print
'<td class="nowrap">';
1930 if ($obj->project_id > 0) {
1935 $totalarray[
'nbfield']++;
1940 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1941 print
'<td class="tdoverflowmax150">';
1942 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1945 $totalarray[
'nbfield']++;
1950 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1951 print
'<td class="tdoverflowmax200">';
1955 $totalarray[
'nbfield']++;
1960 if (!empty($arrayfields[
's.town'][
'checked'])) {
1961 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1965 $totalarray[
'nbfield']++;
1969 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1970 print
'<td class="nocellnopadd">';
1974 $totalarray[
'nbfield']++;
1978 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1979 print
"<td>".$obj->state_name.
"</td>\n";
1981 $totalarray[
'nbfield']++;
1985 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1986 $tmparray =
getCountry($obj->fk_pays,
'all');
1987 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray[
'label']).
'">';
1988 print $tmparray[
'label'];
1991 $totalarray[
'nbfield']++;
1995 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1996 if (!is_array($typenArray) || empty($typenArray)) {
1997 $typenArray = $formcompany->typent_array(1);
2000 print
'<td class="center">';
2001 if (!empty($obj->typent_code)) {
2002 print $typenArray[$obj->typent_code];
2006 $totalarray[
'nbfield']++;
2011 if (!empty($arrayfields[
'p.date'][
'checked'])) {
2012 print
'<td class="center">';
2016 $totalarray[
'nbfield']++;
2021 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
2023 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
2026 print
'<td> </td>';
2029 $totalarray[
'nbfield']++;
2033 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2034 if ($obj->ddelivery) {
2035 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2038 print
'<td> </td>';
2041 $totalarray[
'nbfield']++;
2045 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2046 if ($obj->dsignature) {
2047 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2050 print
'<td> </td>';
2053 $totalarray[
'nbfield']++;
2057 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2058 print
'<td class="center">';
2059 $form->form_availability(0, $obj->availability,
'none', 1);
2062 $totalarray[
'nbfield']++;
2066 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2068 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2071 $totalarray[
'nbfield']++;
2075 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2076 $labelInputReason =
'';
2077 if ($obj->fk_input_reason > 0) {
2078 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2080 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2084 $totalarray[
'nbfield']++;
2088 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2090 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2093 $totalarray[
'nbfield']++;
2097 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2099 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2102 $totalarray[
'nbfield']++;
2106 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2107 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2109 $totalarray[
'nbfield']++;
2112 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2114 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2115 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2117 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2121 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2122 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2124 $totalarray[
'nbfield']++;
2127 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2129 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2130 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2132 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2136 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2137 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2139 $totalarray[
'nbfield']++;
2142 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2144 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2145 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2147 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2151 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2152 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2154 $totalarray[
'nbfield']++;
2157 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2159 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2160 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2162 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2166 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2167 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2169 $totalarray[
'nbfield']++;
2172 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2174 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2175 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2177 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2181 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2182 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2184 $totalarray[
'nbfield']++;
2189 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2190 print
'<td class="nowrap">';
2191 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2194 $totalarray[
'nbfield']++;
2198 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2199 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2201 $totalarray[
'nbfield']++;
2205 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2206 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2208 $totalarray[
'nbfield']++;
2212 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2213 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2215 $totalarray[
'nbfield']++;
2219 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2220 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2222 $totalarray[
'nbfield']++;
2226 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2227 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2229 $totalarray[
'nbfield']++;
2233 $userstatic->id = $obj->fk_user_author;
2234 $userstatic->login = $obj->login;
2235 $userstatic->lastname = $obj->lastname;
2236 $userstatic->firstname = $obj->firstname;
2237 $userstatic->email = $obj->user_email;
2238 $userstatic->status = $obj->user_statut;
2239 $userstatic->entity = $obj->user_entity;
2240 $userstatic->photo = $obj->photo;
2241 $userstatic->office_phone = $obj->office_phone;
2242 $userstatic->office_fax = $obj->office_fax;
2243 $userstatic->user_mobile = $obj->user_mobile;
2244 $userstatic->job = $obj->job;
2245 $userstatic->gender = $obj->gender;
2248 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2249 print
'<td class="tdoverflowmax150">';
2250 if ($userstatic->id) {
2251 print $userstatic->getNomUrl(-1);
2255 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2261 print
'<td class="tdoverflowmax125">';
2262 if ($obj->socid > 0) {
2263 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2264 if ($listsalesrepresentatives < 0) {
2267 $nbofsalesrepresentative = count($listsalesrepresentatives);
2268 if ($nbofsalesrepresentative > 6) {
2270 print $nbofsalesrepresentative;
2271 } elseif ($nbofsalesrepresentative > 0) {
2272 $userstatic =
new User($db);
2274 foreach ($listsalesrepresentatives as $val) {
2275 $userstatic->id = $val[
'id'];
2276 $userstatic->lastname = $val[
'lastname'];
2277 $userstatic->firstname = $val[
'firstname'];
2278 $userstatic->email = $val[
'email'];
2279 $userstatic->status = $val[
'statut'];
2280 $userstatic->entity = $val[
'entity'];
2281 $userstatic->photo = $val[
'photo'];
2282 $userstatic->login = $val[
'login'];
2283 $userstatic->office_phone = $val[
'office_phone'];
2284 $userstatic->office_fax = $val[
'office_fax'];
2285 $userstatic->user_mobile = $val[
'user_mobile'];
2286 $userstatic->job = $val[
'job'];
2287 $userstatic->gender = $val[
'gender'];
2289 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2291 if ($j < $nbofsalesrepresentative) {
2303 $totalarray[
'nbfield']++;
2308 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2309 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2311 $totalarray[
'nbfield']++;
2315 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2316 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2318 $totalarray[
'nbfield']++;
2321 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2323 $totalarray[
'val'][
'total_margin'] = $total_margin;
2326 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2327 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2329 $totalarray[
'nbfield']++;
2333 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2334 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2336 $totalarray[
'nbfield']++;
2339 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2341 if ($i >= $imaxinloop - 1) {
2342 if (!empty($total_ht)) {
2343 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2345 $totalarray[
'val'][
'total_mark_rate'] =
'';
2351 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2353 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2354 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2355 print $hookmanager->resPrint;
2357 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2358 print
'<td align="center" class="nowrap">';
2359 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2362 $totalarray[
'nbfield']++;
2366 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2367 print
'<td align="center" class="nowrap">';
2368 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2371 $totalarray[
'nbfield']++;
2375 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2376 print
'<td align="center" class="nowrap">';
2377 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2380 $totalarray[
'nbfield']++;
2384 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2385 print
'<td class="sensiblehtmlcontent center">';
2389 $totalarray[
'nbfield']++;
2393 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2394 print
'<td class="sensiblehtmlcontent center">';
2398 $totalarray[
'nbfield']++;
2403 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2404 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2406 $totalarray[
'nbfield']++;
2411 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2412 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2414 $totalarray[
'nbfield']++;
2419 print
'<td class="nowrap" align="center">';
2420 if ($massactionbutton || $massaction) {
2422 if (in_array($obj->rowid, $arrayofselected)) {
2425 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2429 $totalarray[
'nbfield']++;
2441include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2446 foreach ($arrayfields as $key => $val) {
2447 if (!empty($val[
'checked'])) {
2451 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2456$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2457$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2458print $hookmanager->resPrint;
2460print
'</table>'.
"\n";
2463print
'</form>'.
"\n";
2465if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2466 $hidegeneratedfilelistifempty = 1;
2467 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2468 $hidegeneratedfilelistifempty = 0;
2471 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2475 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2476 $urlsource .= str_replace(
'&',
'&', $param);
2478 $filedir = $diroutputmassaction;
2479 $genallowed = $permissiontoread;
2480 $delallowed = $permissiontoadd;
2482 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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.