31require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52$langs->loadLangs(array(
"bills",
"companies",
"compta",
"accountancy",
"other",
"productbatch",
"products"));
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$toselect =
GETPOST(
'toselect',
'array:aZ09');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'accountancysupplierlist';
59$optioncss =
GETPOST(
'optioncss',
'alpha');
61$default_account =
GETPOSTINT(
'default_account');
64$search_lineid =
GETPOST(
'search_lineid',
'alpha');
65$search_societe =
GETPOST(
'search_societe',
'alpha');
66$search_ref =
GETPOST(
'search_ref',
'alpha');
67$search_ref_supplier =
GETPOST(
'search_ref_supplier',
'alpha');
68$search_invoice =
GETPOST(
'search_invoice',
'alpha');
69$search_label =
GETPOST(
'search_label',
'alpha');
70$search_desc =
GETPOST(
'search_desc',
'alpha');
71$search_amount =
GETPOST(
'search_amount',
'alpha');
72$search_account =
GETPOST(
'search_account',
'alpha');
73$search_vat =
GETPOST(
'search_vat',
'alpha');
74$search_date_startday =
GETPOSTINT(
'search_date_startday');
75$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
76$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
77$search_date_endday =
GETPOSTINT(
'search_date_endday');
78$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
79$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
80$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
81$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
82$search_country =
GETPOST(
'search_country',
'aZ09');
83$search_tvaintra =
GETPOST(
'search_tvaintra',
'alpha');
87$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
88$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
90if (empty($page) || $page < 0) {
93$offset = $limit * $page;
97 $sortfield =
"f.datef, f.ref, l.rowid";
108$hookmanager->initHooks(array($contextpage));
119if ($user->socid > 0) {
122if (!$user->hasRight(
'accounting',
'bind',
'write')) {
127 'l.rowid' => array(
'label' =>
"LineId",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
128 'f.ref' => array(
'label' =>
"Invoice",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
129 'f.libelle' => array(
'label' =>
"InvoiceLabel",
'position' => 1,
'checked' =>
'-1',
'enabled' =>
'1'),
130 'f.datef' => array(
'label' =>
"Date",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
131 'p.ref' => array(
'label' =>
"ProductRef",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
132 'l.description' => array(
'label' =>
"ProductDescription",
'position' => 1,
'checked' =>
'-1',
'enabled' =>
'1'),
133 'l.total_ht' => array(
'label' =>
"Amount",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
134 'l.tva_tx' => array(
'label' =>
"VATRate",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
135 's.nom' => array(
'label' =>
"ThirdParty",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
136 'co.label' => array(
'label' =>
"Country",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
137 's.tva_intra' => array(
'label' =>
"VATIntraShort",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
138 'aa.data_suggest' => array(
'label' =>
"DataUsedToSuggestAccount",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
139 'aa.account_number' => array(
'label' =>
"AccountAccountingSuggest",
'position' => 1,
'checked' =>
'1',
'enabled' =>
'1'),
142$parameters = array(
'arrayfields' => &$arrayfields);
143$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
148if (empty($search_date_start) &&
getDolGlobalInt(
'ACCOUNTING_DATE_START_BINDING')) {
149 $search_date_start = $db->idate(
getDolGlobalInt(
'ACCOUNTING_DATE_START_BINDING'));
159if (
GETPOST(
'cancel',
'alpha')) {
163if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
167$parameters = array(
'arrayfields' => &$arrayfields);
168$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
170 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
173if (empty($reshook)) {
175 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
178 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
179 $search_societe =
'';
182 $search_ref_supplier =
'';
183 $search_invoice =
'';
187 $search_account =
'';
189 $search_date_startday =
'';
190 $search_date_startmonth =
'';
191 $search_date_startyear =
'';
192 $search_date_endday =
'';
193 $search_date_endmonth =
'';
194 $search_date_endyear =
'';
195 $search_date_start =
'';
196 $search_date_end =
'';
197 $search_country =
'';
198 $search_tvaintra =
'';
202 $objectclass =
'AccountingAccount';
203 $permissiontoread = $user->hasRight(
'accounting',
'read');
204 $permissiontodelete = $user->hasRight(
'accounting',
'delete');
205 $uploaddir =
$conf->accounting->dir_output;
206 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
210if ($massaction ==
'ventil' && $user->hasRight(
'accounting',
'bind',
'write')) {
213 if (!empty($toselect)) {
214 $msg =
'<div>'.$langs->trans(
"SelectedLines").
': '.count($toselect).
'</div>';
215 $msg .=
'<div class="detail">';
220 foreach ($toselect as $maLigneCochee) {
221 $maLigneCourante = explode(
"_", $maLigneCochee);
222 $monId = $maLigneCourante[0];
225 if ($monCompte <= 0) {
226 $msg .=
'<div><span class="error">'.$langs->trans(
"Lineofinvoice").
' '.$monId.
' - '.$langs->trans(
"NoAccountSelected").
'</span></div>';
229 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"facture_fourn_det";
230 $sql .=
" SET fk_code_ventilation = ".((int) $monCompte);
231 $sql .=
" WHERE rowid = ".((int) $monId);
232 $sql .=
" AND fk_facture_fourn IN (SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture_fourn WHERE entity IN (".
getEntity(
'facture_fourn', 0).
"))";
235 $accountventilated->fetch($monCompte,
'', 1);
237 dol_syslog(
'accountancy/supplier/list.php', LOG_DEBUG);
238 if ($db->query($sql)) {
239 $msg .=
'<div><span class="green">'.$langs->trans(
"Lineofinvoice").
' '.$monId.
' - '.$langs->trans(
"VentilatedinAccount").
' : '.
length_accountg($accountventilated->account_number).
'</span></div>';
242 $msg .=
'<div><span class="error">'.$langs->trans(
"ErrorDB").
' : '.$langs->trans(
"Lineofinvoice").
' '.$monId.
' - '.$langs->trans(
"NotVentilatedinAccount").
' : '.
length_accountg($accountventilated->account_number).
'<br> <pre>'.$sql.
'</pre></span></div>';
250 $msg .=
'<div>'.$langs->trans(
"EndProcessing").
'</div>';
254if (
GETPOST(
'sortfield') ==
'f.datef, f.ref, l.rowid') {
255 $value = (
GETPOST(
'sortorder') ==
'asc,asc,asc' ? 0 : 1);
256 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
257 $res =
dolibarr_set_const($db,
"ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value,
'yesno', 0,
'',
$conf->entity);
265$form =
new Form($db);
268$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
270llxHeader(
'', $langs->trans(
"SuppliersVentilation"), $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-accountancy accountancy-supplier page-list');
272if (empty($chartaccountcode)) {
273 print $langs->trans(
"ErrorChartOfAccountSystemNotSelected");
281$sql =
"SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
282$sql .=
" l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
283$sql .=
" p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
285 $sql .=
" ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
286 $sql .=
" ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
288 $sql .=
" p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
289 $sql .=
" p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
291$sql .=
" p.tosell as status, p.tobuy as status_buy,";
292$sql .=
" aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
293$sql .=
" co.code as country_code, co.label as country_label,";
294$sql .=
" s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur,";
296 $sql .=
" spe.accountancy_code_customer as code_compta_client,";
297 $sql .=
" spe.accountancy_code_supplier as code_compta_fournisseur,";
298 $sql .=
" spe.accountancy_code_buy as company_code_buy";
300 $sql .=
" s.code_compta as code_compta_client,";
301 $sql .=
" s.code_compta_fournisseur,";
302 $sql .=
" s.accountancy_code_buy as company_code_buy";
304$parameters = array();
305$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
306$sql .= $hookmanager->resPrint;
307$sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
308$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = f.fk_soc";
310 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int)
$conf->entity);
312$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON co.rowid = s.fk_pays ";
313$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
314$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON p.rowid = l.fk_product";
316 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int)
$conf->entity);
318$alias_societe_perentity = !
getDolGlobalString(
'MAIN_COMPANY_PERENTITY_SHARED') ?
"s" :
"spe";
319$alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
320$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON " . $alias_product_perentity .
".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode).
"' AND aa.entity = ".((int)
$conf->entity);
321$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa2 ON " . $alias_product_perentity .
".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode).
"' AND aa2.entity = ".((int)
$conf->entity);
322$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa3 ON " . $alias_product_perentity .
".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode).
"' AND aa3.entity = ".((int)
$conf->entity);
323$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa4 ON " . $alias_societe_perentity .
".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode).
"' AND aa4.entity = ".((int)
$conf->entity);
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
327$sql .= $hookmanager->resPrint;
329$sql .=
" WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
330$sql .=
" AND l.product_type <= 2";
332if (strlen($search_lineid)) {
335if (strlen($search_societe)) {
338if (strlen(trim($search_invoice))) {
339 $sql .=
natural_search(array(
"f.ref",
"f.ref_supplier"), $search_invoice);
341if (strlen(trim($search_ref))) {
347if (strlen(trim($search_label))) {
348 $sql .=
natural_search(array(
"p.label",
"f.libelle"), $search_label);
350if (strlen(trim($search_desc))) {
353if (strlen(trim($search_amount))) {
356if (strlen(trim($search_account))) {
359if (strlen(trim($search_vat))) {
362if ($search_date_start) {
363 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
365if ($search_date_end) {
366 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
368if (strlen(trim($search_country))) {
370 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
371 foreach ($arrayofcode as $key => $value) {
372 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
373 if ($value !=
$mysoc->country_code) {
374 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
377 if ($search_country ==
'special_allnotme') {
378 $sql .=
" AND co.code <> '".$db->escape(
$mysoc->country_code).
"'";
379 } elseif ($search_country ==
'special_eec') {
380 $sql .=
" AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
381 } elseif ($search_country ==
'special_eecnotme') {
382 $sql .=
" AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
383 } elseif ($search_country ==
'special_noteec') {
384 $sql .=
" AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
389if (strlen(trim($search_tvaintra))) {
397$sql .=
" AND f.entity IN (".getEntity(
'facture_fourn', 0).
")";
400$parameters = array();
401$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
402$sql .= $hookmanager->resPrint;
404$sql .= $db->order($sortfield, $sortorder);
407$nbtotalofrecords =
'';
409 $result = $db->query($sql);
410 $nbtotalofrecords = $db->num_rows($result);
411 if (($page * $limit) > (
int) $nbtotalofrecords) {
417$sql .= $db->plimit($limit + 1, $offset);
419dol_syslog(
'accountancy/supplier/list.php', LOG_DEBUG);
422if ($db->type ==
'mysqli') {
423 $db->query(
"SET SQL_BIG_SELECTS=1");
426$result = $db->query($sql);
428 $num_lines = $db->num_rows($result);
431 $arrayofselected = is_array($toselect) ? $toselect : array();
434 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
435 $param .=
'&contextpage='.urlencode($contextpage);
437 if ($limit > 0 && $limit !=
$conf->liste_limit) {
438 $param .=
'&limit='.((int) $limit);
440 if ($search_lineid) {
441 $param .=
'&search_lineid='.urlencode((
string) ($search_lineid));
443 if ($search_societe) {
444 $param .=
'&search_societe='.urlencode($search_societe);
446 if ($search_date_startday) {
447 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
449 if ($search_date_startmonth) {
450 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
452 if ($search_date_startyear) {
453 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
455 if ($search_date_endday) {
456 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
458 if ($search_date_endmonth) {
459 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
461 if ($search_date_endyear) {
462 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
464 if ($search_invoice) {
465 $param .=
'&search_invoice='.urlencode($search_invoice);
468 $param .=
'&search_ref='.urlencode($search_ref);
470 if ($search_ref_supplier) {
471 $param .=
'&search_ref_supplier='.urlencode($search_ref_supplier);
474 $param .=
'&search_label='.urlencode($search_label);
477 $param .=
'&search_desc='.urlencode($search_desc);
479 if ($search_amount) {
480 $param .=
'&search_amount='.urlencode($search_amount);
483 $param .=
'&search_vat='.urlencode($search_vat);
485 if ($search_country) {
486 $param .=
"&search_country=".urlencode($search_country);
488 if ($search_tvaintra) {
489 $param .=
"&search_tvaintra=".urlencode($search_tvaintra);
492 $parameters = array(
'param' => &$param);
493 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
494 $param .= $hookmanager->resPrint;
496 $arrayofmassactions = array(
497 'set_default_account' => img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ConfirmPreselectAccount"),
498 'ventil' => img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Ventilate")
504 $massactionbutton =
'';
505 if ($massaction !==
'set_default_account') {
506 $massactionbutton = $form->selectMassAction(
'ventil', $arrayofmassactions, 1);
509 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
510 print
'<input type="hidden" name="action" value="ventil">';
511 if ($optioncss !=
'') {
512 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
514 print
'<input type="hidden" name="token" value="'.newToken().
'">';
515 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
516 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
517 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
518 print
'<input type="hidden" name="page" value="'.$page.
'">';
521 print_barre_liste($langs->trans(
"InvoiceLines").
'<br><span class="opacityhigh small">'.$langs->trans(
"DescVentilTodoCustomer").
'</span>', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, (
string) $massactionbutton, $num_lines, $nbtotalofrecords,
'title_accountancy', 0,
'',
'', $limit, 0, 0, 1);
524 if ($massaction ==
'set_default_account') {
525 $formquestion = array();
526 $formquestion[] = array(
'type' =>
'other',
527 'name' =>
'set_default_account',
528 'label' => $langs->trans(
"AccountancyCode"),
529 'value' => $formaccounting->select_account(
'',
'default_account', 1, array(), 0, 0,
'maxwidth200 maxwidthonsmartphone',
'cachewithshowemptyone'));
530 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmPreselectAccount"), $langs->trans(
"ConfirmPreselectAccountQuestion", count($toselect)),
"confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
539 $varpage = $contextpage;
540 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
541 $selectedfields = $htmlofselectarray;
542 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
544 print
'<div class="div-table-responsive">';
545 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
548 print
'<tr class="liste_titre_filter">';
550 if (
$conf->main_checkbox_left_column) {
551 print
'<td class="liste_titre maxwidthsearch center actioncolumn">';
552 $searchpicto = $form->showFilterButtons(
'left');
557 if (!empty($arrayfields[
'l.rowid'][
'checked'])) {
558 print
'<td class="liste_titre" data-key="lineid">';
559 print
'<input type="text" class="flat maxwidth40" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).
'">';
563 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
564 print
'<td class="liste_titre" data-key="invoice">';
565 print
'<input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).
'">';
569 if (!empty($arrayfields[
'f.label'][
'checked'])) {
570 print
'<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).
'"></td>';
573 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
574 print
'<td class="liste_titre center">';
575 print
'<div class="nowrapfordate">';
576 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
578 print
'<div class="nowrapfordate">';
579 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
584 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
585 print
'<td class="liste_titre" data-key="ref">';
586 print
'<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
590 if (!empty($arrayfields[
'l.description'][
'checked'])) {
591 print
'<td class="liste_titre" data-key="desc">';
592 print
'<input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).
'">';
596 if (!empty($arrayfields[
'l.total_ht'][
'checked'])) {
597 print
'<td class="liste_titre" data-key="amount">';
598 print
'<input type="text" class="right flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
602 if (!empty($arrayfields[
'l.tva_tx'][
'checked'])) {
603 print
'<td class="liste_titre" data-key="vat">';
604 print
'<input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="'.dol_escape_htmltag($search_vat).
'">';
608 if (!empty($arrayfields[
's.nom'][
'checked'])) {
609 print
'<td class="liste_titre" data-key="societe">';
610 print
'<input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
614 if (!empty($arrayfields[
'co.label'][
'checked'])) {
615 print
'<td class="liste_titre" data-key="country">';
616 print $form->select_country($search_country,
'search_country',
'', 0,
'maxwidth125',
'code2', 1, 0, 1);
620 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
621 print
'<td class="liste_titre">';
622 print
'<input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).
'">';
626 if (!empty($arrayfields[
'aa.data_suggest'][
'checked'])) {
627 print
'<td class="liste_titre"></td>';
630 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
631 print
'<td class="liste_titre"></td>';
634 $parameters = array(
'arrayfields' => $arrayfields);
635 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
636 print $hookmanager->resPrint;
638 if (!
$conf->main_checkbox_left_column) {
639 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
640 $searchpicto = $form->showFilterButtons();
648 $totalarray = array();
649 $totalarray[
'nbfield'] = 0;
651 print
'<tr class="liste_titre">';
653 if (
$conf->main_checkbox_left_column) {
654 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
655 $totalarray[
'nbfield']++;
658 if (!empty($arrayfields[
'l.rowid'][
'checked'])) {
659 print_liste_field_titre($arrayfields[
'l.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"l.rowid",
"", $param,
'', $sortfield, $sortorder);
660 $totalarray[
'nbfield']++;
663 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
664 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
665 $totalarray[
'nbfield']++;
668 if (!empty($arrayfields[
'f.libelle'][
'checked'])) {
669 print_liste_field_titre($arrayfields[
'f.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"f.libelle",
"", $param,
'', $sortfield, $sortorder);
670 $totalarray[
'nbfield']++;
673 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
674 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datef, f.ref, l.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
675 $totalarray[
'nbfield']++;
678 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
679 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
680 $totalarray[
'nbfield']++;
683 if (!empty($arrayfields[
'l.description'][
'checked'])) {
684 print_liste_field_titre($arrayfields[
'l.description'][
'label'], $_SERVER[
"PHP_SELF"],
"l.description",
"", $param,
'', $sortfield, $sortorder);
685 $totalarray[
'nbfield']++;
688 if (!empty($arrayfields[
'l.total_ht'][
'checked'])) {
689 print_liste_field_titre($arrayfields[
'l.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"l.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
690 $totalarray[
'nbfield']++;
693 if (!empty($arrayfields[
'l.tva_tx'][
'checked'])) {
694 print_liste_field_titre($arrayfields[
'l.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
"l.tva_tx",
"", $param,
'', $sortfield, $sortorder,
'right ');
695 $totalarray[
'nbfield']++;
698 if (!empty($arrayfields[
's.nom'][
'checked'])) {
699 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
700 $totalarray[
'nbfield']++;
703 if (!empty($arrayfields[
'co.label'][
'checked'])) {
704 print_liste_field_titre($arrayfields[
'co.label'][
'label'], $_SERVER[
"PHP_SELF"],
"co.label",
"", $param,
'', $sortfield, $sortorder);
705 $totalarray[
'nbfield']++;
708 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
709 print_liste_field_titre($arrayfields[
's.tva_intra'][
'label'], $_SERVER[
"PHP_SELF"],
"s.tva_intra",
"", $param,
'', $sortfield, $sortorder);
710 $totalarray[
'nbfield']++;
713 if (!empty($arrayfields[
'aa.data_suggest'][
'checked'])) {
714 print_liste_field_titre($arrayfields[
'aa.data_suggest'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
715 $totalarray[
'nbfield']++;
718 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
719 print_liste_field_titre($arrayfields[
'aa.account_number'][
'label'], $_SERVER[
"PHP_SELF"],
"aa.account_number",
"", $param,
'', $sortfield, $sortorder);
720 $totalarray[
'nbfield']++;
723 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
724 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
725 print $hookmanager->resPrint;
727 if (!
$conf->main_checkbox_left_column) {
728 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
729 $totalarray[
'nbfield']++;
733 $thirdpartystatic =
new Societe($db);
736 $product_static =
new Product($db);
738 $accountingaccount_codetotid_cache = array();
739 $suggestedaccountingaccountfor =
'';
740 $suggestedaccountingaccountbydefaultfor =
'';
741 $totalarray = array();
742 $totalarray[
'nbfield'] = 0;
744 while ($i < min($num_lines, $limit)) {
745 $objp = $db->fetch_object($result);
754 $thirdpartystatic->id = $objp->socid;
755 $thirdpartystatic->name = $objp->name;
756 $thirdpartystatic->client = $objp->client;
757 $thirdpartystatic->fournisseur = $objp->fournisseur;
758 $thirdpartystatic->code_client = $objp->code_client;
759 $thirdpartystatic->code_compta_client = $objp->code_compta_client;
760 $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
761 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
762 $thirdpartystatic->email = $objp->email;
763 $thirdpartystatic->country_code = $objp->country_code;
764 $thirdpartystatic->tva_intra = $objp->tva_intra;
765 $thirdpartystatic->code_compta_product = $objp->company_code_buy;
767 $product_static->ref = $objp->product_ref;
768 $product_static->id = $objp->product_id;
769 $product_static->type = $objp->type;
770 $product_static->label = $objp->product_label;
771 $product_static->status = $objp->status;
772 $product_static->status_buy = $objp->status_buy;
773 $product_static->accountancy_code_sell = $objp->code_sell;
774 $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
775 $product_static->accountancy_code_sell_export = $objp->code_sell_export;
776 $product_static->accountancy_code_buy = $objp->code_buy;
777 $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
778 $product_static->accountancy_code_buy_export = $objp->code_buy_export;
779 $product_static->tva_tx = $objp->tva_tx_prod;
781 $facturefourn_static->ref = $objp->ref;
782 $facturefourn_static->id = $objp->facid;
783 $facturefourn_static->type = $objp->ftype;
784 $facturefourn_static->ref_supplier = $objp->ref_supplier;
785 $facturefourn_static->label = $objp->invoice_label;
786 $facturefourn_static->date = $db->jdate($objp->datef);
787 $facturefourn_static->fk_facture_source = $objp->fk_facture_source;
789 $facturefourn_static_det->id = $objp->rowid;
790 $facturefourn_static_det->total_ht = $objp->total_ht;
791 $facturefourn_static_det->tva_tx = $objp->tva_tx_line;
792 $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
793 $facturefourn_static_det->product_type = $objp->type_l;
794 $facturefourn_static_det->desc = $objp->description;
796 $accountingAccountArray = array(
797 'dom' => $objp->aarowid,
798 'intra' => $objp->aarowid_intra,
799 'export' => $objp->aarowid_export,
800 'thirdparty' => $objp->aarowid_thirdparty);
802 $code_buy_p_notset =
'';
803 $code_buy_t_notset =
'';
807 $return = $accountingAccount->getAccountingCodeToBind(
$mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray,
'supplier');
808 if (!is_array($return) && $return < 0) {
809 setEventMessage($accountingAccount->error,
'errors');
811 $suggestedid = $return[
'suggestedid'];
812 $suggestedaccountingaccountfor = $return[
'suggestedaccountingaccountfor'];
813 $suggestedaccountingaccountbydefaultfor = $return[
'suggestedaccountingaccountbydefaultfor'];
814 $code_buy_l = $return[
'code_l'];
815 $code_buy_p = $return[
'code_p'];
816 $code_buy_t = $return[
'code_t'];
820 if (!empty($code_buy_p)) {
823 $code_buy_p_notset =
'color:orange';
825 if (empty($code_buy_l) && empty($code_buy_p)) {
826 $code_buy_p_notset =
'color:red';
837 print
'<tr class="oddeven">';
840 if (
$conf->main_checkbox_left_column) {
841 print
'<td class="nowrap center actioncolumn">';
842 $selected = in_array($objp->rowid.
"_".$i, $toselect);
843 print
'<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.
'" name="toselect[]" value="'.$facturefourn_static_det->id.
"_".$i.
'"'.($selected ?
" checked" :
"").
'/>';
846 $totalarray[
'nbfield']++;
851 if (!empty($arrayfields[
'l.rowid'][
'checked'])) {
852 print
'<td>'.$facturefourn_static_det->id.
'</td>';
853 $totalarray[
'nbfield']++;
856 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
857 print
'<td class="nowraponall cell2linesheight">'.$facturefourn_static->getNomUrl(1);
858 if ($objp->ref_supplier) {
859 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).
'</span>';
862 $totalarray[
'nbfield']++;
871 if (!empty($arrayfields[
'f.libelle'][
'checked'])) {
872 print
'<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).
'">';
873 print dolPrintHTML($objp->invoice_label);
875 $totalarray[
'nbfield']++;
878 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
879 print
'<td class="center">'.dol_print_date($facturefourn_static->date,
'day').
'</td>';
880 $totalarray[
'nbfield']++;
883 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
884 print
'<td class="tdoverflowmax100 cell2linesheight">';
885 if ($product_static->id > 0) {
886 print $product_static->getNomUrl(1);
888 if ($product_static->label) {
889 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).
'</span>';
892 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
'l.description'][
'checked'])) {
897 print
'<td class="tdoverflowmax150 small classfortooltip" title="'.dol_escape_htmltag($text).
'">';
903 if (!empty($arrayfields[
'l.total_ht'][
'checked'])) {
904 print
'<td class="right nowraponall amount">';
905 print
price($objp->total_ht);
907 $totalarray[
'nbfield']++;
910 if (!empty($arrayfields[
'l.tva_tx'][
'checked'])) {
911 $code_vat_differ =
'';
915 print
'<td class="right cell2linesheight'.($code_vat_differ ?
' '.$code_vat_differ :
'').
'">';
916 print
vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ?
' ('.$facturefourn_static_det->vat_src_code.
')' :
''), false, 0, 0, 1);
918 $totalarray[
'nbfield']++;
921 if (!empty($arrayfields[
's.nom'][
'checked'])) {
922 print
'<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1,
'supplier').
'</td>';
923 $totalarray[
'nbfield']++;
926 if (!empty($arrayfields[
'co.label'][
'checked'])) {
927 $labelcountry = ($objp->country_code && ($langs->trans(
"Country".$objp->country_code) !=
"Country".$objp->country_code)) ? $langs->trans(
"Country".$objp->country_code) : $objp->country_label;
928 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelcountry).
'">';
931 $totalarray[
'nbfield']++;
934 if (!empty($arrayfields[
's.tva_intra'][
'checked'])) {
935 print
'<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).
'">'.
dol_escape_htmltag($objp->tva_intra).
'</td>';
936 $totalarray[
'nbfield']++;
939 if (!empty($arrayfields[
'aa.data_suggest'][
'checked'])) {
940 print
'<td class="small cell2linesheight">';
941 $s =
'1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans(
"DefaultForService") : $langs->trans(
"DefaultForProduct")).
': ';
944 if ($suggestedaccountingaccountbydefaultfor ==
'eec') {
945 $shelp .= $langs->trans(
"SaleEEC");
946 } elseif ($suggestedaccountingaccountbydefaultfor ==
'eecwithvat') {
947 $shelp = $langs->trans(
"SaleEECWithVAT");
948 } elseif ($suggestedaccountingaccountbydefaultfor ==
'eecwithoutvatnumber') {
949 $shelp = $langs->trans(
"SaleEECWithoutVATNumber");
951 } elseif ($suggestedaccountingaccountbydefaultfor ==
'export') {
952 $shelp .= $langs->trans(
"SaleExport");
954 $s .= ($code_buy_l > 0 ?
length_accountg($code_buy_l) :
'<span style="'.$code_buy_p_notset.
'">'.$langs->trans(
"NotDefined").
'</span>');
955 $textforrule = $form->textwithpicto($s, $shelp, 1, $ttype,
'', 0, 2,
'', 1);
956 if ($product_static->id > 0) {
957 $textforrule .=
'<br>';
958 $s =
'2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans(
"ThisService") : $langs->trans(
"ThisProduct")).
': ';
961 if ($suggestedaccountingaccountfor ==
'eec') {
962 $shelp = $langs->trans(
"SaleEEC");
963 } elseif ($suggestedaccountingaccountfor ==
'eecwithvat') {
964 $shelp = $langs->trans(
"SaleEECWithVAT");
965 } elseif ($suggestedaccountingaccountfor ==
'eecwithoutvatnumber') {
966 $shelp = $langs->trans(
"SaleEECWithoutVATNumber");
968 } elseif ($suggestedaccountingaccountfor ==
'export') {
969 $shelp = $langs->trans(
"SaleExport");
971 $s .= (empty($code_buy_p) ?
'<span style="'.$code_buy_p_notset.
'">'.$langs->trans(
"NotDefined").
'</span>' :
length_accountg($code_buy_p));
972 $textforrule .= $form->textwithpicto($s, $shelp, 1, $ttype,
'', 0, 2,
'', 1);
974 $textforrule .=
'<br>';
975 $s =
'2. '.(($objp->type_l == 1) ? $langs->trans(
"ThisService") : $langs->trans(
"ThisProduct")).
': ';
977 $s .= $langs->trans(
"NotDefined");
978 $textforrule .= $form->textwithpicto($s, $shelp, 1,
'help',
'', 0, 2,
'', 1);
981 $textforrule .=
'<br>';
982 $s =
'3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans(
"ServiceForThisThirdparty") : $langs->trans(
"ProductForThisThirdparty")).
': ';
984 $s .= ($code_buy_t > 0 ?
length_accountg($code_buy_t) :
'<span style="'.$code_buy_t_notset.
'">'.$langs->trans(
"NotDefined").
'</span>');
985 $textforrule .= $form->textwithpicto($s, $shelp, 1,
'help',
'', 0, 2,
'', 1);
989 $totalarray[
'nbfield']++;
992 if (!empty($arrayfields[
'aa.account_number'][
'checked'])) {
994 print $formaccounting->select_account(($default_account > 0 && $confirm ===
'yes' && in_array($objp->rowid.
"_".$i, $toselect)) ? (
string) $default_account : (string) $suggestedid,
'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0,
'codeventil maxwidth150 maxwidthonsmartphone',
'cachewithshowemptyone');
996 $totalarray[
'nbfield']++;
999 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $objp,
'i' => $i,
'totalarray' => &$totalarray);
1000 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1001 print $hookmanager->resPrint;
1003 if (!
$conf->main_checkbox_left_column) {
1004 print
'<td class="nowrap center actioncolumn">';
1005 $selected = in_array($objp->rowid.
"_".$i, $toselect);
1006 print
'<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.
'" name="toselect[]" value="'.$facturefourn_static_det->id.
"_".$i.
'"'.($selected ?
" checked" :
"").
'/>';
1009 $totalarray[
'nbfield']++;
1016 if ($num_lines == 0) {
1018 foreach ($arrayfields as $key => $val) {
1019 if (!empty($val[
'checked'])) {
1023 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1026 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1027 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1028 print $hookmanager->resPrint;
1037if ($db->type ==
'mysqli') {
1038 $db->query(
"SET SQL_BIG_SELECTS=0");
1042print
'<script type="text/javascript">
1043jQuery(document).ready(function() {
1044 jQuery(".codeventil").change(function() {
1045 var s=$(this).attr("id").replace("codeventil", "")
1046 console.log(s+" "+$(this).val());
1047 if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
1048 else jQuery(".checkforselect"+s).prop("checked", true);
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage accounting accounts.
const TYPE_SITUATION
Situation invoice.
Class to manage suppliers invoices.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const TYPE_REPLACEMENT
Replacement invoice.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage line invoices.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.