40 require
'../../main.inc.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45 if (!empty($conf->margin->enabled)) {
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
54 $langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
55 if (!empty($conf->expedition->enabled)) {
56 $langs->loadLangs(array(
'sendings'));
59 $socid =
GETPOST(
'socid',
'int');
61 $action =
GETPOST(
'action',
'aZ09');
62 $massaction =
GETPOST(
'massaction',
'alpha');
63 $show_files =
GETPOST(
'show_files',
'int');
64 $confirm =
GETPOST(
'confirm',
'alpha');
65 $toselect =
GETPOST(
'toselect',
'array');
66 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
68 $search_user =
GETPOST(
'search_user',
'int');
69 $search_sale =
GETPOST(
'search_sale',
'int');
71 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
73 $search_refproject =
GETPOST(
'search_refproject',
'alpha');
74 $search_project =
GETPOST(
'search_project',
'alpha');
76 $search_societe =
GETPOST(
'search_societe',
'alpha');
77 $search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
78 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
79 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
80 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
81 $search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
82 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
83 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
84 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
85 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
86 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
87 $search_login =
GETPOST(
'search_login',
'alpha');
88 $search_product_category =
GETPOST(
'search_product_category',
'int');
89 $search_town =
GETPOST(
'search_town',
'alpha');
90 $search_zip =
GETPOST(
'search_zip',
'alpha');
91 $search_state =
GETPOST(
"search_state");
92 $search_country =
GETPOST(
"search_country",
'int');
93 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
94 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
95 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
96 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
97 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
98 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
99 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
100 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
101 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
102 $search_date_end_startday =
GETPOST(
'search_date_end_startday',
'int');
103 $search_date_end_startmonth =
GETPOST(
'search_date_end_startmonth',
'int');
104 $search_date_end_startyear =
GETPOST(
'search_date_end_startyear',
'int');
105 $search_date_end_endday =
GETPOST(
'search_date_end_endday',
'int');
106 $search_date_end_endmonth =
GETPOST(
'search_date_end_endmonth',
'int');
107 $search_date_end_endyear =
GETPOST(
'search_date_end_endyear',
'int');
108 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
109 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
110 $search_date_delivery_startday =
GETPOST(
'search_date_delivery_startday',
'int');
111 $search_date_delivery_startmonth =
GETPOST(
'search_date_delivery_startmonth',
'int');
112 $search_date_delivery_startyear =
GETPOST(
'search_date_delivery_startyear',
'int');
113 $search_date_delivery_endday =
GETPOST(
'search_date_delivery_endday',
'int');
114 $search_date_delivery_endmonth =
GETPOST(
'search_date_delivery_endmonth',
'int');
115 $search_date_delivery_endyear =
GETPOST(
'search_date_delivery_endyear',
'int');
116 $search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
117 $search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
118 $search_availability =
GETPOST(
'search_availability',
'int');
119 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
120 $search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'int');
121 $search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'int');
122 $search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'int');
123 $search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'int');
124 $search_btn =
GETPOST(
'button_search',
'alpha');
125 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
126 $search_date_signature_startday =
GETPOST(
'search_date_signature_startday',
'int');
127 $search_date_signature_startmonth =
GETPOST(
'search_date_signature_startmonth',
'int');
128 $search_date_signature_startyear =
GETPOST(
'search_date_signature_startyear',
'int');
129 $search_date_signature_endday =
GETPOST(
'search_date_signature_endday',
'int');
130 $search_date_signature_endmonth =
GETPOST(
'search_date_signature_endmonth',
'int');
131 $search_date_signature_endyear =
GETPOST(
'search_date_signature_endyear',
'int');
132 $search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
133 $search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
136 $search_status =
GETPOST(
'search_status',
'alpha');
137 $optioncss =
GETPOST(
'optioncss',
'alpha');
138 $object_statut =
GETPOST(
'search_statut',
'alpha');
140 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
144 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
145 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
146 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
148 if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
151 $offset = $limit * $page;
152 $pageprev = $page - 1;
153 $pagenext = $page + 1;
155 $sortfield =
'p.ref';
165 if (!empty($user->socid)) {
166 $socid = $user->socid;
168 if (!empty($socid)) {
171 $dbtable =
'&societe';
175 $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
178 $object =
new Propal($db);
179 $hookmanager->initHooks(array(
'propallist'));
183 $extrafields->fetch_name_optionals_label($object->table_element);
185 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
188 $fieldstosearchall = array(
190 'p.ref_client'=>
'RefCustomer',
191 'pd.description'=>
'Description',
192 's.nom'=>
"ThirdParty",
193 's.name_alias'=>
"AliasNameShort",
196 'p.note_public'=>
'NotePublic',
198 if (empty($user->socid)) {
199 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
203 $checkedtypetiers = 0;
204 $arrayfields = array(
205 'p.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
206 'p.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1),
207 'pr.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(empty($conf->project->enabled) ? 0 : 1)),
208 'pr.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(empty($conf->project->enabled) ? 0 : 1)),
209 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1),
210 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1),
211 's.town'=>array(
'label'=>
"Town",
'checked'=>-1),
212 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1),
213 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0),
214 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0),
215 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers),
216 'p.date'=>array(
'label'=>
"DatePropal",
'checked'=>1),
217 'p.fin_validite'=>array(
'label'=>
"DateEnd",
'checked'=>1),
218 'p.date_livraison'=>array(
'label'=>
"DeliveryDate",
'checked'=>0),
219 'p.date_signature'=>array(
'label'=>
"DateSigning",
'checked'=>0),
220 'ava.rowid'=>array(
'label'=>
"AvailabilityPeriod",
'checked'=>0),
221 'p.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>0,
'enabled'=>!empty($conf->expedition->enabled)),
222 'p.fk_input_reason'=>array(
'label'=>
"Origin",
'checked'=>0,
'enabled'=>1),
223 'p.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>0),
224 'p.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>0),
225 'p.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1),
226 'p.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0),
227 'p.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0),
228 'p.total_ht_invoiced'=>array(
'label'=>
"AmountInvoicedHT",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
229 'p.total_invoiced'=>array(
'label'=>
"AmountInvoicedTTC",
'checked'=>0,
'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
230 'p.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
231 'p.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
232 'p.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
233 'p.multicurrency_total_tva'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
234 'p.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
235 'p.multicurrency_total_ht_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedHT',
'checked'=>0,
'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
236 'p.multicurrency_total_invoiced'=>array(
'label'=>
'MulticurrencyAmountInvoicedTTC',
'checked'=>0,
'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
237 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>10),
238 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>-1),
239 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
240 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
241 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
242 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
243 'p.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
244 'p.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
245 'p.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>500),
246 'p.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),
247 'p.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES))),
248 'p.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
252 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
254 $permissiontoread = $user->rights->propal->lire;
255 $permissiontoadd = $user->rights->propal->creer;
256 $permissiontodelete = $user->rights->propal->supprimer;
257 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
258 $permissiontovalidate = $user->rights->propal->propal_advance->validate;
259 $permissiontoclose = $user->rights->propal->propal_advance->close;
260 $permissiontosendbymail = $user->rights->propal->propal_advance->send;
262 $permissiontovalidate = $user->rights->propal->creer;
263 $permissiontoclose = $user->rights->propal->creer;
264 $permissiontosendbymail = $user->rights->propal->lire;
272 if (
GETPOST(
'cancel',
'alpha')) {
276 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
280 $parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
281 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
286 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
289 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
294 $search_refcustomer =
'';
295 $search_refproject =
'';
296 $search_project =
'';
297 $search_societe =
'';
298 $search_societe_alias =
'';
299 $search_montant_ht =
'';
300 $search_montant_vat =
'';
301 $search_montant_ttc =
'';
302 $search_warehouse =
'';
303 $search_multicurrency_code =
'';
304 $search_multicurrency_tx =
'';
305 $search_multicurrency_montant_ht =
'';
306 $search_multicurrency_montant_vat =
'';
307 $search_multicurrency_montant_ttc =
'';
309 $search_product_category =
'';
314 $search_country =
'';
315 $search_type_thirdparty =
'';
316 $search_date_startday =
'';
317 $search_date_startmonth =
'';
318 $search_date_startyear =
'';
319 $search_date_endday =
'';
320 $search_date_endmonth =
'';
321 $search_date_endyear =
'';
322 $search_date_start =
'';
323 $search_date_end =
'';
324 $search_date_end_startday =
'';
325 $search_date_end_startmonth =
'';
326 $search_date_end_startyear =
'';
327 $search_date_end_endday =
'';
328 $search_date_end_endmonth =
'';
329 $search_date_end_endyear =
'';
330 $search_date_end_start =
'';
331 $search_date_end_end =
'';
332 $search_date_delivery_startday =
'';
333 $search_date_delivery_startmonth =
'';
334 $search_date_delivery_startyear =
'';
335 $search_date_delivery_endday =
'';
336 $search_date_delivery_endmonth =
'';
337 $search_date_delivery_endyear =
'';
338 $search_date_delivery_start =
'';
339 $search_date_delivery_end =
'';
340 $search_availability =
'';
344 $search_array_options = array();
345 $search_categ_cus = 0;
346 $search_fk_cond_reglement =
'';
347 $search_fk_shipping_method =
'';
348 $search_fk_input_reason =
'';
349 $search_fk_mode_reglement =
'';
350 $search_date_signature_startday =
'';
351 $search_date_signature_startmonth =
'';
352 $search_date_signature_startyear =
'';
353 $search_date_signature_endday =
'';
354 $search_date_signature_endmonth =
'';
355 $search_date_signature_endyear =
'';
356 $search_date_signature_start =
'';
357 $search_date_signature_end =
'';
359 if ($object_statut !=
'') {
360 $search_status = $object_statut;
364 if (empty($reshook)) {
365 $objectclass =
'Propal';
366 $objectlabel =
'Proposals';
367 $uploaddir = $conf->propal->multidir_output[$conf->entity];
368 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
371 if ($action ==
'validate' && $permissiontovalidate) {
372 if (
GETPOST(
'confirm') ==
'yes') {
373 $tmpproposal =
new Propal($db);
376 foreach ($toselect as $checked) {
377 if ($tmpproposal->fetch($checked) > 0) {
378 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
379 if ($tmpproposal->valid($user) > 0) {
380 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
386 $langs->load(
"errors");
387 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
403 if ($action ==
"sign" && $permissiontoclose) {
404 if (
GETPOST(
'confirm') ==
'yes') {
405 $tmpproposal =
new Propal($db);
408 foreach ($toselect as $checked) {
409 if ($tmpproposal->fetch($checked) > 0) {
410 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
411 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
412 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
413 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
419 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
435 if ($action ==
"nosign" && $permissiontoclose) {
436 if (
GETPOST(
'confirm') ==
'yes') {
437 $tmpproposal =
new Propal($db);
440 foreach ($toselect as $checked) {
441 if ($tmpproposal->fetch($checked) > 0) {
442 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
443 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
444 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
445 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
451 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
468 if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
471 $objecttmp =
new $objectclass($db);
473 foreach ($toselect as $toselectid) {
474 $result = $objecttmp->fetch($toselectid);
476 $result = $objecttmp->classifyBilled($user, 0);
516 if (!empty($conf->margin->enabled)) {
519 $companystatic =
new Societe($db);
520 $projectstatic =
new Project($db);
523 $help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
527 if ($sall || $search_product_category > 0 || $search_user > 0) {
528 $sql =
'SELECT DISTINCT';
530 $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.code_client, ';
531 $sql .=
" typent.code as typent_code,";
532 $sql .=
" ava.rowid as availability,";
533 $sql .=
" country.code as country_code,";
534 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
535 $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,';
536 $sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
537 $sql .=
' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
538 $sql .=
' p.date_signature as dsignature,';
539 $sql .=
' p.note_public, p.note_private,';
540 $sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
541 $sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
542 $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';
543 if (empty($user->rights->societe->client->voir) && !$socid) {
544 $sql .=
", sc.fk_soc, sc.fk_user";
546 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
547 $sql .=
", cc.fk_categorie, cc.fk_soc";
550 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
551 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
552 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
556 $parameters = array();
557 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
558 $sql .= $hookmanager->resPrint;
559 $sql = preg_replace(
'/, $/',
'', $sql);
560 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
561 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
562 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
563 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
564 if (!empty($search_categ_cus) && $search_categ_cus !=
'-1') {
565 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
567 $sql .=
', '.MAIN_DB_PREFIX.
'propal as p';
568 if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
569 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
571 if ($sall || $search_product_category > 0) {
572 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid=pd.fk_propal';
574 if ($search_product_category > 0) {
575 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
577 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
578 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
579 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
581 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
582 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
584 if ($search_user > 0) {
585 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
586 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
590 $parameters = array();
591 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
592 $sql .= $hookmanager->resPrint;
594 $sql .=
' WHERE p.fk_soc = s.rowid';
595 $sql .=
' AND p.entity IN ('.getEntity(
'propal').
')';
596 if (empty($user->rights->societe->client->voir) && !$socid) {
597 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
609 if ($search_country) {
610 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
612 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
613 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
618 if ($search_refcustomer) {
621 if ($search_refproject) {
624 if ($search_project) {
627 if ($search_availability) {
628 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
630 if ($search_societe) {
633 if ($search_societe_alias) {
637 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
639 if ($search_montant_ht !=
'') {
642 if ($search_montant_vat !=
'') {
645 if ($search_montant_ttc !=
'') {
648 if ($search_warehouse !=
'' && $search_warehouse > 0) {
651 if ($search_multicurrency_code !=
'') {
652 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
654 if ($search_multicurrency_tx !=
'') {
655 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
657 if ($search_multicurrency_montant_ht !=
'') {
658 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
660 if ($search_multicurrency_montant_vat !=
'') {
661 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
663 if ($search_multicurrency_montant_ttc !=
'') {
664 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
670 if ($search_categ_cus > 0) {
671 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
673 if ($search_categ_cus == -2) {
674 $sql .=
" AND cc.fk_categorie IS NULL";
677 if ($search_fk_cond_reglement > 0) {
678 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
680 if ($search_fk_shipping_method > 0) {
681 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
683 if ($search_fk_input_reason > 0) {
684 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
686 if ($search_fk_mode_reglement > 0) {
687 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
690 if ($search_product_category > 0) {
691 $sql .=
" AND cp.fk_categorie = ".((int) $search_product_category);
694 $sql .=
' AND s.rowid = '.((int) $socid);
696 if ($search_status !=
'' && $search_status !=
'-1') {
697 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
699 if ($search_date_start) {
700 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
702 if ($search_date_end) {
703 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
705 if ($search_date_end_start) {
706 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
708 if ($search_date_end_end) {
709 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
711 if ($search_date_delivery_start) {
712 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
714 if ($search_date_delivery_end) {
715 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
717 if ($search_sale > 0) {
718 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
720 if ($search_user > 0) {
721 $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);
723 if ($search_date_signature_start) {
724 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
726 if ($search_date_signature_end) {
727 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
730 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
733 $parameters = array();
734 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
735 $sql .= $hookmanager->resPrint;
738 $parameters = array();
739 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
740 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
742 $sql .= $db->order($sortfield, $sortorder);
743 $sql .=
', p.ref DESC';
746 $nbtotalofrecords =
'';
747 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
748 $result = $db->query($sql);
749 $nbtotalofrecords = $db->num_rows($result);
751 if (($page * $limit) > $nbtotalofrecords) {
757 $sql .= $db->plimit($limit + 1, $offset);
759 $resql = $db->query($sql);
762 $objectstatic =
new Propal($db);
763 $userstatic =
new User($db);
768 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
769 if (empty($search_societe)) {
770 $search_societe = $soc->name;
773 $title = $langs->trans(
'Proposals');
776 $num = $db->num_rows(
$resql);
778 $arrayofselected = is_array($toselect) ? $toselect : array();
780 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
781 $obj = $db->fetch_object(
$resql);
785 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.$id);
791 $param =
'&search_status='.urlencode($search_status);
792 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
793 $param .=
'&contextpage='.urlencode($contextpage);
795 if ($limit > 0 && $limit != $conf->liste_limit) {
796 $param .=
'&limit='.urlencode($limit);
799 $param .=
'&sall='.urlencode($sall);
801 if ($search_date_startday) {
802 $param .=
'&search_date_startday='.urlencode($search_date_startday);
804 if ($search_date_startmonth) {
805 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
807 if ($search_date_startyear) {
808 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
810 if ($search_date_endday) {
811 $param .=
'&search_date_endday='.urlencode($search_date_endday);
813 if ($search_date_endmonth) {
814 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
816 if ($search_date_endyear) {
817 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
819 if ($search_date_end_startday) {
820 $param .=
'&search_date_end_startday='.urlencode($search_date_end_startday);
822 if ($search_date_end_startmonth) {
823 $param .=
'&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
825 if ($search_date_end_startyear) {
826 $param .=
'&search_date_end_startyear='.urlencode($search_date_end_startyear);
828 if ($search_date_end_endday) {
829 $param .=
'&search_date_end_endday='.urlencode($search_date_end_endday);
831 if ($search_date_end_endmonth) {
832 $param .=
'&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
834 if ($search_date_end_endyear) {
835 $param .=
'&search_date_end_endyear='.urlencode($search_date_end_endyear);
837 if ($search_date_delivery_startday) {
838 $param .=
'&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
840 if ($search_date_delivery_startmonth) {
841 $param .=
'&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
843 if ($search_date_delivery_startyear) {
844 $param .=
'&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
846 if ($search_date_delivery_endday) {
847 $param .=
'&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
849 if ($search_date_delivery_endmonth) {
850 $param .=
'&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
852 if ($search_date_delivery_endyear) {
853 $param .=
'&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
856 $param .=
'&search_ref='.urlencode($search_ref);
858 if ($search_refcustomer) {
859 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
861 if ($search_refproject) {
862 $param .=
'&search_refproject='.urlencode($search_refproject);
864 if ($search_societe) {
865 $param .=
'&search_societe='.urlencode($search_societe);
867 if ($search_societe_alias) {
868 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
870 if ($search_user > 0) {
871 $param .=
'&search_user='.urlencode($search_user);
873 if ($search_sale > 0) {
874 $param .=
'&search_sale='.urlencode($search_sale);
876 if ($search_montant_ht) {
877 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
879 if ($search_multicurrency_code !=
'') {
880 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
882 if ($search_multicurrency_tx !=
'') {
883 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
885 if ($search_multicurrency_montant_ht !=
'') {
886 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
888 if ($search_multicurrency_montant_vat !=
'') {
889 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
891 if ($search_multicurrency_montant_ttc !=
'') {
892 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
895 $param .=
'&search_login='.urlencode($search_login);
898 $param .=
'&search_town='.urlencode($search_town);
901 $param .=
'&search_zip='.urlencode($search_zip);
904 $param .=
'&socid='.urlencode($socid);
906 if ($optioncss !=
'') {
907 $param .=
'&optioncss='.urlencode($optioncss);
909 if ($search_categ_cus > 0) {
910 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
912 if ($search_product_category !=
'') {
913 $param .=
'&search_product_category='.urlencode($search_product_category);
915 if ($search_fk_cond_reglement > 0) {
916 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
918 if ($search_fk_shipping_method > 0) {
919 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
921 if ($search_fk_input_reason > 0) {
922 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
924 if ($search_fk_mode_reglement > 0) {
925 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
927 if ($search_type_thirdparty > 0) {
928 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
931 $param .=
'&search_town='.urlencode($search_town);
934 $param .=
'&search_zip='.urlencode($search_zip);
937 $param .=
'&search_state='.urlencode($search_state);
940 $param .=
'&search_town='.urlencode($search_town);
942 if ($search_country) {
943 $param .=
'&search_country='.urlencode($search_country);
945 if ($search_date_signature_startday) {
946 $param .=
'&search_date_signature_startday='.urlencode($search_date_signature_startday);
948 if ($search_date_signature_startmonth) {
949 $param .=
'&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
951 if ($search_date_signature_startyear) {
952 $param .=
'&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
954 if ($search_date_signature_endday) {
955 $param .=
'&search_date_signature_endday='.urlencode($search_date_signature_endday);
957 if ($search_date_signature_endmonth) {
958 $param .=
'&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
960 if ($search_date_signature_endyear) {
961 $param .=
'&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
965 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
967 $parameters = array();
968 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
969 $param .= $hookmanager->resPrint;
972 $arrayofmassactions = array(
973 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
974 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
976 if ($permissiontosendbymail) {
977 $arrayofmassactions[
'presend']=
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
979 if ($permissiontovalidate) {
980 $arrayofmassactions[
'prevalidate']=
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
982 if ($permissiontoclose) {
983 $arrayofmassactions[
'presign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
984 $arrayofmassactions[
'nopresign']=
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
985 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
987 if ($permissiontodelete) {
988 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
991 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
992 $arrayofmassactions = array();
994 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
996 $url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
997 if (!empty($socid)) {
998 $url .=
'&socid='.$socid;
1000 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->propal->creer);
1003 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1004 if ($optioncss !=
'') {
1005 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1007 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1008 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1009 print
'<input type="hidden" name="action" value="list">';
1010 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1011 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1012 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1014 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1016 $topicmail =
"SendPropalRef";
1017 $modelmail =
"propal_send";
1018 $objecttmp =
new Propal($db);
1019 $trackid =
'pro'.$object->id;
1020 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1022 if ($massaction ==
'prevalidate') {
1023 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1026 if ($massaction ==
'presign') {
1027 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1030 if ($massaction ==
'nopresign') {
1031 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1035 foreach ($fieldstosearchall as $key => $val) {
1036 $fieldstosearchall[$key] = $langs->trans($val);
1038 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1043 $moreforfilter =
'';
1046 if ($user->rights->user->user->lire) {
1047 $langs->load(
"commercial");
1048 $moreforfilter .=
'<div class="divsearchfield">';
1049 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1050 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1051 $moreforfilter .=
'</div>';
1054 if ($user->rights->user->user->lire) {
1055 $moreforfilter .=
'<div class="divsearchfield">';
1056 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1057 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1058 $moreforfilter .=
'</div>';
1061 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
1062 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1063 $moreforfilter .=
'<div class="divsearchfield">';
1064 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1065 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1066 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0, (empty($conf->dol_optimize_smallscreen) ?
'maxwidth300 widthcentpercentminusx' :
'maxwidth250 widthcentpercentminusx'), 1);
1067 $moreforfilter .=
'</div>';
1069 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
1070 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1071 $moreforfilter .=
'<div class="divsearchfield">';
1072 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1073 $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'));
1074 $moreforfilter .=
'</div>';
1076 if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
1077 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1079 $moreforfilter .=
'<div class="divsearchfield">';
1080 $tmptitle = $langs->trans(
'Warehouse');
1081 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1082 $moreforfilter .=
'</div>';
1084 $parameters = array();
1085 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
1086 if (empty($reshook)) {
1087 $moreforfilter .= $hookmanager->resPrint;
1089 $moreforfilter = $hookmanager->resPrint;
1092 if (!empty($moreforfilter)) {
1093 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1094 print $moreforfilter;
1098 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1099 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1100 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1102 print
'<div class="div-table-responsive">';
1103 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1105 print
'<tr class="liste_titre_filter">';
1106 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1107 print
'<td class="liste_titre">';
1108 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1111 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1112 print
'<td class="liste_titre">';
1113 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1116 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1117 print
'<td class="liste_titre">';
1118 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1121 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1122 print
'<td class="liste_titre">';
1123 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1126 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1127 print
'<td class="liste_titre" align="left">';
1128 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
1131 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1132 print
'<td class="liste_titre" align="left">';
1133 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1136 if (!empty($arrayfields[
's.town'][
'checked'])) {
1137 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1139 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1140 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1143 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1145 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1149 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1150 print
'<td class="liste_titre" align="center">';
1151 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1155 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1156 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1157 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);
1162 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1163 print
'<td class="liste_titre center">';
1164 print
'<div class="nowrap">';
1165 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1167 print
'<div class="nowrap">';
1168 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1173 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1174 print
'<td class="liste_titre center">';
1175 print
'<div class="nowrap">';
1176 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'));
1178 print
'<div class="nowrap">';
1179 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'));
1184 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1185 print
'<td class="liste_titre center">';
1186 print
'<div class="nowrap">';
1187 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'));
1189 print
'<div class="nowrap">';
1190 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'));
1195 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1196 print
'<td class="liste_titre center">';
1197 print
'<div class="nowrap">';
1198 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'));
1200 print
'<div class="nowrap">';
1201 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'));
1206 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1207 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1208 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1213 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1214 print
'<td class="liste_titre">';
1215 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1219 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1220 print
'<td class="liste_titre">';
1221 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1225 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1226 print
'<td class="liste_titre">';
1227 $form->select_conditions_paiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1231 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1232 print
'<td class="liste_titre">';
1233 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1236 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1238 print
'<td class="liste_titre right">';
1239 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1242 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1244 print
'<td class="liste_titre right">';
1245 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1248 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1250 print
'<td class="liste_titre right">';
1251 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1254 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1256 print
'<td class="liste_titre right">';
1259 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1261 print
'<td class="liste_titre right">';
1264 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1267 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1270 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1272 print
'<td class="liste_titre">';
1273 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1276 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1278 print
'<td class="liste_titre right">';
1279 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1282 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1284 print
'<td class="liste_titre right">';
1285 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1288 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1290 print
'<td class="liste_titre right">';
1291 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1294 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1296 print
'<td class="liste_titre right">';
1299 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1301 print
'<td class="liste_titre right">';
1304 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1306 print
'<td class="liste_titre" align="center">';
1307 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1310 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1311 print
'<td class="liste_titre"></td>';
1313 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1314 print
'<td class="liste_titre right">';
1317 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1318 print
'<td class="liste_titre right">';
1321 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1322 print
'<td class="liste_titre right">';
1325 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1326 print
'<td class="liste_titre right">';
1330 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1333 $parameters = array(
'arrayfields'=>$arrayfields);
1334 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1335 print $hookmanager->resPrint;
1337 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1338 print
'<td class="liste_titre">';
1342 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1343 print
'<td class="liste_titre">';
1347 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1348 print
'<td class="liste_titre">';
1351 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1353 print
'<td class="liste_titre">';
1356 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1358 print
'<td class="liste_titre">';
1362 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1363 print
'<td class="liste_titre maxwidthonsmartphone right">';
1364 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_statut');
1368 print
'<td class="liste_titre" align="middle">';
1369 $searchpicto =
$form->showFilterButtons();
1375 $totalarray = array(
1385 print
'<tr class="liste_titre">';
1386 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1389 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1390 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1392 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1395 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1398 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1399 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1401 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1402 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1404 if (!empty($arrayfields[
's.town'][
'checked'])) {
1405 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1407 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1410 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1411 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1413 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1414 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'align="center"', $sortfield, $sortorder);
1416 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1417 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'align="center"', $sortfield, $sortorder);
1419 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1420 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'align="center"', $sortfield, $sortorder);
1422 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'align="center"', $sortfield, $sortorder);
1425 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1426 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'align="center"', $sortfield, $sortorder);
1428 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'align="center"', $sortfield, $sortorder);
1431 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1432 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1434 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1435 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1437 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1438 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1440 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1443 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1444 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1446 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1449 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1452 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1455 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1456 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1458 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1459 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1461 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1464 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1465 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1467 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1468 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1470 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1471 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1473 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1474 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1476 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1477 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1479 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1480 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1482 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1483 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1485 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1486 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1488 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1491 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1492 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1494 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1495 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1497 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1498 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1501 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1503 $parameters = array(
1504 'arrayfields' => $arrayfields,
1506 'sortfield' => $sortfield,
1507 'sortorder' => $sortorder,
1508 'totalarray' => &$totalarray,
1510 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1512 print $hookmanager->resPrint;
1513 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1514 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1516 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1517 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1519 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1520 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1522 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1523 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1525 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1526 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1528 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1529 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'class="right"', $sortfield, $sortorder);
1531 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1538 $with_margin_info =
false;
1539 if (!empty($conf->margin->enabled) && (
1540 !empty($arrayfields[
'total_pa'][
'checked'])
1541 || !empty($arrayfields[
'total_margin'][
'checked'])
1542 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1543 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1546 $with_margin_info =
true;
1551 $savnbfield = $totalarray[
'nbfield'];
1552 $totalarray = array();
1553 $totalarray[
'nbfield'] = 0;
1554 $last_num = min($num, $limit);
1555 while ($i < $last_num) {
1556 $obj = $db->fetch_object(
$resql);
1558 $objectstatic->id = $obj->rowid;
1559 $objectstatic->ref = $obj->ref;
1560 $objectstatic->ref_client = $obj->ref_client;
1561 $objectstatic->note_public = $obj->note_public;
1562 $objectstatic->note_private = $obj->note_private;
1563 $objectstatic->statut = $obj->status;
1564 $objectstatic->status = $obj->status;
1566 $companystatic->id = $obj->socid;
1567 $companystatic->name = $obj->name;
1568 $companystatic->name_alias = $obj->alias;
1569 $companystatic->client = $obj->client;
1570 $companystatic->code_client = $obj->code_client;
1571 $companystatic->email = $obj->email;
1572 $companystatic->phone = $obj->phone;
1573 $companystatic->address = $obj->address;
1574 $companystatic->zip = $obj->zip;
1575 $companystatic->town = $obj->town;
1576 $companystatic->country_code = $obj->country_code;
1578 $projectstatic->id = $obj->project_id;
1579 $projectstatic->ref = $obj->project_ref;
1580 $projectstatic->title = $obj->project_label;
1582 $totalInvoicedHT = 0;
1583 $totalInvoicedTTC = 0;
1584 $multicurrency_totalInvoicedHT = 0;
1585 $multicurrency_totalInvoicedTTC = 0;
1587 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1589 if (!empty($TInvoiceData)) {
1590 foreach ($TInvoiceData as $invoiceData) {
1592 $invoice->fetch($invoiceData->facid);
1594 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type ==
Facture::TYPE_DEPOSIT) {
1598 $totalInvoicedHT += $invoice->total_ht;
1599 $totalInvoicedTTC += $invoice->total_ttc;
1600 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1601 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1605 $marginInfo = array();
1606 if ($with_margin_info ===
true) {
1607 $objectstatic->fetch_lines();
1608 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1609 $total_ht += $obj->total_ht;
1610 $total_margin += $marginInfo[
'total_margin'];
1613 print
'<tr class="oddeven">';
1615 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1616 print
'<td class="nowraponall">';
1618 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1620 print
'<td class="nobordernopadding nowraponall">';
1621 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1625 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1626 $warnornote .=
img_warning($langs->trans(
"Late"));
1629 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1634 print
'<td width="16" class="nobordernopadding right">';
1636 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1637 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1638 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1639 print
'</td></tr></table>';
1643 $totalarray[
'nbfield']++;
1647 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1649 print
'<td class="nowrap tdoverflowmax200">';
1650 print $obj->ref_client;
1653 $totalarray[
'nbfield']++;
1657 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1659 print
'<td class="nowraponall">';
1660 if ($obj->project_id > 0) {
1661 print $projectstatic->getNomUrl(1);
1665 $totalarray[
'nbfield']++;
1669 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1671 print
'<td class="nowrap">';
1672 if ($obj->project_id > 0) {
1673 print $projectstatic->title;
1677 $totalarray[
'nbfield']++;
1682 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1683 print
'<td class="tdoverflowmax150">';
1684 print $companystatic->getNomUrl(1,
'customer');
1687 $totalarray[
'nbfield']++;
1692 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1693 print
'<td class="tdoverflowmax200">';
1697 $totalarray[
'nbfield']++;
1702 if (!empty($arrayfields[
's.town'][
'checked'])) {
1703 print
'<td class="nocellnopadd">';
1707 $totalarray[
'nbfield']++;
1711 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1712 print
'<td class="nocellnopadd">';
1716 $totalarray[
'nbfield']++;
1720 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1721 print
"<td>".$obj->state_name.
"</td>\n";
1723 $totalarray[
'nbfield']++;
1727 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1728 print
'<td class="center">';
1729 $tmparray =
getCountry($obj->fk_pays,
'all');
1730 print $tmparray[
'label'];
1733 $totalarray[
'nbfield']++;
1737 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1738 if (!is_array($typenArray) || empty($typenArray)) {
1739 $typenArray = $formcompany->typent_array(1);
1742 print
'<td class="center">';
1743 print $typenArray[$obj->typent_code];
1746 $totalarray[
'nbfield']++;
1751 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1752 print
'<td class="center">';
1756 $totalarray[
'nbfield']++;
1761 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1763 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1766 print
'<td> </td>';
1769 $totalarray[
'nbfield']++;
1773 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1774 if ($obj->ddelivery) {
1775 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
1778 print
'<td> </td>';
1781 $totalarray[
'nbfield']++;
1785 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1786 if ($obj->dsignature) {
1787 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
1790 print
'<td> </td>';
1793 $totalarray[
'nbfield']++;
1797 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1798 print
'<td class="center">';
1799 $form->form_availability(
'', $obj->availability,
'none', 1);
1802 $totalarray[
'nbfield']++;
1806 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1808 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1811 $totalarray[
'nbfield']++;
1815 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1816 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag(
$form->cache_demand_reason[$obj->fk_input_reason][
'label']).
'">';
1817 if ($obj->fk_input_reason > 0) {
1818 print
$form->cache_demand_reason[$obj->fk_input_reason][
'label'];
1822 $totalarray[
'nbfield']++;
1826 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1828 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1831 $totalarray[
'nbfield']++;
1835 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1837 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1840 $totalarray[
'nbfield']++;
1844 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1845 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1847 $totalarray[
'nbfield']++;
1850 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
1852 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
1855 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1856 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1858 $totalarray[
'nbfield']++;
1861 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
1863 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
1866 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1867 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1869 $totalarray[
'nbfield']++;
1872 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
1874 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
1877 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1878 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
1880 $totalarray[
'nbfield']++;
1883 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
1885 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
1888 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1889 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
1891 $totalarray[
'nbfield']++;
1894 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
1896 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
1899 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1900 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1902 $totalarray[
'nbfield']++;
1907 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1908 print
'<td class="nowrap">';
1909 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1912 $totalarray[
'nbfield']++;
1916 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1917 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1919 $totalarray[
'nbfield']++;
1923 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1924 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
1926 $totalarray[
'nbfield']++;
1930 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1931 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1933 $totalarray[
'nbfield']++;
1937 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1938 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
1940 $totalarray[
'nbfield']++;
1944 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1945 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
1947 $totalarray[
'nbfield']++;
1951 $userstatic->id = $obj->fk_user_author;
1952 $userstatic->login = $obj->login;
1953 $userstatic->lastname = $obj->lastname;
1954 $userstatic->firstname = $obj->firstname;
1955 $userstatic->email = $obj->user_email;
1956 $userstatic->statut = $obj->user_statut;
1957 $userstatic->entity = $obj->user_entity;
1958 $userstatic->photo = $obj->photo;
1959 $userstatic->office_phone = $obj->office_phone;
1960 $userstatic->office_fax = $obj->office_fax;
1961 $userstatic->user_mobile = $obj->user_mobile;
1962 $userstatic->job = $obj->job;
1963 $userstatic->gender = $obj->gender;
1966 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1967 print
'<td class="tdoverflowmax150">';
1968 if ($userstatic->id) {
1969 print $userstatic->getNomUrl(-1);
1973 $totalarray[
'nbfield']++;
1977 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1979 print
'<td class="tdoverflowmax150">';
1980 if ($obj->socid > 0) {
1981 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1982 if ($listsalesrepresentatives < 0) {
1985 $nbofsalesrepresentative = count($listsalesrepresentatives);
1986 if ($nbofsalesrepresentative > 6) {
1988 print $nbofsalesrepresentative;
1989 } elseif ($nbofsalesrepresentative > 0) {
1990 $userstatic =
new User($db);
1992 foreach ($listsalesrepresentatives as $val) {
1993 $userstatic->id = $val[
'id'];
1994 $userstatic->lastname = $val[
'lastname'];
1995 $userstatic->firstname = $val[
'firstname'];
1996 $userstatic->email = $val[
'email'];
1997 $userstatic->statut = $val[
'statut'];
1998 $userstatic->entity = $val[
'entity'];
1999 $userstatic->photo = $val[
'photo'];
2000 $userstatic->login = $val[
'login'];
2001 $userstatic->office_phone = $val[
'office_phone'];
2002 $userstatic->office_fax = $val[
'office_fax'];
2003 $userstatic->user_mobile = $val[
'user_mobile'];
2004 $userstatic->job = $val[
'job'];
2005 $userstatic->gender = $val[
'gender'];
2007 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2009 if ($j < $nbofsalesrepresentative) {
2021 $totalarray[
'nbfield']++;
2026 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2027 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2029 $totalarray[
'nbfield']++;
2033 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2034 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2036 $totalarray[
'nbfield']++;
2039 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2041 $totalarray[
'val'][
'total_margin'] = $total_margin;
2044 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2045 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2047 $totalarray[
'nbfield']++;
2051 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2052 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2054 $totalarray[
'nbfield']++;
2057 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2059 if ($i >= $last_num - 1) {
2060 if (!empty($total_ht)) {
2061 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2063 $totalarray[
'val'][
'total_mark_rate'] =
'';
2069 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2071 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2072 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
2073 print $hookmanager->resPrint;
2075 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2076 print
'<td align="center" class="nowrap">';
2077 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2080 $totalarray[
'nbfield']++;
2084 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2085 print
'<td align="center" class="nowrap">';
2086 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2089 $totalarray[
'nbfield']++;
2093 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2094 print
'<td align="center" class="nowrap">';
2095 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2098 $totalarray[
'nbfield']++;
2102 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2103 print
'<td class="center">';
2107 $totalarray[
'nbfield']++;
2111 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2112 print
'<td class="center">';
2116 $totalarray[
'nbfield']++;
2120 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2121 print
'<td class="nowrap right">'.$objectstatic->getLibStatut(5).
'</td>';
2123 $totalarray[
'nbfield']++;
2127 print
'<td class="nowrap" align="center">';
2128 if ($massactionbutton || $massaction) {
2130 if (in_array($obj->rowid, $arrayofselected)) {
2133 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2137 $totalarray[
'nbfield']++;
2146 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2151 foreach ($arrayfields as $key => $val) {
2152 if (!empty($val[
'checked'])) {
2156 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2161 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2162 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2163 print $hookmanager->resPrint;
2165 print
'</table>'.
"\n";
2166 print
'</div>'.
"\n";
2168 print
'</form>'.
"\n";
2170 $hidegeneratedfilelistifempty = 1;
2171 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2172 $hidegeneratedfilelistifempty = 0;
2176 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2177 $urlsource .= str_replace(
'&',
'&', $param);
2179 $filedir = $diroutputmassaction;
2180 $genallowed = $user->rights->propal->lire;
2181 $delallowed = $user->rights->propal->creer;
2183 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);