44require
'../../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
65 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
66 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
71$langs->loadLangs(array(
'companies',
'propal',
'compta',
'bills',
'orders',
'products',
'sendings',
'categories'));
73 $langs->loadLangs(array(
'sendings'));
79$action =
GETPOST(
'action',
'aZ09');
80$massaction =
GETPOST(
'massaction',
'alpha');
82$confirm =
GETPOST(
'confirm',
'alpha');
83$cancel =
GETPOST(
'cancel',
'alpha');
84$toselect =
GETPOST(
'toselect',
'array:int');
85$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'proposallist';
86$optioncss =
GETPOST(
'optioncss',
'alpha');
87$mode =
GETPOST(
'mode',
'alpha');
90$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
92if ($search_user == -1) {
97$search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
98$search_refproject =
GETPOST(
'search_refproject',
'alpha');
99$search_project =
GETPOST(
'search_project',
'alpha');
100$search_societe =
GETPOST(
'search_societe',
'alpha');
101$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
102$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
103$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
104$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
105$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
106$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
107$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
108$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
109$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
110$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
111$search_login =
GETPOST(
'search_login',
'alpha');
112$searchCategoryPropalList =
GETPOST(
'search_category_propal_list',
'array:int');
113$searchCategoryPropalOperator = 0;
115 $searchCategoryPropalOperator =
GETPOSTINT(
'search_category_propal_operator');
119$search_product_category =
GETPOSTINT(
'search_product_category');
120$search_town =
GETPOST(
'search_town',
'alpha');
121$search_zip =
GETPOST(
'search_zip',
'alpha');
122$search_state =
GETPOST(
"search_state");
123$search_country =
GETPOST(
"search_country",
'aZ09');
124$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
125$search_date_startday =
GETPOSTINT(
'search_date_startday');
126$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
127$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
128$search_date_endday =
GETPOSTINT(
'search_date_endday');
129$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
130$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
131$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
132$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
133$search_date_end_startday =
GETPOSTINT(
'search_date_end_startday');
134$search_date_end_startmonth =
GETPOSTINT(
'search_date_end_startmonth');
135$search_date_end_startyear =
GETPOSTINT(
'search_date_end_startyear');
136$search_date_end_endday =
GETPOSTINT(
'search_date_end_endday');
137$search_date_end_endmonth =
GETPOSTINT(
'search_date_end_endmonth');
138$search_date_end_endyear =
GETPOSTINT(
'search_date_end_endyear');
139$search_date_end_start =
dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear);
140$search_date_end_end =
dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
141$search_date_delivery_startday =
GETPOSTINT(
'search_date_delivery_startday');
142$search_date_delivery_startmonth =
GETPOSTINT(
'search_date_delivery_startmonth');
143$search_date_delivery_startyear =
GETPOSTINT(
'search_date_delivery_startyear');
144$search_date_delivery_endday =
GETPOSTINT(
'search_date_delivery_endday');
145$search_date_delivery_endmonth =
GETPOSTINT(
'search_date_delivery_endmonth');
146$search_date_delivery_endyear =
GETPOSTINT(
'search_date_delivery_endyear');
147$search_date_delivery_start =
dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
148$search_date_delivery_end =
dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
149$search_availability =
GETPOST(
'search_availability',
'intcomma');
150$search_categ_cus =
GETPOSTINT(
"search_categ_cus");
151$search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'intcomma');
152$search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'intcomma');
153$search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'intcomma');
154$search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'intcomma');
155$search_date_signature_startday =
GETPOSTINT(
'search_date_signature_startday');
156$search_date_signature_startmonth =
GETPOSTINT(
'search_date_signature_startmonth');
157$search_date_signature_startyear =
GETPOSTINT(
'search_date_signature_startyear');
158$search_date_signature_endday =
GETPOSTINT(
'search_date_signature_endday');
159$search_date_signature_endmonth =
GETPOSTINT(
'search_date_signature_endmonth');
160$search_date_signature_endyear =
GETPOSTINT(
'search_date_signature_endyear');
161$search_date_signature_start =
dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
162$search_date_signature_end =
dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
163$search_status =
GETPOST(
'search_status',
'alpha');
164$search_note_public =
GETPOST(
'search_note_public',
'alpha');
165$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
167$search_option =
GETPOST(
'search_option',
'alpha');
168if ($search_option ==
'late') {
169 $search_status =
'1';
170 $object_statut =
'1';
175$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
176$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
178if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
182$offset = $limit * $page;
183$pageprev = $page - 1;
184$pagenext = $page + 1;
186 $sortfield =
'p.ref';
196if (!empty($user->socid)) {
197 $socid = $user->socid;
202 $dbtable =
'&societe';
204$hookmanager->initHooks(array(
'propallist'));
208$diroutputmassaction =
$conf->propal->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
214$extrafields->fetch_name_optionals_label(
$object->table_element);
216$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
219$fieldstosearchall = array(
221 'p.ref_client' =>
'RefCustomer',
222 'pd.description' =>
'ProductDescription',
223 's.nom' =>
"ThirdParty",
224 's.name_alias' =>
"AliasNameShort",
227 'p.note_public' =>
'NotePublic',
229if (empty($user->socid)) {
230 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
234$checkedtypetiers = 0;
236 'p.ref' => array(
'label' =>
"Ref",
'checked' =>
'1'),
237 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' =>
'-1'),
238 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'1',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
239 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' =>
'0',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
240 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
241 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1'),
242 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1'),
243 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1'),
244 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0'),
245 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0'),
246 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => (string) $checkedtypetiers),
247 'p.date' => array(
'label' =>
"DatePropal",
'checked' =>
'1'),
248 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' =>
'1'),
249 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' =>
'0'),
250 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' =>
'0'),
251 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' =>
'0'),
252 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' =>
'0',
'enabled' => (string) (int)
isModEnabled(
"shipping")),
253 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' =>
'0',
'enabled' =>
'1'),
254 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0'),
255 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
256 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
257 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'0'),
258 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0'),
259 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' =>
'0',
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
260 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' =>
'0',
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
261 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
262 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
263 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
264 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
265 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
266 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' =>
'0',
'enabled' => (string) (int) (
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT'))),
267 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' =>
'0',
'enabled' => (string) (int) (
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT'))),
268 'u.login' => array(
'label' =>
"Author",
'checked' =>
'1',
'position' => 10),
269 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'-1'),
270 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
271 'total_margin' => array(
'label' =>
'Margin',
'checked' =>
'0',
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
272 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' =>
'0',
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ?
'0' :
'1')),
273 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' =>
'0',
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ?
'0' :
'1')),
274 'p.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
275 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 500),
276 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 500),
277 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 510,
'enabled' => (string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
278 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 511,
'enabled' => (string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
279 'p.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
280 'p.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
284 unset($arrayfields[
'p.note_private']);
312if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
313 $search_sale = $user->id;
317include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
320$parameters = array(
'arrayfields' => &$arrayfields);
321$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
324$permissiontoread = $user->hasRight(
'propal',
'lire');
325$permissiontoadd = $user->hasRight(
'propal',
'creer');
326$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
328 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
329 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
330 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
332 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
333 $permissiontoclose = $user->hasRight(
'propal',
'creer');
334 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
343if (
GETPOST(
'cancel',
'alpha')) {
347if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
353$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
354$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
356 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
359if (empty($reshook)) {
361 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
364 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
368 $search_refcustomer =
'';
369 $search_refproject =
'';
370 $search_project =
'';
371 $search_societe =
'';
372 $search_societe_alias =
'';
373 $search_montant_ht =
'';
374 $search_montant_vat =
'';
375 $search_montant_ttc =
'';
376 $search_warehouse =
'';
377 $search_multicurrency_code =
'';
378 $search_multicurrency_tx =
'';
379 $search_multicurrency_montant_ht =
'';
380 $search_multicurrency_montant_vat =
'';
381 $search_multicurrency_montant_ttc =
'';
383 $search_product_category = 0;
384 $searchCategoryPropalList = array();
389 $search_country =
'';
390 $search_type_thirdparty =
'';
391 $search_date_startday =
'';
392 $search_date_startmonth =
'';
393 $search_date_startyear =
'';
394 $search_date_endday =
'';
395 $search_date_endmonth =
'';
396 $search_date_endyear =
'';
397 $search_date_start =
'';
398 $search_date_end =
'';
399 $search_date_end_startday =
'';
400 $search_date_end_startmonth =
'';
401 $search_date_end_startyear =
'';
402 $search_date_end_endday =
'';
403 $search_date_end_endmonth =
'';
404 $search_date_end_endyear =
'';
405 $search_date_end_start =
'';
406 $search_date_end_end =
'';
407 $search_date_delivery_startday =
'';
408 $search_date_delivery_startmonth =
'';
409 $search_date_delivery_startyear =
'';
410 $search_date_delivery_endday =
'';
411 $search_date_delivery_endmonth =
'';
412 $search_date_delivery_endyear =
'';
413 $search_date_delivery_start =
'';
414 $search_date_delivery_end =
'';
415 $search_availability =
'';
418 $search_fk_cond_reglement =
'';
419 $search_fk_shipping_method =
'';
420 $search_fk_input_reason =
'';
421 $search_fk_mode_reglement =
'';
422 $search_date_signature_startday =
'';
423 $search_date_signature_startmonth =
'';
424 $search_date_signature_startyear =
'';
425 $search_date_signature_endday =
'';
426 $search_date_signature_endmonth =
'';
427 $search_date_signature_endyear =
'';
428 $search_date_signature_start =
'';
429 $search_date_signature_end =
'';
430 $search_import_key =
'';
431 $search_categ_cus = 0;
435 $search_array_options = array();
441 $objectclass =
'Propal';
442 $objectlabel =
'Proposals';
443 $uploaddir =
$conf->propal->multidir_output[
$conf->entity];
444 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
447if ($action ==
'validate' && $permissiontovalidate) {
448 if (
GETPOST(
'confirm') ==
'yes') {
449 $tmpproposal =
new Propal($db);
451 foreach ($toselect as $checked) {
452 if ($tmpproposal->fetch($checked) > 0) {
453 if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
454 if ($tmpproposal->valid($user) > 0) {
455 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
457 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
461 $langs->load(
"errors");
462 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
466 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
478if ($action ==
"sign" && $permissiontoclose) {
479 if (
GETPOST(
'confirm') ==
'yes') {
480 $tmpproposal =
new Propal($db);
482 foreach ($toselect as $checked) {
483 if ($tmpproposal->fetch($checked) > 0) {
484 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
485 $tmpproposal->status = $tmpproposal::STATUS_SIGNED;
486 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
487 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
489 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
493 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
497 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
509if ($action ==
"nosign" && $permissiontoclose) {
510 if (
GETPOST(
'confirm') ==
'yes') {
511 $tmpproposal =
new Propal($db);
513 foreach ($toselect as $checked) {
514 if ($tmpproposal->fetch($checked) > 0) {
515 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->status == $tmpproposal::STATUS_DRAFT)) {
516 $tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
517 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
518 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
520 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
524 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
528 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
541if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
544 $objecttmp =
new $objectclass($db);
546 foreach ($toselect as $toselectid) {
547 $result = $objecttmp->fetch($toselectid);
549 $result = $objecttmp->classifyBilled($user, 0);
551 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
558 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
565 setEventMessages($langs->trans(
"RecordsModified", $nbok),
null,
'mesgs');
580$form =
new Form($db);
588$companystatic =
new Societe($db);
589$projectstatic =
new Project($db);
591$userstatic =
new User($db);
593$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
594$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
597$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,';
598$sql .=
" typent.code as typent_code,";
599$sql .=
" ava.rowid as availability,";
600$sql .=
" country.code as country_code,";
601$sql .=
" state.code_departement as state_code, state.nom as state_name,";
602$sql .=
' p.rowid, p.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.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,';
603$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
604$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
605$sql .=
' p.date_signature as dsignature,';
606$sql .=
' p.note_public, p.note_private,';
607$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
608$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
609$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';
611if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
612 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
613 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
617$parameters = array();
618$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
619$sql .= $hookmanager->resPrint;
620$sql = preg_replace(
'/, $/',
'', $sql);
624$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
625$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
626$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
627$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
629$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
630if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
631 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
633$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
634$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
635$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
637$parameters = array();
638$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
639$sql .= $hookmanager->resPrint;
642$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
652if ($search_country) {
653 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
655if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
656 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
661if ($search_refcustomer) {
664if ($search_refproject) {
667if ($search_project) {
670if ($search_availability && $search_availability !=
'-1') {
671 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
674if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
675 if ($societe_add_ref_in_list == 1) {
676 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
678 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
681 if ($search_societe) {
682 if ($societe_add_ref_in_list == 1) {
683 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
688 if ($search_societe_alias) {
693 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
695if ($search_montant_ht !=
'') {
698if ($search_montant_vat !=
'') {
701if ($search_montant_ttc !=
'') {
704if ($search_warehouse !=
'' && $search_warehouse > 0) {
707if ($search_multicurrency_code !=
'') {
708 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
710if ($search_multicurrency_tx !=
'') {
711 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
713if ($search_multicurrency_montant_ht !=
'') {
714 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
716if ($search_multicurrency_montant_vat !=
'') {
717 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
719if ($search_multicurrency_montant_ttc !=
'') {
720 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
725 $fieldstosearchallwithoutpd = array();
726 $fieldstosearchallwithpd = array();
727 foreach ($fieldstosearchall as $key => $val) {
728 if (!preg_match(
'/^pd\./', $key)) {
729 $fieldstosearchallwithoutpd[$key] = $val;
731 $fieldstosearchallwithpd[$key] = $val;
735 if (count($fieldstosearchallwithpd) > 0) {
736 $sqltoadd .=
' OR EXISTS (SELECT pd.rowid FROM '.MAIN_DB_PREFIX.
'propaldet as pd WHERE pd.fk_propal = p.rowid';
737 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
741 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
743if ($search_fk_cond_reglement > 0) {
744 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
746if ($search_fk_shipping_method > 0) {
747 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
749if ($search_fk_input_reason > 0) {
750 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
752if ($search_fk_mode_reglement > 0) {
753 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
756 $sql .=
' AND s.rowid = '.((int) $socid);
758if ($search_status !=
'' && $search_status !=
'-1') {
759 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
761if ($search_date_start) {
762 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
764if ($search_date_end) {
765 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
767if ($search_date_end_start) {
768 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
770if ($search_date_end_end) {
771 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
773if ($search_date_delivery_start) {
774 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
776if ($search_date_delivery_end) {
777 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
779if ($search_date_signature_start) {
780 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
782if ($search_date_signature_end) {
783 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
785if ($search_note_public) {
786 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
788if ($search_import_key) {
793if ($search_user > 0) {
794 $sql .=
" AND EXISTS (";
795 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
796 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
797 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
798 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
799 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
801if ($searchCategoryPropalOperator == 1) {
802 $param .=
"&search_category_propal_operator=".urlencode((
string) ($searchCategoryPropalOperator));
804foreach ($searchCategoryPropalList as $searchCategoryPropal) {
805 $param .=
"&search_category_propal_list[]=".urlencode($searchCategoryPropal);
808if ($search_sale && $search_sale !=
'-1') {
809 if ($search_sale == -2) {
810 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'p.fk_soc', 0, 1);
811 } elseif ($search_sale > 0) {
812 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'p.fk_soc', (
int) $search_sale);
816if (!empty($searchCategoryPropalList)) {
817 $searchCategoryPropalSqlList = array();
818 $listofcategoryid =
'';
819 foreach ($searchCategoryPropalList as $searchCategoryPropal) {
820 if (intval($searchCategoryPropal) == -2) {
821 $searchCategoryPropalSqlList[] =
"NOT EXISTS (SELECT ck.fk_propal FROM ".MAIN_DB_PREFIX.
"categorie_propal as ck WHERE p.rowid = ck.fk_propal)";
822 } elseif (intval($searchCategoryPropal) > 0) {
823 if ($searchCategoryPropalOperator == 0) {
824 $searchCategoryPropalSqlList[] =
" EXISTS (SELECT ck.fk_propal FROM ".MAIN_DB_PREFIX.
"categorie_propal as ck WHERE p.rowid = ck.fk_propal AND ck.fk_categorie = ".((int) $searchCategoryPropal).
")";
826 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryPropal);
830 if ($listofcategoryid) {
831 $searchCategoryPropalSqlList[] =
" EXISTS (SELECT ck.fk_propal FROM ".MAIN_DB_PREFIX.
"categorie_propal as ck WHERE p.rowid = ck.fk_propal AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
833 if ($searchCategoryPropalOperator == 1) {
834 if (!empty($searchCategoryPropalSqlList)) {
835 $sql .=
" AND (".implode(
' OR ', $searchCategoryPropalSqlList).
")";
838 if (!empty($searchCategoryPropalSqlList)) {
839 $sql .=
" AND (".implode(
' AND ', $searchCategoryPropalSqlList).
")";
844$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
845$searchCategoryCustomerList = ($search_categ_cus !==
'-1' ? explode(
',', (
string) $search_categ_cus) : array());
846if (!empty($searchCategoryCustomerList)) {
847 $searchCategoryCustomerSqlList = array();
848 $listofcategoryid =
'';
849 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
850 if (intval($searchCategoryCustomer) == -2) {
851 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
852 } elseif (intval($searchCategoryCustomer) > 0) {
853 if ($searchCategoryCustomerOperator == 0) {
854 $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).
")";
856 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
860 if ($listofcategoryid) {
861 $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).
"))";
863 if ($searchCategoryCustomerOperator == 1) {
864 if (!empty($searchCategoryCustomerSqlList)) {
865 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
868 if (!empty($searchCategoryCustomerSqlList)) {
869 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
874$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
875$searchCategoryProductList = array($search_product_category);
876if (!empty($searchCategoryProductList)) {
877 $searchCategoryProductSqlList = array();
878 $listofcategoryid =
'';
879 foreach ($searchCategoryProductList as $searchCategoryProduct) {
880 if (intval($searchCategoryProduct) == -2) {
881 $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)";
882 } elseif (intval($searchCategoryProduct) > 0) {
883 if ($searchCategoryProductOperator == 0) {
884 $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).
")";
886 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
890 if ($listofcategoryid) {
891 $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).
"))";
893 if ($searchCategoryProductOperator == 1) {
894 if (!empty($searchCategoryProductSqlList)) {
895 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
898 if (!empty($searchCategoryProductSqlList)) {
899 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
903if ($search_option ==
'late') {
907include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
911$parameters = array();
912$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
913$sql .= $hookmanager->resPrint;
916$parameters = array();
917$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
918if (empty($reshook)) {
919 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
921 $sql = $hookmanager->resPrint;
925$nbtotalofrecords =
'';
928 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
929 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
930 $resql = $db->query($sqlforcount);
932 $objforcount = $db->fetch_object($resql);
933 $nbtotalofrecords = (int) $objforcount->nbtotalofrecords;
935 dol_print_error($db);
938 if (($page * $limit) > (
int) $nbtotalofrecords) {
946$sql .= $db->order($sortfield, $sortorder);
947$sql .=
', p.ref DESC';
949 $sql .= $db->plimit($limit + 1, $offset);
952$resql = $db->query($sql);
954 dol_print_error($db);
961 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
962 if (empty($search_societe)) {
963 $search_societe = $soc->name;
966 $title = $langs->trans(
'Proposals');
969$num = $db->num_rows($resql);
971$arrayofselected = is_array($toselect) ? $toselect : array();
973if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
974 $obj = $db->fetch_object($resql);
978 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
982$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
983llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-propale page-list');
985$param =
'&search_status='.urlencode($search_status);
987 $param .=
'&mode='.urlencode($mode);
989if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
990 $param .=
'&contextpage='.urlencode($contextpage);
992if ($limit > 0 && $limit !=
$conf->liste_limit) {
993 $param .=
'&limit='.((int) $limit);
995if ($optioncss !=
'') {
996 $param .=
'&optioncss='.urlencode($optioncss);
999 $param .=
'&socid='.urlencode((
string) ($socid));
1002 $param .=
'&search_all='.urlencode($search_all);
1004if ($search_date_startday) {
1005 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1007if ($search_date_startmonth) {
1008 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1010if ($search_date_startyear) {
1011 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1013if ($search_date_endday) {
1014 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1016if ($search_date_endmonth) {
1017 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1019if ($search_date_endyear) {
1020 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1022if ($search_date_end_startday) {
1023 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
1025if ($search_date_end_startmonth) {
1026 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
1028if ($search_date_end_startyear) {
1029 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
1031if ($search_date_end_endday) {
1032 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
1034if ($search_date_end_endmonth) {
1035 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
1037if ($search_date_end_endyear) {
1038 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
1040if ($search_date_delivery_startday) {
1041 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1043if ($search_date_delivery_startmonth) {
1044 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1046if ($search_date_delivery_startyear) {
1047 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1049if ($search_date_delivery_endday) {
1050 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1052if ($search_date_delivery_endmonth) {
1053 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1055if ($search_date_delivery_endyear) {
1056 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1059 $param .=
'&search_ref='.urlencode($search_ref);
1061if ($search_refcustomer) {
1062 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1064if ($search_refproject) {
1065 $param .=
'&search_refproject='.urlencode($search_refproject);
1067if ($search_project) {
1068 $param .=
'&search_project='.urlencode($search_project);
1070if ($search_societe) {
1071 $param .=
'&search_societe='.urlencode($search_societe);
1073if ($search_societe_alias) {
1074 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1076if ($search_warehouse) {
1077 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1079if ($search_note_public) {
1080 $param .=
'&search_note_public='.urlencode($search_note_public);
1082if ($search_user > 0) {
1083 $param .=
'&search_user='.urlencode((
string) ($search_user));
1085if ($search_sale > 0) {
1086 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1088if ($search_montant_ht) {
1089 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1091if ($search_montant_vat) {
1092 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1094if ($search_montant_ttc) {
1095 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1097if ($search_multicurrency_code !=
'') {
1098 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1100if ($search_multicurrency_tx !=
'') {
1101 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1103if ($search_multicurrency_montant_ht !=
'') {
1104 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1106if ($search_multicurrency_montant_vat !=
'') {
1107 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1109if ($search_multicurrency_montant_ttc !=
'') {
1110 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1113 $param .=
'&search_login='.urlencode($search_login);
1116 $param .=
'&search_town='.urlencode($search_town);
1119 $param .=
'&search_zip='.urlencode($search_zip);
1121if ($search_categ_cus > 0) {
1122 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1124if ($search_product_category !=
'') {
1125 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1127if ($search_fk_cond_reglement > 0) {
1128 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1130if ($search_fk_shipping_method > 0) {
1131 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1133if ($search_fk_input_reason > 0) {
1134 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1136if ($search_fk_mode_reglement > 0) {
1137 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1139if ($search_type_thirdparty > 0) {
1140 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1143 $param .=
'&search_town='.urlencode($search_town);
1146 $param .=
'&search_zip='.urlencode($search_zip);
1149 $param .=
'&search_state='.urlencode($search_state);
1152 $param .=
'&search_town='.urlencode($search_town);
1154if ($search_country) {
1155 $param .=
'&search_country='.urlencode((
string) ($search_country));
1157if ($search_date_signature_startday) {
1158 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1160if ($search_date_signature_startmonth) {
1161 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1163if ($search_date_signature_startyear) {
1164 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1166if ($search_date_signature_endday) {
1167 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1169if ($search_date_signature_endmonth) {
1170 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1172if ($search_date_signature_endyear) {
1173 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1175if ($search_import_key !=
'') {
1176 $param .=
'&search_import_key='.urlencode($search_import_key);
1180include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1182$parameters = array(
'param' => &$param);
1183$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1184$param .= $hookmanager->resPrint;
1187$arrayofmassactions = array(
1188 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1189 'builddoc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1191if ($permissiontosendbymail) {
1192 $arrayofmassactions[
'presend'] = img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1194if (
isModEnabled(
'category') && $user->hasRight(
'propal',
'lire')) {
1195 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1197if ($permissiontovalidate) {
1198 $arrayofmassactions[
'prevalidate'] = img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1200if ($permissiontoclose) {
1201 $arrayofmassactions[
'presign'] = img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1202 $arrayofmassactions[
'nopresign'] = img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1203 $arrayofmassactions[
'setbilled'] = img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1205if ($permissiontodelete) {
1206 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1209if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1210 $arrayofmassactions = array();
1212$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1214$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1215if (!empty($socid)) {
1216 $url .=
'&socid='.$socid;
1219$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'));
1220$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'));
1221$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/comm/propal/stats/index.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1223$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1226print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1227if ($optioncss !=
'') {
1228 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1230print
'<input type="hidden" name="token" value="'.newToken().
'">';
1231print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1232print
'<input type="hidden" name="action" value="list">';
1233print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1234print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1235print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1236print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1237print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1239print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1241$topicmail =
"SendPropalRef";
1242$modelmail =
"propal_send";
1243$objecttmp =
new Propal($db);
1244$trackid =
'pro'.$object->id;
1245include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1247if ($massaction ==
'prevalidate') {
1248 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1251if ($massaction ==
'presign') {
1252 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1255if ($massaction ==
'nopresign') {
1256 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1260 foreach ($fieldstosearchall as $key => $val) {
1261 $fieldstosearchall[$key] = $langs->trans($val);
1263 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1269if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1270 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1272 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROPOSAL, $searchCategoryPropalList,
'minwidth300', $searchCategoryPropalOperator ? $searchCategoryPropalOperator : 0);
1275if ($user->hasRight(
'user',
'user',
'lire')) {
1276 $langs->load(
"commercial");
1277 $moreforfilter .=
'<div class="divsearchfield">';
1278 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1279 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1280 $moreforfilter .=
'</div>';
1283if ($user->hasRight(
'user',
'user',
'lire')) {
1284 $moreforfilter .=
'<div class="divsearchfield">';
1285 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1286 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers(($search_user > 0 ? $search_user : -2),
'search_user', $tmptitle, null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1287 $moreforfilter .=
'</div>';
1290if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1291 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1292 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1293 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1295 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1297if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1298 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1299 $moreforfilter .=
'<div class="divsearchfield">';
1300 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1301 $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'));
1302 $moreforfilter .=
'</div>';
1305 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1307 $moreforfilter .=
'<div class="divsearchfield">';
1308 $tmptitle = $langs->trans(
'Warehouse');
1309 $moreforfilter .= img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0,
'', 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1310 $moreforfilter .=
'</div>';
1312$parameters = array();
1313$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1314if (empty($reshook)) {
1315 $moreforfilter .= $hookmanager->resPrint;
1317 $moreforfilter = $hookmanager->resPrint;
1320if (!empty($moreforfilter)) {
1321 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1322 print $moreforfilter;
1326$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1327$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1328$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1330print
'<div class="div-table-responsive">';
1331print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1333print
'<tr class="liste_titre_filter">';
1336if (
$conf->main_checkbox_left_column) {
1337 print
'<td class="liste_titre center">';
1338 $searchpicto = $form->showFilterButtons(
'left');
1343if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1344 print
'<td class="liste_titre">';
1345 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1348if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1349 print
'<td class="liste_titre">';
1350 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1353if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1354 print
'<td class="liste_titre">';
1355 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1358if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1359 print
'<td class="liste_titre">';
1360 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1363if (!empty($arrayfields[
's.nom'][
'checked'])) {
1364 print
'<td class="liste_titre" align="left">';
1365 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1368if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1369 print
'<td class="liste_titre" align="left">';
1370 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1373if (!empty($arrayfields[
's.town'][
'checked'])) {
1374 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1376if (!empty($arrayfields[
's.zip'][
'checked'])) {
1377 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1380if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1381 print
'<td class="liste_titre">';
1382 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1386if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1387 print
'<td class="liste_titre center">';
1388 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1392if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1393 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1394 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);
1399if (!empty($arrayfields[
'p.date'][
'checked'])) {
1400 print
'<td class="liste_titre center">';
1401 print
'<div class="nowrapfordate">';
1402 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1404 print
'<div class="nowrapfordate">';
1405 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1410if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1411 print
'<td class="liste_titre center">';
1412 print
'<div class="nowrapfordate">';
1413 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'));
1415 print
'<div class="nowrapfordate">';
1416 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'));
1421if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1422 print
'<td class="liste_titre center">';
1423 print
'<div class="nowrapfordate">';
1424 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'));
1426 print
'<div class="nowrapfordate">';
1427 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'));
1432if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1433 print
'<td class="liste_titre center">';
1434 print
'<div class="nowrapfordate">';
1435 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'));
1437 print
'<div class="nowrapfordate">';
1438 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'));
1443if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1444 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1445 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1450if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1451 print
'<td class="liste_titre">';
1452 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1456if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1457 print
'<td class="liste_titre">';
1458 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1462if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1463 print
'<td class="liste_titre">';
1464 print $form->getSelectConditionsPaiements((
int) $search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1468if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1469 print
'<td class="liste_titre">';
1470 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1473if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1475 print
'<td class="liste_titre right">';
1476 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1479if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1481 print
'<td class="liste_titre right">';
1482 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1485if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1487 print
'<td class="liste_titre right">';
1488 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1491if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1493 print
'<td class="liste_titre right">';
1496if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1498 print
'<td class="liste_titre right">';
1501if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1503 print
'<td class="liste_titre">';
1504 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1507if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1509 print
'<td class="liste_titre">';
1510 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1513if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1515 print
'<td class="liste_titre right">';
1516 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1519if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1521 print
'<td class="liste_titre right">';
1522 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1525if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1527 print
'<td class="liste_titre right">';
1528 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1531if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1533 print
'<td class="liste_titre right">';
1536if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1538 print
'<td class="liste_titre right">';
1541if (!empty($arrayfields[
'u.login'][
'checked'])) {
1543 print
'<td class="liste_titre">';
1544 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1547if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1548 print
'<td class="liste_titre"></td>';
1550if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1551 print
'<td class="liste_titre right">';
1554if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1555 print
'<td class="liste_titre right">';
1558if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1559 print
'<td class="liste_titre right">';
1562if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1563 print
'<td class="liste_titre right">';
1567include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1570$parameters = array(
'arrayfields' => $arrayfields);
1571$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1572print $hookmanager->resPrint;
1574if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1575 print
'<td class="liste_titre">';
1579if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1580 print
'<td class="liste_titre">';
1584if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1585 print
'<td class="liste_titre">';
1588if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1590 print
'<td class="liste_titre">';
1591 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1594if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1596 print
'<td class="liste_titre">';
1600if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1601 print
'<td class="liste_titre maxwidthonsmartphone center">';
1602 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1606if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1607 print
'<td class="liste_titre center parentonrightofpage">';
1608 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1612if (!
$conf->main_checkbox_left_column) {
1613 print
'<td class="liste_titre center">';
1614 $searchpicto = $form->showFilterButtons();
1630print
'<tr class="liste_titre">';
1631if (
$conf->main_checkbox_left_column) {
1632 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1633 $totalarray[
'nbfield']++;
1635if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1636 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1637 $totalarray[
'nbfield']++;
1639if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1640 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1641 $totalarray[
'nbfield']++;
1643if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1644 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1645 $totalarray[
'nbfield']++;
1647if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1648 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1649 $totalarray[
'nbfield']++;
1651if (!empty($arrayfields[
's.nom'][
'checked'])) {
1652 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1653 $totalarray[
'nbfield']++;
1655if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1657 $totalarray[
'nbfield']++;
1659if (!empty($arrayfields[
's.town'][
'checked'])) {
1660 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1661 $totalarray[
'nbfield']++;
1663if (!empty($arrayfields[
's.zip'][
'checked'])) {
1664 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1665 $totalarray[
'nbfield']++;
1667if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1669 $totalarray[
'nbfield']++;
1671if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1672 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1673 $totalarray[
'nbfield']++;
1675if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1676 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1677 $totalarray[
'nbfield']++;
1679if (!empty($arrayfields[
'p.date'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1681 $totalarray[
'nbfield']++;
1683if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1685 $totalarray[
'nbfield']++;
1687if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1688 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1689 $totalarray[
'nbfield']++;
1691if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1693 $totalarray[
'nbfield']++;
1695if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1697 $totalarray[
'nbfield']++;
1699if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1700 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1701 $totalarray[
'nbfield']++;
1703if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1705 $totalarray[
'nbfield']++;
1707if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1708 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1709 $totalarray[
'nbfield']++;
1711if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1713 $totalarray[
'nbfield']++;
1715if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1717 $totalarray[
'nbfield']++;
1719if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1724 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1725 $totalarray[
'nbfield']++;
1727if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1729 $totalarray[
'nbfield']++;
1731if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1732 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1733 $totalarray[
'nbfield']++;
1735if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1736 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1737 $totalarray[
'nbfield']++;
1739if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1753 $totalarray[
'nbfield']++;
1755if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1756 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1757 $totalarray[
'nbfield']++;
1759if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1760 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1761 $totalarray[
'nbfield']++;
1763if (!empty($arrayfields[
'u.login'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1765 $totalarray[
'nbfield']++;
1767if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1768 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1769 $totalarray[
'nbfield']++;
1771if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1772 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1773 $totalarray[
'nbfield']++;
1775if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1776 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1777 $totalarray[
'nbfield']++;
1779if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1780 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1781 $totalarray[
'nbfield']++;
1783if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1784 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1785 $totalarray[
'nbfield']++;
1788include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1791 'arrayfields' => $arrayfields,
1793 'sortfield' => $sortfield,
1794 'sortorder' => $sortorder,
1795 'totalarray' => &$totalarray,
1798$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1800print $hookmanager->resPrint;
1801if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1802 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1803 $totalarray[
'nbfield']++;
1805if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1806 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1807 $totalarray[
'nbfield']++;
1809if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1810 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1811 $totalarray[
'nbfield']++;
1813if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1814 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1815 $totalarray[
'nbfield']++;
1817if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1818 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1819 $totalarray[
'nbfield']++;
1822if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1823 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1826if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1827 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1828 $totalarray[
'nbfield']++;
1830if (!
$conf->main_checkbox_left_column) {
1831 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1832 $totalarray[
'nbfield']++;
1841$with_margin_info =
false;
1843 !empty($arrayfields[
'total_pa'][
'checked'])
1844 || !empty($arrayfields[
'total_margin'][
'checked'])
1845 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1846 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1849 $with_margin_info =
true;
1852$with_amount_invoiced_info =
isModEnabled(
'invoice') && (
1853 !empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])
1854 || !empty($arrayfields[
'p.total_invoiced'][
'checked'])
1855 || !empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])
1856 || !empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])
1863$savnbfield = $totalarray[
'nbfield'];
1864$totalarray = array();
1865$totalarray[
'nbfield'] = 0;
1866$imaxinloop = ($limit ? min($num, $limit) : $num);
1867while ($i < $imaxinloop) {
1868 $obj = $db->fetch_object($resql);
1872 if ($search_option) {
1873 $param .=
"&search_option=".urlencode($search_option);
1878 $object->ref_customer = $obj->ref_client;
1879 $object->note_public = $obj->note_public;
1880 $object->note_private = $obj->note_private;
1881 $object->statut = $obj->status;
1882 $object->status = $obj->status;
1884 $companystatic->id = $obj->socid;
1885 $companystatic->name = $obj->name;
1886 $companystatic->name_alias = $obj->alias;
1887 $companystatic->client = $obj->client;
1888 $companystatic->fournisseur = $obj->fournisseur;
1889 $companystatic->code_client = $obj->code_client;
1890 $companystatic->email = $obj->email;
1891 $companystatic->phone = $obj->phone;
1892 $companystatic->address = $obj->address;
1893 $companystatic->zip = $obj->zip;
1894 $companystatic->town = $obj->town;
1895 $companystatic->country_code = $obj->country_code;
1897 $projectstatic->id = $obj->project_id;
1898 $projectstatic->ref = $obj->project_ref;
1899 $projectstatic->title = $obj->project_label;
1901 $totalInvoicedHT = 0;
1902 $totalInvoicedTTC = 0;
1903 $multicurrency_totalInvoicedHT = 0;
1904 $multicurrency_totalInvoicedTTC = 0;
1906 if ($with_amount_invoiced_info) {
1909 if (!empty($TInvoiceData)) {
1910 foreach ($TInvoiceData as $invoiceData) {
1911 '@phan-var-force stdClass $invoiceData';
1913 $invoice->fetch($invoiceData->facid);
1919 $totalInvoicedHT += $invoice->total_ht;
1920 $totalInvoicedTTC += $invoice->total_ttc;
1921 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1922 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1927 $marginInfo = array();
1928 if ($with_margin_info) {
1930 $marginInfo = $formmargin->getMarginInfosArray($object);
1931 $total_ht += $obj->total_ht;
1932 $total_margin += $marginInfo[
'total_margin'];
1935 if ($mode ==
'kanban') {
1937 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1938 print
'<div class="box-flex-container kanban">';
1941 $object->thirdparty = $companystatic;
1942 $userstatic->fetch($obj->fk_user_author);
1943 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1944 print
$object->getKanbanView(
'', $arrayofparams);
1945 if ($i == ($imaxinloop - 1)) {
1950 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'">';
1953 if (
$conf->main_checkbox_left_column) {
1954 print
'<td class="nowrap center">';
1955 if ($massactionbutton || $massaction) {
1957 if (in_array($obj->rowid, $arrayofselected)) {
1960 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1964 $totalarray[
'nbfield']++;
1968 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1969 print
'<td class="nowraponall">';
1971 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1973 print
'<td class="nobordernopadding nowraponall">';
1979 $warnornote .= img_warning($langs->trans(
"Late"));
1982 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1987 print
'<td width="16" class="nobordernopadding right">';
1990 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1991 print $formfile->getDocumentsLink(
$object->element, $filename, $filedir);
1992 print
'</td></tr></table>';
1996 $totalarray[
'nbfield']++;
2000 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
2002 print
'<td class="nowrap tdoverflowmax200">';
2006 $totalarray[
'nbfield']++;
2010 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
2012 print
'<td class="nowraponall">';
2013 if ($obj->project_id > 0) {
2014 print $projectstatic->getNomUrl(1);
2018 $totalarray[
'nbfield']++;
2022 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
2024 print
'<td class="nowrap">';
2025 if ($obj->project_id > 0) {
2030 $totalarray[
'nbfield']++;
2035 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2036 print
'<td class="tdoverflowmax150">';
2037 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2040 $totalarray[
'nbfield']++;
2045 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2046 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->alias).
'">';
2047 print
'<span class="spantitle">';
2048 print dolPrintHTML($obj->alias);
2052 $totalarray[
'nbfield']++;
2057 if (!empty($arrayfields[
's.town'][
'checked'])) {
2058 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2062 $totalarray[
'nbfield']++;
2066 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2067 print
'<td class="nocellnopadd">';
2071 $totalarray[
'nbfield']++;
2075 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2076 print
"<td>".$obj->state_name.
"</td>\n";
2078 $totalarray[
'nbfield']++;
2082 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2083 $tmparray =
getCountry($obj->fk_pays,
'all');
2084 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray[
'label']).
'">';
2085 print $tmparray[
'label'];
2088 $totalarray[
'nbfield']++;
2092 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2093 if (!is_array($typenArray) || empty($typenArray)) {
2094 $typenArray = $formcompany->typent_array(1);
2097 print
'<td class="center">';
2098 if (!empty($obj->typent_code)) {
2099 print $typenArray[$obj->typent_code];
2103 $totalarray[
'nbfield']++;
2108 if (!empty($arrayfields[
'p.date'][
'checked'])) {
2109 print
'<td class="center">';
2113 $totalarray[
'nbfield']++;
2118 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
2120 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
2123 print
'<td> </td>';
2126 $totalarray[
'nbfield']++;
2130 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2131 if ($obj->ddelivery) {
2132 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2135 print
'<td> </td>';
2138 $totalarray[
'nbfield']++;
2142 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2143 if ($obj->dsignature) {
2144 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2147 print
'<td> </td>';
2150 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2155 print
'<td class="center">';
2156 $form->form_availability(
'0', $obj->availability,
'none', 1);
2159 $totalarray[
'nbfield']++;
2163 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2165 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2168 $totalarray[
'nbfield']++;
2172 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2173 $labelInputReason =
'';
2174 if ($obj->fk_input_reason > 0) {
2175 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2177 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2181 $totalarray[
'nbfield']++;
2185 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2187 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2190 $totalarray[
'nbfield']++;
2194 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2196 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2199 $totalarray[
'nbfield']++;
2203 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2204 print
'<td class="nowrap right">'.showTotalAmount(
price($obj->total_ht)).
"</td>\n";
2206 $totalarray[
'nbfield']++;
2209 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2211 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2212 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2214 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2218 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2219 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2221 $totalarray[
'nbfield']++;
2224 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2226 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2227 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2229 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2233 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2234 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2236 $totalarray[
'nbfield']++;
2239 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2241 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2242 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2244 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2248 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2249 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2251 $totalarray[
'nbfield']++;
2254 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2256 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2257 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2259 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2263 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2264 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2266 $totalarray[
'nbfield']++;
2269 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2271 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2272 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2274 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2278 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2279 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2281 $totalarray[
'nbfield']++;
2286 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2287 print
'<td class="nowrap">';
2288 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2291 $totalarray[
'nbfield']++;
2295 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2296 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2298 $totalarray[
'nbfield']++;
2302 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2303 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2305 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2310 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2312 $totalarray[
'nbfield']++;
2316 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2317 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2319 $totalarray[
'nbfield']++;
2323 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2324 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2326 $totalarray[
'nbfield']++;
2330 $userstatic->id = $obj->fk_user_author;
2331 $userstatic->login = $obj->login;
2332 $userstatic->lastname = $obj->lastname;
2333 $userstatic->firstname = $obj->firstname;
2334 $userstatic->email = $obj->user_email;
2335 $userstatic->status = $obj->user_statut;
2336 $userstatic->entity = $obj->user_entity;
2337 $userstatic->photo = $obj->photo;
2338 $userstatic->office_phone = $obj->office_phone;
2339 $userstatic->office_fax = $obj->office_fax;
2340 $userstatic->user_mobile = $obj->user_mobile;
2341 $userstatic->job = $obj->job;
2342 $userstatic->gender = $obj->gender;
2345 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2346 print
'<td class="tdoverflowmax150">';
2347 if ($userstatic->id) {
2348 print $userstatic->getNomUrl(-1);
2352 $totalarray[
'nbfield']++;
2356 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2358 print
'<td class="tdoverflowmax125">';
2359 if ($obj->socid > 0) {
2360 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2361 if ($listsalesrepresentatives < 0) {
2362 dol_print_error($db);
2364 $nbofsalesrepresentative = count($listsalesrepresentatives);
2365 if ($nbofsalesrepresentative > 6) {
2367 print $nbofsalesrepresentative;
2368 } elseif ($nbofsalesrepresentative > 0) {
2369 $userstatic =
new User($db);
2371 foreach ($listsalesrepresentatives as $val) {
2372 $userstatic->id = $val[
'id'];
2373 $userstatic->lastname = $val[
'lastname'];
2374 $userstatic->firstname = $val[
'firstname'];
2375 $userstatic->email = $val[
'email'];
2376 $userstatic->status = $val[
'statut'];
2377 $userstatic->entity = $val[
'entity'];
2378 $userstatic->photo = $val[
'photo'];
2379 $userstatic->login = $val[
'login'];
2380 $userstatic->office_phone = $val[
'office_phone'];
2381 $userstatic->office_fax = $val[
'office_fax'];
2382 $userstatic->user_mobile = $val[
'user_mobile'];
2383 $userstatic->job = $val[
'job'];
2384 $userstatic->gender = $val[
'gender'];
2386 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2388 if ($j < $nbofsalesrepresentative) {
2400 $totalarray[
'nbfield']++;
2405 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2406 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2408 $totalarray[
'nbfield']++;
2412 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2413 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2415 $totalarray[
'nbfield']++;
2418 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2420 $totalarray[
'val'][
'total_margin'] = $total_margin;
2423 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2424 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2426 $totalarray[
'nbfield']++;
2430 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2431 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2433 $totalarray[
'nbfield']++;
2436 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2438 if ($i >= $imaxinloop - 1) {
2439 if (!empty($total_ht)) {
2440 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2442 $totalarray[
'val'][
'total_mark_rate'] =
'';
2448 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2450 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2451 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2452 print $hookmanager->resPrint;
2454 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2455 print
'<td class="nowraponall center">';
2456 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2459 $totalarray[
'nbfield']++;
2463 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2464 print
'<td class="nowraponall center">';
2465 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2468 $totalarray[
'nbfield']++;
2472 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2473 print
'<td class="nowraponall center">';
2474 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2477 $totalarray[
'nbfield']++;
2481 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2482 print
'<td class="sensiblehtmlcontent center">';
2483 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2486 $totalarray[
'nbfield']++;
2490 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2491 print
'<td class="sensiblehtmlcontent center">';
2492 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2495 $totalarray[
'nbfield']++;
2500 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2501 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2503 $totalarray[
'nbfield']++;
2508 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2509 print
'<td class="nowrap center">'.$object->getLibStatut(5).
'</td>';
2511 $totalarray[
'nbfield']++;
2515 if (!
$conf->main_checkbox_left_column) {
2516 print
'<td class="nowrap center">';
2517 if ($massactionbutton || $massaction) {
2519 if (in_array($obj->rowid, $arrayofselected)) {
2522 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2526 $totalarray[
'nbfield']++;
2538include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2543 foreach ($arrayfields as $key => $val) {
2544 if (!empty($val[
'checked'])) {
2548 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2553$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2554$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2555print $hookmanager->resPrint;
2557print
'</table>'.
"\n";
2560print
'</form>'.
"\n";
2562if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2563 $hidegeneratedfilelistifempty = 1;
2564 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2565 $hidegeneratedfilelistifempty = 0;
2568 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2572 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2573 $urlsource .= str_replace(
'&',
'&', $param);
2575 $filedir = $diroutputmassaction;
2576 $genallowed = $permissiontoread;
2577 $delallowed = $permissiontoadd;
2579 print $formfile->showdocuments(
'massfilesarea_proposals',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
if(! $sortfield) if(! $sortorder) $module
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_now($mode='gmt')
Return date for now.
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...
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolRedirectPostSearchListRequestToGetIfPossible(string $context)
Function to redirect search list forms from POST to GET request.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
getWarningDelay($module, $parmlevel1, $parmlevel2='')
Return a warning delay You can use it like this: if (getWarningDelay('module', 'paramlevel1')) It rep...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.