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'));
207$diroutputmassaction =
$conf->propal->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
213$extrafields->fetch_name_optionals_label(
$object->table_element);
215$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
218$fieldstosearchall = array(
220 'p.ref_client' =>
'RefCustomer',
221 'pd.description' =>
'ProductDescription',
222 's.nom' =>
"ThirdParty",
223 's.name_alias' =>
"AliasNameShort",
226 'p.note_public' =>
'NotePublic',
228if (empty($user->socid)) {
229 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
233$checkedtypetiers = 0;
235 'p.ref' => array(
'label' =>
"Ref",
'checked' =>
'1'),
236 'p.ref_client' => array(
'label' =>
"RefCustomer",
'checked' =>
'-1'),
237 'pr.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'1',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
238 'pr.title' => array(
'label' =>
"ProjectLabel",
'checked' =>
'0',
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
239 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
240 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1'),
241 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1'),
242 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1'),
243 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0'),
244 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0'),
245 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => (string) $checkedtypetiers),
246 'p.date' => array(
'label' =>
"DatePropal",
'checked' =>
'1'),
247 'p.fin_validite' => array(
'label' =>
"DateEnd",
'checked' =>
'1'),
248 'p.date_livraison' => array(
'label' =>
"DeliveryDate",
'checked' =>
'0'),
249 'p.date_signature' => array(
'label' =>
"DateSigning",
'checked' =>
'0'),
250 'ava.rowid' => array(
'label' =>
"AvailabilityPeriod",
'checked' =>
'0'),
251 'p.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' =>
'0',
'enabled' => (string) (int)
isModEnabled(
"shipping")),
252 'p.fk_input_reason' => array(
'label' =>
"Origin",
'checked' =>
'0',
'enabled' =>
'1'),
253 'p.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0'),
254 'p.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
255 'p.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
256 'p.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'0'),
257 'p.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0'),
258 'p.total_ht_invoiced' => array(
'label' =>
"AmountInvoicedHT",
'checked' =>
'0',
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
259 'p.total_invoiced' => array(
'label' =>
"AmountInvoicedTTC",
'checked' =>
'0',
'enabled' =>
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT')),
260 'p.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
261 'p.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
262 'p.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
263 'p.multicurrency_total_tva' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
264 'p.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
265 'p.multicurrency_total_ht_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedHT',
'checked' =>
'0',
'enabled' => (string) (int) (
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT'))),
266 'p.multicurrency_total_invoiced' => array(
'label' =>
'MulticurrencyAmountInvoicedTTC',
'checked' =>
'0',
'enabled' => (string) (int) (
isModEnabled(
"multicurrency") &&
getDolGlobalString(
'PROPOSAL_SHOW_INVOICED_AMOUNT'))),
267 'u.login' => array(
'label' =>
"Author",
'checked' =>
'1',
'position' => 10),
268 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'-1'),
269 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
270 'total_margin' => array(
'label' =>
'Margin',
'checked' =>
'0',
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
271 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' =>
'0',
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ?
'0' :
'1')),
272 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' =>
'0',
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ?
'0' :
'1')),
273 'p.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
274 'p.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 500),
275 'p.date_cloture' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 500),
276 'p.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 510,
'enabled' => (string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
277 'p.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 511,
'enabled' => (string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
278 'p.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
279 'p.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
307if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
308 $search_sale = $user->id;
312include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
315$parameters = array(
'arrayfields' => &$arrayfields);
316$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
319$permissiontoread = $user->hasRight(
'propal',
'lire');
320$permissiontoadd = $user->hasRight(
'propal',
'creer');
321$permissiontodelete = $user->hasRight(
'propal',
'supprimer');
323 $permissiontovalidate = $user->hasRight(
'propal',
'propal_advance',
'validate');
324 $permissiontoclose = $user->hasRight(
'propal',
'propal_advance',
'close');
325 $permissiontosendbymail = $user->hasRight(
'propal',
'propal_advance',
'send');
327 $permissiontovalidate = $user->hasRight(
'propal',
'creer');
328 $permissiontoclose = $user->hasRight(
'propal',
'creer');
329 $permissiontosendbymail = $user->hasRight(
'propal',
'lire');
338if (
GETPOST(
'cancel',
'alpha')) {
342if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
348$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
349$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
351 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
354if (empty($reshook)) {
356 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
359 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
363 $search_refcustomer =
'';
364 $search_refproject =
'';
365 $search_project =
'';
366 $search_societe =
'';
367 $search_societe_alias =
'';
368 $search_montant_ht =
'';
369 $search_montant_vat =
'';
370 $search_montant_ttc =
'';
371 $search_warehouse =
'';
372 $search_multicurrency_code =
'';
373 $search_multicurrency_tx =
'';
374 $search_multicurrency_montant_ht =
'';
375 $search_multicurrency_montant_vat =
'';
376 $search_multicurrency_montant_ttc =
'';
378 $search_product_category = 0;
379 $searchCategoryPropalList = array();
384 $search_country =
'';
385 $search_type_thirdparty =
'';
386 $search_date_startday =
'';
387 $search_date_startmonth =
'';
388 $search_date_startyear =
'';
389 $search_date_endday =
'';
390 $search_date_endmonth =
'';
391 $search_date_endyear =
'';
392 $search_date_start =
'';
393 $search_date_end =
'';
394 $search_date_end_startday =
'';
395 $search_date_end_startmonth =
'';
396 $search_date_end_startyear =
'';
397 $search_date_end_endday =
'';
398 $search_date_end_endmonth =
'';
399 $search_date_end_endyear =
'';
400 $search_date_end_start =
'';
401 $search_date_end_end =
'';
402 $search_date_delivery_startday =
'';
403 $search_date_delivery_startmonth =
'';
404 $search_date_delivery_startyear =
'';
405 $search_date_delivery_endday =
'';
406 $search_date_delivery_endmonth =
'';
407 $search_date_delivery_endyear =
'';
408 $search_date_delivery_start =
'';
409 $search_date_delivery_end =
'';
410 $search_availability =
'';
413 $search_fk_cond_reglement =
'';
414 $search_fk_shipping_method =
'';
415 $search_fk_input_reason =
'';
416 $search_fk_mode_reglement =
'';
417 $search_date_signature_startday =
'';
418 $search_date_signature_startmonth =
'';
419 $search_date_signature_startyear =
'';
420 $search_date_signature_endday =
'';
421 $search_date_signature_endmonth =
'';
422 $search_date_signature_endyear =
'';
423 $search_date_signature_start =
'';
424 $search_date_signature_end =
'';
425 $search_import_key =
'';
426 $search_categ_cus = 0;
430 $search_array_options = array();
436 $objectclass =
'Propal';
437 $objectlabel =
'Proposals';
438 $uploaddir =
$conf->propal->multidir_output[
$conf->entity];
439 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
442if ($action ==
'validate' && $permissiontovalidate) {
443 if (
GETPOST(
'confirm') ==
'yes') {
444 $tmpproposal =
new Propal($db);
446 foreach ($toselect as $checked) {
447 if ($tmpproposal->fetch($checked) > 0) {
448 if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
449 if ($tmpproposal->valid($user) > 0) {
450 setEventMessages($langs->trans(
'hasBeenValidated', $tmpproposal->ref),
null,
'mesgs');
452 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
456 $langs->load(
"errors");
457 setEventMessages($langs->trans(
'ErrorIsNotADraft', $tmpproposal->ref),
null,
'errors');
461 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
473if ($action ==
"sign" && $permissiontoclose) {
474 if (
GETPOST(
'confirm') ==
'yes') {
475 $tmpproposal =
new Propal($db);
477 foreach ($toselect as $checked) {
478 if ($tmpproposal->fetch($checked) > 0) {
479 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
480 $tmpproposal->status = $tmpproposal::STATUS_SIGNED;
481 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
482 setEventMessages($tmpproposal->ref.
" ".$langs->trans(
'Signed'),
null,
'mesgs');
484 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
488 setEventMessage($langs->trans(
'MustBeValidatedToBeSigned', $tmpproposal->ref),
'errors');
492 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
504if ($action ==
"nosign" && $permissiontoclose) {
505 if (
GETPOST(
'confirm') ==
'yes') {
506 $tmpproposal =
new Propal($db);
508 foreach ($toselect as $checked) {
509 if ($tmpproposal->fetch($checked) > 0) {
510 if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (
getDolGlobalString(
'PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->status == $tmpproposal::STATUS_DRAFT)) {
511 $tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
512 if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
513 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'NoSigned'),
'mesgs');
515 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
519 setEventMessage($tmpproposal->ref.
" ".$langs->trans(
'CantBeNoSign'),
'errors');
523 setEventMessages($tmpproposal->error, $tmpproposal->errors,
'errors');
536if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
539 $objecttmp =
new $objectclass($db);
541 foreach ($toselect as $toselectid) {
542 $result = $objecttmp->fetch($toselectid);
544 $result = $objecttmp->classifyBilled($user, 0);
546 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
553 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
560 setEventMessages($langs->trans(
"RecordsModified", $nbok),
null,
'mesgs');
575$form =
new Form($db);
583$companystatic =
new Societe($db);
584$projectstatic =
new Project($db);
586$userstatic =
new User($db);
588$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
589$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
592$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,';
593$sql .=
" typent.code as typent_code,";
594$sql .=
" ava.rowid as availability,";
595$sql .=
" country.code as country_code,";
596$sql .=
" state.code_departement as state_code, state.nom as state_name,";
597$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,';
598$sql .=
' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
599$sql .=
' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,';
600$sql .=
' p.date_signature as dsignature,';
601$sql .=
' p.note_public, p.note_private,';
602$sql .=
' p.fk_cond_reglement,p.deposit_percent,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
603$sql .=
" pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
604$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';
606if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
607 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
608 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
612$parameters = array();
613$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
614$sql .= $hookmanager->resPrint;
615$sql = preg_replace(
'/, $/',
'', $sql);
619$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
620$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
621$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
622$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
624$sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'propal as p ON p.fk_soc = s.rowid';
625if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
626 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (p.rowid = ef.fk_object)";
628$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON p.fk_user_author = u.rowid';
629$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr ON pr.rowid = p.fk_projet";
630$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_availability as ava on (ava.rowid = p.fk_availability)";
632$parameters = array();
633$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
634$sql .= $hookmanager->resPrint;
637$sql .=
' p.entity IN ('.getEntity(
'propal').
')';
647if ($search_country) {
648 $sql .=
" AND s.fk_pays IN (".$db->sanitize($db->escape($search_country)).
')';
650if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
651 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
656if ($search_refcustomer) {
659if ($search_refproject) {
662if ($search_project) {
665if ($search_availability) {
666 $sql .=
" AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).
')';
669if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
670 if ($societe_add_ref_in_list == 1) {
671 $sql .=
natural_search(array(
"s.nom",
"s.name_alias",
"s.code_client"), $search_societe);
673 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
676 if ($search_societe) {
677 if ($societe_add_ref_in_list == 1) {
678 $sql .=
natural_search(array(
's.nom',
's.code_client'), $search_societe);
683 if ($search_societe_alias) {
688 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
690if ($search_montant_ht !=
'') {
693if ($search_montant_vat !=
'') {
696if ($search_montant_ttc !=
'') {
699if ($search_warehouse !=
'' && $search_warehouse > 0) {
702if ($search_multicurrency_code !=
'') {
703 $sql .=
" AND p.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
705if ($search_multicurrency_tx !=
'') {
706 $sql .=
natural_search(
'p.multicurrency_tx', $search_multicurrency_tx, 1);
708if ($search_multicurrency_montant_ht !=
'') {
709 $sql .=
natural_search(
'p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
711if ($search_multicurrency_montant_vat !=
'') {
712 $sql .=
natural_search(
'p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
714if ($search_multicurrency_montant_ttc !=
'') {
715 $sql .=
natural_search(
'p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
720 $fieldstosearchallwithoutpd = array();
721 $fieldstosearchallwithpd = array();
722 foreach ($fieldstosearchall as $key => $val) {
723 if (!preg_match(
'/^pd\./', $key)) {
724 $fieldstosearchallwithoutpd[$key] = $val;
726 $fieldstosearchallwithpd[$key] = $val;
730 if (count($fieldstosearchallwithpd) > 0) {
731 $sqltoadd .=
' OR EXISTS (SELECT pd.rowid FROM '.MAIN_DB_PREFIX.
'propaldet as pd WHERE pd.fk_propal = p.rowid';
732 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
736 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
738if ($search_fk_cond_reglement > 0) {
739 $sql .=
" AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
741if ($search_fk_shipping_method > 0) {
742 $sql .=
" AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
744if ($search_fk_input_reason > 0) {
745 $sql .=
" AND p.fk_input_reason = ".((int) $search_fk_input_reason);
747if ($search_fk_mode_reglement > 0) {
748 $sql .=
" AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
751 $sql .=
' AND s.rowid = '.((int) $socid);
753if ($search_status !=
'' && $search_status !=
'-1') {
754 $sql .=
' AND p.fk_statut IN ('.$db->sanitize($search_status).
')';
756if ($search_date_start) {
757 $sql .=
" AND p.datep >= '".$db->idate($search_date_start).
"'";
759if ($search_date_end) {
760 $sql .=
" AND p.datep <= '".$db->idate($search_date_end).
"'";
762if ($search_date_end_start) {
763 $sql .=
" AND p.fin_validite >= '".$db->idate($search_date_end_start).
"'";
765if ($search_date_end_end) {
766 $sql .=
" AND p.fin_validite <= '".$db->idate($search_date_end_end).
"'";
768if ($search_date_delivery_start) {
769 $sql .=
" AND p.date_livraison >= '".$db->idate($search_date_delivery_start).
"'";
771if ($search_date_delivery_end) {
772 $sql .=
" AND p.date_livraison <= '".$db->idate($search_date_delivery_end).
"'";
774if ($search_date_signature_start) {
775 $sql .=
" AND p.date_signature >= '".$db->idate($search_date_signature_start).
"'";
777if ($search_date_signature_end) {
778 $sql .=
" AND p.date_signature <= '".$db->idate($search_date_signature_end).
"'";
780if ($search_note_public) {
781 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
783if ($search_import_key) {
788if ($search_user > 0) {
789 $sql .=
" AND EXISTS (";
790 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
791 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
792 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
793 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
794 $sql .=
" WHERE ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
796if ($searchCategoryPropalOperator == 1) {
797 $param .=
"&search_category_propal_operator=".urlencode((
string) ($searchCategoryPropalOperator));
799foreach ($searchCategoryPropalList as $searchCategoryPropal) {
800 $param .=
"&search_category_propal_list[]=".urlencode($searchCategoryPropal);
803if ($search_sale && $search_sale !=
'-1') {
804 if ($search_sale == -2) {
805 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'p.fk_soc', 0, 1);
806 } elseif ($search_sale > 0) {
807 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'p.fk_soc', (
int) $search_sale);
811if (!empty($searchCategoryPropalList)) {
812 $searchCategoryPropalSqlList = array();
813 $listofcategoryid =
'';
814 foreach ($searchCategoryPropalList as $searchCategoryPropal) {
815 if (intval($searchCategoryPropal) == -2) {
816 $searchCategoryPropalSqlList[] =
"NOT EXISTS (SELECT ck.fk_propal FROM ".MAIN_DB_PREFIX.
"categorie_propal as ck WHERE p.rowid = ck.fk_propal)";
817 } elseif (intval($searchCategoryPropal) > 0) {
818 if ($searchCategoryPropalOperator == 0) {
819 $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).
")";
821 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryPropal);
825 if ($listofcategoryid) {
826 $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).
"))";
828 if ($searchCategoryPropalOperator == 1) {
829 if (!empty($searchCategoryPropalSqlList)) {
830 $sql .=
" AND (".implode(
' OR ', $searchCategoryPropalSqlList).
")";
833 if (!empty($searchCategoryPropalSqlList)) {
834 $sql .=
" AND (".implode(
' AND ', $searchCategoryPropalSqlList).
")";
839$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
840$searchCategoryCustomerList = ($search_categ_cus !==
'-1' ? explode(
',', (
string) $search_categ_cus) : array());
841if (!empty($searchCategoryCustomerList)) {
842 $searchCategoryCustomerSqlList = array();
843 $listofcategoryid =
'';
844 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
845 if (intval($searchCategoryCustomer) == -2) {
846 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
847 } elseif (intval($searchCategoryCustomer) > 0) {
848 if ($searchCategoryCustomerOperator == 0) {
849 $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).
")";
851 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
855 if ($listofcategoryid) {
856 $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).
"))";
858 if ($searchCategoryCustomerOperator == 1) {
859 if (!empty($searchCategoryCustomerSqlList)) {
860 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
863 if (!empty($searchCategoryCustomerSqlList)) {
864 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
869$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
870$searchCategoryProductList = array($search_product_category);
871if (!empty($searchCategoryProductList)) {
872 $searchCategoryProductSqlList = array();
873 $listofcategoryid =
'';
874 foreach ($searchCategoryProductList as $searchCategoryProduct) {
875 if (intval($searchCategoryProduct) == -2) {
876 $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)";
877 } elseif (intval($searchCategoryProduct) > 0) {
878 if ($searchCategoryProductOperator == 0) {
879 $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).
")";
881 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
885 if ($listofcategoryid) {
886 $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).
"))";
888 if ($searchCategoryProductOperator == 1) {
889 if (!empty($searchCategoryProductSqlList)) {
890 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
893 if (!empty($searchCategoryProductSqlList)) {
894 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
898if ($search_option ==
'late') {
902include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
906$parameters = array();
907$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
908$sql .= $hookmanager->resPrint;
911$parameters = array();
912$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
913if (empty($reshook)) {
914 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
916 $sql = $hookmanager->resPrint;
920$nbtotalofrecords =
'';
923 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
924 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
925 $resql = $db->query($sqlforcount);
927 $objforcount = $db->fetch_object($resql);
928 $nbtotalofrecords = (int) $objforcount->nbtotalofrecords;
930 dol_print_error($db);
933 if (($page * $limit) > (
int) $nbtotalofrecords) {
941$sql .= $db->order($sortfield, $sortorder);
942$sql .=
', p.ref DESC';
944 $sql .= $db->plimit($limit + 1, $offset);
947$resql = $db->query($sql);
949 dol_print_error($db);
956 $title = $langs->trans(
'Proposals').
' - '.$soc->name;
957 if (empty($search_societe)) {
958 $search_societe = $soc->name;
961 $title = $langs->trans(
'Proposals');
964$num = $db->num_rows($resql);
966$arrayofselected = is_array($toselect) ? $toselect : array();
968if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
969 $obj = $db->fetch_object($resql);
973 header(
"Location: ".DOL_URL_ROOT.
'/comm/propal/card.php?id='.
$id);
977$help_url =
'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
978llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-propale page-list');
980$param =
'&search_status='.urlencode($search_status);
982 $param .=
'&mode='.urlencode($mode);
984if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
985 $param .=
'&contextpage='.urlencode($contextpage);
987if ($limit > 0 && $limit !=
$conf->liste_limit) {
988 $param .=
'&limit='.((int) $limit);
990if ($optioncss !=
'') {
991 $param .=
'&optioncss='.urlencode($optioncss);
994 $param .=
'&socid='.urlencode((
string) ($socid));
997 $param .=
'&search_all='.urlencode($search_all);
999if ($search_date_startday) {
1000 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
1002if ($search_date_startmonth) {
1003 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
1005if ($search_date_startyear) {
1006 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
1008if ($search_date_endday) {
1009 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
1011if ($search_date_endmonth) {
1012 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
1014if ($search_date_endyear) {
1015 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
1017if ($search_date_end_startday) {
1018 $param .=
'&search_date_end_startday='.urlencode((
string) ($search_date_end_startday));
1020if ($search_date_end_startmonth) {
1021 $param .=
'&search_date_end_startmonth='.urlencode((
string) ($search_date_end_startmonth));
1023if ($search_date_end_startyear) {
1024 $param .=
'&search_date_end_startyear='.urlencode((
string) ($search_date_end_startyear));
1026if ($search_date_end_endday) {
1027 $param .=
'&search_date_end_endday='.urlencode((
string) ($search_date_end_endday));
1029if ($search_date_end_endmonth) {
1030 $param .=
'&search_date_end_endmonth='.urlencode((
string) ($search_date_end_endmonth));
1032if ($search_date_end_endyear) {
1033 $param .=
'&search_date_end_endyear='.urlencode((
string) ($search_date_end_endyear));
1035if ($search_date_delivery_startday) {
1036 $param .=
'&search_date_delivery_startday='.urlencode((
string) ($search_date_delivery_startday));
1038if ($search_date_delivery_startmonth) {
1039 $param .=
'&search_date_delivery_startmonth='.urlencode((
string) ($search_date_delivery_startmonth));
1041if ($search_date_delivery_startyear) {
1042 $param .=
'&search_date_delivery_startyear='.urlencode((
string) ($search_date_delivery_startyear));
1044if ($search_date_delivery_endday) {
1045 $param .=
'&search_date_delivery_endday='.urlencode((
string) ($search_date_delivery_endday));
1047if ($search_date_delivery_endmonth) {
1048 $param .=
'&search_date_delivery_endmonth='.urlencode((
string) ($search_date_delivery_endmonth));
1050if ($search_date_delivery_endyear) {
1051 $param .=
'&search_date_delivery_endyear='.urlencode((
string) ($search_date_delivery_endyear));
1054 $param .=
'&search_ref='.urlencode($search_ref);
1056if ($search_refcustomer) {
1057 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1059if ($search_refproject) {
1060 $param .=
'&search_refproject='.urlencode($search_refproject);
1062if ($search_societe) {
1063 $param .=
'&search_societe='.urlencode($search_societe);
1065if ($search_societe_alias) {
1066 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
1068if ($search_user > 0) {
1069 $param .=
'&search_user='.urlencode((
string) ($search_user));
1071if ($search_sale > 0) {
1072 $param .=
'&search_sale='.urlencode((
string) $search_sale);
1074if ($search_montant_ht) {
1075 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1077if ($search_multicurrency_code !=
'') {
1078 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1080if ($search_multicurrency_tx !=
'') {
1081 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1083if ($search_multicurrency_montant_ht !=
'') {
1084 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1086if ($search_multicurrency_montant_vat !=
'') {
1087 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1089if ($search_multicurrency_montant_ttc !=
'') {
1090 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1093 $param .=
'&search_login='.urlencode($search_login);
1096 $param .=
'&search_town='.urlencode($search_town);
1099 $param .=
'&search_zip='.urlencode($search_zip);
1101if ($search_categ_cus > 0) {
1102 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1104if ($search_product_category !=
'') {
1105 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1107if ($search_fk_cond_reglement > 0) {
1108 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1110if ($search_fk_shipping_method > 0) {
1111 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1113if ($search_fk_input_reason > 0) {
1114 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1116if ($search_fk_mode_reglement > 0) {
1117 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1119if ($search_type_thirdparty > 0) {
1120 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1123 $param .=
'&search_town='.urlencode($search_town);
1126 $param .=
'&search_zip='.urlencode($search_zip);
1129 $param .=
'&search_state='.urlencode($search_state);
1132 $param .=
'&search_town='.urlencode($search_town);
1134if ($search_country) {
1135 $param .=
'&search_country='.urlencode((
string) ($search_country));
1137if ($search_date_signature_startday) {
1138 $param .=
'&search_date_signature_startday='.urlencode((
string) ($search_date_signature_startday));
1140if ($search_date_signature_startmonth) {
1141 $param .=
'&search_date_signature_startmonth='.urlencode((
string) ($search_date_signature_startmonth));
1143if ($search_date_signature_startyear) {
1144 $param .=
'&search_date_signature_startyear='.urlencode((
string) ($search_date_signature_startyear));
1146if ($search_date_signature_endday) {
1147 $param .=
'&search_date_signature_endday='.urlencode((
string) ($search_date_signature_endday));
1149if ($search_date_signature_endmonth) {
1150 $param .=
'&search_date_signature_endmonth='.urlencode((
string) ($search_date_signature_endmonth));
1152if ($search_date_signature_endyear) {
1153 $param .=
'&search_date_signature_endyear='.urlencode((
string) ($search_date_signature_endyear));
1155if ($search_import_key !=
'') {
1156 $param .=
'&search_import_key='.urlencode($search_import_key);
1160include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1162$parameters = array(
'param' => &$param);
1163$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1164$param .= $hookmanager->resPrint;
1167$arrayofmassactions = array(
1168 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1169 'builddoc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1171if ($permissiontosendbymail) {
1172 $arrayofmassactions[
'presend'] = img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1174if (
isModEnabled(
'category') && $user->hasRight(
'propal',
'lire')) {
1175 $arrayofmassactions[
'preaffecttag'] = img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1177if ($permissiontovalidate) {
1178 $arrayofmassactions[
'prevalidate'] = img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1180if ($permissiontoclose) {
1181 $arrayofmassactions[
'presign'] = img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Sign");
1182 $arrayofmassactions[
'nopresign'] = img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"NoSign");
1183 $arrayofmassactions[
'setbilled'] = img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1185if ($permissiontodelete) {
1186 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1189if (in_array($massaction, array(
'presend',
'predelete',
'closed'))) {
1190 $arrayofmassactions = array();
1192$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1194$url = DOL_URL_ROOT.
'/comm/propal/card.php?action=create';
1195if (!empty($socid)) {
1196 $url .=
'&socid='.$socid;
1199$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'));
1200$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'));
1201$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'));
1203$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPropal'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'propal',
'creer'));
1206print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
1207if ($optioncss !=
'') {
1208 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1210print
'<input type="hidden" name="token" value="'.newToken().
'">';
1211print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1212print
'<input type="hidden" name="action" value="list">';
1213print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1214print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1215print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1216print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1217print
'<input type="hidden" name="mode"value="'.$mode.
'">';
1219print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'propal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1221$topicmail =
"SendPropalRef";
1222$modelmail =
"propal_send";
1223$objecttmp =
new Propal($db);
1224$trackid =
'pro'.$object->id;
1225include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1227if ($massaction ==
'prevalidate') {
1228 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1231if ($massaction ==
'presign') {
1232 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassSignature"), $langs->trans(
"ConfirmMassSignatureQuestion"),
"sign",
null,
'', 0, 200, 500, 1);
1235if ($massaction ==
'nopresign') {
1236 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassNoSignature"), $langs->trans(
"ConfirmMassNoSignatureQuestion"),
"nosign",
null,
'', 0, 200, 500, 1);
1240 foreach ($fieldstosearchall as $key => $val) {
1241 $fieldstosearchall[$key] = $langs->trans($val);
1243 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1249if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1250 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1252 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROPOSAL, $searchCategoryPropalList,
'minwidth300', $searchCategoryPropalOperator ? $searchCategoryPropalOperator : 0);
1255if ($user->hasRight(
'user',
'user',
'lire')) {
1256 $langs->load(
"commercial");
1257 $moreforfilter .=
'<div class="divsearchfield">';
1258 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1259 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx', 1);
1260 $moreforfilter .=
'</div>';
1263if ($user->hasRight(
'user',
'user',
'lire')) {
1264 $moreforfilter .=
'<div class="divsearchfield">';
1265 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1266 $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');
1267 $moreforfilter .=
'</div>';
1270if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read') && ($user->hasRight(
'product',
'read') || $user->hasRight(
'service',
'read'))) {
1271 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1272 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1273 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1275 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category),
'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
1277if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1278 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1279 $moreforfilter .=
'<div class="divsearchfield">';
1280 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1281 $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'));
1282 $moreforfilter .=
'</div>';
1285 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1287 $moreforfilter .=
'<div class="divsearchfield">';
1288 $tmptitle = $langs->trans(
'Warehouse');
1289 $moreforfilter .= img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0,
'', 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1290 $moreforfilter .=
'</div>';
1292$parameters = array();
1293$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1294if (empty($reshook)) {
1295 $moreforfilter .= $hookmanager->resPrint;
1297 $moreforfilter = $hookmanager->resPrint;
1300if (!empty($moreforfilter)) {
1301 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1302 print $moreforfilter;
1306$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1307$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1308$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1310print
'<div class="div-table-responsive">';
1311print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1313print
'<tr class="liste_titre_filter">';
1316if (
$conf->main_checkbox_left_column) {
1317 print
'<td class="liste_titre center">';
1318 $searchpicto = $form->showFilterButtons(
'left');
1323if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1324 print
'<td class="liste_titre">';
1325 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1328if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1329 print
'<td class="liste_titre">';
1330 print
'<input class="flat maxwidth50" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1333if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1334 print
'<td class="liste_titre">';
1335 print
'<input class="flat maxwidth50" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).
'">';
1338if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1339 print
'<td class="liste_titre">';
1340 print
'<input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'">';
1343if (!empty($arrayfields[
's.nom'][
'checked'])) {
1344 print
'<td class="liste_titre" align="left">';
1345 print
'<input class="flat maxwidth100" type="text" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"'.($socid > 0 ?
" disabled" :
"").
'>';
1348if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1349 print
'<td class="liste_titre" align="left">';
1350 print
'<input class="flat maxwidth100" type="text" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
1353if (!empty($arrayfields[
's.town'][
'checked'])) {
1354 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.
'"></td>';
1356if (!empty($arrayfields[
's.zip'][
'checked'])) {
1357 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.
'"></td>';
1360if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1361 print
'<td class="liste_titre">';
1362 print
'<input class="flat maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1366if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1367 print
'<td class="liste_titre center">';
1368 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1372if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1373 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1374 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);
1379if (!empty($arrayfields[
'p.date'][
'checked'])) {
1380 print
'<td class="liste_titre center">';
1381 print
'<div class="nowrapfordate">';
1382 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1384 print
'<div class="nowrapfordate">';
1385 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1390if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1391 print
'<td class="liste_titre center">';
1392 print
'<div class="nowrapfordate">';
1393 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'));
1395 print
'<div class="nowrapfordate">';
1396 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'));
1401if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1402 print
'<td class="liste_titre center">';
1403 print
'<div class="nowrapfordate">';
1404 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'));
1406 print
'<div class="nowrapfordate">';
1407 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'));
1412if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1413 print
'<td class="liste_titre center">';
1414 print
'<div class="nowrapfordate">';
1415 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'));
1417 print
'<div class="nowrapfordate">';
1418 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'));
1423if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1424 print
'<td class="liste_titre maxwidth100onsmartphone center">';
1425 $form->selectAvailabilityDelay($search_availability,
'search_availability',
'', 1);
1430if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1431 print
'<td class="liste_titre">';
1432 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1436if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1437 print
'<td class="liste_titre">';
1438 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'maxwidth125', 1);
1442if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1443 print
'<td class="liste_titre">';
1444 print $form->getSelectConditionsPaiements((
int) $search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1448if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1449 print
'<td class="liste_titre">';
1450 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1453if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1455 print
'<td class="liste_titre right">';
1456 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1459if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1461 print
'<td class="liste_titre right">';
1462 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1465if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1467 print
'<td class="liste_titre right">';
1468 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1471if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1473 print
'<td class="liste_titre right">';
1476if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1478 print
'<td class="liste_titre right">';
1481if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1483 print
'<td class="liste_titre">';
1484 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1487if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1489 print
'<td class="liste_titre">';
1490 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1493if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1495 print
'<td class="liste_titre right">';
1496 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1499if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1501 print
'<td class="liste_titre right">';
1502 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1505if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1507 print
'<td class="liste_titre right">';
1508 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1511if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1513 print
'<td class="liste_titre right">';
1516if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1518 print
'<td class="liste_titre right">';
1521if (!empty($arrayfields[
'u.login'][
'checked'])) {
1523 print
'<td class="liste_titre">';
1524 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1527if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1528 print
'<td class="liste_titre"></td>';
1530if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1531 print
'<td class="liste_titre right">';
1534if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1535 print
'<td class="liste_titre right">';
1538if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1539 print
'<td class="liste_titre right">';
1542if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1543 print
'<td class="liste_titre right">';
1547include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1550$parameters = array(
'arrayfields' => $arrayfields);
1551$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1552print $hookmanager->resPrint;
1554if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1555 print
'<td class="liste_titre">';
1559if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1560 print
'<td class="liste_titre">';
1564if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1565 print
'<td class="liste_titre">';
1568if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1570 print
'<td class="liste_titre">';
1571 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1574if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1576 print
'<td class="liste_titre">';
1580if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1581 print
'<td class="liste_titre maxwidthonsmartphone center">';
1582 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1586if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1587 print
'<td class="liste_titre center parentonrightofpage">';
1588 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'customer',
'search_status',
'search_status width100 onrightofpage');
1592if (!
$conf->main_checkbox_left_column) {
1593 print
'<td class="liste_titre center">';
1594 $searchpicto = $form->showFilterButtons();
1610print
'<tr class="liste_titre">';
1611if (
$conf->main_checkbox_left_column) {
1612 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1613 $totalarray[
'nbfield']++;
1615if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1616 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
1617 $totalarray[
'nbfield']++;
1619if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1620 print_liste_field_titre($arrayfields[
'p.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref_client',
'', $param,
'', $sortfield, $sortorder);
1621 $totalarray[
'nbfield']++;
1623if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1624 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1625 $totalarray[
'nbfield']++;
1627if (!empty($arrayfields[
'pr.title'][
'checked'])) {
1628 print_liste_field_titre($arrayfields[
'pr.title'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.title',
'', $param,
'', $sortfield, $sortorder);
1629 $totalarray[
'nbfield']++;
1631if (!empty($arrayfields[
's.nom'][
'checked'])) {
1632 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1633 $totalarray[
'nbfield']++;
1635if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1636 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1637 $totalarray[
'nbfield']++;
1639if (!empty($arrayfields[
's.town'][
'checked'])) {
1640 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1641 $totalarray[
'nbfield']++;
1643if (!empty($arrayfields[
's.zip'][
'checked'])) {
1644 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1645 $totalarray[
'nbfield']++;
1647if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1648 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1649 $totalarray[
'nbfield']++;
1651if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1652 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1653 $totalarray[
'nbfield']++;
1655if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1657 $totalarray[
'nbfield']++;
1659if (!empty($arrayfields[
'p.date'][
'checked'])) {
1660 print_liste_field_titre($arrayfields[
'p.date'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
1661 $totalarray[
'nbfield']++;
1663if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
1664 print_liste_field_titre($arrayfields[
'p.fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
'dfv',
'', $param,
'', $sortfield, $sortorder,
'center ');
1665 $totalarray[
'nbfield']++;
1667if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'p.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1669 $totalarray[
'nbfield']++;
1671if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
1672 print_liste_field_titre($arrayfields[
'p.date_signature'][
'label'], $_SERVER[
"PHP_SELF"],
'p.date_signature',
'', $param,
'', $sortfield, $sortorder,
'center ');
1673 $totalarray[
'nbfield']++;
1675if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
1676 print_liste_field_titre($arrayfields[
'ava.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'availability',
'', $param,
'', $sortfield, $sortorder);
1677 $totalarray[
'nbfield']++;
1679if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'p.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1681 $totalarray[
'nbfield']++;
1683if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
1684 print_liste_field_titre($arrayfields[
'p.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1685 $totalarray[
'nbfield']++;
1687if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
1688 print_liste_field_titre($arrayfields[
'p.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1689 $totalarray[
'nbfield']++;
1691if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'p.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1693 $totalarray[
'nbfield']++;
1695if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
1696 print_liste_field_titre($arrayfields[
'p.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1697 $totalarray[
'nbfield']++;
1699if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
1700 print_liste_field_titre($arrayfields[
'p.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1701 $totalarray[
'nbfield']++;
1703if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'p.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'p.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1705 $totalarray[
'nbfield']++;
1707if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
1708 print_liste_field_titre($arrayfields[
'p.total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1709 $totalarray[
'nbfield']++;
1711if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
1712 print_liste_field_titre($arrayfields[
'p.total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1713 $totalarray[
'nbfield']++;
1715if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'p.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1717 $totalarray[
'nbfield']++;
1719if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
1720 print_liste_field_titre($arrayfields[
'p.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1721 $totalarray[
'nbfield']++;
1723if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
1724 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1725 $totalarray[
'nbfield']++;
1727if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
'p.multicurrency_total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1729 $totalarray[
'nbfield']++;
1731if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
1732 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'p.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1733 $totalarray[
'nbfield']++;
1735if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
1736 print_liste_field_titre($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1737 $totalarray[
'nbfield']++;
1739if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
1740 print_liste_field_titre($arrayfields[
'p.multicurrency_total_invoiced'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1741 $totalarray[
'nbfield']++;
1743if (!empty($arrayfields[
'u.login'][
'checked'])) {
1744 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1745 $totalarray[
'nbfield']++;
1747if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1748 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1749 $totalarray[
'nbfield']++;
1751if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1753 $totalarray[
'nbfield']++;
1755if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1756 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1757 $totalarray[
'nbfield']++;
1759if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1760 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1761 $totalarray[
'nbfield']++;
1763if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1765 $totalarray[
'nbfield']++;
1768include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1771 'arrayfields' => $arrayfields,
1773 'sortfield' => $sortfield,
1774 'sortorder' => $sortorder,
1775 'totalarray' => &$totalarray,
1778$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1780print $hookmanager->resPrint;
1781if (!empty($arrayfields[
'p.datec'][
'checked'])) {
1782 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1783 $totalarray[
'nbfield']++;
1785if (!empty($arrayfields[
'p.tms'][
'checked'])) {
1786 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1787 $totalarray[
'nbfield']++;
1789if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
1790 print_liste_field_titre($arrayfields[
'p.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"p.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowraponall ');
1791 $totalarray[
'nbfield']++;
1793if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
1794 print_liste_field_titre($arrayfields[
'p.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1795 $totalarray[
'nbfield']++;
1797if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
1798 print_liste_field_titre($arrayfields[
'p.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"p.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1799 $totalarray[
'nbfield']++;
1802if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
1803 print_liste_field_titre($arrayfields[
'p.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"p.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1806if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1807 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1808 $totalarray[
'nbfield']++;
1810if (!
$conf->main_checkbox_left_column) {
1811 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1812 $totalarray[
'nbfield']++;
1821$with_margin_info =
false;
1823 !empty($arrayfields[
'total_pa'][
'checked'])
1824 || !empty($arrayfields[
'total_margin'][
'checked'])
1825 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1826 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1829 $with_margin_info =
true;
1832$with_amount_invoiced_info =
isModEnabled(
'invoice') && (
1833 !empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])
1834 || !empty($arrayfields[
'p.total_invoiced'][
'checked'])
1835 || !empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])
1836 || !empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])
1843$savnbfield = $totalarray[
'nbfield'];
1844$totalarray = array();
1845$totalarray[
'nbfield'] = 0;
1846$imaxinloop = ($limit ? min($num, $limit) : $num);
1847while ($i < $imaxinloop) {
1848 $obj = $db->fetch_object($resql);
1852 if ($search_option) {
1853 $param .=
"&search_option=".urlencode($search_option);
1858 $object->ref_customer = $obj->ref_client;
1859 $object->note_public = $obj->note_public;
1860 $object->note_private = $obj->note_private;
1861 $object->statut = $obj->status;
1862 $object->status = $obj->status;
1864 $companystatic->id = $obj->socid;
1865 $companystatic->name = $obj->name;
1866 $companystatic->name_alias = $obj->alias;
1867 $companystatic->client = $obj->client;
1868 $companystatic->fournisseur = $obj->fournisseur;
1869 $companystatic->code_client = $obj->code_client;
1870 $companystatic->email = $obj->email;
1871 $companystatic->phone = $obj->phone;
1872 $companystatic->address = $obj->address;
1873 $companystatic->zip = $obj->zip;
1874 $companystatic->town = $obj->town;
1875 $companystatic->country_code = $obj->country_code;
1877 $projectstatic->id = $obj->project_id;
1878 $projectstatic->ref = $obj->project_ref;
1879 $projectstatic->title = $obj->project_label;
1881 $totalInvoicedHT = 0;
1882 $totalInvoicedTTC = 0;
1883 $multicurrency_totalInvoicedHT = 0;
1884 $multicurrency_totalInvoicedTTC = 0;
1886 if ($with_amount_invoiced_info) {
1889 if (!empty($TInvoiceData)) {
1890 foreach ($TInvoiceData as $invoiceData) {
1891 '@phan-var-force stdClass $invoiceData';
1893 $invoice->fetch($invoiceData->facid);
1899 $totalInvoicedHT += $invoice->total_ht;
1900 $totalInvoicedTTC += $invoice->total_ttc;
1901 $multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
1902 $multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
1907 $marginInfo = array();
1908 if ($with_margin_info) {
1910 $marginInfo = $formmargin->getMarginInfosArray($object);
1911 $total_ht += $obj->total_ht;
1912 $total_margin += $marginInfo[
'total_margin'];
1915 if ($mode ==
'kanban') {
1917 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1918 print
'<div class="box-flex-container kanban">';
1921 $object->thirdparty = $companystatic;
1922 $userstatic->fetch($obj->fk_user_author);
1923 $arrayofparams = array(
'selected' => in_array(
$object->id, $arrayofselected),
'authorlink' => $userstatic->getNomUrl(-2),
'projectlink' => $projectstatic->getNomUrl(2));
1924 print
$object->getKanbanView(
'', $arrayofparams);
1925 if ($i == ($imaxinloop - 1)) {
1930 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.
$object->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'">';
1933 if (
$conf->main_checkbox_left_column) {
1934 print
'<td class="nowrap center">';
1935 if ($massactionbutton || $massaction) {
1937 if (in_array($obj->rowid, $arrayofselected)) {
1940 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1944 $totalarray[
'nbfield']++;
1948 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1949 print
'<td class="nowraponall">';
1951 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1953 print
'<td class="nobordernopadding nowraponall">';
1959 $warnornote .= img_warning($langs->trans(
"Late"));
1962 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1967 print
'<td width="16" class="nobordernopadding right">';
1970 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1971 print $formfile->getDocumentsLink(
$object->element, $filename, $filedir);
1972 print
'</td></tr></table>';
1976 $totalarray[
'nbfield']++;
1980 if (!empty($arrayfields[
'p.ref_client'][
'checked'])) {
1982 print
'<td class="nowrap tdoverflowmax200">';
1986 $totalarray[
'nbfield']++;
1990 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1992 print
'<td class="nowraponall">';
1993 if ($obj->project_id > 0) {
1994 print $projectstatic->getNomUrl(1);
1998 $totalarray[
'nbfield']++;
2002 if (!empty($arrayfields[
'pr.title'][
'checked'])) {
2004 print
'<td class="nowrap">';
2005 if ($obj->project_id > 0) {
2010 $totalarray[
'nbfield']++;
2015 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2016 print
'<td class="tdoverflowmax150">';
2017 print $companystatic->getNomUrl(1,
'customer', 0, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2020 $totalarray[
'nbfield']++;
2025 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2026 print
'<td class="tdoverflowmax200">';
2030 $totalarray[
'nbfield']++;
2035 if (!empty($arrayfields[
's.town'][
'checked'])) {
2036 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2040 $totalarray[
'nbfield']++;
2044 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2045 print
'<td class="nocellnopadd">';
2049 $totalarray[
'nbfield']++;
2053 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2054 print
"<td>".$obj->state_name.
"</td>\n";
2056 $totalarray[
'nbfield']++;
2060 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2061 $tmparray =
getCountry($obj->fk_pays,
'all');
2062 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTML($tmparray[
'label']).
'">';
2063 print $tmparray[
'label'];
2066 $totalarray[
'nbfield']++;
2070 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2071 if (!is_array($typenArray) || empty($typenArray)) {
2072 $typenArray = $formcompany->typent_array(1);
2075 print
'<td class="center">';
2076 if (!empty($obj->typent_code)) {
2077 print $typenArray[$obj->typent_code];
2081 $totalarray[
'nbfield']++;
2086 if (!empty($arrayfields[
'p.date'][
'checked'])) {
2087 print
'<td class="center">';
2091 $totalarray[
'nbfield']++;
2096 if (!empty($arrayfields[
'p.fin_validite'][
'checked'])) {
2098 print
'<td class="center">'.dol_print_date($db->jdate($obj->dfv),
'day');
2101 print
'<td> </td>';
2104 $totalarray[
'nbfield']++;
2108 if (!empty($arrayfields[
'p.date_livraison'][
'checked'])) {
2109 if ($obj->ddelivery) {
2110 print
'<td class="center">'.dol_print_date($db->jdate($obj->ddelivery),
'day');
2113 print
'<td> </td>';
2116 $totalarray[
'nbfield']++;
2120 if (!empty($arrayfields[
'p.date_signature'][
'checked'])) {
2121 if ($obj->dsignature) {
2122 print
'<td class="center">'.dol_print_date($db->jdate($obj->dsignature),
'day');
2125 print
'<td> </td>';
2128 $totalarray[
'nbfield']++;
2132 if (!empty($arrayfields[
'ava.rowid'][
'checked'])) {
2133 print
'<td class="center">';
2134 $form->form_availability(
'0', $obj->availability,
'none', 1);
2137 $totalarray[
'nbfield']++;
2141 if (!empty($arrayfields[
'p.fk_shipping_method'][
'checked'])) {
2143 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2146 $totalarray[
'nbfield']++;
2150 if (!empty($arrayfields[
'p.fk_input_reason'][
'checked'])) {
2151 $labelInputReason =
'';
2152 if ($obj->fk_input_reason > 0) {
2153 $labelInputReason = $form->cache_demand_reason[$obj->fk_input_reason][
'label'];
2155 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($labelInputReason).
'">';
2159 $totalarray[
'nbfield']++;
2163 if (!empty($arrayfields[
'p.fk_cond_reglement'][
'checked'])) {
2165 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2168 $totalarray[
'nbfield']++;
2172 if (!empty($arrayfields[
'p.fk_mode_reglement'][
'checked'])) {
2174 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2177 $totalarray[
'nbfield']++;
2181 if (!empty($arrayfields[
'p.total_ht'][
'checked'])) {
2182 print
'<td class="nowrap right">'.showTotalAmount(
price($obj->total_ht)).
"</td>\n";
2184 $totalarray[
'nbfield']++;
2187 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht';
2189 if (empty($totalarray[
'val'][
'p.total_ht'])) {
2190 $totalarray[
'val'][
'p.total_ht'] = $obj->total_ht;
2192 $totalarray[
'val'][
'p.total_ht'] += $obj->total_ht;
2196 if (!empty($arrayfields[
'p.total_tva'][
'checked'])) {
2197 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2199 $totalarray[
'nbfield']++;
2202 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_tva';
2204 if (empty($totalarray[
'val'][
'p.total_tva'])) {
2205 $totalarray[
'val'][
'p.total_tva'] = $obj->total_tva;
2207 $totalarray[
'val'][
'p.total_tva'] += $obj->total_tva;
2211 if (!empty($arrayfields[
'p.total_ttc'][
'checked'])) {
2212 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2214 $totalarray[
'nbfield']++;
2217 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ttc';
2219 if (empty($totalarray[
'val'][
'p.total_ttc'])) {
2220 $totalarray[
'val'][
'p.total_ttc'] = $obj->total_ttc;
2222 $totalarray[
'val'][
'p.total_ttc'] += $obj->total_ttc;
2226 if (!empty($arrayfields[
'p.total_ht_invoiced'][
'checked'])) {
2227 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT).
"</span></td>\n";
2229 $totalarray[
'nbfield']++;
2232 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_ht_invoiced';
2234 if (empty($totalarray[
'val'][
'p.total_ht_invoiced'])) {
2235 $totalarray[
'val'][
'p.total_ht_invoiced'] = $totalInvoicedHT;
2237 $totalarray[
'val'][
'p.total_ht_invoiced'] += $totalInvoicedHT;
2241 if (!empty($arrayfields[
'p.total_invoiced'][
'checked'])) {
2242 print
'<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC).
"</span></td>\n";
2244 $totalarray[
'nbfield']++;
2247 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'p.total_invoiced';
2249 if (empty($totalarray[
'val'][
'p.total_invoiced'])) {
2250 $totalarray[
'val'][
'p.total_invoiced'] = $totalInvoicedTTC;
2252 $totalarray[
'val'][
'p.total_invoiced'] += $totalInvoicedTTC;
2256 if (!empty($arrayfields[
'p.multicurrency_code'][
'checked'])) {
2257 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2259 $totalarray[
'nbfield']++;
2264 if (!empty($arrayfields[
'p.multicurrency_tx'][
'checked'])) {
2265 print
'<td class="nowrap">';
2266 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2269 $totalarray[
'nbfield']++;
2273 if (!empty($arrayfields[
'p.multicurrency_total_ht'][
'checked'])) {
2274 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2276 $totalarray[
'nbfield']++;
2280 if (!empty($arrayfields[
'p.multicurrency_total_tva'][
'checked'])) {
2281 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva).
"</span></td>\n";
2283 $totalarray[
'nbfield']++;
2287 if (!empty($arrayfields[
'p.multicurrency_total_ttc'][
'checked'])) {
2288 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2290 $totalarray[
'nbfield']++;
2294 if (!empty($arrayfields[
'p.multicurrency_total_ht_invoiced'][
'checked'])) {
2295 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT).
"</span></td>\n";
2297 $totalarray[
'nbfield']++;
2301 if (!empty($arrayfields[
'p.multicurrency_total_invoiced'][
'checked'])) {
2302 print
'<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC).
"</span></td>\n";
2304 $totalarray[
'nbfield']++;
2308 $userstatic->id = $obj->fk_user_author;
2309 $userstatic->login = $obj->login;
2310 $userstatic->lastname = $obj->lastname;
2311 $userstatic->firstname = $obj->firstname;
2312 $userstatic->email = $obj->user_email;
2313 $userstatic->status = $obj->user_statut;
2314 $userstatic->entity = $obj->user_entity;
2315 $userstatic->photo = $obj->photo;
2316 $userstatic->office_phone = $obj->office_phone;
2317 $userstatic->office_fax = $obj->office_fax;
2318 $userstatic->user_mobile = $obj->user_mobile;
2319 $userstatic->job = $obj->job;
2320 $userstatic->gender = $obj->gender;
2323 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2324 print
'<td class="tdoverflowmax150">';
2325 if ($userstatic->id) {
2326 print $userstatic->getNomUrl(-1);
2330 $totalarray[
'nbfield']++;
2334 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2336 print
'<td class="tdoverflowmax125">';
2337 if ($obj->socid > 0) {
2338 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2339 if ($listsalesrepresentatives < 0) {
2340 dol_print_error($db);
2342 $nbofsalesrepresentative = count($listsalesrepresentatives);
2343 if ($nbofsalesrepresentative > 6) {
2345 print $nbofsalesrepresentative;
2346 } elseif ($nbofsalesrepresentative > 0) {
2347 $userstatic =
new User($db);
2349 foreach ($listsalesrepresentatives as $val) {
2350 $userstatic->id = $val[
'id'];
2351 $userstatic->lastname = $val[
'lastname'];
2352 $userstatic->firstname = $val[
'firstname'];
2353 $userstatic->email = $val[
'email'];
2354 $userstatic->status = $val[
'statut'];
2355 $userstatic->entity = $val[
'entity'];
2356 $userstatic->photo = $val[
'photo'];
2357 $userstatic->login = $val[
'login'];
2358 $userstatic->office_phone = $val[
'office_phone'];
2359 $userstatic->office_fax = $val[
'office_fax'];
2360 $userstatic->user_mobile = $val[
'user_mobile'];
2361 $userstatic->job = $val[
'job'];
2362 $userstatic->gender = $val[
'gender'];
2364 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2366 if ($j < $nbofsalesrepresentative) {
2378 $totalarray[
'nbfield']++;
2383 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2384 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2386 $totalarray[
'nbfield']++;
2390 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2391 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2393 $totalarray[
'nbfield']++;
2396 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2398 $totalarray[
'val'][
'total_margin'] = $total_margin;
2401 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2402 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2404 $totalarray[
'nbfield']++;
2408 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2409 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2411 $totalarray[
'nbfield']++;
2414 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2416 if ($i >= $imaxinloop - 1) {
2417 if (!empty($total_ht)) {
2418 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2420 $totalarray[
'val'][
'total_mark_rate'] =
'';
2426 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2428 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2429 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2430 print $hookmanager->resPrint;
2432 if (!empty($arrayfields[
'p.datec'][
'checked'])) {
2433 print
'<td class="nowraponall center">';
2434 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2437 $totalarray[
'nbfield']++;
2441 if (!empty($arrayfields[
'p.tms'][
'checked'])) {
2442 print
'<td class="nowraponall center">';
2443 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2446 $totalarray[
'nbfield']++;
2450 if (!empty($arrayfields[
'p.date_cloture'][
'checked'])) {
2451 print
'<td class="nowraponall center">';
2452 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2455 $totalarray[
'nbfield']++;
2459 if (!empty($arrayfields[
'p.note_public'][
'checked'])) {
2460 print
'<td class="sensiblehtmlcontent center">';
2461 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2464 $totalarray[
'nbfield']++;
2468 if (!empty($arrayfields[
'p.note_private'][
'checked'])) {
2469 print
'<td class="sensiblehtmlcontent center">';
2470 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2473 $totalarray[
'nbfield']++;
2478 if (!empty($arrayfields[
'p.import_key'][
'checked'])) {
2479 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2481 $totalarray[
'nbfield']++;
2486 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
2487 print
'<td class="nowrap center">'.$object->getLibStatut(5).
'</td>';
2489 $totalarray[
'nbfield']++;
2493 if (!
$conf->main_checkbox_left_column) {
2494 print
'<td class="nowrap center">';
2495 if ($massactionbutton || $massaction) {
2497 if (in_array($obj->rowid, $arrayofselected)) {
2500 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2504 $totalarray[
'nbfield']++;
2516include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2521 foreach ($arrayfields as $key => $val) {
2522 if (!empty($val[
'checked'])) {
2526 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2531$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2532$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2533print $hookmanager->resPrint;
2535print
'</table>'.
"\n";
2538print
'</form>'.
"\n";
2540if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2541 $hidegeneratedfilelistifempty = 1;
2542 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2543 $hidegeneratedfilelistifempty = 0;
2546 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2550 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2551 $urlsource .= str_replace(
'&',
'&', $param);
2553 $filedir = $diroutputmassaction;
2554 $genallowed = $permissiontoread;
2555 $delallowed = $permissiontoadd;
2557 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.
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...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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.