43 require
'../../main.inc.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
53 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
61 $langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'deliveries',
'categories'));
63 $langs->loadLangs(array(
'sendings'));
69 $action =
GETPOST(
'action',
'aZ09');
70 $massaction =
GETPOST(
'massaction',
'alpha');
72 $confirm =
GETPOST(
'confirm',
'alpha');
73 $cancel =
GETPOST(
'cancel',
'alpha');
74 $toselect =
GETPOST(
'toselect',
'array');
75 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
76 $optioncss =
GETPOST(
'optioncss',
'alpha');
77 $mode =
GETPOST(
'mode',
'alpha');
80 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
82 if ($search_user == -1) {
87 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
88 $search_refproject =
GETPOST(
'search_refproject',
'alpha');
89 $search_project =
GETPOST(
'search_project',
'alpha');
90 $search_societe =
GETPOST(
'search_societe',
'alpha');
91 $search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
92 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
93 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
94 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
95 $search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
96 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
97 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
98 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
99 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
100 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
101 $search_login =
GETPOST(
'search_login',
'alpha');
102 $search_product_category =
GETPOSTINT(
'search_product_category');
103 $search_town =
GETPOST(
'search_town',
'alpha');
104 $search_zip =
GETPOST(
'search_zip',
'alpha');
105 $search_state =
GETPOST(
"search_state");
106 $search_country =
GETPOST(
"search_country",
'aZ09');
107 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
108 $search_date_startday =
GETPOSTINT(
'search_date_startday');
109 $search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
110 $search_date_startyear =
GETPOSTINT(
'search_date_startyear');
111 $search_date_endday =
GETPOSTINT(
'search_date_endday');
112 $search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
113 $search_date_endyear =
GETPOSTINT(
'search_date_endyear');
114 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
115 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
116 $search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
117 $search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
118 $search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
119 $search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
120 $search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
121 $search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
122 $search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
123 $search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
124 $search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
125 $search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
126 $search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
127 $search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
128 $search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
129 $search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
130 $search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
131 $search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
132 $search_availability =
GETPOST(
'search_availability',
'intcomma');
133 $search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
134 $search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'intcomma');
135 $search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'intcomma');
136 $search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'intcomma');
137 $search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'intcomma');
138 $search_date_signature_startday =
GETPOSTINT(
'search_date_signature_startday');
139 $search_date_signature_startmonth =
GETPOSTINT(
'search_date_signature_startmonth');
140 $search_date_signature_startyear =
GETPOSTINT(
'search_date_signature_startyear');
141 $search_date_signature_endday =
GETPOSTINT(
'search_date_signature_endday');
142 $search_date_signature_endmonth =
GETPOSTINT(
'search_date_signature_endmonth');
143 $search_date_signature_endyear =
GETPOSTINT(
'search_date_signature_endyear');
144 $search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
145 $search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
146 $search_status =
GETPOST(
'search_status',
'alpha');
150 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
151 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
153 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
157 $offset = $limit * $page;
158 $pageprev = $page - 1;
159 $pagenext = $page + 1;
161 $sortfield =
'p.ref';
171 if (!empty($user->socid)) {
172 $socid = $user->socid;
174 if (!empty($socid)) {
177 $dbtable =
'&societe';
181 $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
185 $hookmanager->initHooks(array(
'propallist'));
189 $extrafields->fetch_name_optionals_label(
$object->table_element);
191 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
194 $fieldstosearchall = array(
196 'p.ref_client' =>
'RefCustomer',
197 'pd.description' =>
'Description',
198 's.nom' =>
"ThirdParty",
199 's.name_alias' =>
"AliasNameShort",
202 'p.note_public' =>
'NotePublic',
204 if (empty($user->socid)) {
205 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
209 $checkedtypetiers = 0;
210 $arrayfields = array(
211 'p.ref' => array(
'label' =>
"Ref",
'checked' => 1),
212 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' => -1),
213 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'enabled' => (
isModEnabled(
'project') ? 1 : 0)),
214 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (
isModEnabled(
'project') ? 1 : 0)),
215 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1),
216 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1),
217 's.town' => array(
'label' =>
"Town",
'checked' => -1),
218 's.zip' => array(
'label' =>
"Zip",
'checked' => -1),
219 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0),
220 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0),
221 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers),
222 'p.date' => array(
'label' =>
"DatePropal",
'checked' => 1),
223 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' => 1),
224 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' => 0),
225 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' => 0),
226 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' => 0),
227 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => 0,
'enabled' =>
isModEnabled(
"shipping")),
228 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' => 0,
'enabled' => 1),
229 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 0),
230 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 0),
231 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1),
232 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' => 0),
233 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0),
234 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
235 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' => 0,
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
236 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!
isModEnabled(
"multicurrency") ? 0 : 1)),
237 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!
isModEnabled(
"multicurrency") ? 0 : 1)),
238 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!
isModEnabled(
"multicurrency") ? 0 : 1)),
239 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!
isModEnabled(
"multicurrency") ? 0 : 1)),
240 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!
isModEnabled(
"multicurrency") ? 0 : 1)),
241 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' => 0,
'enabled' =>
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
242 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' => 0,
'enabled' =>
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
243 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 10),
244 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => -1),
245 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
246 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
247 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
248 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
249 'p.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
250 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
251 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 500),
252 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
253 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
254 'p.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
281 if (!$user->hasRight(
'societe',
'client',
'voir')) {
282 $search_sale = $user->id;
286 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
289 $permissiontoread = $user->hasRight(
'propal',
'lire');
290 $permissiontoadd = $user->hasRight(
'propal',
'creer');
291 $permissiontodelete = $user->hasRight(
'propal',
'supprimer');
293 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
294 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
295 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
297 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
298 $permissiontoclose = $user->hasRight(
'propal',
'creer');
299 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
307 if (
GETPOST(
'cancel',
'alpha')) {
311 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
315 $parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
316 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
321 if (empty($reshook)) {
323 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
326 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
330 $search_refcustomer =
'';
331 $search_refproject =
'';
332 $search_project =
'';
333 $search_societe =
'';
334 $search_societe_alias =
'';
335 $search_montant_ht =
'';
336 $search_montant_vat =
'';
337 $search_montant_ttc =
'';
338 $search_warehouse =
'';
339 $search_multicurrency_code =
'';
340 $search_multicurrency_tx =
'';
341 $search_multicurrency_montant_ht =
'';
342 $search_multicurrency_montant_vat =
'';
343 $search_multicurrency_montant_ttc =
'';
345 $search_product_category =
'';
350 $search_country =
'';
351 $search_type_thirdparty =
'';
352 $search_date_startday =
'';
353 $search_date_startmonth =
'';
354 $search_date_startyear =
'';
355 $search_date_endday =
'';
356 $search_date_endmonth =
'';
357 $search_date_endyear =
'';
358 $search_date_start =
'';
359 $search_date_end =
'';
360 $search_date_end_startday =
'';
361 $search_date_end_startmonth =
'';
362 $search_date_end_startyear =
'';
363 $search_date_end_endday =
'';
364 $search_date_end_endmonth =
'';
365 $search_date_end_endyear =
'';
366 $search_date_end_start =
'';
367 $search_date_end_end =
'';
368 $search_date_delivery_startday =
'';
369 $search_date_delivery_startmonth =
'';
370 $search_date_delivery_startyear =
'';
371 $search_date_delivery_endday =
'';
372 $search_date_delivery_endmonth =
'';
373 $search_date_delivery_endyear =
'';
374 $search_date_delivery_start =
'';
375 $search_date_delivery_end =
'';
376 $search_availability =
'';
378 $search_categ_cus = 0;
379 $search_fk_cond_reglement =
'';
380 $search_fk_shipping_method =
'';
381 $search_fk_input_reason =
'';
382 $search_fk_mode_reglement =
'';
383 $search_date_signature_startday =
'';
384 $search_date_signature_startmonth =
'';
385 $search_date_signature_startyear =
'';
386 $search_date_signature_endday =
'';
387 $search_date_signature_endmonth =
'';
388 $search_date_signature_endyear =
'';
389 $search_date_signature_start =
'';
390 $search_date_signature_end =
'';
392 $search_array_options = array();
396 $objectclass =
'Propal';
397 $objectlabel =
'Proposals';
398 $uploaddir = $conf->propal->multidir_output[$conf->entity];
399 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
402 if ($action ==
'validate' && $permissiontovalidate) {
403 if (
GETPOST(
'confirm') ==
'yes') {
404 $tmpproposal =
new Propal($db);
407 foreach ($toselect as $checked) {
408 if ($tmpproposal->fetch($checked) > 0) {
409 if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
410 if ($tmpproposal->valid($user) > 0) {
411 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
417 $langs->load(
"errors");
418 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
434 if ($action ==
"sign" && $permissiontoclose) {
435 if (
GETPOST(
'confirm') ==
'yes') {
436 $tmpproposal =
new Propal($db);
439 foreach ($toselect as $checked) {
440 if ($tmpproposal->fetch($checked) > 0) {
441 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
442 $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
443 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
444 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
450 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
466 if ($action ==
"nosign" && $permissiontoclose) {
467 if (
GETPOST(
'confirm') ==
'yes') {
468 $tmpproposal =
new Propal($db);
471 foreach ($toselect as $checked) {
472 if ($tmpproposal->fetch($checked) > 0) {
473 if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
474 $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
475 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
476 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
482 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
499 if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
502 $objecttmp =
new $objectclass($db);
504 foreach ($toselect as $toselectid) {
505 $result = $objecttmp->fetch($toselectid);
507 $result = $objecttmp->classifyBilled($user, 0);
538 $form =
new Form($db);
546 $companystatic =
new Societe($db);
547 $projectstatic =
new Project($db);
550 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
551 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
554 if ($search_all > 0) {
555 $sql =
'SELECT DISTINCT';
557 $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,';
558 $sql .=
" typent.code as typent_code,";
559 $sql .=
" ava.rowid as availability,";
560 $sql .=
" country.code as country_code,";
561 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
562 $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,';
563 $sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
564 $sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
565 $sql .=
' p.date_signature as dsignature,';
566 $sql .=
' p.note_public, p.note_private,';
567 $sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
568 $sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
569 $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';
571 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
572 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
573 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
577 $parameters = array();
578 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
579 $sql .= $hookmanager->resPrint;
580 $sql = preg_replace(
'/, $/',
'',
$sql);
584 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
585 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
586 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
587 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
589 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
590 if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
591 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
594 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propaldet as pd ON p.rowid = pd.fk_propal';
596 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
597 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
598 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
600 $parameters = array();
601 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object);
602 $sql .= $hookmanager->resPrint;
605 $sql .=
' p.entity IN ('.getEntity(
'propal').
')';
615 if ($search_country) {
616 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
618 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
619 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
624 if ($search_refcustomer) {
627 if ($search_refproject) {
630 if ($search_project) {
633 if ($search_availability) {
634 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
636 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
639 if ($search_societe) {
642 if ($search_societe_alias) {
649 if ($search_montant_ht !=
'') {
652 if ($search_montant_vat !=
'') {
655 if ($search_montant_ttc !=
'') {
658 if ($search_warehouse !=
'' && $search_warehouse > 0) {
661 if ($search_multicurrency_code !=
'') {
662 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
664 if ($search_multicurrency_tx !=
'') {
667 if ($search_multicurrency_montant_ht !=
'') {
668 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
670 if ($search_multicurrency_montant_vat !=
'') {
671 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
673 if ($search_multicurrency_montant_ttc !=
'') {
674 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
679 if ($search_fk_cond_reglement > 0) {
680 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
682 if ($search_fk_shipping_method > 0) {
683 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
685 if ($search_fk_input_reason > 0) {
686 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
688 if ($search_fk_mode_reglement > 0) {
689 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
692 $sql .=
' AND s.rowid = '.((int) $socid);
694 if ($search_status !=
'' && $search_status !=
'-1') {
695 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
697 if ($search_date_start) {
698 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
700 if ($search_date_end) {
701 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
703 if ($search_date_end_start) {
704 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
706 if ($search_date_end_end) {
707 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
709 if ($search_date_delivery_start) {
710 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
712 if ($search_date_delivery_end) {
713 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
715 if ($search_date_signature_start) {
716 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
718 if ($search_date_signature_end) {
719 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
722 if ($search_user > 0) {
723 $sql .=
" AND EXISTS (";
724 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
725 $sql .=
" FROM llx_element_contact as ec";
726 $sql .=
" INNER JOIN llx_c_type_contact as tc";
727 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
728 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
731 if ($search_sale && $search_sale !=
'-1') {
732 if ($search_sale == -2) {
733 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
734 } elseif ($search_sale > 0) {
735 $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).
")";
739 $searchCategoryCustomerOperator = -1;
740 $searchCategoryCustomerList = array($search_categ_cus);
741 if (!empty($searchCategoryCustomerList)) {
742 $searchCategoryCustomerSqlList = array();
743 $listofcategoryid =
'';
744 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
745 if (intval($searchCategoryCustomer) == -2) {
746 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
747 } elseif (intval($searchCategoryCustomer) > 0) {
748 if ($searchCategoryCustomerOperator == 0) {
749 $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).
")";
751 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
755 if ($listofcategoryid) {
756 $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).
"))";
758 if ($searchCategoryCustomerOperator == 1) {
759 if (!empty($searchCategoryCustomerSqlList)) {
760 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
763 if (!empty($searchCategoryCustomerSqlList)) {
764 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
769 $searchCategoryProductOperator = -1;
770 $searchCategoryProductList = array($search_product_category);
771 if (!empty($searchCategoryProductList)) {
772 $searchCategoryProductSqlList = array();
773 $listofcategoryid =
'';
774 foreach ($searchCategoryProductList as $searchCategoryProduct) {
775 if (intval($searchCategoryProduct) == -2) {
776 $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)";
777 } elseif (intval($searchCategoryProduct) > 0) {
778 if ($searchCategoryProductOperator == 0) {
779 $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).
")";
781 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
785 if ($listofcategoryid) {
786 $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).
"))";
788 if ($searchCategoryProductOperator == 1) {
789 if (!empty($searchCategoryProductSqlList)) {
790 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
793 if (!empty($searchCategoryProductSqlList)) {
794 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
799 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
803 $parameters = array();
804 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
805 $sql .= $hookmanager->resPrint;
808 $parameters = array();
809 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters,
$object, $action);
810 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
813 $nbtotalofrecords =
'';
816 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
817 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
818 $resql = $db->query($sqlforcount);
820 $objforcount = $db->fetch_object($resql);
821 $nbtotalofrecords = $objforcount->nbtotalofrecords;
826 if (($page * $limit) > $nbtotalofrecords) {
834 $sql .= $db->order($sortfield, $sortorder);
835 $sql .=
', p.ref DESC';
837 $sql .= $db->plimit($limit + 1, $offset);
840 $resql = $db->query(
$sql);
846 $objectstatic =
new Propal($db);
847 $userstatic =
new User($db);
852 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
853 if (empty($search_societe)) {
854 $search_societe = $soc->name;
857 $title = $langs->trans(
'Proposals');
860 $num = $db->num_rows($resql);
862 $arrayofselected = is_array($toselect) ? $toselect : array();
864 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
865 $obj = $db->fetch_object($resql);
869 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.$id);
873 $help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
876 $param =
'&search_status='.urlencode($search_status);
878 $param .=
'&mode='.urlencode($mode);
880 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
881 $param .=
'&contextpage='.urlencode($contextpage);
883 if ($limit > 0 && $limit != $conf->liste_limit) {
884 $param .=
'&limit='.((int) $limit);
887 $param .=
'&search_all='.urlencode($search_all);
889 if ($search_date_startday) {
890 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
892 if ($search_date_startmonth) {
893 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
895 if ($search_date_startyear) {
896 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
898 if ($search_date_endday) {
899 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
901 if ($search_date_endmonth) {
902 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
904 if ($search_date_endyear) {
905 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
907 if ($search_date_end_startday) {
908 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
910 if ($search_date_end_startmonth) {
911 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
913 if ($search_date_end_startyear) {
914 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
916 if ($search_date_end_endday) {
917 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
919 if ($search_date_end_endmonth) {
920 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
922 if ($search_date_end_endyear) {
923 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
925 if ($search_date_delivery_startday) {
926 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
928 if ($search_date_delivery_startmonth) {
929 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
931 if ($search_date_delivery_startyear) {
932 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
934 if ($search_date_delivery_endday) {
935 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
937 if ($search_date_delivery_endmonth) {
938 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
940 if ($search_date_delivery_endyear) {
941 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
944 $param .=
'&search_ref='.urlencode($search_ref);
946 if ($search_refcustomer) {
947 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
949 if ($search_refproject) {
950 $param .=
'&search_refproject='.urlencode($search_refproject);
952 if ($search_societe) {
953 $param .=
'&search_societe='.urlencode($search_societe);
955 if ($search_societe_alias) {
956 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
958 if ($search_user > 0) {
959 $param .=
'&search_user='.urlencode((
string) ($search_user));
961 if ($search_sale > 0) {
962 $param .=
'&search_sale='.urlencode($search_sale);
964 if ($search_montant_ht) {
965 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
967 if ($search_multicurrency_code !=
'') {
968 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
970 if ($search_multicurrency_tx !=
'') {
971 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
973 if ($search_multicurrency_montant_ht !=
'') {
974 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
976 if ($search_multicurrency_montant_vat !=
'') {
977 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
979 if ($search_multicurrency_montant_ttc !=
'') {
980 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
983 $param .=
'&search_login='.urlencode($search_login);
986 $param .=
'&search_town='.urlencode($search_town);
989 $param .=
'&search_zip='.urlencode($search_zip);
992 $param .=
'&socid='.urlencode((
string) ($socid));
994 if ($optioncss !=
'') {
995 $param .=
'&optioncss='.urlencode($optioncss);
997 if ($search_categ_cus > 0) {
998 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1000 if ($search_product_category !=
'') {
1001 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1003 if ($search_fk_cond_reglement > 0) {
1004 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1006 if ($search_fk_shipping_method > 0) {
1007 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1009 if ($search_fk_input_reason > 0) {
1010 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1012 if ($search_fk_mode_reglement > 0) {
1013 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1015 if ($search_type_thirdparty > 0) {
1016 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1019 $param .=
'&search_town='.urlencode($search_town);
1022 $param .=
'&search_zip='.urlencode($search_zip);
1024 if ($search_state) {
1025 $param .=
'&search_state='.urlencode($search_state);
1028 $param .=
'&search_town='.urlencode($search_town);
1030 if ($search_country) {
1031 $param .=
'&search_country='.urlencode((
string) ($search_country));
1033 if ($search_date_signature_startday) {
1034 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1036 if ($search_date_signature_startmonth) {
1037 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1039 if ($search_date_signature_startyear) {
1040 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1042 if ($search_date_signature_endday) {
1043 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1045 if ($search_date_signature_endmonth) {
1046 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1048 if ($search_date_signature_endyear) {
1049 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1053 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1055 $parameters = array(
'param' => &$param);
1056 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
1057 $param .= $hookmanager->resPrint;
1060 $arrayofmassactions = array(
1061 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1062 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1064 if ($permissiontosendbymail) {
1065 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1067 if ($permissiontovalidate) {
1068 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1070 if ($permissiontoclose) {
1071 $arrayofmassactions[
'presign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1072 $arrayofmassactions[
'nopresign'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1073 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1075 if ($permissiontodelete) {
1076 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1079 if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1080 $arrayofmassactions = array();
1082 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1084 $url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1085 if (!empty($socid)) {
1086 $url .=
'&socid='.$socid;
1088 $newcardbutton =
'';
1089 $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'));
1090 $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'));
1092 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1095 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
1096 if ($optioncss !=
'') {
1097 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1099 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1100 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1101 print
'<input type="hidden" name="action" value="list">';
1102 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1103 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1104 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1105 print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1107 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1109 $topicmail =
"SendPropalRef";
1110 $modelmail =
"propal_send";
1111 $objecttmp =
new Propal($db);
1112 $trackid =
'pro'.$object->id;
1113 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1115 if ($massaction ==
'prevalidate') {
1116 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1119 if ($massaction ==
'presign') {
1120 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1123 if ($massaction ==
'nopresign') {
1124 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1128 foreach ($fieldstosearchall as $key => $val) {
1129 $fieldstosearchall[$key] = $langs->trans($val);
1131 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1136 $moreforfilter =
'';
1139 if ($user->hasRight(
'user',
'user',
'lire')) {
1140 $langs->load(
"commercial");
1141 $moreforfilter .=
'<div class="divsearchfield">';
1142 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1143 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1144 $moreforfilter .=
'</div>';
1147 if ($user->hasRight(
'user',
'user',
'lire')) {
1148 $moreforfilter .=
'<div class="divsearchfield">';
1149 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1150 $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');
1151 $moreforfilter .=
'</div>';
1154 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1155 $searchCategoryProductOperator = -1;
1156 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1157 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1159 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1161 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1162 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1163 $moreforfilter .=
'<div class="divsearchfield">';
1164 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1165 $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'));
1166 $moreforfilter .=
'</div>';
1169 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1171 $moreforfilter .=
'<div class="divsearchfield">';
1172 $tmptitle = $langs->trans(
'Warehouse');
1173 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
1174 $moreforfilter .=
'</div>';
1176 $parameters = array();
1177 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
1178 if (empty($reshook)) {
1179 $moreforfilter .= $hookmanager->resPrint;
1181 $moreforfilter = $hookmanager->resPrint;
1184 if (!empty($moreforfilter)) {
1185 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1186 print $moreforfilter;
1190 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1191 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1192 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1194 print
'<div class="div-table-responsive">';
1195 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1197 print
'<tr class="liste_titre_filter">';
1201 print
'<td class="liste_titre" align="middle">';
1202 $searchpicto = $form->showFilterButtons(
'left');
1207 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1208 print
'<td class="liste_titre">';
1209 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1212 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1213 print
'<td class="liste_titre">';
1214 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1217 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1218 print
'<td class="liste_titre">';
1219 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1222 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1223 print
'<td class="liste_titre">';
1224 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1227 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1228 print
'<td class="liste_titre" align="left">';
1229 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
1232 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1233 print
'<td class="liste_titre" align="left">';
1234 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1237 if (!empty($arrayfields[
's.town'][
'checked'])) {
1238 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1240 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1241 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1244 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1246 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1250 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1251 print
'<td class="liste_titre" align="center">';
1252 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1256 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1257 print
'<td class="liste_titre maxwidth100onsmartphone" align="center">';
1258 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);
1263 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1264 print
'<td class="liste_titre center">';
1265 print
'<div class="nowrapfordate">';
1266 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1268 print
'<div class="nowrapfordate">';
1269 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1274 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1275 print
'<td class="liste_titre center">';
1276 print
'<div class="nowrapfordate">';
1277 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'));
1279 print
'<div class="nowrapfordate">';
1280 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'));
1285 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1286 print
'<td class="liste_titre center">';
1287 print
'<div class="nowrapfordate">';
1288 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'));
1290 print
'<div class="nowrapfordate">';
1291 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'));
1296 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1297 print
'<td class="liste_titre center">';
1298 print
'<div class="nowrapfordate">';
1299 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'));
1301 print
'<div class="nowrapfordate">';
1302 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'));
1307 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1308 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1309 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1314 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1315 print
'<td class="liste_titre">';
1316 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1320 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1321 print
'<td class="liste_titre">';
1322 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1326 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1327 print
'<td class="liste_titre">';
1328 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1332 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1333 print
'<td class="liste_titre">';
1334 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1337 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1339 print
'<td class="liste_titre right">';
1340 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1343 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1345 print
'<td class="liste_titre right">';
1346 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1349 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1351 print
'<td class="liste_titre right">';
1352 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1355 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1357 print
'<td class="liste_titre right">';
1360 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1362 print
'<td class="liste_titre right">';
1365 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1367 print
'<td class="liste_titre">';
1368 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1371 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1373 print
'<td class="liste_titre">';
1374 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1377 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1379 print
'<td class="liste_titre right">';
1380 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1383 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1385 print
'<td class="liste_titre right">';
1386 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1389 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1391 print
'<td class="liste_titre right">';
1392 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1395 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1397 print
'<td class="liste_titre right">';
1400 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1402 print
'<td class="liste_titre right">';
1405 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1407 print
'<td class="liste_titre">';
1408 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1411 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1412 print
'<td class="liste_titre"></td>';
1414 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1415 print
'<td class="liste_titre right">';
1418 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1419 print
'<td class="liste_titre right">';
1422 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1423 print
'<td class="liste_titre right">';
1426 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1427 print
'<td class="liste_titre right">';
1431 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1434 $parameters = array(
'arrayfields' => $arrayfields);
1435 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
1436 print $hookmanager->resPrint;
1438 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1439 print
'<td class="liste_titre">';
1443 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1444 print
'<td class="liste_titre">';
1448 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1449 print
'<td class="liste_titre">';
1452 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1454 print
'<td class="liste_titre">';
1457 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1459 print
'<td class="liste_titre">';
1463 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1464 print
'<td class="liste_titre center parentonrightofpage">';
1465 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1470 print
'<td class="liste_titre" align="middle">';
1471 $searchpicto = $form->showFilterButtons();
1477 $totalarray = array(
1487 print
'<tr class="liste_titre">';
1489 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1490 $totalarray[
'nbfield']++;
1492 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1493 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1494 $totalarray[
'nbfield']++;
1496 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1497 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1498 $totalarray[
'nbfield']++;
1500 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1501 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1502 $totalarray[
'nbfield']++;
1504 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1505 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1506 $totalarray[
'nbfield']++;
1508 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1509 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1510 $totalarray[
'nbfield']++;
1512 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1513 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1514 $totalarray[
'nbfield']++;
1516 if (!empty($arrayfields[
's.town'][
'checked'])) {
1517 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1518 $totalarray[
'nbfield']++;
1520 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1521 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1522 $totalarray[
'nbfield']++;
1524 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1525 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1526 $totalarray[
'nbfield']++;
1528 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1529 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1530 $totalarray[
'nbfield']++;
1532 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1533 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1534 $totalarray[
'nbfield']++;
1536 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1537 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1538 $totalarray[
'nbfield']++;
1540 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1541 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1542 $totalarray[
'nbfield']++;
1544 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1545 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1546 $totalarray[
'nbfield']++;
1548 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1549 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1550 $totalarray[
'nbfield']++;
1552 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1553 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1554 $totalarray[
'nbfield']++;
1556 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1557 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1558 $totalarray[
'nbfield']++;
1560 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1561 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1562 $totalarray[
'nbfield']++;
1564 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1565 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1566 $totalarray[
'nbfield']++;
1568 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1569 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1570 $totalarray[
'nbfield']++;
1572 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1573 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1574 $totalarray[
'nbfield']++;
1576 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1577 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1578 $totalarray[
'nbfield']++;
1580 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1581 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1582 $totalarray[
'nbfield']++;
1584 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1585 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1586 $totalarray[
'nbfield']++;
1588 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1589 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1590 $totalarray[
'nbfield']++;
1592 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1593 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1594 $totalarray[
'nbfield']++;
1596 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1597 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1598 $totalarray[
'nbfield']++;
1600 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1601 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1602 $totalarray[
'nbfield']++;
1604 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1605 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1606 $totalarray[
'nbfield']++;
1608 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1609 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1610 $totalarray[
'nbfield']++;
1612 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1613 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1614 $totalarray[
'nbfield']++;
1616 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1617 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1618 $totalarray[
'nbfield']++;
1620 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1621 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1622 $totalarray[
'nbfield']++;
1624 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1625 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1626 $totalarray[
'nbfield']++;
1628 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1629 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1630 $totalarray[
'nbfield']++;
1632 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1633 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1634 $totalarray[
'nbfield']++;
1636 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1637 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1638 $totalarray[
'nbfield']++;
1640 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1641 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1642 $totalarray[
'nbfield']++;
1645 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1647 $parameters = array(
1648 'arrayfields' => $arrayfields,
1650 'sortfield' => $sortfield,
1651 'sortorder' => $sortorder,
1652 'totalarray' => &$totalarray,
1655 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
1657 print $hookmanager->resPrint;
1658 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1660 $totalarray[
'nbfield']++;
1662 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1663 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1664 $totalarray[
'nbfield']++;
1666 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1667 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1668 $totalarray[
'nbfield']++;
1670 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1671 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1672 $totalarray[
'nbfield']++;
1674 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1675 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1676 $totalarray[
'nbfield']++;
1678 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1679 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1680 $totalarray[
'nbfield']++;
1683 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1684 $totalarray[
'nbfield']++;
1693 $with_margin_info =
false;
1695 !empty($arrayfields[
'total_pa'][
'checked'])
1696 || !empty($arrayfields[
'total_margin'][
'checked'])
1697 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1698 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1701 $with_margin_info =
true;
1707 $savnbfield = $totalarray[
'nbfield'];
1708 $totalarray = array();
1709 $totalarray[
'nbfield'] = 0;
1710 $imaxinloop = ($limit ? min($num, $limit) : $num);
1711 while ($i < $imaxinloop) {
1712 $obj = $db->fetch_object($resql);
1717 $objectstatic->id = $obj->rowid;
1718 $objectstatic->ref = $obj->ref;
1719 $objectstatic->ref_customer = $obj->ref_client;
1720 $objectstatic->note_public = $obj->note_public;
1721 $objectstatic->note_private = $obj->note_private;
1722 $objectstatic->statut = $obj->status;
1723 $objectstatic->status = $obj->status;
1725 $companystatic->id = $obj->socid;
1726 $companystatic->name = $obj->name;
1727 $companystatic->name_alias = $obj->alias;
1728 $companystatic->client = $obj->client;
1729 $companystatic->fournisseur = $obj->fournisseur;
1730 $companystatic->code_client = $obj->code_client;
1731 $companystatic->email = $obj->email;
1732 $companystatic->phone = $obj->phone;
1733 $companystatic->address = $obj->address;
1734 $companystatic->zip = $obj->zip;
1735 $companystatic->town = $obj->town;
1736 $companystatic->country_code = $obj->country_code;
1738 $projectstatic->id = $obj->project_id;
1739 $projectstatic->ref = $obj->project_ref;
1740 $projectstatic->title = $obj->project_label;
1742 $totalInvoicedHT = 0;
1743 $totalInvoicedTTC = 0;
1744 $multicurrency_totalInvoicedHT = 0;
1745 $multicurrency_totalInvoicedTTC = 0;
1747 $TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
1749 if (!empty($TInvoiceData)) {
1750 foreach ($TInvoiceData as $invoiceData) {
1752 $invoice->fetch($invoiceData->facid);
1758 $totalInvoicedHT += $invoice->total_ht;
1759 $totalInvoicedTTC += $invoice->total_ttc;
1760 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1761 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1765 $marginInfo = array();
1766 if ($with_margin_info ===
true) {
1767 $objectstatic->fetch_lines();
1768 $marginInfo = $formmargin->getMarginInfosArray($objectstatic);
1769 $total_ht += $obj->total_ht;
1770 $total_margin += $marginInfo[
'total_margin'];
1773 if ($mode ==
'kanban') {
1775 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1776 print
'<div class="box-flex-container kanban">';
1779 $objectstatic->thirdparty = $companystatic;
1780 $userstatic->fetch($obj->fk_user_author);
1781 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1782 print $objectstatic->getKanbanView(
'', $arrayofparams);
1783 if ($i == ($imaxinloop - 1)) {
1788 print
'<tr class="oddeven">';
1792 print
'<td class="nowrap" align="center">';
1793 if ($massactionbutton || $massaction) {
1795 if (in_array($obj->rowid, $arrayofselected)) {
1798 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1802 $totalarray[
'nbfield']++;
1806 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1807 print
'<td class="nowraponall">';
1809 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1811 print
'<td class="nobordernopadding nowraponall">';
1812 print $objectstatic->getNomUrl(1,
'',
'', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
1816 if ($obj->status ==
Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
1817 $warnornote .=
img_warning($langs->trans(
"Late"));
1820 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1825 print
'<td width="16" class="nobordernopadding right">';
1827 $filedir = $conf->propal->multidir_output[$obj->propal_entity].
'/'.
dol_sanitizeFileName($obj->ref);
1828 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1829 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1830 print
'</td></tr></table>';
1834 $totalarray[
'nbfield']++;
1838 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1840 print
'<td class="nowrap tdoverflowmax200">';
1844 $totalarray[
'nbfield']++;
1848 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1850 print
'<td class="nowraponall">';
1851 if ($obj->project_id > 0) {
1852 print $projectstatic->getNomUrl(1);
1856 $totalarray[
'nbfield']++;
1860 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1862 print
'<td class="nowrap">';
1863 if ($obj->project_id > 0) {
1868 $totalarray[
'nbfield']++;
1873 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1874 print
'<td class="tdoverflowmax150">';
1875 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1878 $totalarray[
'nbfield']++;
1883 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1884 print
'<td class="tdoverflowmax200">';
1888 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
's.town'][
'checked'])) {
1894 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1898 $totalarray[
'nbfield']++;
1902 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1903 print
'<td class="nocellnopadd">';
1907 $totalarray[
'nbfield']++;
1911 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1912 print
"<td>".$obj->state_name.
"</td>\n";
1914 $totalarray[
'nbfield']++;
1918 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1919 print
'<td class="center">';
1920 $tmparray =
getCountry($obj->fk_pays,
'all');
1921 print $tmparray[
'label'];
1924 $totalarray[
'nbfield']++;
1928 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1929 if (!is_array($typenArray) || empty($typenArray)) {
1930 $typenArray = $formcompany->typent_array(1);
1933 print
'<td class="center">';
1934 if (!empty($obj->typent_code)) {
1935 print $typenArray[$obj->typent_code];
1939 $totalarray[
'nbfield']++;
1944 if (!empty($arrayfields[
'p.date'][
'checked'])) {
1945 print
'<td class="center">';
1949 $totalarray[
'nbfield']++;
1954 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1956 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
1959 print
'<td> </td>';
1962 $totalarray[
'nbfield']++;
1966 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1967 if ($obj->ddelivery) {
1968 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
1971 print
'<td> </td>';
1974 $totalarray[
'nbfield']++;
1978 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1979 if ($obj->dsignature) {
1980 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
1983 print
'<td> </td>';
1986 $totalarray[
'nbfield']++;
1990 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1991 print
'<td class="center">';
1992 $form->form_availability(
'', $obj->availability,
'none', 1);
1995 $totalarray[
'nbfield']++;
1999 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2001 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2004 $totalarray[
'nbfield']++;
2008 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2009 $labelInputReason =
'';
2010 if ($obj->fk_input_reason > 0) {
2011 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2013 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2017 $totalarray[
'nbfield']++;
2021 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2023 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2026 $totalarray[
'nbfield']++;
2030 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2032 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2035 $totalarray[
'nbfield']++;
2039 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2040 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2042 $totalarray[
'nbfield']++;
2045 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2047 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2048 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2050 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2054 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2055 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2057 $totalarray[
'nbfield']++;
2060 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2062 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2063 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2065 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2069 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2070 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2072 $totalarray[
'nbfield']++;
2075 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2077 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2078 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2080 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2084 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2085 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2087 $totalarray[
'nbfield']++;
2090 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2092 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2093 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2095 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2099 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2100 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2102 $totalarray[
'nbfield']++;
2105 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2107 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2108 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2110 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2114 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2115 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2117 $totalarray[
'nbfield']++;
2122 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2123 print
'<td class="nowrap">';
2124 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2127 $totalarray[
'nbfield']++;
2131 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2132 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2134 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2139 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2141 $totalarray[
'nbfield']++;
2145 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2146 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2148 $totalarray[
'nbfield']++;
2152 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2153 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2155 $totalarray[
'nbfield']++;
2159 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2160 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2162 $totalarray[
'nbfield']++;
2166 $userstatic->id = $obj->fk_user_author;
2167 $userstatic->login = $obj->login;
2168 $userstatic->lastname = $obj->lastname;
2169 $userstatic->firstname = $obj->firstname;
2170 $userstatic->email = $obj->user_email;
2171 $userstatic->status = $obj->user_statut;
2172 $userstatic->entity = $obj->user_entity;
2173 $userstatic->photo = $obj->photo;
2174 $userstatic->office_phone = $obj->office_phone;
2175 $userstatic->office_fax = $obj->office_fax;
2176 $userstatic->user_mobile = $obj->user_mobile;
2177 $userstatic->job = $obj->job;
2178 $userstatic->gender = $obj->gender;
2181 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2182 print
'<td class="tdoverflowmax150">';
2183 if ($userstatic->id) {
2184 print $userstatic->getNomUrl(-1);
2188 $totalarray[
'nbfield']++;
2192 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2194 print
'<td class="tdoverflowmax125">';
2195 if ($obj->socid > 0) {
2196 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2197 if ($listsalesrepresentatives < 0) {
2200 $nbofsalesrepresentative = count($listsalesrepresentatives);
2201 if ($nbofsalesrepresentative > 6) {
2203 print $nbofsalesrepresentative;
2204 } elseif ($nbofsalesrepresentative > 0) {
2205 $userstatic =
new User($db);
2207 foreach ($listsalesrepresentatives as $val) {
2208 $userstatic->id = $val[
'id'];
2209 $userstatic->lastname = $val[
'lastname'];
2210 $userstatic->firstname = $val[
'firstname'];
2211 $userstatic->email = $val[
'email'];
2212 $userstatic->status = $val[
'statut'];
2213 $userstatic->entity = $val[
'entity'];
2214 $userstatic->photo = $val[
'photo'];
2215 $userstatic->login = $val[
'login'];
2216 $userstatic->office_phone = $val[
'office_phone'];
2217 $userstatic->office_fax = $val[
'office_fax'];
2218 $userstatic->user_mobile = $val[
'user_mobile'];
2219 $userstatic->job = $val[
'job'];
2220 $userstatic->gender = $val[
'gender'];
2222 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2224 if ($j < $nbofsalesrepresentative) {
2236 $totalarray[
'nbfield']++;
2241 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2242 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2244 $totalarray[
'nbfield']++;
2248 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2249 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2251 $totalarray[
'nbfield']++;
2254 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2256 $totalarray[
'val'][
'total_margin'] = $total_margin;
2259 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2260 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2262 $totalarray[
'nbfield']++;
2266 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2267 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2269 $totalarray[
'nbfield']++;
2272 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2274 if ($i >= $imaxinloop - 1) {
2275 if (!empty($total_ht)) {
2276 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2278 $totalarray[
'val'][
'total_mark_rate'] =
'';
2284 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2286 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2287 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
2288 print $hookmanager->resPrint;
2290 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2291 print
'<td align="center" class="nowrap">';
2292 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2295 $totalarray[
'nbfield']++;
2299 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2300 print
'<td align="center" class="nowrap">';
2301 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2304 $totalarray[
'nbfield']++;
2308 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2309 print
'<td align="center" class="nowrap">';
2310 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2313 $totalarray[
'nbfield']++;
2317 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2318 print
'<td class="sensiblehtmlcontent center">';
2322 $totalarray[
'nbfield']++;
2326 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2327 print
'<td class="sensiblehtmlcontent center">';
2331 $totalarray[
'nbfield']++;
2335 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2336 print
'<td class="nowrap center">'.$objectstatic->getLibStatut(5).
'</td>';
2338 $totalarray[
'nbfield']++;
2343 print
'<td class="nowrap" align="center">';
2344 if ($massactionbutton || $massaction) {
2346 if (in_array($obj->rowid, $arrayofselected)) {
2349 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2353 $totalarray[
'nbfield']++;
2365 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2370 foreach ($arrayfields as $key => $val) {
2371 if (!empty($val[
'checked'])) {
2375 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2380 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
2381 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
2382 print $hookmanager->resPrint;
2384 print
'</table>'.
"\n";
2385 print
'</div>'.
"\n";
2387 print
'</form>'.
"\n";
2389 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2390 $hidegeneratedfilelistifempty = 1;
2391 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2392 $hidegeneratedfilelistifempty = 0;
2395 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2399 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2400 $urlsource .= str_replace(
'&',
'&', $param);
2402 $filedir = $diroutputmassaction;
2403 $genallowed = $permissiontoread;
2404 $delallowed = $permissiontoadd;
2406 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()
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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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...
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.