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');
158$search_option =
GETPOST(
'search_option',
'alpha');
159if ($search_option ==
'late') {
160 $search_status =
'1';
161 $object_statut =
'1';
166$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
167$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
169if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
173$offset = $limit * $page;
174$pageprev = $page - 1;
175$pagenext = $page + 1;
177 $sortfield =
'p.ref';
187if (!empty($user->socid)) {
188 $socid = $user->socid;
193 $dbtable =
'&societe';
195$hookmanager->initHooks(array(
'propallist'));
198$diroutputmassaction =
$conf->propal->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
205$extrafields->fetch_name_optionals_label(
$object->table_element);
207$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
210$fieldstosearchall = array(
212 'p.ref_client' =>
'RefCustomer',
213 'pd.description' =>
'Description',
214 's.nom' =>
"ThirdParty",
215 's.name_alias' =>
"AliasNameShort",
218 'p.note_public' =>
'NotePublic',
220if (empty($user->socid)) {
221 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
225$checkedtypetiers = 0;
227 'p.ref' => array(
'label' =>
"Ref",
'checked' => 1),
228 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1),
229 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
230 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
231 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
232 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1),
233 's.town' => array(
'label' =>
"Town",
'checked' => -1),
234 's.zip' => array(
'label' =>
"Zip",
'checked' => -1),
235 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0),
236 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0),
237 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers),
238 'p.date' => array(
'label' =>
"DatePropal",
'checked' => 1),
239 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' => 1),
240 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' => 0),
241 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' => 0),
242 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' => 0),
243 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => 0,
'enabled' => isModEnabled(
"shipping")),
244 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => 0,
'enabled' => 1),
245 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 0),
246 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 0),
247 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1),
248 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0),
249 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0),
250 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
251 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
252 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
253 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
254 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
255 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
256 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
257 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
258 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
259 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 10),
260 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => -1),
261 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
262 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
263 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
264 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
265 'p.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
266 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
267 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 500),
268 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
269 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
270 'p.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
297if (!$user->hasRight(
'societe',
'client',
'voir')) {
298 $search_sale = $user->id;
302include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
305$permissiontoread = $user->hasRight(
'propal',
'lire');
306$permissiontoadd = $user->hasRight(
'propal',
'creer');
307$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
309 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
310 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
311 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
313 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
314 $permissiontoclose = $user->hasRight(
'propal',
'creer');
315 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
324if (
GETPOST(
'cancel',
'alpha')) {
328if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
333$search_code_client =
'';
335$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
336$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
341if (empty($reshook)) {
343 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
346 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
350 $search_refcustomer =
'';
351 $search_refproject =
'';
352 $search_project =
'';
353 $search_societe =
'';
354 $search_societe_alias =
'';
355 $search_montant_ht =
'';
356 $search_montant_vat =
'';
357 $search_montant_ttc =
'';
358 $search_warehouse =
'';
359 $search_multicurrency_code =
'';
360 $search_multicurrency_tx =
'';
361 $search_multicurrency_montant_ht =
'';
362 $search_multicurrency_montant_vat =
'';
363 $search_multicurrency_montant_ttc =
'';
365 $search_product_category =
'';
370 $search_country =
'';
371 $search_type_thirdparty =
'';
372 $search_date_startday =
'';
373 $search_date_startmonth =
'';
374 $search_date_startyear =
'';
375 $search_date_endday =
'';
376 $search_date_endmonth =
'';
377 $search_date_endyear =
'';
378 $search_date_start =
'';
379 $search_date_end =
'';
380 $search_date_end_startday =
'';
381 $search_date_end_startmonth =
'';
382 $search_date_end_startyear =
'';
383 $search_date_end_endday =
'';
384 $search_date_end_endmonth =
'';
385 $search_date_end_endyear =
'';
386 $search_date_end_start =
'';
387 $search_date_end_end =
'';
388 $search_date_delivery_startday =
'';
389 $search_date_delivery_startmonth =
'';
390 $search_date_delivery_startyear =
'';
391 $search_date_delivery_endday =
'';
392 $search_date_delivery_endmonth =
'';
393 $search_date_delivery_endyear =
'';
394 $search_date_delivery_start =
'';
395 $search_date_delivery_end =
'';
396 $search_availability =
'';
399 $search_categ_cus = 0;
400 $search_fk_cond_reglement =
'';
401 $search_fk_shipping_method =
'';
402 $search_fk_input_reason =
'';
403 $search_fk_mode_reglement =
'';
404 $search_date_signature_startday =
'';
405 $search_date_signature_startmonth =
'';
406 $search_date_signature_startyear =
'';
407 $search_date_signature_endday =
'';
408 $search_date_signature_endmonth =
'';
409 $search_date_signature_endyear =
'';
410 $search_date_signature_start =
'';
411 $search_date_signature_end =
'';
413 $search_array_options = array();
418 $objectclass =
'Propal';
419 $objectlabel =
'Proposals';
420 $uploaddir =
$conf->propal->multidir_output[
$conf->entity];
421 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
424if ($action ==
'validate' && $permissiontovalidate) {
425 if (
GETPOST(
'confirm') ==
'yes') {
426 $tmpproposal =
new Propal($db);
428 foreach ($toselect as $checked) {
429 if ($tmpproposal->fetch($checked) > 0) {
430 if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
431 if ($tmpproposal->valid($user) > 0) {
432 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
438 $langs->load(
"errors");
439 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
455if ($action ==
"sign" && $permissiontoclose) {
456 if (
GETPOST(
'confirm') ==
'yes') {
457 $tmpproposal =
new Propal($db);
459 foreach ($toselect as $checked) {
460 if ($tmpproposal->fetch($checked) > 0) {
461 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
462 $tmpproposal->status = $tmpproposal::STATUS_SIGNED;
463 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
464 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
470 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
486if ($action ==
"nosign" && $permissiontoclose) {
487 if (
GETPOST(
'confirm') ==
'yes') {
488 $tmpproposal =
new Propal($db);
490 foreach ($toselect as $checked) {
491 if ($tmpproposal->fetch($checked) > 0) {
492 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
493 $tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
494 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
495 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
501 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
518if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
521 $objecttmp =
new $objectclass($db);
523 foreach ($toselect as $toselectid) {
524 $result = $objecttmp->fetch($toselectid);
526 $result = $objecttmp->classifyBilled($user, 0);
557$form =
new Form($db);
562if (isModEnabled(
'margin')) {
565$companystatic =
new Societe($db);
566$projectstatic =
new Project($db);
569$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
570$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
573if ($search_all !==
'') {
574 $sql =
'SELECT DISTINCT';
576$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,';
577$sql .=
" typent.code as typent_code,";
578$sql .=
" ava.rowid as availability,";
579$sql .=
" country.code as country_code,";
580$sql .=
" state.code_departement as state_code, state.nom as state_name,";
581$sql .=
' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,';
582$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
583$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
584$sql .=
' p.date_signature as dsignature,';
585$sql .=
' p.note_public, p.note_private,';
586$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
587$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
588$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';
590if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
591 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
592 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
596$parameters = array();
597$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
598$sql .= $hookmanager->resPrint;
599$sql = preg_replace(
'/, $/',
'', $sql);
603$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
604$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
605$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
606$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
608$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
609if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
610 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
613 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
615$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
616$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
617$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
619$parameters = array();
620$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
621$sql .= $hookmanager->resPrint;
624$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
634if ($search_country) {
635 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
637if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
638 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
643if ($search_refcustomer) {
646if ($search_refproject) {
649if ($search_project) {
652if ($search_availability) {
653 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
656if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
657 if ($societe_add_ref_in_list == 1) {
658 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
660 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
663 if ($search_societe) {
664 if ($societe_add_ref_in_list == 1) {
665 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
670 if ($search_societe_alias) {
675if ($societe_add_ref_in_list == 1 && $search_code_client && !$search_societe) {
679 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
681if ($search_montant_ht !=
'') {
684if ($search_montant_vat !=
'') {
687if ($search_montant_ttc !=
'') {
690if ($search_warehouse !=
'' && $search_warehouse > 0) {
693if ($search_multicurrency_code !=
'') {
694 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
696if ($search_multicurrency_tx !=
'') {
697 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
699if ($search_multicurrency_montant_ht !=
'') {
700 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
702if ($search_multicurrency_montant_vat !=
'') {
703 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
705if ($search_multicurrency_montant_ttc !=
'') {
706 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
709 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
711if ($search_fk_cond_reglement > 0) {
712 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
714if ($search_fk_shipping_method > 0) {
715 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
717if ($search_fk_input_reason > 0) {
718 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
720if ($search_fk_mode_reglement > 0) {
721 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
724 $sql .=
' AND s.rowid = '.((int) $socid);
726if ($search_status !=
'' && $search_status !=
'-1') {
727 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
729if ($search_date_start) {
730 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
732if ($search_date_end) {
733 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
735if ($search_date_end_start) {
736 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
738if ($search_date_end_end) {
739 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
741if ($search_date_delivery_start) {
742 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
744if ($search_date_delivery_end) {
745 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
747if ($search_date_signature_start) {
748 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
750if ($search_date_signature_end) {
751 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
753if ($search_note_public) {
754 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
757if ($search_user > 0) {
758 $sql .=
" AND EXISTS (";
759 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
760 $sql .=
" FROM llx_element_contact as ec";
761 $sql .=
" INNER JOIN llx_c_type_contact as tc";
762 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
763 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
766if ($search_sale && $search_sale !=
'-1') {
767 if ($search_sale == -2) {
768 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
769 } elseif ($search_sale > 0) {
770 $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).
")";
774$searchCategoryCustomerOperator = -1;
775$searchCategoryCustomerList = array($search_categ_cus);
776if (!empty($searchCategoryCustomerList)) {
777 $searchCategoryCustomerSqlList = array();
778 $listofcategoryid =
'';
779 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
780 if (intval($searchCategoryCustomer) == -2) {
781 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
782 } elseif (intval($searchCategoryCustomer) > 0) {
783 if ($searchCategoryCustomerOperator == 0) {
784 $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).
")";
786 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
790 if ($listofcategoryid) {
791 $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).
"))";
793 if ($searchCategoryCustomerOperator == 1) {
794 if (!empty($searchCategoryCustomerSqlList)) {
795 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
798 if (!empty($searchCategoryCustomerSqlList)) {
799 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
804$searchCategoryProductOperator = -1;
805$searchCategoryProductList = array($search_product_category);
806if (!empty($searchCategoryProductList)) {
807 $searchCategoryProductSqlList = array();
808 $listofcategoryid =
'';
809 foreach ($searchCategoryProductList as $searchCategoryProduct) {
810 if (intval($searchCategoryProduct) == -2) {
811 $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)";
812 } elseif (intval($searchCategoryProduct) > 0) {
813 if ($searchCategoryProductOperator == 0) {
814 $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).
")";
816 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
820 if ($listofcategoryid) {
821 $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).
"))";
823 if ($searchCategoryProductOperator == 1) {
824 if (!empty($searchCategoryProductSqlList)) {
825 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
828 if (!empty($searchCategoryProductSqlList)) {
829 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
833if ($search_option ==
'late') {
834 $sql .=
" AND p.fin_validite < '".$db->idate(
dol_now() -
$conf->propal->cloture->warning_delay).
"'";
837include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
841$parameters = array();
842$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
843$sql .= $hookmanager->resPrint;
846$parameters = array();
847$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
848$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
851$nbtotalofrecords =
'';
854 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
855 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
856 $resql = $db->query($sqlforcount);
858 $objforcount = $db->fetch_object($resql);
859 $nbtotalofrecords = $objforcount->nbtotalofrecords;
864 if (($page * $limit) > $nbtotalofrecords) {
872$sql .= $db->order($sortfield, $sortorder);
873$sql .=
', p.ref DESC';
875 $sql .= $db->plimit($limit + 1, $offset);
878$resql = $db->query($sql);
884$objectstatic =
new Propal($db);
885$userstatic =
new User($db);
890 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
891 if (empty($search_societe)) {
892 $search_societe = $soc->name;
895 $title = $langs->trans(
'Proposals');
898$num = $db->num_rows($resql);
900$arrayofselected = is_array($toselect) ? $toselect : array();
902if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
903 $obj = $db->fetch_object($resql);
907 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
911$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
912llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
914$param =
'&search_status='.urlencode($search_status);
916 $param .=
'&mode='.urlencode($mode);
918if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
919 $param .=
'&contextpage='.urlencode($contextpage);
921if ($limit > 0 && $limit !=
$conf->liste_limit) {
922 $param .=
'&limit='.((int) $limit);
925 $param .=
'&search_all='.urlencode($search_all);
927if ($search_date_startday) {
928 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
930if ($search_date_startmonth) {
931 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
933if ($search_date_startyear) {
934 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
936if ($search_date_endday) {
937 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
939if ($search_date_endmonth) {
940 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
942if ($search_date_endyear) {
943 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
945if ($search_date_end_startday) {
946 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
948if ($search_date_end_startmonth) {
949 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
951if ($search_date_end_startyear) {
952 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
954if ($search_date_end_endday) {
955 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
957if ($search_date_end_endmonth) {
958 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
960if ($search_date_end_endyear) {
961 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
963if ($search_date_delivery_startday) {
964 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
966if ($search_date_delivery_startmonth) {
967 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
969if ($search_date_delivery_startyear) {
970 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
972if ($search_date_delivery_endday) {
973 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
975if ($search_date_delivery_endmonth) {
976 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
978if ($search_date_delivery_endyear) {
979 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
982 $param .=
'&search_ref='.urlencode($search_ref);
984if ($search_refcustomer) {
985 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
987if ($search_refproject) {
988 $param .=
'&search_refproject='.urlencode($search_refproject);
990if ($search_societe) {
991 $param .=
'&search_societe='.urlencode($search_societe);
993if ($search_societe_alias) {
994 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
996if ($search_user > 0) {
997 $param .=
'&search_user='.urlencode((
string) ($search_user));
999if ($search_sale > 0) {
1000 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1002if ($search_montant_ht) {
1003 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1005if ($search_multicurrency_code !=
'') {
1006 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1008if ($search_multicurrency_tx !=
'') {
1009 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1011if ($search_multicurrency_montant_ht !=
'') {
1012 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1014if ($search_multicurrency_montant_vat !=
'') {
1015 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1017if ($search_multicurrency_montant_ttc !=
'') {
1018 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1021 $param .=
'&search_login='.urlencode($search_login);
1024 $param .=
'&search_town='.urlencode($search_town);
1027 $param .=
'&search_zip='.urlencode($search_zip);
1030 $param .=
'&socid='.urlencode((
string) ($socid));
1032if ($optioncss !=
'') {
1033 $param .=
'&optioncss='.urlencode($optioncss);
1035if ($search_categ_cus > 0) {
1036 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1038if ($search_product_category !=
'') {
1039 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1041if ($search_fk_cond_reglement > 0) {
1042 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1044if ($search_fk_shipping_method > 0) {
1045 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1047if ($search_fk_input_reason > 0) {
1048 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1050if ($search_fk_mode_reglement > 0) {
1051 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1053if ($search_type_thirdparty > 0) {
1054 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1057 $param .=
'&search_town='.urlencode($search_town);
1060 $param .=
'&search_zip='.urlencode($search_zip);
1063 $param .=
'&search_state='.urlencode($search_state);
1066 $param .=
'&search_town='.urlencode($search_town);
1068if ($search_country) {
1069 $param .=
'&search_country='.urlencode((
string) ($search_country));
1071if ($search_date_signature_startday) {
1072 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1074if ($search_date_signature_startmonth) {
1075 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1077if ($search_date_signature_startyear) {
1078 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1080if ($search_date_signature_endday) {
1081 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1083if ($search_date_signature_endmonth) {
1084 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1086if ($search_date_signature_endyear) {
1087 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1091include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1093$parameters = array(
'param' => &$param);
1094$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1095$param .= $hookmanager->resPrint;
1098$arrayofmassactions = array(
1099 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1100 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1102if ($permissiontosendbymail) {
1103 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1105if ($permissiontovalidate) {
1106 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1108if ($permissiontoclose) {
1109 $arrayofmassactions[
'presign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1110 $arrayofmassactions[
'nopresign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1111 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1113if ($permissiontodelete) {
1114 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1117if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1118 $arrayofmassactions = array();
1120$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1122$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1123if (!empty($socid)) {
1124 $url .=
'&socid='.$socid;
1127$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'));
1128$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'));
1130$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1133print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1134if ($optioncss !=
'') {
1135 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1137print
'<input type="hidden" name="token" value="'.newToken().
'">';
1138print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1139print
'<input type="hidden" name="action" value="list">';
1140print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1141print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1142print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1143print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1144print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1146print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1148$topicmail =
"SendPropalRef";
1149$modelmail =
"propal_send";
1150$objecttmp =
new Propal($db);
1151$trackid =
'pro'.$object->id;
1152include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1154if ($massaction ==
'prevalidate') {
1155 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1158if ($massaction ==
'presign') {
1159 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1162if ($massaction ==
'nopresign') {
1163 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1167 foreach ($fieldstosearchall as $key => $val) {
1168 $fieldstosearchall[$key] = $langs->trans($val);
1170 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1178if ($user->hasRight(
'user',
'user',
'lire')) {
1179 $langs->load(
"commercial");
1180 $moreforfilter .=
'<div class="divsearchfield">';
1181 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1182 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1183 $moreforfilter .=
'</div>';
1186if ($user->hasRight(
'user',
'user',
'lire')) {
1187 $moreforfilter .=
'<div class="divsearchfield">';
1188 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1189 $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');
1190 $moreforfilter .=
'</div>';
1193if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1194 $searchCategoryProductOperator = -1;
1195 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1196 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1198 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1200if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1201 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1202 $moreforfilter .=
'<div class="divsearchfield">';
1203 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1204 $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'));
1205 $moreforfilter .=
'</div>';
1207if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) {
1208 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1210 $moreforfilter .=
'<div class="divsearchfield">';
1211 $tmptitle = $langs->trans(
'Warehouse');
1212 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1213 $moreforfilter .=
'</div>';
1215$parameters = array();
1216$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1217if (empty($reshook)) {
1218 $moreforfilter .= $hookmanager->resPrint;
1220 $moreforfilter = $hookmanager->resPrint;
1223if (!empty($moreforfilter)) {
1224 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1225 print $moreforfilter;
1229$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1230$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1231$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1233print
'<div class="div-table-responsive">';
1234print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1236print
'<tr class="liste_titre_filter">';
1240 print
'<td class="liste_titre" align="middle">';
1241 $searchpicto = $form->showFilterButtons(
'left');
1246if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1247 print
'<td class="liste_titre">';
1248 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1251if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1252 print
'<td class="liste_titre">';
1253 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1256if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1257 print
'<td class="liste_titre">';
1258 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1261if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1262 print
'<td class="liste_titre">';
1263 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1266if (!empty($arrayfields[
's.nom'][
'checked'])) {
1267 print
'<td class="liste_titre" align="left">';
1268 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1271if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1272 print
'<td class="liste_titre" align="left">';
1273 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1276if (!empty($arrayfields[
's.town'][
'checked'])) {
1277 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1279if (!empty($arrayfields[
's.zip'][
'checked'])) {
1280 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1283if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1284 print
'<td class="liste_titre">';
1285 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1289if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1290 print
'<td class="liste_titre" align="center">';
1291 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1295if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1296 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1297 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);
1302if (!empty($arrayfields[
'p.date'][
'checked'])) {
1303 print
'<td class="liste_titre center">';
1304 print
'<div class="nowrapfordate">';
1305 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1307 print
'<div class="nowrapfordate">';
1308 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1313if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1314 print
'<td class="liste_titre center">';
1315 print
'<div class="nowrapfordate">';
1316 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'));
1318 print
'<div class="nowrapfordate">';
1319 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'));
1324if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1325 print
'<td class="liste_titre center">';
1326 print
'<div class="nowrapfordate">';
1327 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'));
1329 print
'<div class="nowrapfordate">';
1330 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'));
1335if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1336 print
'<td class="liste_titre center">';
1337 print
'<div class="nowrapfordate">';
1338 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'));
1340 print
'<div class="nowrapfordate">';
1341 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'));
1346if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1347 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1348 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1353if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1354 print
'<td class="liste_titre">';
1355 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1359if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1360 print
'<td class="liste_titre">';
1361 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1365if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1366 print
'<td class="liste_titre">';
1367 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1371if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1372 print
'<td class="liste_titre">';
1373 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1376if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1378 print
'<td class="liste_titre right">';
1379 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1382if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1384 print
'<td class="liste_titre right">';
1385 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1388if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1390 print
'<td class="liste_titre right">';
1391 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1394if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1396 print
'<td class="liste_titre right">';
1399if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1401 print
'<td class="liste_titre right">';
1404if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1406 print
'<td class="liste_titre">';
1407 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1410if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1412 print
'<td class="liste_titre">';
1413 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1416if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1418 print
'<td class="liste_titre right">';
1419 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1422if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1424 print
'<td class="liste_titre right">';
1425 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1428if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1430 print
'<td class="liste_titre right">';
1431 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1434if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1436 print
'<td class="liste_titre right">';
1439if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1441 print
'<td class="liste_titre right">';
1444if (!empty($arrayfields[
'u.login'][
'checked'])) {
1446 print
'<td class="liste_titre">';
1447 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1450if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1451 print
'<td class="liste_titre"></td>';
1453if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1454 print
'<td class="liste_titre right">';
1457if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1458 print
'<td class="liste_titre right">';
1461if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1462 print
'<td class="liste_titre right">';
1465if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1466 print
'<td class="liste_titre right">';
1470include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1473$parameters = array(
'arrayfields' => $arrayfields);
1474$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1475print $hookmanager->resPrint;
1477if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1478 print
'<td class="liste_titre">';
1482if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1483 print
'<td class="liste_titre">';
1487if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1488 print
'<td class="liste_titre">';
1491if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1493 print
'<td class="liste_titre">';
1494 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1497if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1499 print
'<td class="liste_titre">';
1503if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1504 print
'<td class="liste_titre center parentonrightofpage">';
1505 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1510 print
'<td class="liste_titre" align="middle">';
1511 $searchpicto = $form->showFilterButtons();
1527print
'<tr class="liste_titre">';
1529 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1530 $totalarray[
'nbfield']++;
1532if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1533 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1534 $totalarray[
'nbfield']++;
1536if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1537 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1538 $totalarray[
'nbfield']++;
1540if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1541 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1542 $totalarray[
'nbfield']++;
1544if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1545 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1546 $totalarray[
'nbfield']++;
1548if (!empty($arrayfields[
's.nom'][
'checked'])) {
1549 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1550 $totalarray[
'nbfield']++;
1552if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1553 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1554 $totalarray[
'nbfield']++;
1556if (!empty($arrayfields[
's.town'][
'checked'])) {
1557 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1558 $totalarray[
'nbfield']++;
1560if (!empty($arrayfields[
's.zip'][
'checked'])) {
1561 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1562 $totalarray[
'nbfield']++;
1564if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1565 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1566 $totalarray[
'nbfield']++;
1568if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1569 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1570 $totalarray[
'nbfield']++;
1572if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1573 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1574 $totalarray[
'nbfield']++;
1576if (!empty($arrayfields[
'p.date'][
'checked'])) {
1577 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1578 $totalarray[
'nbfield']++;
1580if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1581 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1582 $totalarray[
'nbfield']++;
1584if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1585 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1586 $totalarray[
'nbfield']++;
1588if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1589 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1590 $totalarray[
'nbfield']++;
1592if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1593 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1594 $totalarray[
'nbfield']++;
1596if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1597 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1598 $totalarray[
'nbfield']++;
1600if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1601 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1602 $totalarray[
'nbfield']++;
1604if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1605 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1606 $totalarray[
'nbfield']++;
1608if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1609 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1610 $totalarray[
'nbfield']++;
1612if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1613 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1614 $totalarray[
'nbfield']++;
1616if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1617 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1618 $totalarray[
'nbfield']++;
1620if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1621 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1622 $totalarray[
'nbfield']++;
1624if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1625 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1626 $totalarray[
'nbfield']++;
1628if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1629 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1630 $totalarray[
'nbfield']++;
1632if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1633 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1634 $totalarray[
'nbfield']++;
1636if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1637 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1638 $totalarray[
'nbfield']++;
1640if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1641 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1642 $totalarray[
'nbfield']++;
1644if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1645 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1646 $totalarray[
'nbfield']++;
1648if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1649 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1650 $totalarray[
'nbfield']++;
1652if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1653 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1654 $totalarray[
'nbfield']++;
1656if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1657 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1658 $totalarray[
'nbfield']++;
1660if (!empty($arrayfields[
'u.login'][
'checked'])) {
1661 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1662 $totalarray[
'nbfield']++;
1664if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1665 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1666 $totalarray[
'nbfield']++;
1668if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1669 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1670 $totalarray[
'nbfield']++;
1672if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1673 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1674 $totalarray[
'nbfield']++;
1676if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1677 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1678 $totalarray[
'nbfield']++;
1680if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1681 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1682 $totalarray[
'nbfield']++;
1685include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1688 'arrayfields' => $arrayfields,
1690 'sortfield' => $sortfield,
1691 'sortorder' => $sortorder,
1692 'totalarray' => &$totalarray,
1695$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1697print $hookmanager->resPrint;
1698if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1699 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1700 $totalarray[
'nbfield']++;
1702if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1703 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1704 $totalarray[
'nbfield']++;
1706if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1708 $totalarray[
'nbfield']++;
1710if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1711 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1712 $totalarray[
'nbfield']++;
1714if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1715 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1716 $totalarray[
'nbfield']++;
1718if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1720 $totalarray[
'nbfield']++;
1723 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1724 $totalarray[
'nbfield']++;
1733$with_margin_info =
false;
1734if (isModEnabled(
'margin') && (
1735 !empty($arrayfields[
'total_pa'][
'checked'])
1736 || !empty($arrayfields[
'total_margin'][
'checked'])
1737 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1738 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1741 $with_margin_info =
true;
1748$savnbfield = $totalarray[
'nbfield'];
1749$totalarray = array();
1750$totalarray[
'nbfield'] = 0;
1751$imaxinloop = ($limit ? min($num, $limit) : $num);
1752while ($i < $imaxinloop) {
1753 $obj = $db->fetch_object($resql);
1757 if ($search_option) {
1758 $param .=
"&search_option=".urlencode($search_option);
1761 $objectstatic->id = $obj->rowid;
1762 $objectstatic->ref = $obj->ref;
1763 $objectstatic->ref_customer = $obj->ref_client;
1764 $objectstatic->note_public = $obj->note_public;
1765 $objectstatic->note_private = $obj->note_private;
1766 $objectstatic->statut = $obj->status;
1767 $objectstatic->status = $obj->status;
1769 $companystatic->id = $obj->socid;
1770 $companystatic->name = $obj->name;
1771 $companystatic->name_alias = $obj->alias;
1772 $companystatic->client = $obj->client;
1773 $companystatic->fournisseur = $obj->fournisseur;
1774 $companystatic->code_client = $obj->code_client;
1775 $companystatic->email = $obj->email;
1776 $companystatic->phone = $obj->phone;
1777 $companystatic->address = $obj->address;
1778 $companystatic->zip = $obj->zip;
1779 $companystatic->town = $obj->town;
1780 $companystatic->country_code = $obj->country_code;
1782 $projectstatic->id = $obj->project_id;
1783 $projectstatic->ref = $obj->project_ref;
1784 $projectstatic->title = $obj->project_label;
1786 $totalInvoicedHT = 0;
1787 $totalInvoicedTTC = 0;
1788 $multicurrency_totalInvoicedHT = 0;
1789 $multicurrency_totalInvoicedTTC = 0;
1791 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1793 if (!empty($TInvoiceData)) {
1794 foreach ($TInvoiceData as $invoiceData) {
1796 $invoice->fetch($invoiceData->facid);
1802 $totalInvoicedHT += $invoice->total_ht;
1803 $totalInvoicedTTC += $invoice->total_ttc;
1804 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1805 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1809 $marginInfo = array();
1810 if ($with_margin_info) {
1811 $objectstatic->fetch_lines();
1812 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1813 $total_ht += $obj->total_ht;
1814 $total_margin += $marginInfo[
'total_margin'];
1817 if ($mode ==
'kanban') {
1819 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1820 print
'<div class="box-flex-container kanban">';
1823 $objectstatic->thirdparty = $companystatic;
1824 $userstatic->fetch($obj->fk_user_author);
1825 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1826 print $objectstatic->getKanbanView(
'', $arrayofparams);
1827 if ($i == ($imaxinloop - 1)) {
1832 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1836 print
'<td class="nowrap" align="center">';
1837 if ($massactionbutton || $massaction) {
1839 if (in_array($obj->rowid, $arrayofselected)) {
1842 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1846 $totalarray[
'nbfield']++;
1850 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1851 print
'<td class="nowraponall">';
1853 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1855 print
'<td class="nobordernopadding nowraponall">';
1856 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset(
$conf->global->PROPAL_LIST_SHOW_NOTES) ?
$conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1861 $warnornote .=
img_warning($langs->trans(
"Late"));
1864 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1869 print
'<td width="16" class="nobordernopadding right">';
1872 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1873 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1874 print
'</td></tr></table>';
1878 $totalarray[
'nbfield']++;
1882 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1884 print
'<td class="nowrap tdoverflowmax200">';
1888 $totalarray[
'nbfield']++;
1892 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1894 print
'<td class="nowraponall">';
1895 if ($obj->project_id > 0) {
1896 print $projectstatic->getNomUrl(1);
1900 $totalarray[
'nbfield']++;
1904 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1906 print
'<td class="nowrap">';
1907 if ($obj->project_id > 0) {
1912 $totalarray[
'nbfield']++;
1917 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1918 print
'<td class="tdoverflowmax150">';
1919 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1922 $totalarray[
'nbfield']++;
1927 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1928 print
'<td class="tdoverflowmax200">';
1932 $totalarray[
'nbfield']++;
1937 if (!empty($arrayfields[
's.town'][
'checked'])) {
1938 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1942 $totalarray[
'nbfield']++;
1946 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1947 print
'<td class="nocellnopadd">';
1951 $totalarray[
'nbfield']++;
1955 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1956 print
"<td>".$obj->state_name.
"</td>\n";
1958 $totalarray[
'nbfield']++;
1962 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1963 print
'<td class="center">';
1964 $tmparray =
getCountry($obj->fk_pays,
'all');
1965 print $tmparray[
'label'];
1968 $totalarray[
'nbfield']++;
1972 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1973 if (!is_array($typenArray) || empty($typenArray)) {
1974 $typenArray = $formcompany->typent_array(1);
1977 print
'<td class="center">';
1978 if (!empty($obj->typent_code)) {
1979 print $typenArray[$obj->typent_code];
1983 $totalarray[
'nbfield']++;
1988 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1989 print
'<td class="center">';
1993 $totalarray[
'nbfield']++;
1998 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
2000 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
2003 print
'<td> </td>';
2006 $totalarray[
'nbfield']++;
2010 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2011 if ($obj->ddelivery) {
2012 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2015 print
'<td> </td>';
2018 $totalarray[
'nbfield']++;
2022 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2023 if ($obj->dsignature) {
2024 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2027 print
'<td> </td>';
2030 $totalarray[
'nbfield']++;
2034 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2035 print
'<td class="center">';
2036 $form->form_availability(0, $obj->availability,
'none', 1);
2039 $totalarray[
'nbfield']++;
2043 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2045 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2048 $totalarray[
'nbfield']++;
2052 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2053 $labelInputReason =
'';
2054 if ($obj->fk_input_reason > 0) {
2055 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2057 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2061 $totalarray[
'nbfield']++;
2065 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2067 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2070 $totalarray[
'nbfield']++;
2074 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2076 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2079 $totalarray[
'nbfield']++;
2083 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2084 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2086 $totalarray[
'nbfield']++;
2089 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2091 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2092 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2094 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2098 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2099 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2101 $totalarray[
'nbfield']++;
2104 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2106 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2107 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2109 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2113 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2114 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2116 $totalarray[
'nbfield']++;
2119 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2121 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2122 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2124 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2128 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2129 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2131 $totalarray[
'nbfield']++;
2134 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2136 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2137 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2139 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2143 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2144 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2146 $totalarray[
'nbfield']++;
2149 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2151 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2152 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2154 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2158 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2159 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2161 $totalarray[
'nbfield']++;
2166 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2167 print
'<td class="nowrap">';
2168 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2171 $totalarray[
'nbfield']++;
2175 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2176 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2178 $totalarray[
'nbfield']++;
2182 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2183 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2185 $totalarray[
'nbfield']++;
2189 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2190 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2192 $totalarray[
'nbfield']++;
2196 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2197 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2199 $totalarray[
'nbfield']++;
2203 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2204 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2206 $totalarray[
'nbfield']++;
2210 $userstatic->id = $obj->fk_user_author;
2211 $userstatic->login = $obj->login;
2212 $userstatic->lastname = $obj->lastname;
2213 $userstatic->firstname = $obj->firstname;
2214 $userstatic->email = $obj->user_email;
2215 $userstatic->status = $obj->user_statut;
2216 $userstatic->entity = $obj->user_entity;
2217 $userstatic->photo = $obj->photo;
2218 $userstatic->office_phone = $obj->office_phone;
2219 $userstatic->office_fax = $obj->office_fax;
2220 $userstatic->user_mobile = $obj->user_mobile;
2221 $userstatic->job = $obj->job;
2222 $userstatic->gender = $obj->gender;
2225 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2226 print
'<td class="tdoverflowmax150">';
2227 if ($userstatic->id) {
2228 print $userstatic->getNomUrl(-1);
2232 $totalarray[
'nbfield']++;
2236 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2238 print
'<td class="tdoverflowmax125">';
2239 if ($obj->socid > 0) {
2240 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2241 if ($listsalesrepresentatives < 0) {
2244 $nbofsalesrepresentative = count($listsalesrepresentatives);
2245 if ($nbofsalesrepresentative > 6) {
2247 print $nbofsalesrepresentative;
2248 } elseif ($nbofsalesrepresentative > 0) {
2249 $userstatic =
new User($db);
2251 foreach ($listsalesrepresentatives as $val) {
2252 $userstatic->id = $val[
'id'];
2253 $userstatic->lastname = $val[
'lastname'];
2254 $userstatic->firstname = $val[
'firstname'];
2255 $userstatic->email = $val[
'email'];
2256 $userstatic->status = $val[
'statut'];
2257 $userstatic->entity = $val[
'entity'];
2258 $userstatic->photo = $val[
'photo'];
2259 $userstatic->login = $val[
'login'];
2260 $userstatic->office_phone = $val[
'office_phone'];
2261 $userstatic->office_fax = $val[
'office_fax'];
2262 $userstatic->user_mobile = $val[
'user_mobile'];
2263 $userstatic->job = $val[
'job'];
2264 $userstatic->gender = $val[
'gender'];
2266 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2268 if ($j < $nbofsalesrepresentative) {
2280 $totalarray[
'nbfield']++;
2285 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2286 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2288 $totalarray[
'nbfield']++;
2292 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2293 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2295 $totalarray[
'nbfield']++;
2298 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2300 $totalarray[
'val'][
'total_margin'] = $total_margin;
2303 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2304 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2306 $totalarray[
'nbfield']++;
2310 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2311 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2313 $totalarray[
'nbfield']++;
2316 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2318 if ($i >= $imaxinloop - 1) {
2319 if (!empty($total_ht)) {
2320 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2322 $totalarray[
'val'][
'total_mark_rate'] =
'';
2328 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2330 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2331 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2332 print $hookmanager->resPrint;
2334 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2335 print
'<td align="center" class="nowrap">';
2336 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2339 $totalarray[
'nbfield']++;
2343 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2344 print
'<td align="center" class="nowrap">';
2345 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2348 $totalarray[
'nbfield']++;
2352 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2353 print
'<td align="center" class="nowrap">';
2354 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2357 $totalarray[
'nbfield']++;
2361 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2362 print
'<td class="sensiblehtmlcontent center">';
2366 $totalarray[
'nbfield']++;
2370 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2371 print
'<td class="sensiblehtmlcontent center">';
2375 $totalarray[
'nbfield']++;
2379 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2380 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2382 $totalarray[
'nbfield']++;
2387 print
'<td class="nowrap" align="center">';
2388 if ($massactionbutton || $massaction) {
2390 if (in_array($obj->rowid, $arrayofselected)) {
2393 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2397 $totalarray[
'nbfield']++;
2409include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2414 foreach ($arrayfields as $key => $val) {
2415 if (!empty($val[
'checked'])) {
2419 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2424$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2425$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2426print $hookmanager->resPrint;
2428print
'</table>'.
"\n";
2431print
'</form>'.
"\n";
2433if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2434 $hidegeneratedfilelistifempty = 1;
2435 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2436 $hidegeneratedfilelistifempty = 0;
2439 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2443 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2444 $urlsource .= str_replace(
'&',
'&', $param);
2446 $filedir = $diroutputmassaction;
2447 $genallowed = $permissiontoread;
2448 $delallowed = $permissiontoadd;
2450 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.
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.