44require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49if (isModEnabled(
'margin')) {
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
56if (isModEnabled(
'category')) {
57 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
62$langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
63if (isModEnabled(
"shipping")) {
64 $langs->loadLangs(array(
'sendings'));
70$action =
GETPOST(
'action',
'aZ09');
71$massaction =
GETPOST(
'massaction',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
74$cancel =
GETPOST(
'cancel',
'alpha');
75$toselect =
GETPOST(
'toselect',
'array');
76$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
77$optioncss =
GETPOST(
'optioncss',
'alpha');
78$mode =
GETPOST(
'mode',
'alpha');
81$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
83if ($search_user == -1) {
88$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
89$search_refproject =
GETPOST(
'search_refproject',
'alpha');
90$search_project =
GETPOST(
'search_project',
'alpha');
91$search_societe =
GETPOST(
'search_societe',
'alpha');
92$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
93$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
94$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
95$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
96$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
97$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
98$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
99$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
100$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
101$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
102$search_login =
GETPOST(
'search_login',
'alpha');
103$search_product_category =
GETPOSTINT(
'search_product_category');
104$search_town =
GETPOST(
'search_town',
'alpha');
105$search_zip =
GETPOST(
'search_zip',
'alpha');
106$search_state =
GETPOST(
"search_state");
107$search_country =
GETPOST(
"search_country",
'aZ09');
108$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
109$search_date_startday =
GETPOSTINT(
'search_date_startday');
110$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
111$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
112$search_date_endday =
GETPOSTINT(
'search_date_endday');
113$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
114$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
115$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
116$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
117$search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
118$search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
119$search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
120$search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
121$search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
122$search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
123$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
124$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
125$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
126$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
127$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
128$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
129$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
130$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
131$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
132$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
133$search_availability =
GETPOST(
'search_availability',
'intcomma');
134$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
135$search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'intcomma');
136$search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'intcomma');
137$search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'intcomma');
138$search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'intcomma');
139$search_date_signature_startday =
GETPOSTINT(
'search_date_signature_startday');
140$search_date_signature_startmonth =
GETPOSTINT(
'search_date_signature_startmonth');
141$search_date_signature_startyear =
GETPOSTINT(
'search_date_signature_startyear');
142$search_date_signature_endday =
GETPOSTINT(
'search_date_signature_endday');
143$search_date_signature_endmonth =
GETPOSTINT(
'search_date_signature_endmonth');
144$search_date_signature_endyear =
GETPOSTINT(
'search_date_signature_endyear');
145$search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
146$search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
147$search_status =
GETPOST(
'search_status',
'alpha');
148$search_note_public =
GETPOST(
'search_note_public',
'alpha');
150$search_option =
GETPOST(
'search_option',
'alpha');
151if ($search_option ==
'late') {
152 $search_status =
'1';
153 $object_statut =
'1';
158$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
159$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
161if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
165$offset = $limit * $page;
166$pageprev = $page - 1;
167$pagenext = $page + 1;
169 $sortfield =
'p.ref';
179if (!empty($user->socid)) {
180 $socid = $user->socid;
185 $dbtable =
'&societe';
187$hookmanager->initHooks(array(
'propallist'));
190$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
197$extrafields->fetch_name_optionals_label(
$object->table_element);
199$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
202$fieldstosearchall = array(
204 'p.ref_client' =>
'RefCustomer',
205 'pd.description' =>
'Description',
206 's.nom' =>
"ThirdParty",
207 's.name_alias' =>
"AliasNameShort",
210 'p.note_public' =>
'NotePublic',
212if (empty($user->socid)) {
213 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
217$checkedtypetiers = 0;
219 'p.ref' => array(
'label' =>
"Ref",
'checked' => 1),
220 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1),
221 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
222 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (isModEnabled(
'project') ? 1 : 0)),
223 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
224 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1),
225 's.town' => array(
'label' =>
"Town",
'checked' => -1),
226 's.zip' => array(
'label' =>
"Zip",
'checked' => -1),
227 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0),
228 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0),
229 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers),
230 'p.date' => array(
'label' =>
"DatePropal",
'checked' => 1),
231 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' => 1),
232 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' => 0),
233 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' => 0),
234 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' => 0),
235 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => 0,
'enabled' => isModEnabled(
"shipping")),
236 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => 0,
'enabled' => 1),
237 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 0),
238 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 0),
239 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1),
240 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0),
241 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0),
242 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
243 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
244 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
245 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
246 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
247 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
248 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
249 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
250 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' => 0,
'enabled' => isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
251 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 10),
252 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => -1),
253 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
254 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
255 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
256 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
257 'p.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
258 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
259 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 500),
260 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
261 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
262 'p.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
289if (!$user->hasRight(
'societe',
'client',
'voir')) {
290 $search_sale = $user->id;
294include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
297$permissiontoread = $user->hasRight(
'propal',
'lire');
298$permissiontoadd = $user->hasRight(
'propal',
'creer');
299$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
301 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
302 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
303 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
305 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
306 $permissiontoclose = $user->hasRight(
'propal',
'creer');
307 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
315if (
GETPOST(
'cancel',
'alpha')) {
319if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
324$search_code_client =
'';
326$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
327$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
332if (empty($reshook)) {
334 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
337 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
341 $search_refcustomer =
'';
342 $search_refproject =
'';
343 $search_project =
'';
344 $search_societe =
'';
345 $search_societe_alias =
'';
346 $search_montant_ht =
'';
347 $search_montant_vat =
'';
348 $search_montant_ttc =
'';
349 $search_warehouse =
'';
350 $search_multicurrency_code =
'';
351 $search_multicurrency_tx =
'';
352 $search_multicurrency_montant_ht =
'';
353 $search_multicurrency_montant_vat =
'';
354 $search_multicurrency_montant_ttc =
'';
356 $search_product_category =
'';
361 $search_country =
'';
362 $search_type_thirdparty =
'';
363 $search_date_startday =
'';
364 $search_date_startmonth =
'';
365 $search_date_startyear =
'';
366 $search_date_endday =
'';
367 $search_date_endmonth =
'';
368 $search_date_endyear =
'';
369 $search_date_start =
'';
370 $search_date_end =
'';
371 $search_date_end_startday =
'';
372 $search_date_end_startmonth =
'';
373 $search_date_end_startyear =
'';
374 $search_date_end_endday =
'';
375 $search_date_end_endmonth =
'';
376 $search_date_end_endyear =
'';
377 $search_date_end_start =
'';
378 $search_date_end_end =
'';
379 $search_date_delivery_startday =
'';
380 $search_date_delivery_startmonth =
'';
381 $search_date_delivery_startyear =
'';
382 $search_date_delivery_endday =
'';
383 $search_date_delivery_endmonth =
'';
384 $search_date_delivery_endyear =
'';
385 $search_date_delivery_start =
'';
386 $search_date_delivery_end =
'';
387 $search_availability =
'';
390 $search_categ_cus = 0;
391 $search_fk_cond_reglement =
'';
392 $search_fk_shipping_method =
'';
393 $search_fk_input_reason =
'';
394 $search_fk_mode_reglement =
'';
395 $search_date_signature_startday =
'';
396 $search_date_signature_startmonth =
'';
397 $search_date_signature_startyear =
'';
398 $search_date_signature_endday =
'';
399 $search_date_signature_endmonth =
'';
400 $search_date_signature_endyear =
'';
401 $search_date_signature_start =
'';
402 $search_date_signature_end =
'';
404 $search_array_options = array();
409 $objectclass =
'Propal';
410 $objectlabel =
'Proposals';
411 $uploaddir = $conf->propal->multidir_output[$conf->entity];
412 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
415if ($action ==
'validate' && $permissiontovalidate) {
416 if (
GETPOST(
'confirm') ==
'yes') {
417 $tmpproposal =
new Propal($db);
420 foreach ($toselect as $checked) {
421 if ($tmpproposal->fetch($checked) > 0) {
422 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
423 if ($tmpproposal->valid($user) > 0) {
424 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
430 $langs->load(
"errors");
431 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
447if ($action ==
"sign" && $permissiontoclose) {
448 if (
GETPOST(
'confirm') ==
'yes') {
449 $tmpproposal =
new Propal($db);
452 foreach ($toselect as $checked) {
453 if ($tmpproposal->fetch($checked) > 0) {
454 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
455 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
456 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
457 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
463 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
479if ($action ==
"nosign" && $permissiontoclose) {
480 if (
GETPOST(
'confirm') ==
'yes') {
481 $tmpproposal =
new Propal($db);
484 foreach ($toselect as $checked) {
485 if ($tmpproposal->fetch($checked) > 0) {
486 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
487 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
488 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
489 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
495 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
512if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
515 $objecttmp =
new $objectclass($db);
517 foreach ($toselect as $toselectid) {
518 $result = $objecttmp->fetch($toselectid);
520 $result = $objecttmp->classifyBilled($user, 0);
551$form =
new Form($db);
556if (isModEnabled(
'margin')) {
559$companystatic =
new Societe($db);
560$projectstatic =
new Project($db);
563$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
564$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
567if ($search_all !==
'') {
568 $sql =
'SELECT DISTINCT';
570$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,';
571$sql .=
" typent.code as typent_code,";
572$sql .=
" ava.rowid as availability,";
573$sql .=
" country.code as country_code,";
574$sql .=
" state.code_departement as state_code, state.nom as state_name,";
575$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,';
576$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
577$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
578$sql .=
' p.date_signature as dsignature,';
579$sql .=
' p.note_public, p.note_private,';
580$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
581$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
582$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';
584if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
585 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
586 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
590$parameters = array();
591$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
592$sql .= $hookmanager->resPrint;
593$sql = preg_replace(
'/, $/',
'', $sql);
597$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
598$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
599$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
600$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
602$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
603if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
604 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
607 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
609$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
610$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
611$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
613$parameters = array();
614$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
615$sql .= $hookmanager->resPrint;
618$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
628if ($search_country) {
629 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
631if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
632 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
637if ($search_refcustomer) {
640if ($search_refproject) {
643if ($search_project) {
646if ($search_availability) {
647 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
650if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
651 if ($societe_add_ref_in_list == 1) {
652 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
654 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
657 if ($search_societe) {
658 if ($societe_add_ref_in_list == 1) {
659 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
664 if ($search_societe_alias) {
669if ($societe_add_ref_in_list == 1 && $search_code_client && !$search_societe) {
673 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
675if ($search_montant_ht !=
'') {
678if ($search_montant_vat !=
'') {
681if ($search_montant_ttc !=
'') {
684if ($search_warehouse !=
'' && $search_warehouse > 0) {
687if ($search_multicurrency_code !=
'') {
688 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
690if ($search_multicurrency_tx !=
'') {
691 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
693if ($search_multicurrency_montant_ht !=
'') {
694 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
696if ($search_multicurrency_montant_vat !=
'') {
697 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
699if ($search_multicurrency_montant_ttc !=
'') {
700 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
703 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
705if ($search_fk_cond_reglement > 0) {
706 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
708if ($search_fk_shipping_method > 0) {
709 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
711if ($search_fk_input_reason > 0) {
712 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
714if ($search_fk_mode_reglement > 0) {
715 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
718 $sql .=
' AND s.rowid = '.((int) $socid);
720if ($search_status !=
'' && $search_status !=
'-1') {
721 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
723if ($search_date_start) {
724 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
726if ($search_date_end) {
727 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
729if ($search_date_end_start) {
730 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
732if ($search_date_end_end) {
733 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
735if ($search_date_delivery_start) {
736 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
738if ($search_date_delivery_end) {
739 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
741if ($search_date_signature_start) {
742 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
744if ($search_date_signature_end) {
745 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
747if ($search_note_public) {
748 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
751if ($search_user > 0) {
752 $sql .=
" AND EXISTS (";
753 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
754 $sql .=
" FROM llx_element_contact as ec";
755 $sql .=
" INNER JOIN llx_c_type_contact as tc";
756 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
757 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
760if ($search_sale && $search_sale !=
'-1') {
761 if ($search_sale == -2) {
762 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
763 } elseif ($search_sale > 0) {
764 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
768$searchCategoryCustomerOperator = -1;
769$searchCategoryCustomerList = array($search_categ_cus);
770if (!empty($searchCategoryCustomerList)) {
771 $searchCategoryCustomerSqlList = array();
772 $listofcategoryid =
'';
773 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
774 if (intval($searchCategoryCustomer) == -2) {
775 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
776 } elseif (intval($searchCategoryCustomer) > 0) {
777 if ($searchCategoryCustomerOperator == 0) {
778 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).
")";
780 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
784 if ($listofcategoryid) {
785 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
787 if ($searchCategoryCustomerOperator == 1) {
788 if (!empty($searchCategoryCustomerSqlList)) {
789 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
792 if (!empty($searchCategoryCustomerSqlList)) {
793 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
798$searchCategoryProductOperator = -1;
799$searchCategoryProductList = array($search_product_category);
800if (!empty($searchCategoryProductList)) {
801 $searchCategoryProductSqlList = array();
802 $listofcategoryid =
'';
803 foreach ($searchCategoryProductList as $searchCategoryProduct) {
804 if (intval($searchCategoryProduct) == -2) {
805 $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)";
806 } elseif (intval($searchCategoryProduct) > 0) {
807 if ($searchCategoryProductOperator == 0) {
808 $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).
")";
810 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
814 if ($listofcategoryid) {
815 $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).
"))";
817 if ($searchCategoryProductOperator == 1) {
818 if (!empty($searchCategoryProductSqlList)) {
819 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
822 if (!empty($searchCategoryProductSqlList)) {
823 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
827if ($search_option ==
'late') {
828 $sql .=
" AND p.fin_validite < '".$db->idate(
dol_now() - $conf->propal->cloture->warning_delay).
"'";
831include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
835$parameters = array();
836$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
837$sql .= $hookmanager->resPrint;
840$parameters = array();
841$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
842$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
845$nbtotalofrecords =
'';
848 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
849 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
850 $resql = $db->query($sqlforcount);
852 $objforcount = $db->fetch_object($resql);
853 $nbtotalofrecords = $objforcount->nbtotalofrecords;
858 if (($page * $limit) > $nbtotalofrecords) {
866$sql .= $db->order($sortfield, $sortorder);
867$sql .=
', p.ref DESC';
869 $sql .= $db->plimit($limit + 1, $offset);
872$resql = $db->query($sql);
878$objectstatic =
new Propal($db);
879$userstatic =
new User($db);
884 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
885 if (empty($search_societe)) {
886 $search_societe = $soc->name;
889 $title = $langs->trans(
'Proposals');
892$num = $db->num_rows($resql);
894$arrayofselected = is_array($toselect) ? $toselect : array();
896if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
897 $obj = $db->fetch_object($resql);
901 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
905$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
906llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
908$param =
'&search_status='.urlencode($search_status);
910 $param .=
'&mode='.urlencode($mode);
912if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
913 $param .=
'&contextpage='.urlencode($contextpage);
915if ($limit > 0 && $limit != $conf->liste_limit) {
916 $param .=
'&limit='.((int) $limit);
919 $param .=
'&search_all='.urlencode($search_all);
921if ($search_date_startday) {
922 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
924if ($search_date_startmonth) {
925 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
927if ($search_date_startyear) {
928 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
930if ($search_date_endday) {
931 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
933if ($search_date_endmonth) {
934 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
936if ($search_date_endyear) {
937 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
939if ($search_date_end_startday) {
940 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
942if ($search_date_end_startmonth) {
943 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
945if ($search_date_end_startyear) {
946 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
948if ($search_date_end_endday) {
949 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
951if ($search_date_end_endmonth) {
952 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
954if ($search_date_end_endyear) {
955 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
957if ($search_date_delivery_startday) {
958 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
960if ($search_date_delivery_startmonth) {
961 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
963if ($search_date_delivery_startyear) {
964 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
966if ($search_date_delivery_endday) {
967 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
969if ($search_date_delivery_endmonth) {
970 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
972if ($search_date_delivery_endyear) {
973 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
976 $param .=
'&search_ref='.urlencode($search_ref);
978if ($search_refcustomer) {
979 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
981if ($search_refproject) {
982 $param .=
'&search_refproject='.urlencode($search_refproject);
984if ($search_societe) {
985 $param .=
'&search_societe='.urlencode($search_societe);
987if ($search_societe_alias) {
988 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
990if ($search_user > 0) {
991 $param .=
'&search_user='.urlencode((
string) ($search_user));
993if ($search_sale > 0) {
994 $param .=
'&search_sale='.urlencode((
string) $search_sale);
996if ($search_montant_ht) {
997 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
999if ($search_multicurrency_code !=
'') {
1000 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1002if ($search_multicurrency_tx !=
'') {
1003 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1005if ($search_multicurrency_montant_ht !=
'') {
1006 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1008if ($search_multicurrency_montant_vat !=
'') {
1009 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1011if ($search_multicurrency_montant_ttc !=
'') {
1012 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1015 $param .=
'&search_login='.urlencode($search_login);
1018 $param .=
'&search_town='.urlencode($search_town);
1021 $param .=
'&search_zip='.urlencode($search_zip);
1024 $param .=
'&socid='.urlencode((
string) ($socid));
1026if ($optioncss !=
'') {
1027 $param .=
'&optioncss='.urlencode($optioncss);
1029if ($search_categ_cus > 0) {
1030 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1032if ($search_product_category !=
'') {
1033 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1035if ($search_fk_cond_reglement > 0) {
1036 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1038if ($search_fk_shipping_method > 0) {
1039 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1041if ($search_fk_input_reason > 0) {
1042 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1044if ($search_fk_mode_reglement > 0) {
1045 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1047if ($search_type_thirdparty > 0) {
1048 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1051 $param .=
'&search_town='.urlencode($search_town);
1054 $param .=
'&search_zip='.urlencode($search_zip);
1057 $param .=
'&search_state='.urlencode($search_state);
1060 $param .=
'&search_town='.urlencode($search_town);
1062if ($search_country) {
1063 $param .=
'&search_country='.urlencode((
string) ($search_country));
1065if ($search_date_signature_startday) {
1066 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1068if ($search_date_signature_startmonth) {
1069 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1071if ($search_date_signature_startyear) {
1072 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1074if ($search_date_signature_endday) {
1075 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1077if ($search_date_signature_endmonth) {
1078 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1080if ($search_date_signature_endyear) {
1081 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1085include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1087$parameters = array(
'param' => &$param);
1088$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1089$param .= $hookmanager->resPrint;
1092$arrayofmassactions = array(
1093 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1094 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1096if ($permissiontosendbymail) {
1097 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1099if ($permissiontovalidate) {
1100 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1102if ($permissiontoclose) {
1103 $arrayofmassactions[
'presign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1104 $arrayofmassactions[
'nopresign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1105 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1107if ($permissiontodelete) {
1108 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1111if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1112 $arrayofmassactions = array();
1114$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1116$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1117if (!empty($socid)) {
1118 $url .=
'&socid='.$socid;
1121$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
1122$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
1124$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1127print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1128if ($optioncss !=
'') {
1129 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1131print
'<input type="hidden" name="token" value="'.newToken().
'">';
1132print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1133print
'<input type="hidden" name="action" value="list">';
1134print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1135print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1136print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1137print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1138print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1140print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1142$topicmail =
"SendPropalRef";
1143$modelmail =
"propal_send";
1144$objecttmp =
new Propal($db);
1145$trackid =
'pro'.$object->id;
1146include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1148if ($massaction ==
'prevalidate') {
1149 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1152if ($massaction ==
'presign') {
1153 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1156if ($massaction ==
'nopresign') {
1157 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1161 foreach ($fieldstosearchall as $key => $val) {
1162 $fieldstosearchall[$key] = $langs->trans($val);
1164 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1172if ($user->hasRight(
'user',
'user',
'lire')) {
1173 $langs->load(
"commercial");
1174 $moreforfilter .=
'<div class="divsearchfield">';
1175 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1176 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1177 $moreforfilter .=
'</div>';
1180if ($user->hasRight(
'user',
'user',
'lire')) {
1181 $moreforfilter .=
'<div class="divsearchfield">';
1182 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1183 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers((empty($search_user) ? -2 : 0),
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1184 $moreforfilter .=
'</div>';
1187if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1188 $searchCategoryProductOperator = -1;
1189 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1190 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1192 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1194if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1195 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1196 $moreforfilter .=
'<div class="divsearchfield">';
1197 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1198 $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'));
1199 $moreforfilter .=
'</div>';
1201if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL')) {
1202 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1204 $moreforfilter .=
'<div class="divsearchfield">';
1205 $tmptitle = $langs->trans(
'Warehouse');
1206 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1207 $moreforfilter .=
'</div>';
1209$parameters = array();
1210$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1211if (empty($reshook)) {
1212 $moreforfilter .= $hookmanager->resPrint;
1214 $moreforfilter = $hookmanager->resPrint;
1217if (!empty($moreforfilter)) {
1218 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1219 print $moreforfilter;
1223$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1224$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1225$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1227print
'<div class="div-table-responsive">';
1228print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1230print
'<tr class="liste_titre_filter">';
1234 print
'<td class="liste_titre" align="middle">';
1235 $searchpicto = $form->showFilterButtons(
'left');
1240if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1241 print
'<td class="liste_titre">';
1242 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1245if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1247 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1250if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1251 print
'<td class="liste_titre">';
1252 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1255if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1256 print
'<td class="liste_titre">';
1257 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1260if (!empty($arrayfields[
's.nom'][
'checked'])) {
1261 print
'<td class="liste_titre" align="left">';
1262 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1265if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1266 print
'<td class="liste_titre" align="left">';
1267 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1270if (!empty($arrayfields[
's.town'][
'checked'])) {
1271 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1273if (!empty($arrayfields[
's.zip'][
'checked'])) {
1274 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1277if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1278 print
'<td class="liste_titre">';
1279 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1283if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1284 print
'<td class="liste_titre" align="center">';
1285 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1289if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1290 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1291 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'maxwidth100', 1);
1296if (!empty($arrayfields[
'p.date'][
'checked'])) {
1297 print
'<td class="liste_titre center">';
1298 print
'<div class="nowrapfordate">';
1299 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1301 print
'<div class="nowrapfordate">';
1302 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1307if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1308 print
'<td class="liste_titre center">';
1309 print
'<div class="nowrapfordate">';
1310 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'));
1312 print
'<div class="nowrapfordate">';
1313 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'));
1318if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1319 print
'<td class="liste_titre center">';
1320 print
'<div class="nowrapfordate">';
1321 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'));
1323 print
'<div class="nowrapfordate">';
1324 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'));
1329if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1330 print
'<td class="liste_titre center">';
1331 print
'<div class="nowrapfordate">';
1332 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'));
1334 print
'<div class="nowrapfordate">';
1335 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'));
1340if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1341 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1342 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1347if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1348 print
'<td class="liste_titre">';
1349 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1353if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1354 print
'<td class="liste_titre">';
1355 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1359if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1360 print
'<td class="liste_titre">';
1361 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1365if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1366 print
'<td class="liste_titre">';
1367 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1370if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1372 print
'<td class="liste_titre right">';
1373 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1376if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1378 print
'<td class="liste_titre right">';
1379 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1382if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1384 print
'<td class="liste_titre right">';
1385 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1388if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1390 print
'<td class="liste_titre right">';
1393if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1395 print
'<td class="liste_titre right">';
1398if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1400 print
'<td class="liste_titre">';
1401 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1404if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1406 print
'<td class="liste_titre">';
1407 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1410if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1412 print
'<td class="liste_titre right">';
1413 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1416if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1418 print
'<td class="liste_titre right">';
1419 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1422if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1424 print
'<td class="liste_titre right">';
1425 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1428if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1430 print
'<td class="liste_titre right">';
1433if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1435 print
'<td class="liste_titre right">';
1438if (!empty($arrayfields[
'u.login'][
'checked'])) {
1440 print
'<td class="liste_titre">';
1441 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1444if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1445 print
'<td class="liste_titre"></td>';
1447if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1448 print
'<td class="liste_titre right">';
1451if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1452 print
'<td class="liste_titre right">';
1455if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1456 print
'<td class="liste_titre right">';
1459if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1460 print
'<td class="liste_titre right">';
1464include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1467$parameters = array(
'arrayfields' => $arrayfields);
1468$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1469print $hookmanager->resPrint;
1471if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1472 print
'<td class="liste_titre">';
1476if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1477 print
'<td class="liste_titre">';
1481if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1482 print
'<td class="liste_titre">';
1485if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1487 print
'<td class="liste_titre">';
1488 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1491if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1493 print
'<td class="liste_titre">';
1497if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1498 print
'<td class="liste_titre center parentonrightofpage">';
1499 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1504 print
'<td class="liste_titre" align="middle">';
1505 $searchpicto = $form->showFilterButtons();
1521print
'<tr class="liste_titre">';
1523 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1524 $totalarray[
'nbfield']++;
1526if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1528 $totalarray[
'nbfield']++;
1530if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1531 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1532 $totalarray[
'nbfield']++;
1534if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1535 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1536 $totalarray[
'nbfield']++;
1538if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1539 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1540 $totalarray[
'nbfield']++;
1542if (!empty($arrayfields[
's.nom'][
'checked'])) {
1543 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1544 $totalarray[
'nbfield']++;
1546if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1547 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1548 $totalarray[
'nbfield']++;
1550if (!empty($arrayfields[
's.town'][
'checked'])) {
1551 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1552 $totalarray[
'nbfield']++;
1554if (!empty($arrayfields[
's.zip'][
'checked'])) {
1555 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1556 $totalarray[
'nbfield']++;
1558if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1559 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1560 $totalarray[
'nbfield']++;
1562if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1563 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1564 $totalarray[
'nbfield']++;
1566if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1567 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1568 $totalarray[
'nbfield']++;
1570if (!empty($arrayfields[
'p.date'][
'checked'])) {
1571 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1572 $totalarray[
'nbfield']++;
1574if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1575 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1576 $totalarray[
'nbfield']++;
1578if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1579 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1580 $totalarray[
'nbfield']++;
1582if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1583 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1584 $totalarray[
'nbfield']++;
1586if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1587 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1588 $totalarray[
'nbfield']++;
1590if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1591 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1592 $totalarray[
'nbfield']++;
1594if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1595 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1596 $totalarray[
'nbfield']++;
1598if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1599 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1600 $totalarray[
'nbfield']++;
1602if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1603 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1604 $totalarray[
'nbfield']++;
1606if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1607 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1608 $totalarray[
'nbfield']++;
1610if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1611 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1612 $totalarray[
'nbfield']++;
1614if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1615 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1616 $totalarray[
'nbfield']++;
1618if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1619 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1620 $totalarray[
'nbfield']++;
1622if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1623 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1624 $totalarray[
'nbfield']++;
1626if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1627 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1628 $totalarray[
'nbfield']++;
1630if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1631 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1632 $totalarray[
'nbfield']++;
1634if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1635 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1636 $totalarray[
'nbfield']++;
1638if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1639 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1640 $totalarray[
'nbfield']++;
1642if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1643 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1644 $totalarray[
'nbfield']++;
1646if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1647 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1648 $totalarray[
'nbfield']++;
1650if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1651 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1652 $totalarray[
'nbfield']++;
1654if (!empty($arrayfields[
'u.login'][
'checked'])) {
1655 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1656 $totalarray[
'nbfield']++;
1658if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1660 $totalarray[
'nbfield']++;
1662if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1663 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1664 $totalarray[
'nbfield']++;
1666if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1667 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1668 $totalarray[
'nbfield']++;
1670if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1671 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1672 $totalarray[
'nbfield']++;
1674if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1675 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1676 $totalarray[
'nbfield']++;
1679include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1682 'arrayfields' => $arrayfields,
1684 'sortfield' => $sortfield,
1685 'sortorder' => $sortorder,
1686 'totalarray' => &$totalarray,
1689$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1691print $hookmanager->resPrint;
1692if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1693 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1694 $totalarray[
'nbfield']++;
1696if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1697 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1698 $totalarray[
'nbfield']++;
1700if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1702 $totalarray[
'nbfield']++;
1704if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1705 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1706 $totalarray[
'nbfield']++;
1708if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1709 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1710 $totalarray[
'nbfield']++;
1712if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1713 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1714 $totalarray[
'nbfield']++;
1717 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1718 $totalarray[
'nbfield']++;
1727$with_margin_info =
false;
1728if (isModEnabled(
'margin') && (
1729 !empty($arrayfields[
'total_pa'][
'checked'])
1730 || !empty($arrayfields[
'total_margin'][
'checked'])
1731 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1732 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1735 $with_margin_info =
true;
1742$savnbfield = $totalarray[
'nbfield'];
1743$totalarray = array();
1744$totalarray[
'nbfield'] = 0;
1745$imaxinloop = ($limit ? min($num, $limit) : $num);
1746while ($i < $imaxinloop) {
1747 $obj = $db->fetch_object($resql);
1751 if ($search_option) {
1752 $param .=
"&search_option=".urlencode($search_option);
1755 $objectstatic->id = $obj->rowid;
1756 $objectstatic->ref = $obj->ref;
1757 $objectstatic->ref_customer = $obj->ref_client;
1758 $objectstatic->note_public = $obj->note_public;
1759 $objectstatic->note_private = $obj->note_private;
1760 $objectstatic->statut = $obj->status;
1761 $objectstatic->status = $obj->status;
1763 $companystatic->id = $obj->socid;
1764 $companystatic->name = $obj->name;
1765 $companystatic->name_alias = $obj->alias;
1766 $companystatic->client = $obj->client;
1767 $companystatic->fournisseur = $obj->fournisseur;
1768 $companystatic->code_client = $obj->code_client;
1769 $companystatic->email = $obj->email;
1770 $companystatic->phone = $obj->phone;
1771 $companystatic->address = $obj->address;
1772 $companystatic->zip = $obj->zip;
1773 $companystatic->town = $obj->town;
1774 $companystatic->country_code = $obj->country_code;
1776 $projectstatic->id = $obj->project_id;
1777 $projectstatic->ref = $obj->project_ref;
1778 $projectstatic->title = $obj->project_label;
1780 $totalInvoicedHT = 0;
1781 $totalInvoicedTTC = 0;
1782 $multicurrency_totalInvoicedHT = 0;
1783 $multicurrency_totalInvoicedTTC = 0;
1785 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1787 if (!empty($TInvoiceData)) {
1788 foreach ($TInvoiceData as $invoiceData) {
1790 $invoice->fetch($invoiceData->facid);
1796 $totalInvoicedHT += $invoice->total_ht;
1797 $totalInvoicedTTC += $invoice->total_ttc;
1798 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1799 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1803 $marginInfo = array();
1804 if ($with_margin_info) {
1805 $objectstatic->fetch_lines();
1806 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1807 $total_ht += $obj->total_ht;
1808 $total_margin += $marginInfo[
'total_margin'];
1811 if ($mode ==
'kanban') {
1813 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1814 print
'<div class="box-flex-container kanban">';
1817 $objectstatic->thirdparty = $companystatic;
1818 $userstatic->fetch($obj->fk_user_author);
1819 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1820 print $objectstatic->getKanbanView(
'', $arrayofparams);
1821 if ($i == ($imaxinloop - 1)) {
1826 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1830 print
'<td class="nowrap" align="center">';
1831 if ($massactionbutton || $massaction) {
1833 if (in_array($obj->rowid, $arrayofselected)) {
1836 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1840 $totalarray[
'nbfield']++;
1844 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1845 print
'<td class="nowraponall">';
1847 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1849 print
'<td class="nobordernopadding nowraponall">';
1850 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1854 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1855 $warnornote .=
img_warning($langs->trans(
"Late"));
1858 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1863 print
'<td width="16" class="nobordernopadding right">';
1865 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1866 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1867 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1868 print
'</td></tr></table>';
1872 $totalarray[
'nbfield']++;
1876 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1878 print
'<td class="nowrap tdoverflowmax200">';
1882 $totalarray[
'nbfield']++;
1886 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1888 print
'<td class="nowraponall">';
1889 if ($obj->project_id > 0) {
1890 print $projectstatic->getNomUrl(1);
1894 $totalarray[
'nbfield']++;
1898 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1900 print
'<td class="nowrap">';
1901 if ($obj->project_id > 0) {
1906 $totalarray[
'nbfield']++;
1911 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1912 print
'<td class="tdoverflowmax150">';
1913 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1916 $totalarray[
'nbfield']++;
1921 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1922 print
'<td class="tdoverflowmax200">';
1926 $totalarray[
'nbfield']++;
1931 if (!empty($arrayfields[
's.town'][
'checked'])) {
1932 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1936 $totalarray[
'nbfield']++;
1940 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1941 print
'<td class="nocellnopadd">';
1945 $totalarray[
'nbfield']++;
1949 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1950 print
"<td>".$obj->state_name.
"</td>\n";
1952 $totalarray[
'nbfield']++;
1956 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1957 print
'<td class="center">';
1958 $tmparray =
getCountry($obj->fk_pays,
'all');
1959 print $tmparray[
'label'];
1962 $totalarray[
'nbfield']++;
1966 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1967 if (!is_array($typenArray) || empty($typenArray)) {
1968 $typenArray = $formcompany->typent_array(1);
1971 print
'<td class="center">';
1972 if (!empty($obj->typent_code)) {
1973 print $typenArray[$obj->typent_code];
1977 $totalarray[
'nbfield']++;
1982 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1983 print
'<td class="center">';
1987 $totalarray[
'nbfield']++;
1992 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1994 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1997 print
'<td> </td>';
2000 $totalarray[
'nbfield']++;
2004 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2005 if ($obj->ddelivery) {
2006 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2009 print
'<td> </td>';
2012 $totalarray[
'nbfield']++;
2016 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2017 if ($obj->dsignature) {
2018 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2021 print
'<td> </td>';
2024 $totalarray[
'nbfield']++;
2028 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2029 print
'<td class="center">';
2030 $form->form_availability(0, $obj->availability,
'none', 1);
2033 $totalarray[
'nbfield']++;
2037 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2039 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2042 $totalarray[
'nbfield']++;
2046 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2047 $labelInputReason =
'';
2048 if ($obj->fk_input_reason > 0) {
2049 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2051 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2055 $totalarray[
'nbfield']++;
2059 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2061 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2064 $totalarray[
'nbfield']++;
2068 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2070 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2073 $totalarray[
'nbfield']++;
2077 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2078 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2080 $totalarray[
'nbfield']++;
2083 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2085 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2086 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2088 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2092 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2093 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2095 $totalarray[
'nbfield']++;
2098 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2100 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2101 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2103 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2107 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2108 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2110 $totalarray[
'nbfield']++;
2113 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2115 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2116 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2118 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2122 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2123 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2125 $totalarray[
'nbfield']++;
2128 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2130 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2131 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2133 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2137 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2138 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2140 $totalarray[
'nbfield']++;
2143 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2145 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2146 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2148 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2152 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2153 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2155 $totalarray[
'nbfield']++;
2160 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2161 print
'<td class="nowrap">';
2162 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2165 $totalarray[
'nbfield']++;
2169 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2170 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2172 $totalarray[
'nbfield']++;
2176 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2177 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2179 $totalarray[
'nbfield']++;
2183 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2184 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2186 $totalarray[
'nbfield']++;
2190 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2191 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2193 $totalarray[
'nbfield']++;
2197 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2198 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2200 $totalarray[
'nbfield']++;
2204 $userstatic->id = $obj->fk_user_author;
2205 $userstatic->login = $obj->login;
2206 $userstatic->lastname = $obj->lastname;
2207 $userstatic->firstname = $obj->firstname;
2208 $userstatic->email = $obj->user_email;
2209 $userstatic->status = $obj->user_statut;
2210 $userstatic->entity = $obj->user_entity;
2211 $userstatic->photo = $obj->photo;
2212 $userstatic->office_phone = $obj->office_phone;
2213 $userstatic->office_fax = $obj->office_fax;
2214 $userstatic->user_mobile = $obj->user_mobile;
2215 $userstatic->job = $obj->job;
2216 $userstatic->gender = $obj->gender;
2219 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2220 print
'<td class="tdoverflowmax150">';
2221 if ($userstatic->id) {
2222 print $userstatic->getNomUrl(-1);
2226 $totalarray[
'nbfield']++;
2230 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2232 print
'<td class="tdoverflowmax125">';
2233 if ($obj->socid > 0) {
2234 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2235 if ($listsalesrepresentatives < 0) {
2238 $nbofsalesrepresentative = count($listsalesrepresentatives);
2239 if ($nbofsalesrepresentative > 6) {
2241 print $nbofsalesrepresentative;
2242 } elseif ($nbofsalesrepresentative > 0) {
2243 $userstatic =
new User($db);
2245 foreach ($listsalesrepresentatives as $val) {
2246 $userstatic->id = $val[
'id'];
2247 $userstatic->lastname = $val[
'lastname'];
2248 $userstatic->firstname = $val[
'firstname'];
2249 $userstatic->email = $val[
'email'];
2250 $userstatic->status = $val[
'statut'];
2251 $userstatic->entity = $val[
'entity'];
2252 $userstatic->photo = $val[
'photo'];
2253 $userstatic->login = $val[
'login'];
2254 $userstatic->office_phone = $val[
'office_phone'];
2255 $userstatic->office_fax = $val[
'office_fax'];
2256 $userstatic->user_mobile = $val[
'user_mobile'];
2257 $userstatic->job = $val[
'job'];
2258 $userstatic->gender = $val[
'gender'];
2260 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2262 if ($j < $nbofsalesrepresentative) {
2274 $totalarray[
'nbfield']++;
2279 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2280 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2282 $totalarray[
'nbfield']++;
2286 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2287 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2289 $totalarray[
'nbfield']++;
2292 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2294 $totalarray[
'val'][
'total_margin'] = $total_margin;
2297 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2298 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2300 $totalarray[
'nbfield']++;
2304 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2305 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2307 $totalarray[
'nbfield']++;
2310 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2312 if ($i >= $imaxinloop - 1) {
2313 if (!empty($total_ht)) {
2314 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2316 $totalarray[
'val'][
'total_mark_rate'] =
'';
2322 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2324 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2325 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2326 print $hookmanager->resPrint;
2328 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2329 print
'<td align="center" class="nowrap">';
2330 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2333 $totalarray[
'nbfield']++;
2337 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2338 print
'<td align="center" class="nowrap">';
2339 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2342 $totalarray[
'nbfield']++;
2346 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2347 print
'<td align="center" class="nowrap">';
2348 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2351 $totalarray[
'nbfield']++;
2355 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2356 print
'<td class="sensiblehtmlcontent center">';
2360 $totalarray[
'nbfield']++;
2364 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2365 print
'<td class="sensiblehtmlcontent center">';
2369 $totalarray[
'nbfield']++;
2373 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2374 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2376 $totalarray[
'nbfield']++;
2381 print
'<td class="nowrap" align="center">';
2382 if ($massactionbutton || $massaction) {
2384 if (in_array($obj->rowid, $arrayofselected)) {
2387 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2391 $totalarray[
'nbfield']++;
2403include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2408 foreach ($arrayfields as $key => $val) {
2409 if (!empty($val[
'checked'])) {
2413 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2418$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2419$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2420print $hookmanager->resPrint;
2422print
'</table>'.
"\n";
2425print
'</form>'.
"\n";
2427if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2428 $hidegeneratedfilelistifempty = 1;
2429 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2430 $hidegeneratedfilelistifempty = 0;
2433 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2437 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2438 $urlsource .= str_replace(
'&',
'&', $param);
2440 $filedir = $diroutputmassaction;
2441 $genallowed = $permissiontoread;
2442 $delallowed = $permissiontoadd;
2444 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage invoices.
const TYPE_DEPOSIT
Deposit invoice.
Class to manage projects.
Class to manage proposals.
const STATUS_VALIDATED
Validated status.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.