42 require
'../../main.inc.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
60 $langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
62 $langs->loadLangs(array(
'sendings'));
65 $socid =
GETPOST(
'socid',
'int');
67 $action =
GETPOST(
'action',
'aZ09');
68 $massaction =
GETPOST(
'massaction',
'alpha');
69 $show_files =
GETPOST(
'show_files',
'int');
70 $confirm =
GETPOST(
'confirm',
'alpha');
71 $toselect =
GETPOST(
'toselect',
'array');
72 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
74 $search_user =
GETPOST(
'search_user',
'int');
75 $search_sale =
GETPOST(
'search_sale',
'int');
77 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
79 $search_refproject =
GETPOST(
'search_refproject',
'alpha');
80 $search_project =
GETPOST(
'search_project',
'alpha');
82 $search_societe =
GETPOST(
'search_societe',
'alpha');
83 $search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
84 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
85 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
86 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
87 $search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
88 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
89 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
90 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
91 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
92 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
93 $search_login =
GETPOST(
'search_login',
'alpha');
94 $search_product_category =
GETPOST(
'search_product_category',
'int');
95 $search_town =
GETPOST(
'search_town',
'alpha');
96 $search_zip =
GETPOST(
'search_zip',
'alpha');
97 $search_state =
GETPOST(
"search_state");
98 $search_country =
GETPOST(
"search_country",
'int');
99 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
100 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
101 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
102 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
103 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
104 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
105 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
106 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
107 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
108 $search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
109 $search_date_end_startmonth =
GETPOST(
'se$sql .= $db->plimit($limit + 1, $offset);
110 arch_date_end_startmonth',
'int');
111 $search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
112 $search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
113 $search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
114 $search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
115 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
116 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
117 $search_date_delivery_startday =
GETPOST(
'search_date_delivery_startday',
'int');
118 $search_date_delivery_startmonth =
GETPOST(
'search_date_delivery_startmonth',
'int');
119 $search_date_delivery_startyear =
GETPOST(
'search_date_delivery_startyear',
'int');
120 $search_date_delivery_endday =
GETPOST(
'search_date_delivery_endday',
'int');
121 $search_date_delivery_endmonth =
GETPOST(
'search_date_delivery_endmonth',
'int');
122 $search_date_delivery_endyear =
GETPOST(
'search_date_delivery_endyear',
'int');
123 $search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
124 $search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
125 $search_availability =
GETPOST(
'search_availability',
'int');
126 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
127 $search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'int');
128 $search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'int');
129 $search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'int');
130 $search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'int');
131 $search_btn =
GETPOST(
'button_search',
'alpha');
132 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
133 $search_date_signature_startday =
GETPOST(
'search_date_signature_startday',
'int');
134 $search_date_signature_startmonth =
GETPOST(
'search_date_signature_startmonth',
'int');
135 $search_date_signature_startyear =
GETPOST(
'search_date_signature_startyear',
'int');
136 $search_date_signature_endday =
GETPOST(
'search_date_signature_endday',
'int');
137 $search_date_signature_endmonth =
GETPOST(
'search_date_signature_endmonth',
'int');
138 $search_date_signature_endyear =
GETPOST(
'search_date_signature_endyear',
'int');
139 $search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
140 $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');
144 $optioncss =
GETPOST(
'optioncss',
'alpha');
145 $object_statut =
GETPOST(
'search_statut',
'alpha');
147 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
151 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
152 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
153 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
155 if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
158 $offset = $limit * $page;
159 $pageprev = $page - 1;
160 $pagenext = $page + 1;
162 $sortfield =
'p.ref';
172 if (!empty($user->socid)) {
173 $socid = $user->socid;
175 if (!empty($socid)) {
178 $dbtable =
'&societe';
182 $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
185 $object =
new Propal($db);
186 $hookmanager->initHooks(array(
'propallist'));
190 $extrafields->fetch_name_optionals_label($object->table_element);
192 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
195 $fieldstosearchall = array(
197 'p.ref_client'=>
'CustomerRef',
198 'pd.description'=>
'Description',
199 's.nom'=>
"ThirdParty",
200 's.name_alias'=>
"AliasNameShort",
203 'p.note_public'=>
'NotePublic',
205 if (empty($user->socid)) {
206 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
210 $checkedtypetiers = 0;
211 $arrayfields = array(
212 'p.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
213 'p.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1),
214 'pr.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(
isModEnabled(
'project') ? 1 : 0)),
215 'pr.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(
isModEnabled(
'project') ? 1 : 0)),
216 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
217 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1),
218 's.town'=>array(
'label'=>
"Town",
'checked'=>-1),
219 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1),
220 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0),
221 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0),
222 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers),
223 'p.date'=>array(
'label'=>
"DatePropal",
'checked'=>1),
224 'p.fin_validite'=>array(
'label'=>
"DateEnd",
'checked'=>1),
225 'p.date_livraison'=>array(
'label'=>
"DeliveryDate",
'checked'=>0),
226 'p.date_signature'=>array(
'label'=>
"DateSigning",
'checked'=>0),
227 'ava.rowid'=>array(
'label'=>
"AvailabilityPeriod",
'checked'=>0),
228 'p.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>0,
'enabled'=>
isModEnabled(
"expedition")),
229 'p.fk_input_reason'=>array(
'label'=>
"Origin",
'checked'=>0,
'enabled'=>1),
230 'p.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>0),
231 'p.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>0),
232 'p.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1),
233 'p.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0),
234 'p.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0),
235 'p.total_ht_invoiced'=>array(
'label'=>
"AmountInvoicedHT",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
236 'p.total_invoiced'=>array(
'label'=>
"AmountInvoicedTTC",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
237 'p.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
238 'p.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
239 'p.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
240 'p.multicurrency_total_tva'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
241 'p.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!
isModEnabled(
"multicurrency") ? 0 : 1)),
242 'p.multicurrency_total_ht_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedHT',
'checked'=>0,
'enabled'=>
isModEnabled(
"multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
243 'p.multicurrency_total_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedTTC',
'checked'=>0,
'enabled'=>
isModEnabled(
"multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
244 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>10),
245 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>-1),
246 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->rights->margins->liretous ? 0 : 1)),
247 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->rights->margins->liretous ? 0 : 1)),
248 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
249 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
250 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
251 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
252 'p.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>500),
253 'p.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
254 'p.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
255 'p.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
281 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
283 $permissiontoread = $user->rights->propal->lire;
284 $permissiontoadd = $user->rights->propal->creer;
285 $permissiontodelete = $user->rights->propal->supprimer;
286 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
287 $permissiontovalidate = $user->rights->propal->propal_advance->validate;
288 $permissiontoclose = $user->rights->propal->propal_advance->close;
289 $permissiontosendbymail = $user->rights->propal->propal_advance->send;
291 $permissiontovalidate = $user->rights->propal->creer;
292 $permissiontoclose = $user->rights->propal->creer;
293 $permissiontosendbymail = $user->rights->propal->lire;
301 if (
GETPOST(
'cancel',
'alpha')) {
305 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
309 $parameters = array(
'socid'=>$socid);
310 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
315 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
318 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
323 $search_refcustomer =
'';
324 $search_refproject =
'';
325 $search_project =
'';
326 $search_societe =
'';
327 $search_societe_alias =
'';
328 $search_montant_ht =
'';
329 $search_montant_vat =
'';
330 $search_montant_ttc =
'';
331 $search_warehouse =
'';
332 $search_multicurrency_code =
'';
333 $search_multicurrency_tx =
'';
334 $search_multicurrency_montant_ht =
'';
335 $search_multicurrency_montant_vat =
'';
336 $search_multicurrency_montant_ttc =
'';
338 $search_product_category =
'';
343 $search_country =
'';
344 $search_type_thirdparty =
'';
345 $search_date_startday =
'';
346 $search_date_startmonth =
'';
347 $search_date_startyear =
'';
348 $search_date_endday =
'';
349 $search_date_endmonth =
'';
350 $search_date_endyear =
'';
351 $search_date_start =
'';
352 $search_date_end =
'';
353 $search_date_end_startday =
'';
354 $search_date_end_startmonth =
'';
355 $search_date_end_startyear =
'';
356 $search_date_end_endday =
'';
357 $search_date_end_endmonth =
'';
358 $search_date_end_endyear =
'';
359 $search_date_end_start =
'';
360 $search_date_end_end =
'';
361 $search_date_delivery_startday =
'';
362 $search_date_delivery_startmonth =
'';
363 $search_date_delivery_startyear =
'';
364 $search_date_delivery_endday =
'';
365 $search_date_delivery_endmonth =
'';
366 $search_date_delivery_endyear =
'';
367 $search_date_delivery_start =
'';
368 $search_date_delivery_end =
'';
369 $search_availability =
'';
373 $search_array_options = array();
374 $search_categ_cus = 0;
375 $search_fk_cond_reglement =
'';
376 $search_fk_shipping_method =
'';
377 $search_fk_input_reason =
'';
378 $search_fk_mode_reglement =
'';
379 $search_date_signature_startday =
'';
380 $search_date_signature_startmonth =
'';
381 $search_date_signature_startyear =
'';
382 $search_date_signature_endday =
'';
383 $search_date_signature_endmonth =
'';
384 $search_date_signature_endyear =
'';
385 $search_date_signature_start =
'';
386 $search_date_signature_end =
'';
388 if ($object_statut !=
'') {
389 $search_status = $object_statut;
393 if (empty($reshook)) {
394 $objectclass =
'Propal';
395 $objectlabel =
'Proposals';
396 $uploaddir = $conf->propal->multidir_output[$conf->entity];
397 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
400 if ($action ==
'validate' && $permissiontovalidate) {
401 if (
GETPOST(
'confirm') ==
'yes') {
402 $tmpproposal =
new Propal($db);
405 foreach ($toselect as $checked) {
406 if ($tmpproposal->fetch($checked) > 0) {
407 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
408 if ($tmpproposal->valid($user) > 0) {
409 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
415 $langs->load(
"errors");
416 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
432 if ($action ==
"sign" && $permissiontoclose) {
433 if (
GETPOST(
'confirm') ==
'yes') {
434 $tmpproposal =
new Propal($db);
437 foreach ($toselect as $checked) {
438 if ($tmpproposal->fetch($checked) > 0) {
439 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
440 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
441 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
442 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
448 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
464 if ($action ==
"nosign" && $permissiontoclose) {
465 if (
GETPOST(
'confirm') ==
'yes') {
466 $tmpproposal =
new Propal($db);
469 foreach ($toselect as $checked) {
470 if ($tmpproposal->fetch($checked) > 0) {
471 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (!empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
472 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
473 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
474 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
480 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
497 if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
500 $objecttmp =
new $objectclass($db);
502 foreach ($toselect as $toselectid) {
503 $result = $objecttmp->fetch($toselectid);
505 $result = $objecttmp->classifyBilled($user, 0);
548 $companystatic =
new Societe($db);
549 $projectstatic =
new Project($db);
552 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
553 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
555 $title = $langs->trans(
'ListOfProposals');
556 $help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
560 if ($sall || $search_user > 0) {
561 $sql =
'SELECT DISTINCT';
563 $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, ';
564 $sql .=
" typent.code as typent_code,";
565 $sql .=
" ava.rowid as availability,";
566 $sql .=
" country.code as country_code,";
567 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
568 $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,';
569 $sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
570 $sql .=
' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
571 $sql .=
' p.date_signature as dsignature,';
572 $sql .=
' p.note_public, p.note_private,';
573 $sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
574 $sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
575 $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';
576 if (empty($user->rights->societe->client->voir) && !$socid) {
577 $sql .=
", sc.fk_soc, sc.fk_user";
579 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
580 $sql .=
", cc.fk_categorie, cc.fk_soc";
583 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
584 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
585 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
589 $parameters = array();
590 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
591 $sql .= $hookmanager->resPrint;
592 $sql = preg_replace(
'/, $/',
'', $sql);
596 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
597 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
598 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
599 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
600 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
601 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
603 $sql .=
', '.MAIN_DB_PREFIX.
'propal as p';
604 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
605 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
608 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid=pd.fk_propal';
610 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
611 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
612 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
614 if ($search_sale == -2) {
615 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON (sc.fk_soc = p.fk_soc)";
616 } elseif ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
617 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
619 if ($search_user > 0) {
620 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
621 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
625 $parameters = array();
626 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
627 $sql .= $hookmanager->resPrint;
629 $sql .=
' WHERE p.fk_soc = s.rowid';
630 $sql .=
' AND p.entity IN ('.getEntity(
'propal').
')';
631 if (empty($user->rights->societe->client->voir) && !$socid) {
632 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
644 if ($search_country) {
645 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
647 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
648 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
653 if ($search_refcustomer) {
656 if ($search_refproject) {
659 if ($search_project) {
662 if ($search_availability) {
663 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
665 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
666 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
668 if ($search_societe) {
671 if ($search_societe_alias) {
676 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
678 if ($search_montant_ht !=
'') {
681 if ($search_montant_vat !=
'') {
684 if ($search_montant_ttc !=
'') {
687 if ($search_warehouse !=
'' && $search_warehouse > 0) {
690 if ($search_multicurrency_code !=
'') {
691 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
693 if ($search_multicurrency_tx !=
'') {
694 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
696 if ($search_multicurrency_montant_ht !=
'') {
697 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
699 if ($search_multicurrency_montant_vat !=
'') {
700 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
702 if ($search_multicurrency_montant_ttc !=
'') {
703 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
709 if ($search_categ_cus > 0) {
710 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
712 if ($search_categ_cus == -2) {
713 $sql .=
" AND cc.fk_categorie IS NULL";
716 if ($search_fk_cond_reglement > 0) {
717 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
719 if ($search_fk_shipping_method > 0) {
720 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
722 if ($search_fk_input_reason > 0) {
723 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
725 if ($search_fk_mode_reglement > 0) {
726 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
729 $sql .=
' AND s.rowid = '.((int) $socid);
731 if ($search_status !=
'' && $search_status !=
'-1') {
732 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
734 if ($search_date_start) {
735 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
737 if ($search_date_end) {
738 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
740 if ($search_date_end_start) {
741 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
743 if ($search_date_end_end) {
744 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
746 if ($search_date_delivery_start) {
747 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
749 if ($search_date_delivery_end) {
750 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
752 if ($search_sale == -2) {
753 $sql .=
" AND sc.fk_user IS NULL";
754 } elseif ($search_sale > 0) {
755 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
757 if ($search_user > 0) {
758 $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);
760 if ($search_date_signature_start) {
761 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
763 if ($search_date_signature_end) {
764 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
767 $searchCategoryProductOperator = -1;
768 $searchCategoryProductList = array($search_product_category);
769 if (!empty($searchCategoryProductList)) {
770 $searchCategoryProductSqlList = array();
771 $listofcategoryid =
'';
772 foreach ($searchCategoryProductList as $searchCategoryProduct) {
773 if (intval($searchCategoryProduct) == -2) {
774 $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)";
775 } elseif (intval($searchCategoryProduct) > 0) {
776 if ($searchCategoryProductOperator == 0) {
777 $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).
")";
779 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
783 if ($listofcategoryid) {
784 $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).
"))";
786 if ($searchCategoryProductOperator == 1) {
787 if (!empty($searchCategoryProductSqlList)) {
788 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
791 if (!empty($searchCategoryProductSqlList)) {
792 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
797 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
800 $parameters = array();
801 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
802 $sql .= $hookmanager->resPrint;
805 $parameters = array();
806 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
807 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
811 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
813 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
814 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
815 $resql = $db->query($sqlforcount);
817 $objforcount = $db->fetch_object(
$resql);
830 $sql .= $db->order($sortfield, $sortorder);
831 $sql .=
', p.ref DESC';
833 $sql .= $db->plimit($limit + 1, $offset);
836 $resql = $db->query($sql);
839 $objectstatic =
new Propal($db);
840 $userstatic =
new User($db);
845 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
846 if (empty($search_societe)) {
847 $search_societe = $soc->name;
850 $title = $langs->trans(
'Proposals');
853 $num = $db->num_rows(
$resql);
855 $arrayofselected = is_array($toselect) ? $toselect : array();
857 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
858 $obj = $db->fetch_object(
$resql);
862 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.$id);
866 $param =
'&search_status='.urlencode($search_status);
867 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
868 $param .=
'&contextpage='.urlencode($contextpage);
870 if ($limit > 0 && $limit != $conf->liste_limit) {
871 $param .=
'&limit='.urlencode($limit);
874 $param .=
'&sall='.urlencode($sall);
876 if ($search_date_startday) {
877 $param .=
'&search_date_startday='.urlencode($search_date_startday);
879 if ($search_date_startmonth) {
880 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
882 if ($search_date_startyear) {
883 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
885 if ($search_date_endday) {
886 $param .=
'&search_date_endday='.urlencode($search_date_endday);
888 if ($search_date_endmonth) {
889 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
891 if ($search_date_endyear) {
892 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
894 if ($search_date_end_startday) {
895 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
897 if ($search_date_end_startmonth) {
898 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
900 if ($search_date_end_startyear) {
901 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
903 if ($search_date_end_endday) {
904 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
906 if ($search_date_end_endmonth) {
907 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
909 if ($search_date_end_endyear) {
910 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
912 if ($search_date_delivery_startday) {
913 $param .=
'&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
915 if ($search_date_delivery_startmonth) {
916 $param .=
'&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
918 if ($search_date_delivery_startyear) {
919 $param .=
'&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
921 if ($search_date_delivery_endday) {
922 $param .=
'&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
924 if ($search_date_delivery_endmonth) {
925 $param .=
'&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
927 if ($search_date_delivery_endyear) {
928 $param .=
'&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
931 $param .=
'&search_ref='.urlencode($search_ref);
933 if ($search_refcustomer) {
934 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
936 if ($search_refproject) {
937 $param .=
'&search_refproject='.urlencode($search_refproject);
939 if ($search_societe) {
940 $param .=
'&search_societe='.urlencode($search_societe);
942 if ($search_societe_alias) {
943 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
945 if ($search_user > 0) {
946 $param .=
'&search_user='.urlencode($search_user);
948 if ($search_sale > 0) {
949 $param .=
'&search_sale='.urlencode($search_sale);
951 if ($search_montant_ht) {
952 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
954 if ($search_multicurrency_code !=
'') {
955 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
957 if ($search_multicurrency_tx !=
'') {
958 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
960 if ($search_multicurrency_montant_ht !=
'') {
961 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
963 if ($search_multicurrency_montant_vat !=
'') {
964 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
966 if ($search_multicurrency_montant_ttc !=
'') {
967 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
970 $param .=
'&search_login='.urlencode($search_login);
973 $param .=
'&search_town='.urlencode($search_town);
976 $param .=
'&search_zip='.urlencode($search_zip);
979 $param .=
'&socid='.urlencode($socid);
981 if ($optioncss !=
'') {
982 $param .=
'&optioncss='.urlencode($optioncss);
984 if ($search_categ_cus > 0) {
985 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
987 if ($search_product_category !=
'') {
988 $param .=
'&search_product_category='.urlencode($search_product_category);
990 if ($search_fk_cond_reglement > 0) {
991 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
993 if ($search_fk_shipping_method > 0) {
994 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
996 if ($search_fk_input_reason > 0) {
997 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
999 if ($search_fk_mode_reglement > 0) {
1000 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1002 if ($search_type_thirdparty > 0) {
1003 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1006 $param .=
'&search_town='.urlencode($search_town);
1009 $param .=
'&search_zip='.urlencode($search_zip);
1011 if ($search_state) {
1012 $param .=
'&search_state='.urlencode($search_state);
1015 $param .=
'&search_town='.urlencode($search_town);
1017 if ($search_country) {
1018 $param .=
'&search_country='.urlencode($search_country);
1020 if ($search_date_signature_startday) {
1021 $param .=
'&search_date_signature_startday='.urlencode($search_date_signature_startday);
1023 if ($search_date_signature_startmonth) {
1024 $param .=
'&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
1026 if ($search_date_signature_startyear) {
1027 $param .=
'&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
1029 if ($search_date_signature_endday) {
1030 $param .=
'&search_date_signature_endday='.urlencode($search_date_signature_endday);
1032 if ($search_date_signature_endmonth) {
1033 $param .=
'&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
1035 if ($search_date_signature_endyear) {
1036 $param .=
'&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
1040 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1042 $parameters = array();
1043 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1044 $param .= $hookmanager->resPrint;
1047 $arrayofmassactions = array(
1048 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1049 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1051 if ($permissiontosendbymail) {
1052 $arrayofmassactions[
'presend']=
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1054 if ($permissiontovalidate) {
1055 $arrayofmassactions[
'prevalidate']=
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1057 if ($permissiontoclose) {
1058 $arrayofmassactions[
'presign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1059 $arrayofmassactions[
'nopresign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1060 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1062 if ($permissiontodelete) {
1063 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1066 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1067 $arrayofmassactions = array();
1069 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1071 $url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1072 if (!empty($socid)) {
1073 $url .=
'&socid='.$socid;
1075 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->propal->creer);
1078 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1079 if ($optioncss !=
'') {
1080 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1082 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1083 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1084 print
'<input type="hidden" name="action" value="list">';
1085 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1086 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1087 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1089 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1091 $topicmail =
"SendPropalRef";
1092 $modelmail =
"propal_send";
1093 $objecttmp =
new Propal($db);
1094 $trackid =
'pro'.$object->id;
1095 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1097 if ($massaction ==
'prevalidate') {
1098 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1101 if ($massaction ==
'presign') {
1102 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1105 if ($massaction ==
'nopresign') {
1106 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1110 foreach ($fieldstosearchall as $key => $val) {
1111 $fieldstosearchall[$key] = $langs->trans($val);
1113 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1118 $moreforfilter =
'';
1121 if ($user->rights->user->user->lire) {
1122 $langs->load(
"commercial");
1123 $moreforfilter .=
'<div class="divsearchfield">';
1124 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1125 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1126 $moreforfilter .=
'</div>';
1129 if ($user->rights->user->user->lire) {
1130 $moreforfilter .=
'<div class="divsearchfield">';
1131 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1132 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1133 $moreforfilter .=
'</div>';
1136 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'read') && ($user->rights->produit->lire || $user->rights->service->lire)) {
1137 $searchCategoryProductOperator = -1;
1138 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1139 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1141 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1143 if (
isModEnabled(
'categorie') && $user->rights->categorie->lire) {
1144 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1145 $moreforfilter .=
'<div class="divsearchfield">';
1146 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1147 $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'));
1148 $moreforfilter .=
'</div>';
1150 if (
isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
1151 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1153 $moreforfilter .=
'<div class="divsearchfield">';
1154 $tmptitle = $langs->trans(
'Warehouse');
1155 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1156 $moreforfilter .=
'</div>';
1158 $parameters = array();
1159 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1160 if (empty($reshook)) {
1161 $moreforfilter .= $hookmanager->resPrint;
1163 $moreforfilter = $hookmanager->resPrint;
1166 if (!empty($moreforfilter)) {
1167 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1168 print $moreforfilter;
1172 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1173 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1174 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1176 print
'<div class="div-table-responsive">';
1177 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1179 print
'<tr class="liste_titre_filter">';
1182 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1183 print
'<td class="liste_titre" align="middle">';
1184 $searchpicto =
$form->showFilterButtons(
'left');
1189 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1190 print
'<td class="liste_titre">';
1191 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1194 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1195 print
'<td class="liste_titre">';
1196 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1199 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1200 print
'<td class="liste_titre">';
1201 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1204 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1205 print
'<td class="liste_titre">';
1206 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1209 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1210 print
'<td class="liste_titre" align="left">';
1211 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
1214 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1215 print
'<td class="liste_titre" align="left">';
1216 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1219 if (!empty($arrayfields[
's.town'][
'checked'])) {
1220 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1222 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1223 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1226 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1227 print
'<td class="liste_titre">';
1228 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1232 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1233 print
'<td class="liste_titre" align="center">';
1234 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1238 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1239 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1240 print
$form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1245 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1246 print
'<td class="liste_titre center">';
1247 print
'<div class="nowrap">';
1248 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1250 print
'<div class="nowrap">';
1251 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1256 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1257 print
'<td class="liste_titre center">';
1258 print
'<div class="nowrap">';
1259 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'));
1261 print
'<div class="nowrap">';
1262 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'));
1267 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1268 print
'<td class="liste_titre center">';
1269 print
'<div class="nowrap">';
1270 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'));
1272 print
'<div class="nowrap">';
1273 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'));
1278 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1279 print
'<td class="liste_titre center">';
1280 print
'<div class="nowrap">';
1281 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'));
1283 print
'<div class="nowrap">';
1284 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'));
1289 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1290 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1291 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1296 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1297 print
'<td class="liste_titre">';
1298 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1302 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1303 print
'<td class="liste_titre">';
1304 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1308 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1309 print
'<td class="liste_titre">';
1310 print
$form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1314 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1315 print
'<td class="liste_titre">';
1316 print
$form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1319 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1321 print
'<td class="liste_titre right">';
1322 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1325 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1327 print
'<td class="liste_titre right">';
1328 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1331 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1333 print
'<td class="liste_titre right">';
1334 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1337 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1339 print
'<td class="liste_titre right">';
1342 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1344 print
'<td class="liste_titre right">';
1347 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1349 print
'<td class="liste_titre">';
1350 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1353 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1355 print
'<td class="liste_titre">';
1356 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1359 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1361 print
'<td class="liste_titre right">';
1362 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1365 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1367 print
'<td class="liste_titre right">';
1368 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1371 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1373 print
'<td class="liste_titre right">';
1374 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1377 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1379 print
'<td class="liste_titre right">';
1382 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1384 print
'<td class="liste_titre right">';
1387 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1389 print
'<td class="liste_titre" align="center">';
1390 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1393 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1394 print
'<td class="liste_titre"></td>';
1396 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1397 print
'<td class="liste_titre right">';
1400 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1401 print
'<td class="liste_titre right">';
1404 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1405 print
'<td class="liste_titre right">';
1408 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1409 print
'<td class="liste_titre right">';
1413 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1416 $parameters = array(
'arrayfields'=>$arrayfields);
1417 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1418 print $hookmanager->resPrint;
1420 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1421 print
'<td class="liste_titre">';
1425 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1426 print
'<td class="liste_titre">';
1430 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1431 print
'<td class="liste_titre">';
1434 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1436 print
'<td class="liste_titre">';
1439 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1441 print
'<td class="liste_titre">';
1445 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1446 print
'<td class="liste_titre maxwidthonsmartphone right">';
1447 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_statut',
'search_status maxwidth125 onrightofpage');
1451 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1452 print
'<td class="liste_titre" align="middle">';
1453 $searchpicto =
$form->showFilterButtons();
1459 $totalarray = array(
1469 print
'<tr class="liste_titre">';
1470 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1471 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1473 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1476 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1477 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1479 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1480 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1482 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1483 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1485 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1486 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1488 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1491 if (!empty($arrayfields[
's.town'][
'checked'])) {
1492 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1494 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1495 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1497 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1498 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1500 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1501 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'class="center"', $sortfield, $sortorder);
1503 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1504 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'class="center"', $sortfield, $sortorder);
1506 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1507 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'class="center"', $sortfield, $sortorder);
1509 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1510 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'class="center"', $sortfield, $sortorder);
1512 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1513 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'class="center"', $sortfield, $sortorder);
1515 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1516 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'class="center"', $sortfield, $sortorder);
1518 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1519 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1521 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1522 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1524 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1525 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1527 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1530 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1531 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1533 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1534 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1536 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1537 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1539 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1540 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1542 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1543 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1545 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1546 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1548 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1549 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1551 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1552 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1554 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1555 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1557 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1558 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1560 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1561 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1563 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1566 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1567 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1569 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1570 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'class="center"', $sortfield, $sortorder);
1572 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1573 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1575 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1576 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1578 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1579 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1581 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1582 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1584 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1585 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1588 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1590 $parameters = array(
1591 'arrayfields' => $arrayfields,
1593 'sortfield' => $sortfield,
1594 'sortorder' => $sortorder,
1595 'totalarray' => &$totalarray,
1598 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1600 print $hookmanager->resPrint;
1601 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1602 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1604 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1605 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1607 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1608 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1610 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1611 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1613 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1614 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1616 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1617 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'class="right"', $sortfield, $sortorder);
1619 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1620 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1628 $with_margin_info =
false;
1630 !empty($arrayfields[
'total_pa'][
'checked'])
1631 || !empty($arrayfields[
'total_margin'][
'checked'])
1632 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1633 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1636 $with_margin_info =
true;
1641 $savnbfield = $totalarray[
'nbfield'];
1642 $totalarray = array();
1643 $totalarray[
'nbfield'] = 0;
1645 $imaxinloop = ($limit ? min($num, $limit) : $num);
1646 while ($i < $imaxinloop) {
1647 $obj = $db->fetch_object(
$resql);
1649 $objectstatic->id = $obj->rowid;
1650 $objectstatic->ref = $obj->ref;
1651 $objectstatic->ref_client = $obj->ref_client;
1652 $objectstatic->note_public = $obj->note_public;
1653 $objectstatic->note_private = $obj->note_private;
1654 $objectstatic->statut = $obj->status;
1655 $objectstatic->status = $obj->status;
1657 $companystatic->id = $obj->socid;
1658 $companystatic->name = $obj->name;
1659 $companystatic->name_alias = $obj->alias;
1660 $companystatic->client = $obj->client;
1661 $companystatic->fournisseur = $obj->fournisseur;
1662 $companystatic->code_client = $obj->code_client;
1663 $companystatic->email = $obj->email;
1664 $companystatic->phone = $obj->phone;
1665 $companystatic->address = $obj->address;
1666 $companystatic->zip = $obj->zip;
1667 $companystatic->town = $obj->town;
1668 $companystatic->country_code = $obj->country_code;
1670 $projectstatic->id = $obj->project_id;
1671 $projectstatic->ref = $obj->project_ref;
1672 $projectstatic->title = $obj->project_label;
1674 $totalInvoicedHT = 0;
1675 $totalInvoicedTTC = 0;
1676 $multicurrency_totalInvoicedHT = 0;
1677 $multicurrency_totalInvoicedTTC = 0;
1679 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1681 if (!empty($TInvoiceData)) {
1682 foreach ($TInvoiceData as $invoiceData) {
1684 $invoice->fetch($invoiceData->facid);
1686 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type ==
Facture::TYPE_DEPOSIT) {
1690 $totalInvoicedHT += $invoice->total_ht;
1691 $totalInvoicedTTC += $invoice->total_ttc;
1692 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1693 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1697 $marginInfo = array();
1698 if ($with_margin_info ===
true) {
1699 $objectstatic->fetch_lines();
1700 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1701 $total_ht += $obj->total_ht;
1702 $total_margin += $marginInfo[
'total_margin'];
1705 print
'<tr class="oddeven">';
1708 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1709 print
'<td class="nowrap" align="center">';
1710 if ($massactionbutton || $massaction) {
1712 if (in_array($obj->rowid, $arrayofselected)) {
1715 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1719 $totalarray[
'nbfield']++;
1723 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1724 print
'<td class="nowraponall">';
1726 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1728 print
'<td class="nobordernopadding nowraponall">';
1729 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1733 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1734 $warnornote .=
img_warning($langs->trans(
"Late"));
1737 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1742 print
'<td width="16" class="nobordernopadding right">';
1744 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1745 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1746 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1747 print
'</td></tr></table>';
1751 $totalarray[
'nbfield']++;
1755 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1757 print
'<td class="nowrap tdoverflowmax200">';
1761 $totalarray[
'nbfield']++;
1765 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1767 print
'<td class="nowraponall">';
1768 if ($obj->project_id > 0) {
1769 print $projectstatic->getNomUrl(1);
1773 $totalarray[
'nbfield']++;
1777 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1779 print
'<td class="nowrap">';
1780 if ($obj->project_id > 0) {
1785 $totalarray[
'nbfield']++;
1790 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1791 print
'<td class="tdoverflowmax150">';
1792 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1795 $totalarray[
'nbfield']++;
1800 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1801 print
'<td class="tdoverflowmax200">';
1805 $totalarray[
'nbfield']++;
1810 if (!empty($arrayfields[
's.town'][
'checked'])) {
1811 print
'<td class="nocellnopadd">';
1815 $totalarray[
'nbfield']++;
1819 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1820 print
'<td class="nocellnopadd">';
1824 $totalarray[
'nbfield']++;
1828 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1829 print
"<td>".$obj->state_name.
"</td>\n";
1831 $totalarray[
'nbfield']++;
1835 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1836 print
'<td class="center">';
1837 $tmparray =
getCountry($obj->fk_pays,
'all');
1838 print $tmparray[
'label'];
1841 $totalarray[
'nbfield']++;
1845 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1846 if (!is_array($typenArray) || empty($typenArray)) {
1847 $typenArray = $formcompany->typent_array(1);
1850 print
'<td class="center">';
1851 print $typenArray[$obj->typent_code];
1854 $totalarray[
'nbfield']++;
1859 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1860 print
'<td class="center">';
1864 $totalarray[
'nbfield']++;
1869 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1871 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1874 print
'<td> </td>';
1877 $totalarray[
'nbfield']++;
1881 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1882 if ($obj->ddelivery) {
1883 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
1886 print
'<td> </td>';
1889 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1894 if ($obj->dsignature) {
1895 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
1898 print
'<td> </td>';
1901 $totalarray[
'nbfield']++;
1905 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1906 print
'<td class="center">';
1907 $form->form_availability(
'', $obj->availability,
'none', 1);
1910 $totalarray[
'nbfield']++;
1914 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1916 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1919 $totalarray[
'nbfield']++;
1923 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1924 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag(
$form->cache_demand_reason[$obj->fk_input_reason][
'label']).
'">';
1925 if ($obj->fk_input_reason > 0) {
1926 print
$form->cache_demand_reason[$obj->fk_input_reason][
'label'];
1930 $totalarray[
'nbfield']++;
1934 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1936 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1939 $totalarray[
'nbfield']++;
1943 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1945 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1948 $totalarray[
'nbfield']++;
1952 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1953 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1955 $totalarray[
'nbfield']++;
1958 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
1960 if (empty($totalarray[
'val'][
'p.total_ht'])) {
1961 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
1963 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
1967 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1968 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1970 $totalarray[
'nbfield']++;
1973 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
1975 if (empty($totalarray[
'val'][
'p.total_tva'])) {
1976 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
1978 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
1982 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1983 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1985 $totalarray[
'nbfield']++;
1988 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
1990 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
1991 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
1993 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
1997 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1998 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2000 $totalarray[
'nbfield']++;
2003 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2005 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2006 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2008 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2012 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2013 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2015 $totalarray[
'nbfield']++;
2018 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2020 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2021 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2023 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2027 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2028 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2030 $totalarray[
'nbfield']++;
2035 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2036 print
'<td class="nowrap">';
2037 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2040 $totalarray[
'nbfield']++;
2044 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2045 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2047 $totalarray[
'nbfield']++;
2051 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2052 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2054 $totalarray[
'nbfield']++;
2058 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2059 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2061 $totalarray[
'nbfield']++;
2065 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2066 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2068 $totalarray[
'nbfield']++;
2072 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2073 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2075 $totalarray[
'nbfield']++;
2079 $userstatic->id = $obj->fk_user_author;
2080 $userstatic->login = $obj->login;
2081 $userstatic->lastname = $obj->lastname;
2082 $userstatic->firstname = $obj->firstname;
2083 $userstatic->email = $obj->user_email;
2084 $userstatic->statut = $obj->user_statut;
2085 $userstatic->entity = $obj->user_entity;
2086 $userstatic->photo = $obj->photo;
2087 $userstatic->office_phone = $obj->office_phone;
2088 $userstatic->office_fax = $obj->office_fax;
2089 $userstatic->user_mobile = $obj->user_mobile;
2090 $userstatic->job = $obj->job;
2091 $userstatic->gender = $obj->gender;
2094 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2095 print
'<td class="tdoverflowmax150">';
2096 if ($userstatic->id) {
2097 print $userstatic->getNomUrl(-1);
2101 $totalarray[
'nbfield']++;
2105 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2107 print
'<td class="tdoverflowmax150">';
2108 if ($obj->socid > 0) {
2109 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2110 if ($listsalesrepresentatives < 0) {
2113 $nbofsalesrepresentative = count($listsalesrepresentatives);
2114 if ($nbofsalesrepresentative > 6) {
2116 print $nbofsalesrepresentative;
2117 } elseif ($nbofsalesrepresentative > 0) {
2118 $userstatic =
new User($db);
2120 foreach ($listsalesrepresentatives as $val) {
2121 $userstatic->id = $val[
'id'];
2122 $userstatic->lastname = $val[
'lastname'];
2123 $userstatic->firstname = $val[
'firstname'];
2124 $userstatic->email = $val[
'email'];
2125 $userstatic->statut = $val[
'statut'];
2126 $userstatic->entity = $val[
'entity'];
2127 $userstatic->photo = $val[
'photo'];
2128 $userstatic->login = $val[
'login'];
2129 $userstatic->office_phone = $val[
'office_phone'];
2130 $userstatic->office_fax = $val[
'office_fax'];
2131 $userstatic->user_mobile = $val[
'user_mobile'];
2132 $userstatic->job = $val[
'job'];
2133 $userstatic->gender = $val[
'gender'];
2135 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2137 if ($j < $nbofsalesrepresentative) {
2149 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2155 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2157 $totalarray[
'nbfield']++;
2161 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2162 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2164 $totalarray[
'nbfield']++;
2167 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2169 $totalarray[
'val'][
'total_margin'] = $total_margin;
2172 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2173 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2175 $totalarray[
'nbfield']++;
2179 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2180 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2182 $totalarray[
'nbfield']++;
2185 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2187 if ($i >= $imaxinloop - 1) {
2188 if (!empty($total_ht)) {
2189 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2191 $totalarray[
'val'][
'total_mark_rate'] =
'';
2197 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2199 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2200 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2201 print $hookmanager->resPrint;
2203 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2204 print
'<td align="center" class="nowrap">';
2205 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2208 $totalarray[
'nbfield']++;
2212 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2213 print
'<td align="center" class="nowrap">';
2214 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2217 $totalarray[
'nbfield']++;
2221 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2222 print
'<td align="center" class="nowrap">';
2223 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2226 $totalarray[
'nbfield']++;
2230 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2231 print
'<td class="center">';
2235 $totalarray[
'nbfield']++;
2239 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2240 print
'<td class="center">';
2244 $totalarray[
'nbfield']++;
2248 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2249 print
'<td class="nowrap right">'.$objectstatic->getLibStatut(5).
'</td>';
2251 $totalarray[
'nbfield']++;
2255 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2256 print
'<td class="nowrap" align="center">';
2257 if ($massactionbutton || $massaction) {
2259 if (in_array($obj->rowid, $arrayofselected)) {
2262 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2266 $totalarray[
'nbfield']++;
2277 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2282 foreach ($arrayfields as $key => $val) {
2283 if (!empty($val[
'checked'])) {
2287 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2292 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2293 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2294 print $hookmanager->resPrint;
2296 print
'</table>'.
"\n";
2297 print
'</div>'.
"\n";
2299 print
'</form>'.
"\n";
2301 $hidegeneratedfilelistifempty = 1;
2302 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2303 $hidegeneratedfilelistifempty = 0;
2307 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2308 $urlsource .= str_replace(
'&',
'&', $param);
2310 $filedir = $diroutputmassaction;
2311 $genallowed = $user->rights->propal->lire;
2312 $delallowed = $user->rights->propal->creer;
2314 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages 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_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 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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessage($mesgs, $style='mesgs')
Set event message 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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
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.