43require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48if (isModEnabled(
'margin')) {
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55if (isModEnabled(
'categorie')) {
56 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
61$langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
62if (isModEnabled(
"expedition")) {
63 $langs->loadLangs(array(
'sendings'));
67$socid =
GETPOST(
'socid',
'int');
69$action =
GETPOST(
'action',
'aZ09');
70$massaction =
GETPOST(
'massaction',
'alpha');
71$show_files =
GETPOST(
'show_files',
'int');
72$confirm =
GETPOST(
'confirm',
'alpha');
73$cancel =
GETPOST(
'cancel',
'alpha');
74$toselect =
GETPOST(
'toselect',
'array');
75$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
76$optioncss =
GETPOST(
'optioncss',
'alpha');
77$mode =
GETPOST(
'mode',
'alpha');
80$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
81$search_user =
GETPOST(
'search_user',
'int');
82$search_sale =
GETPOST(
'search_sale',
'int');
84$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
85$search_refproject =
GETPOST(
'search_refproject',
'alpha');
86$search_project =
GETPOST(
'search_project',
'alpha');
87$search_societe =
GETPOST(
'search_societe',
'alpha');
88$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
89$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
90$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
91$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
92$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
93$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
94$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
95$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
96$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
97$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
98$search_login =
GETPOST(
'search_login',
'alpha');
99$search_product_category =
GETPOST(
'search_product_category',
'int');
100$search_town =
GETPOST(
'search_town',
'alpha');
101$search_zip =
GETPOST(
'search_zip',
'alpha');
102$search_state =
GETPOST(
"search_state");
103$search_country =
GETPOST(
"search_country",
'int');
104$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
105$search_date_startday =
GETPOST(
'search_date_startday',
'int');
106$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
107$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
108$search_date_endday =
GETPOST(
'search_date_endday',
'int');
109$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
110$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
111$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
112$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
113$search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
114$search_date_end_startmonth =
GETPOST(
'search_date_end_startmonth',
'int');
115$search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
116$search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
117$search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
118$search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
119$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
120$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
121$search_date_delivery_startday =
GETPOST(
'search_date_delivery_startday',
'int');
122$search_date_delivery_startmonth =
GETPOST(
'search_date_delivery_startmonth',
'int');
123$search_date_delivery_startyear =
GETPOST(
'search_date_delivery_startyear',
'int');
124$search_date_delivery_endday =
GETPOST(
'search_date_delivery_endday',
'int');
125$search_date_delivery_endmonth =
GETPOST(
'search_date_delivery_endmonth',
'int');
126$search_date_delivery_endyear =
GETPOST(
'search_date_delivery_endyear',
'int');
127$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
128$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
129$search_availability =
GETPOST(
'search_availability',
'int');
130$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
131$search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'int');
132$search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'int');
133$search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'int');
134$search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'int');
135$search_date_signature_startday =
GETPOST(
'search_date_signature_startday',
'int');
136$search_date_signature_startmonth =
GETPOST(
'search_date_signature_startmonth',
'int');
137$search_date_signature_startyear =
GETPOST(
'search_date_signature_startyear',
'int');
138$search_date_signature_endday =
GETPOST(
'search_date_signature_endday',
'int');
139$search_date_signature_endmonth =
GETPOST(
'search_date_signature_endmonth',
'int');
140$search_date_signature_endyear =
GETPOST(
'search_date_signature_endyear',
'int');
141$search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
142$search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
143$search_status =
GETPOST(
'search_status',
'alpha');
145$optioncss =
GETPOST(
'optioncss',
'alpha');
146$object_statut =
GETPOST(
'search_statut',
'alpha');
148$search_option =
GETPOST(
'search_option',
'alpha');
149if ($search_option ==
'late') {
150 $search_status =
'1';
151 $object_statut =
'1';
155$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
156$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
157$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
158$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
159if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
163$offset = $limit * $page;
164$pageprev = $page - 1;
165$pagenext = $page + 1;
167 $sortfield =
'p.ref';
177if (!empty($user->socid)) {
178 $socid = $user->socid;
183 $dbtable =
'&societe';
187$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
191$hookmanager->initHooks(array(
'propallist'));
195$extrafields->fetch_name_optionals_label($object->table_element);
197$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
200$fieldstosearchall = array(
202 'p.ref_client'=>
'RefCustomer',
203 'pd.description'=>
'Description',
204 's.nom'=>
"ThirdParty",
205 's.name_alias'=>
"AliasNameShort",
208 'p.note_public'=>
'NotePublic',
210if (empty($user->socid)) {
211 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
215$checkedtypetiers = 0;
217 'p.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
218 'p.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1),
219 'pr.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(isModEnabled(
'project') ? 1 : 0)),
220 'pr.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(isModEnabled(
'project') ? 1 : 0)),
221 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
222 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1),
223 's.town'=>array(
'label'=>
"Town",
'checked'=>-1),
224 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1),
225 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0),
226 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0),
227 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers),
228 'p.date'=>array(
'label'=>
"DatePropal",
'checked'=>1),
229 'p.fin_validite'=>array(
'label'=>
"DateEnd",
'checked'=>1),
230 'p.date_livraison'=>array(
'label'=>
"DeliveryDate",
'checked'=>0),
231 'p.date_signature'=>array(
'label'=>
"DateSigning",
'checked'=>0),
232 'ava.rowid'=>array(
'label'=>
"AvailabilityPeriod",
'checked'=>0),
233 'p.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>0,
'enabled'=>isModEnabled(
"expedition")),
234 'p.fk_input_reason'=>array(
'label'=>
"Origin",
'checked'=>0,
'enabled'=>1),
235 'p.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>0),
236 'p.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>0),
237 'p.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1),
238 'p.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0),
239 'p.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0),
240 'p.total_ht_invoiced'=>array(
'label'=>
"AmountInvoicedHT",
'checked'=>0,
'enabled'=>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
241 'p.total_invoiced'=>array(
'label'=>
"AmountInvoicedTTC",
'checked'=>0,
'enabled'=>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
242 'p.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
243 'p.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
244 'p.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
245 'p.multicurrency_total_tva'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
246 'p.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
247 'p.multicurrency_total_ht_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedHT',
'checked'=>0,
'enabled'=>isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
248 'p.multicurrency_total_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedTTC',
'checked'=>0,
'enabled'=>isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
249 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>10),
250 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>-1),
251 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
252 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
253 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
254 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
255 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
256 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
257 'p.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>500),
258 'p.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
259 'p.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
260 'p.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
287if (!$user->hasRight(
'societe',
'client',
'voir')) {
288 $search_sale = $user->id;
292include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
295$permissiontoread = $user->hasRight(
'propal',
'lire');
296$permissiontoadd = $user->hasRight(
'propal',
'creer');
297$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
299 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
300 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
301 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
303 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
304 $permissiontoclose = $user->hasRight(
'propal',
'creer');
305 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
313if (
GETPOST(
'cancel',
'alpha')) {
317if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
321$parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
322$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
327if (empty($reshook)) {
329 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
332 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
336 $search_refcustomer =
'';
337 $search_refproject =
'';
338 $search_project =
'';
339 $search_societe =
'';
340 $search_societe_alias =
'';
341 $search_montant_ht =
'';
342 $search_montant_vat =
'';
343 $search_montant_ttc =
'';
344 $search_warehouse =
'';
345 $search_multicurrency_code =
'';
346 $search_multicurrency_tx =
'';
347 $search_multicurrency_montant_ht =
'';
348 $search_multicurrency_montant_vat =
'';
349 $search_multicurrency_montant_ttc =
'';
351 $search_product_category =
'';
356 $search_country =
'';
357 $search_type_thirdparty =
'';
358 $search_date_startday =
'';
359 $search_date_startmonth =
'';
360 $search_date_startyear =
'';
361 $search_date_endday =
'';
362 $search_date_endmonth =
'';
363 $search_date_endyear =
'';
364 $search_date_start =
'';
365 $search_date_end =
'';
366 $search_date_end_startday =
'';
367 $search_date_end_startmonth =
'';
368 $search_date_end_startyear =
'';
369 $search_date_end_endday =
'';
370 $search_date_end_endmonth =
'';
371 $search_date_end_endyear =
'';
372 $search_date_end_start =
'';
373 $search_date_end_end =
'';
374 $search_date_delivery_startday =
'';
375 $search_date_delivery_startmonth =
'';
376 $search_date_delivery_startyear =
'';
377 $search_date_delivery_endday =
'';
378 $search_date_delivery_endmonth =
'';
379 $search_date_delivery_endyear =
'';
380 $search_date_delivery_start =
'';
381 $search_date_delivery_end =
'';
382 $search_availability =
'';
386 $search_categ_cus = 0;
387 $search_fk_cond_reglement =
'';
388 $search_fk_shipping_method =
'';
389 $search_fk_input_reason =
'';
390 $search_fk_mode_reglement =
'';
391 $search_date_signature_startday =
'';
392 $search_date_signature_startmonth =
'';
393 $search_date_signature_startyear =
'';
394 $search_date_signature_endday =
'';
395 $search_date_signature_endmonth =
'';
396 $search_date_signature_endyear =
'';
397 $search_date_signature_start =
'';
398 $search_date_signature_end =
'';
400 $search_array_options = array();
402 if ($object_statut !=
'') {
403 $search_status = $object_statut;
407 $objectclass =
'Propal';
408 $objectlabel =
'Proposals';
409 $uploaddir = $conf->propal->multidir_output[$conf->entity];
410 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
413if ($action ==
'validate' && $permissiontovalidate) {
414 if (
GETPOST(
'confirm') ==
'yes') {
415 $tmpproposal =
new Propal($db);
418 foreach ($toselect as $checked) {
419 if ($tmpproposal->fetch($checked) > 0) {
420 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
421 if ($tmpproposal->valid($user) > 0) {
422 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
428 $langs->load(
"errors");
429 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
445if ($action ==
"sign" && $permissiontoclose) {
446 if (
GETPOST(
'confirm') ==
'yes') {
447 $tmpproposal =
new Propal($db);
450 foreach ($toselect as $checked) {
451 if ($tmpproposal->fetch($checked) > 0) {
452 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
453 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
454 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
455 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
461 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
477if ($action ==
"nosign" && $permissiontoclose) {
478 if (
GETPOST(
'confirm') ==
'yes') {
479 $tmpproposal =
new Propal($db);
482 foreach ($toselect as $checked) {
483 if ($tmpproposal->fetch($checked) > 0) {
484 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
485 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
486 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
487 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
493 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
510if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
513 $objecttmp =
new $objectclass($db);
515 foreach ($toselect as $toselectid) {
516 $result = $objecttmp->fetch($toselectid);
518 $result = $objecttmp->classifyBilled($user, 0);
553$form =
new Form($db);
558if (isModEnabled(
'margin')) {
561$companystatic =
new Societe($db);
562$projectstatic =
new Project($db);
565$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
566$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
569if ($search_all || $search_user > 0) {
570 $sql =
'SELECT DISTINCT';
572$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,';
573$sql .=
" typent.code as typent_code,";
574$sql .=
" ava.rowid as availability,";
575$sql .=
" country.code as country_code,";
576$sql .=
" state.code_departement as state_code, state.nom as state_name,";
577$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,';
578$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
579$sql .=
' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
580$sql .=
' p.date_signature as dsignature,';
581$sql .=
' p.note_public, p.note_private,';
582$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
583$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
584$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';
586if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
587 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
588 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
592$parameters = array();
593$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
594$sql .= $hookmanager->resPrint;
595$sql = preg_replace(
'/, $/',
'', $sql);
599$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
600$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
601$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
602$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
604$sql .=
', '.MAIN_DB_PREFIX.
'propal as p';
605if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
606 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
609 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
611$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
612$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
613$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
614if ($search_user > 0) {
615 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
616 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
620$parameters = array();
621$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
622$sql .= $hookmanager->resPrint;
624$sql .=
' WHERE p.fk_soc = s.rowid';
625$sql .=
' AND p.entity IN ('.getEntity(
'propal').
')';
635if ($search_country) {
636 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
638if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
639 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
644if ($search_refcustomer) {
647if ($search_refproject) {
650if ($search_project) {
653if ($search_availability) {
654 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
656if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
657 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
659 if ($search_societe) {
662 if ($search_societe_alias) {
667 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
669if ($search_montant_ht !=
'') {
672if ($search_montant_vat !=
'') {
675if ($search_montant_ttc !=
'') {
678if ($search_warehouse !=
'' && $search_warehouse > 0) {
681if ($search_multicurrency_code !=
'') {
682 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
684if ($search_multicurrency_tx !=
'') {
685 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
687if ($search_multicurrency_montant_ht !=
'') {
688 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
690if ($search_multicurrency_montant_vat !=
'') {
691 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
693if ($search_multicurrency_montant_ttc !=
'') {
694 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
697 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
699if ($search_fk_cond_reglement > 0) {
700 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
702if ($search_fk_shipping_method > 0) {
703 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
705if ($search_fk_input_reason > 0) {
706 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
708if ($search_fk_mode_reglement > 0) {
709 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
712 $sql .=
' AND s.rowid = '.((int) $socid);
714if ($search_status !=
'' && $search_status !=
'-1') {
715 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
717if ($search_date_start) {
718 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
720if ($search_date_end) {
721 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
723if ($search_date_end_start) {
724 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
726if ($search_date_end_end) {
727 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
729if ($search_date_delivery_start) {
730 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
732if ($search_date_delivery_end) {
733 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
735if ($search_user > 0) {
736 $sql .=
" AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
738if ($search_date_signature_start) {
739 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
741if ($search_date_signature_end) {
742 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
745if ($search_sale && $search_sale !=
'-1') {
746 if ($search_sale == -2) {
747 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
748 } elseif ($search_sale > 0) {
749 $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).
")";
753$searchCategoryCustomerOperator = -1;
754$searchCategoryCustomerList = array($search_categ_cus);
755if (!empty($searchCategoryCustomerList)) {
756 $searchCategoryCustomerSqlList = array();
757 $listofcategoryid =
'';
758 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
759 if (intval($searchCategoryCustomer) == -2) {
760 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
761 } elseif (intval($searchCategoryCustomer) > 0) {
762 if ($searchCategoryCustomerOperator == 0) {
763 $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).
")";
765 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
769 if ($listofcategoryid) {
770 $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).
"))";
772 if ($searchCategoryCustomerOperator == 1) {
773 if (!empty($searchCategoryCustomerSqlList)) {
774 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
777 if (!empty($searchCategoryCustomerSqlList)) {
778 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
783$searchCategoryProductOperator = -1;
784$searchCategoryProductList = array($search_product_category);
785if (!empty($searchCategoryProductList)) {
786 $searchCategoryProductSqlList = array();
787 $listofcategoryid =
'';
788 foreach ($searchCategoryProductList as $searchCategoryProduct) {
789 if (intval($searchCategoryProduct) == -2) {
790 $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)";
791 } elseif (intval($searchCategoryProduct) > 0) {
792 if ($searchCategoryProductOperator == 0) {
793 $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).
")";
795 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
799 if ($listofcategoryid) {
800 $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).
"))";
802 if ($searchCategoryProductOperator == 1) {
803 if (!empty($searchCategoryProductSqlList)) {
804 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
807 if (!empty($searchCategoryProductSqlList)) {
808 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
812if ($search_option ==
'late') {
813 $sql .=
" AND p.fin_validite < '".$db->idate(
dol_now() - $conf->propal->cloture->warning_delay).
"'";
816include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
820$parameters = array();
821$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
822$sql .= $hookmanager->resPrint;
825$parameters = array();
826$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
827$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
830$nbtotalofrecords =
'';
833 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
834 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
835 $resql = $db->query($sqlforcount);
837 $objforcount = $db->fetch_object($resql);
838 $nbtotalofrecords = $objforcount->nbtotalofrecords;
843 if (($page * $limit) > $nbtotalofrecords) {
851$sql .= $db->order($sortfield, $sortorder);
852$sql .=
', p.ref DESC';
854 $sql .= $db->plimit($limit + 1, $offset);
857$resql = $db->query($sql);
863$objectstatic =
new Propal($db);
864$userstatic =
new User($db);
869 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
870 if (empty($search_societe)) {
871 $search_societe = $soc->name;
874 $title = $langs->trans(
'Proposals');
877$num = $db->num_rows($resql);
879$arrayofselected = is_array($toselect) ? $toselect : array();
881if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
882 $obj = $db->fetch_object($resql);
886 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.$id);
890$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
893$param =
'&search_status='.urlencode($search_status);
895 $param .=
'&mode='.urlencode($mode);
897if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
898 $param .=
'&contextpage='.urlencode($contextpage);
900if ($limit > 0 && $limit != $conf->liste_limit) {
901 $param .=
'&limit='.((int) $limit);
904 $param .=
'&search_all='.urlencode($search_all);
906if ($search_date_startday) {
907 $param .=
'&search_date_startday='.urlencode($search_date_startday);
909if ($search_date_startmonth) {
910 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
912if ($search_date_startyear) {
913 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
915if ($search_date_endday) {
916 $param .=
'&search_date_endday='.urlencode($search_date_endday);
918if ($search_date_endmonth) {
919 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
921if ($search_date_endyear) {
922 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
924if ($search_date_end_startday) {
925 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
927if ($search_date_end_startmonth) {
928 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
930if ($search_date_end_startyear) {
931 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
933if ($search_date_end_endday) {
934 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
936if ($search_date_end_endmonth) {
937 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
939if ($search_date_end_endyear) {
940 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
942if ($search_date_delivery_startday) {
943 $param .=
'&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
945if ($search_date_delivery_startmonth) {
946 $param .=
'&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
948if ($search_date_delivery_startyear) {
949 $param .=
'&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
951if ($search_date_delivery_endday) {
952 $param .=
'&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
954if ($search_date_delivery_endmonth) {
955 $param .=
'&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
957if ($search_date_delivery_endyear) {
958 $param .=
'&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
961 $param .=
'&search_ref='.urlencode($search_ref);
963if ($search_refcustomer) {
964 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
966if ($search_refproject) {
967 $param .=
'&search_refproject='.urlencode($search_refproject);
969if ($search_societe) {
970 $param .=
'&search_societe='.urlencode($search_societe);
972if ($search_societe_alias) {
973 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
975if ($search_user > 0) {
976 $param .=
'&search_user='.urlencode($search_user);
978if ($search_sale > 0) {
979 $param .=
'&search_sale='.urlencode($search_sale);
981if ($search_montant_ht) {
982 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
984if ($search_multicurrency_code !=
'') {
985 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
987if ($search_multicurrency_tx !=
'') {
988 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
990if ($search_multicurrency_montant_ht !=
'') {
991 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
993if ($search_multicurrency_montant_vat !=
'') {
994 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
996if ($search_multicurrency_montant_ttc !=
'') {
997 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1000 $param .=
'&search_login='.urlencode($search_login);
1003 $param .=
'&search_town='.urlencode($search_town);
1006 $param .=
'&search_zip='.urlencode($search_zip);
1009 $param .=
'&socid='.urlencode($socid);
1011if ($optioncss !=
'') {
1012 $param .=
'&optioncss='.urlencode($optioncss);
1014if ($search_categ_cus > 0) {
1015 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1017if ($search_product_category !=
'') {
1018 $param .=
'&search_product_category='.urlencode($search_product_category);
1020if ($search_fk_cond_reglement > 0) {
1021 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1023if ($search_fk_shipping_method > 0) {
1024 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1026if ($search_fk_input_reason > 0) {
1027 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1029if ($search_fk_mode_reglement > 0) {
1030 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1032if ($search_type_thirdparty > 0) {
1033 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1036 $param .=
'&search_town='.urlencode($search_town);
1039 $param .=
'&search_zip='.urlencode($search_zip);
1042 $param .=
'&search_state='.urlencode($search_state);
1045 $param .=
'&search_town='.urlencode($search_town);
1047if ($search_country) {
1048 $param .=
'&search_country='.urlencode($search_country);
1050if ($search_date_signature_startday) {
1051 $param .=
'&search_date_signature_startday='.urlencode($search_date_signature_startday);
1053if ($search_date_signature_startmonth) {
1054 $param .=
'&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
1056if ($search_date_signature_startyear) {
1057 $param .=
'&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
1059if ($search_date_signature_endday) {
1060 $param .=
'&search_date_signature_endday='.urlencode($search_date_signature_endday);
1062if ($search_date_signature_endmonth) {
1063 $param .=
'&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
1065if ($search_date_signature_endyear) {
1066 $param .=
'&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
1070include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1072$parameters = array(
'param' => &$param);
1073$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1074$param .= $hookmanager->resPrint;
1077$arrayofmassactions = array(
1078 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1079 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1081if ($permissiontosendbymail) {
1082 $arrayofmassactions[
'presend']=
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1084if ($permissiontovalidate) {
1085 $arrayofmassactions[
'prevalidate']=
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1087if ($permissiontoclose) {
1088 $arrayofmassactions[
'presign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1089 $arrayofmassactions[
'nopresign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1090 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1092if ($permissiontodelete) {
1093 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1096if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1097 $arrayofmassactions = array();
1099$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1101$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1102if (!empty($socid)) {
1103 $url .=
'&socid='.$socid;
1106$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'));
1107$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'));
1109$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1112print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1113if ($optioncss !=
'') {
1114 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1116print
'<input type="hidden" name="token" value="'.newToken().
'">';
1117print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1118print
'<input type="hidden" name="action" value="list">';
1119print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1120print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1121print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1122print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1124print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1126$topicmail =
"SendPropalRef";
1127$modelmail =
"propal_send";
1128$objecttmp =
new Propal($db);
1129$trackid =
'pro'.$object->id;
1130include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1132if ($massaction ==
'prevalidate') {
1133 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1136if ($massaction ==
'presign') {
1137 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1140if ($massaction ==
'nopresign') {
1141 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1145 foreach ($fieldstosearchall as $key => $val) {
1146 $fieldstosearchall[$key] = $langs->trans($val);
1148 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
1156if ($user->hasRight(
'user',
'user',
'lire')) {
1157 $langs->load(
"commercial");
1158 $moreforfilter .=
'<div class="divsearchfield">';
1159 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1160 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1161 $moreforfilter .=
'</div>';
1164if ($user->hasRight(
'user',
'user',
'lire')) {
1165 $moreforfilter .=
'<div class="divsearchfield">';
1166 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1167 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1168 $moreforfilter .=
'</div>';
1171if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1172 $searchCategoryProductOperator = -1;
1173 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1174 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1176 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1178if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1179 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1180 $moreforfilter .=
'<div class="divsearchfield">';
1181 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1182 $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'));
1183 $moreforfilter .=
'</div>';
1185if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) {
1186 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1188 $moreforfilter .=
'<div class="divsearchfield">';
1189 $tmptitle = $langs->trans(
'Warehouse');
1190 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1191 $moreforfilter .=
'</div>';
1193$parameters = array();
1194$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1195if (empty($reshook)) {
1196 $moreforfilter .= $hookmanager->resPrint;
1198 $moreforfilter = $hookmanager->resPrint;
1201if (!empty($moreforfilter)) {
1202 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1203 print $moreforfilter;
1207$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1208$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1209$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1211print
'<div class="div-table-responsive">';
1212print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1214print
'<tr class="liste_titre_filter">';
1218 print
'<td class="liste_titre" align="middle">';
1219 $searchpicto = $form->showFilterButtons(
'left');
1224if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1225 print
'<td class="liste_titre">';
1226 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1229if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1230 print
'<td class="liste_titre">';
1231 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1234if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1235 print
'<td class="liste_titre">';
1236 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1239if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1240 print
'<td class="liste_titre">';
1241 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1244if (!empty($arrayfields[
's.nom'][
'checked'])) {
1245 print
'<td class="liste_titre" align="left">';
1246 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
1249if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1250 print
'<td class="liste_titre" align="left">';
1251 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1254if (!empty($arrayfields[
's.town'][
'checked'])) {
1255 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1257if (!empty($arrayfields[
's.zip'][
'checked'])) {
1258 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1261if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1262 print
'<td class="liste_titre">';
1263 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1267if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1268 print
'<td class="liste_titre" align="center">';
1269 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1273if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1274 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1275 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' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1280if (!empty($arrayfields[
'p.date'][
'checked'])) {
1281 print
'<td class="liste_titre center">';
1282 print
'<div class="nowrapfordate">';
1283 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1285 print
'<div class="nowrapfordate">';
1286 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1291if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1292 print
'<td class="liste_titre center">';
1293 print
'<div class="nowrapfordate">';
1294 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'));
1296 print
'<div class="nowrapfordate">';
1297 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'));
1302if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1303 print
'<td class="liste_titre center">';
1304 print
'<div class="nowrapfordate">';
1305 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'));
1307 print
'<div class="nowrapfordate">';
1308 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'));
1313if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1314 print
'<td class="liste_titre center">';
1315 print
'<div class="nowrapfordate">';
1316 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'));
1318 print
'<div class="nowrapfordate">';
1319 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'));
1324if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1325 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1326 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1331if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1332 print
'<td class="liste_titre">';
1333 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1337if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1338 print
'<td class="liste_titre">';
1339 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1343if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1344 print
'<td class="liste_titre">';
1345 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1349if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1350 print
'<td class="liste_titre">';
1351 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1354if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1356 print
'<td class="liste_titre right">';
1357 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1360if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1362 print
'<td class="liste_titre right">';
1363 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1366if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1368 print
'<td class="liste_titre right">';
1369 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1372if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1374 print
'<td class="liste_titre right">';
1377if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1379 print
'<td class="liste_titre right">';
1382if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1384 print
'<td class="liste_titre">';
1385 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1388if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1390 print
'<td class="liste_titre">';
1391 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1394if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1396 print
'<td class="liste_titre right">';
1397 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1400if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1402 print
'<td class="liste_titre right">';
1403 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1406if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1408 print
'<td class="liste_titre right">';
1409 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1412if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1414 print
'<td class="liste_titre right">';
1417if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1419 print
'<td class="liste_titre right">';
1422if (!empty($arrayfields[
'u.login'][
'checked'])) {
1424 print
'<td class="liste_titre">';
1425 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1428if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1429 print
'<td class="liste_titre"></td>';
1431if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1432 print
'<td class="liste_titre right">';
1435if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1436 print
'<td class="liste_titre right">';
1439if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1440 print
'<td class="liste_titre right">';
1443if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1444 print
'<td class="liste_titre right">';
1448include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1451$parameters = array(
'arrayfields'=>$arrayfields);
1452$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1453print $hookmanager->resPrint;
1455if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1456 print
'<td class="liste_titre">';
1460if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1461 print
'<td class="liste_titre">';
1465if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1466 print
'<td class="liste_titre">';
1469if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1471 print
'<td class="liste_titre">';
1474if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1476 print
'<td class="liste_titre">';
1480if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1481 print
'<td class="liste_titre center parentonrightofpage">';
1482 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_statut',
'search_status width100 onrightofpage');
1487 print
'<td class="liste_titre" align="middle">';
1488 $searchpicto = $form->showFilterButtons();
1504print
'<tr class="liste_titre">';
1506 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1507 $totalarray[
'nbfield']++;
1509if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1510 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1511 $totalarray[
'nbfield']++;
1513if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1514 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1515 $totalarray[
'nbfield']++;
1517if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1518 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1519 $totalarray[
'nbfield']++;
1521if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1522 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1523 $totalarray[
'nbfield']++;
1525if (!empty($arrayfields[
's.nom'][
'checked'])) {
1526 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1527 $totalarray[
'nbfield']++;
1529if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1530 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1531 $totalarray[
'nbfield']++;
1533if (!empty($arrayfields[
's.town'][
'checked'])) {
1534 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1535 $totalarray[
'nbfield']++;
1537if (!empty($arrayfields[
's.zip'][
'checked'])) {
1538 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1539 $totalarray[
'nbfield']++;
1541if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1542 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1543 $totalarray[
'nbfield']++;
1545if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1546 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'class="center"', $sortfield, $sortorder,
'center ');
1547 $totalarray[
'nbfield']++;
1549if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1550 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'class="center"', $sortfield, $sortorder);
1551 $totalarray[
'nbfield']++;
1553if (!empty($arrayfields[
'p.date'][
'checked'])) {
1554 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'class="center"', $sortfield, $sortorder,
'center ');
1555 $totalarray[
'nbfield']++;
1557if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1558 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'class="center"', $sortfield, $sortorder,
'center ');
1559 $totalarray[
'nbfield']++;
1561if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1562 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'class="center"', $sortfield, $sortorder,
'center ');
1563 $totalarray[
'nbfield']++;
1565if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1566 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'class="center"', $sortfield, $sortorder,
'center ');
1567 $totalarray[
'nbfield']++;
1569if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1570 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1571 $totalarray[
'nbfield']++;
1573if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1574 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1575 $totalarray[
'nbfield']++;
1577if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1578 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1579 $totalarray[
'nbfield']++;
1581if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1582 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1583 $totalarray[
'nbfield']++;
1585if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1586 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1587 $totalarray[
'nbfield']++;
1589if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1590 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1591 $totalarray[
'nbfield']++;
1593if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1594 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1595 $totalarray[
'nbfield']++;
1597if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1598 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1599 $totalarray[
'nbfield']++;
1601if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1602 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1603 $totalarray[
'nbfield']++;
1605if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1606 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1607 $totalarray[
'nbfield']++;
1609if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1610 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1611 $totalarray[
'nbfield']++;
1613if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1614 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1615 $totalarray[
'nbfield']++;
1617if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1618 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1619 $totalarray[
'nbfield']++;
1621if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1622 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1623 $totalarray[
'nbfield']++;
1625if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1626 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1627 $totalarray[
'nbfield']++;
1629if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1630 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1631 $totalarray[
'nbfield']++;
1633if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1634 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1635 $totalarray[
'nbfield']++;
1637if (!empty($arrayfields[
'u.login'][
'checked'])) {
1638 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1639 $totalarray[
'nbfield']++;
1641if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1642 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1643 $totalarray[
'nbfield']++;
1645if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1646 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1647 $totalarray[
'nbfield']++;
1649if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1650 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1651 $totalarray[
'nbfield']++;
1653if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1654 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1655 $totalarray[
'nbfield']++;
1657if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1658 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1659 $totalarray[
'nbfield']++;
1662include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1665 'arrayfields' => $arrayfields,
1667 'sortfield' => $sortfield,
1668 'sortorder' => $sortorder,
1669 'totalarray' => &$totalarray,
1672$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1674print $hookmanager->resPrint;
1675if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1676 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1677 $totalarray[
'nbfield']++;
1679if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1681 $totalarray[
'nbfield']++;
1683if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1685 $totalarray[
'nbfield']++;
1687if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1688 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1689 $totalarray[
'nbfield']++;
1691if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1693 $totalarray[
'nbfield']++;
1695if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1697 $totalarray[
'nbfield']++;
1700 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1701 $totalarray[
'nbfield']++;
1710$with_margin_info =
false;
1711if (isModEnabled(
'margin') && (
1712 !empty($arrayfields[
'total_pa'][
'checked'])
1713 || !empty($arrayfields[
'total_margin'][
'checked'])
1714 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1715 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1718 $with_margin_info =
true;
1725$savnbfield = $totalarray[
'nbfield'];
1726$totalarray = array();
1727$totalarray[
'nbfield'] = 0;
1728$imaxinloop = ($limit ? min($num, $limit) : $num);
1729while ($i < $imaxinloop) {
1730 $obj = $db->fetch_object($resql);
1734 if ($search_option) {
1735 $param .=
"&search_option=".urlencode($search_option);
1738 $objectstatic->id = $obj->rowid;
1739 $objectstatic->ref = $obj->ref;
1740 $objectstatic->ref_client = $obj->ref_client;
1741 $objectstatic->note_public = $obj->note_public;
1742 $objectstatic->note_private = $obj->note_private;
1743 $objectstatic->statut = $obj->status;
1744 $objectstatic->status = $obj->status;
1746 $companystatic->id = $obj->socid;
1747 $companystatic->name = $obj->name;
1748 $companystatic->name_alias = $obj->alias;
1749 $companystatic->client = $obj->client;
1750 $companystatic->fournisseur = $obj->fournisseur;
1751 $companystatic->code_client = $obj->code_client;
1752 $companystatic->email = $obj->email;
1753 $companystatic->phone = $obj->phone;
1754 $companystatic->address = $obj->address;
1755 $companystatic->zip = $obj->zip;
1756 $companystatic->town = $obj->town;
1757 $companystatic->country_code = $obj->country_code;
1759 $projectstatic->id = $obj->project_id;
1760 $projectstatic->ref = $obj->project_ref;
1761 $projectstatic->title = $obj->project_label;
1763 $totalInvoicedHT = 0;
1764 $totalInvoicedTTC = 0;
1765 $multicurrency_totalInvoicedHT = 0;
1766 $multicurrency_totalInvoicedTTC = 0;
1768 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1770 if (!empty($TInvoiceData)) {
1771 foreach ($TInvoiceData as $invoiceData) {
1773 $invoice->fetch($invoiceData->facid);
1779 $totalInvoicedHT += $invoice->total_ht;
1780 $totalInvoicedTTC += $invoice->total_ttc;
1781 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1782 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1786 $marginInfo = array();
1787 if ($with_margin_info ===
true) {
1788 $objectstatic->fetch_lines();
1789 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1790 $total_ht += $obj->total_ht;
1791 $total_margin += $marginInfo[
'total_margin'];
1794 if ($mode ==
'kanban') {
1796 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1797 print
'<div class="box-flex-container kanban">';
1800 $userstatic->fetch($obj->fk_user_author);
1801 $arrayofparams = array(
'selected' => in_array($object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1802 print $objectstatic->getKanbanView(
'', $arrayofparams);
1803 if ($i == ($imaxinloop - 1)) {
1808 print
'<tr class="oddeven">';
1812 print
'<td class="nowrap" align="center">';
1813 if ($massactionbutton || $massaction) {
1815 if (in_array($obj->rowid, $arrayofselected)) {
1818 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1822 $totalarray[
'nbfield']++;
1826 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1827 print
'<td class="nowraponall">';
1829 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1831 print
'<td class="nobordernopadding nowraponall">';
1832 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1836 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1837 $warnornote .=
img_warning($langs->trans(
"Late"));
1840 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1845 print
'<td width="16" class="nobordernopadding right">';
1847 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1848 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1849 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1850 print
'</td></tr></table>';
1854 $totalarray[
'nbfield']++;
1858 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1860 print
'<td class="nowrap tdoverflowmax200">';
1864 $totalarray[
'nbfield']++;
1868 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1870 print
'<td class="nowraponall">';
1871 if ($obj->project_id > 0) {
1872 print $projectstatic->getNomUrl(1);
1876 $totalarray[
'nbfield']++;
1880 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1882 print
'<td class="nowrap">';
1883 if ($obj->project_id > 0) {
1888 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1894 print
'<td class="tdoverflowmax150">';
1895 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1898 $totalarray[
'nbfield']++;
1903 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1904 print
'<td class="tdoverflowmax200">';
1908 $totalarray[
'nbfield']++;
1913 if (!empty($arrayfields[
's.town'][
'checked'])) {
1914 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1918 $totalarray[
'nbfield']++;
1922 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1923 print
'<td class="nocellnopadd">';
1927 $totalarray[
'nbfield']++;
1931 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1932 print
"<td>".$obj->state_name.
"</td>\n";
1934 $totalarray[
'nbfield']++;
1938 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1939 print
'<td class="center">';
1940 $tmparray =
getCountry($obj->fk_pays,
'all');
1941 print $tmparray[
'label'];
1944 $totalarray[
'nbfield']++;
1948 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1949 if (!is_array($typenArray) || empty($typenArray)) {
1950 $typenArray = $formcompany->typent_array(1);
1953 print
'<td class="center">';
1954 print $typenArray[$obj->typent_code];
1957 $totalarray[
'nbfield']++;
1962 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1963 print
'<td class="center">';
1967 $totalarray[
'nbfield']++;
1972 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1974 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1977 print
'<td> </td>';
1980 $totalarray[
'nbfield']++;
1984 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1985 if ($obj->ddelivery) {
1986 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
1989 print
'<td> </td>';
1992 $totalarray[
'nbfield']++;
1996 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1997 if ($obj->dsignature) {
1998 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2001 print
'<td> </td>';
2004 $totalarray[
'nbfield']++;
2008 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2009 print
'<td class="center">';
2010 $form->form_availability(
'', $obj->availability,
'none', 1);
2013 $totalarray[
'nbfield']++;
2017 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2019 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2022 $totalarray[
'nbfield']++;
2026 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2027 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($form->cache_demand_reason[$obj->fk_input_reason][
'label']).
'">';
2028 if ($obj->fk_input_reason > 0) {
2029 print $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2033 $totalarray[
'nbfield']++;
2037 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2039 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2042 $totalarray[
'nbfield']++;
2046 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2048 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2051 $totalarray[
'nbfield']++;
2055 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2056 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2058 $totalarray[
'nbfield']++;
2061 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2063 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2064 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2066 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2070 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2071 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2073 $totalarray[
'nbfield']++;
2076 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2078 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2079 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2081 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2085 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2086 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2088 $totalarray[
'nbfield']++;
2091 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2093 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2094 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2096 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2100 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2101 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2103 $totalarray[
'nbfield']++;
2106 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2108 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2109 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2111 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2115 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2116 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2118 $totalarray[
'nbfield']++;
2121 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2123 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2124 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2126 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2130 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2131 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2133 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2139 print
'<td class="nowrap">';
2140 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2143 $totalarray[
'nbfield']++;
2147 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2148 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2150 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2155 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2157 $totalarray[
'nbfield']++;
2161 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2162 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2164 $totalarray[
'nbfield']++;
2168 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2169 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2171 $totalarray[
'nbfield']++;
2175 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2176 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2178 $totalarray[
'nbfield']++;
2182 $userstatic->id = $obj->fk_user_author;
2183 $userstatic->login = $obj->login;
2184 $userstatic->lastname = $obj->lastname;
2185 $userstatic->firstname = $obj->firstname;
2186 $userstatic->email = $obj->user_email;
2187 $userstatic->statut = $obj->user_statut;
2188 $userstatic->entity = $obj->user_entity;
2189 $userstatic->photo = $obj->photo;
2190 $userstatic->office_phone = $obj->office_phone;
2191 $userstatic->office_fax = $obj->office_fax;
2192 $userstatic->user_mobile = $obj->user_mobile;
2193 $userstatic->job = $obj->job;
2194 $userstatic->gender = $obj->gender;
2197 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2198 print
'<td class="tdoverflowmax150">';
2199 if ($userstatic->id) {
2200 print $userstatic->getNomUrl(-1);
2204 $totalarray[
'nbfield']++;
2208 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2210 print
'<td class="tdoverflowmax125">';
2211 if ($obj->socid > 0) {
2212 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2213 if ($listsalesrepresentatives < 0) {
2216 $nbofsalesrepresentative = count($listsalesrepresentatives);
2217 if ($nbofsalesrepresentative > 6) {
2219 print $nbofsalesrepresentative;
2220 } elseif ($nbofsalesrepresentative > 0) {
2221 $userstatic =
new User($db);
2223 foreach ($listsalesrepresentatives as $val) {
2224 $userstatic->id = $val[
'id'];
2225 $userstatic->lastname = $val[
'lastname'];
2226 $userstatic->firstname = $val[
'firstname'];
2227 $userstatic->email = $val[
'email'];
2228 $userstatic->statut = $val[
'statut'];
2229 $userstatic->entity = $val[
'entity'];
2230 $userstatic->photo = $val[
'photo'];
2231 $userstatic->login = $val[
'login'];
2232 $userstatic->office_phone = $val[
'office_phone'];
2233 $userstatic->office_fax = $val[
'office_fax'];
2234 $userstatic->user_mobile = $val[
'user_mobile'];
2235 $userstatic->job = $val[
'job'];
2236 $userstatic->gender = $val[
'gender'];
2238 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2240 if ($j < $nbofsalesrepresentative) {
2252 $totalarray[
'nbfield']++;
2257 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2258 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2260 $totalarray[
'nbfield']++;
2264 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2265 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2267 $totalarray[
'nbfield']++;
2270 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2272 $totalarray[
'val'][
'total_margin'] = $total_margin;
2275 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2276 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2278 $totalarray[
'nbfield']++;
2282 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2283 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2285 $totalarray[
'nbfield']++;
2288 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2290 if ($i >= $imaxinloop - 1) {
2291 if (!empty($total_ht)) {
2292 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2294 $totalarray[
'val'][
'total_mark_rate'] =
'';
2300 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2302 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2303 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2304 print $hookmanager->resPrint;
2306 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2307 print
'<td align="center" class="nowrap">';
2308 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2311 $totalarray[
'nbfield']++;
2315 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2316 print
'<td align="center" class="nowrap">';
2317 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2320 $totalarray[
'nbfield']++;
2324 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2325 print
'<td align="center" class="nowrap">';
2326 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2329 $totalarray[
'nbfield']++;
2333 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2334 print
'<td class="center">';
2338 $totalarray[
'nbfield']++;
2342 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2343 print
'<td class="center">';
2347 $totalarray[
'nbfield']++;
2351 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2352 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2354 $totalarray[
'nbfield']++;
2359 print
'<td class="nowrap" align="center">';
2360 if ($massactionbutton || $massaction) {
2362 if (in_array($obj->rowid, $arrayofselected)) {
2365 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2369 $totalarray[
'nbfield']++;
2381include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2386 foreach ($arrayfields as $key => $val) {
2387 if (!empty($val[
'checked'])) {
2391 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2396$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2397$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2398print $hookmanager->resPrint;
2400print
'</table>'.
"\n";
2403print
'</form>'.
"\n";
2405if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2406 $hidegeneratedfilelistifempty = 1;
2407 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2408 $hidegeneratedfilelistifempty = 0;
2411 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2415 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2416 $urlsource .= str_replace(
'&',
'&', $param);
2418 $filedir = $diroutputmassaction;
2419 $genallowed = $permissiontoread;
2420 $delallowed = $permissiontoadd;
2422 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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()
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=0, $outputlangs='', $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 informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return 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...
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.