dolibarr 21.0.0-beta
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3 * Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5 * Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
6 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7 * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
8 * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
9 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
10 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
31require '../../main.inc.php';
32
33require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
36require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
37require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
39require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
43
53// Load translation files required by the page
54$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
55
56$action = GETPOST('action', 'aZ09');
57$massaction = GETPOST('massaction', 'alpha');
58$confirm = GETPOST('confirm', 'alpha');
59$toselect = GETPOST('toselect', 'array');
60$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
61$optioncss = GETPOST('optioncss', 'alpha');
62
63$default_account = GETPOSTINT('default_account');
64
65// Select Box
66$mesCasesCochees = GETPOST('toselect', 'array');
67
68// Search Getpost
69$search_lineid = GETPOST('search_lineid', 'alpha'); // Can be '> 100'
70$search_societe = GETPOST('search_societe', 'alpha');
71$search_ref = GETPOST('search_ref', 'alpha');
72$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
73$search_invoice = GETPOST('search_invoice', 'alpha');
74$search_label = GETPOST('search_label', 'alpha');
75$search_desc = GETPOST('search_desc', 'alpha');
76$search_amount = GETPOST('search_amount', 'alpha');
77$search_account = GETPOST('search_account', 'alpha');
78$search_vat = GETPOST('search_vat', 'alpha');
79$search_date_startday = GETPOSTINT('search_date_startday');
80$search_date_startmonth = GETPOSTINT('search_date_startmonth');
81$search_date_startyear = GETPOSTINT('search_date_startyear');
82$search_date_endday = GETPOSTINT('search_date_endday');
83$search_date_endmonth = GETPOSTINT('search_date_endmonth');
84$search_date_endyear = GETPOSTINT('search_date_endyear');
85$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
86$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
87$search_country = GETPOST('search_country', 'aZ09');
88$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
89
90// Load variable for pagination
91$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
92$sortfield = GETPOST('sortfield', 'aZ09comma');
93$sortorder = GETPOST('sortorder', 'aZ09comma');
94$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
95if (empty($page) || $page < 0) {
96 $page = 0;
97}
98$offset = $limit * $page;
99$pageprev = $page - 1;
100$pagenext = $page + 1;
101if (!$sortfield) {
102 $sortfield = "f.datef, f.ref, l.rowid";
103}
104if (!$sortorder) {
105 if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) {
106 $sortorder = "DESC";
107 } else {
108 $sortorder = "ASC";
109 }
110}
111
112// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
113$hookmanager->initHooks(array('accountancysupplierlist'));
114
115$formaccounting = new FormAccounting($db);
116$accountingAccount = new AccountingAccount($db);
117
118$chartaccountcode = dol_getIdFromCode($db, getDolGlobalString('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
119
120// Security check
121if (!isModEnabled('accounting')) {
123}
124if ($user->socid > 0) {
126}
127if (!$user->hasRight('accounting', 'bind', 'write')) {
129}
130
131// Define begin binding date
132if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
133 $search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'));
134}
135
136
137/*
138 * Actions
139 */
140
141if (GETPOST('cancel', 'alpha')) {
142 $action = 'list';
143 $massaction = '';
144}
145if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
146 $massaction = '';
147}
148
149$parameters = array();
150$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
151if ($reshook < 0) {
152 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
153}
154
155if (empty($reshook)) {
156 // Purge search criteria
157 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
158 $search_societe = '';
159 $search_lineid = '';
160 $search_ref = '';
161 $search_ref_supplier = '';
162 $search_invoice = '';
163 $search_label = '';
164 $search_desc = '';
165 $search_amount = '';
166 $search_account = '';
167 $search_vat = '';
168 $search_date_startday = '';
169 $search_date_startmonth = '';
170 $search_date_startyear = '';
171 $search_date_endday = '';
172 $search_date_endmonth = '';
173 $search_date_endyear = '';
174 $search_date_start = '';
175 $search_date_end = '';
176 $search_country = '';
177 $search_tvaintra = '';
178 }
179
180 // Mass actions
181 $objectclass = 'AccountingAccount';
182 $permissiontoread = $user->hasRight('accounting', 'read');
183 $permissiontodelete = $user->hasRight('accounting', 'delete');
184 $uploaddir = $conf->accounting->dir_output;
185 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
186}
187
188
189if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
190 $msg = '';
191
192 if (!empty($mesCasesCochees)) {
193 $msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
194 $msg .= '<div class="detail">';
195 $cpt = 0;
196 $ok = 0;
197 $ko = 0;
198
199 foreach ($mesCasesCochees as $maLigneCochee) {
200 $maLigneCourante = explode("_", $maLigneCochee);
201 $monId = $maLigneCourante[0];
202 $monCompte = GETPOST('codeventil'.$monId);
203
204 if ($monCompte <= 0) {
205 $msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
206 $ko++;
207 } else {
208 $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
209 $sql .= " SET fk_code_ventilation = ".((int) $monCompte);
210 $sql .= " WHERE rowid = ".((int) $monId);
211
212 $accountventilated = new AccountingAccount($db);
213 $accountventilated->fetch($monCompte, '', 1);
214
215 dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
216 if ($db->query($sql)) {
217 $msg .= '<div><span class="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
218 $ok++;
219 } else {
220 $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>';
221 $ko++;
222 }
223 }
224
225 $cpt++;
226 }
227 $msg .= '</div>';
228 $msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
229 }
230}
231
232if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
233 $value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
234 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
235 $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
236}
237
238
239/*
240 * View
241 */
242
243$form = new Form($db);
244$formother = new FormOther($db);
245
246$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
247
248llxHeader('', $langs->trans("SuppliersVentilation"), $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-accountancy accountancy-supplier page-list');
249
250if (empty($chartaccountcode)) {
251 print $langs->trans("ErrorChartOfAccountSystemNotSelected");
252 // End of page
253 llxFooter();
254 $db->close();
255 exit;
256}
257
258// Supplier Invoice Lines
259$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,";
260$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,";
261$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,";
262if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
263 $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,";
264 $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,";
265} else {
266 $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,";
267 $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,";
268}
269$sql .= " p.tosell as status, p.tobuy as status_buy,";
270$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
271$sql .= " co.code as country_code, co.label as country_label,";
272$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,";
273if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
274 $sql .= " spe.accountancy_code_customer as code_compta_client,";
275 $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
276 $sql .= " spe.accountancy_code_buy as company_code_buy";
277} else {
278 $sql .= " s.code_compta as code_compta_client,";
279 $sql .= " s.code_compta_fournisseur,";
280 $sql .= " s.accountancy_code_buy as company_code_buy";
281}
282$parameters = array();
283$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
284$sql .= $hookmanager->resPrint;
285$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
286$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
287if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
288 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
289}
290$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
291$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
292$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
293if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
294 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
295}
296$alias_societe_perentity = !getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED') ? "s" : "spe";
297$alias_product_perentity = !getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p" : "ppe";
298$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 = ".$conf->entity;
299$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 = ".$conf->entity;
300$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 = ".$conf->entity;
301$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 = ".$conf->entity;
302$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
303$sql .= " AND l.product_type <= 2";
304// Add search filter like
305if (strlen($search_lineid)) {
306 $sql .= natural_search("l.rowid", $search_lineid, 1);
307}
308if (strlen($search_societe)) {
309 $sql .= natural_search('s.nom', $search_societe);
310}
311if (strlen(trim($search_invoice))) {
312 $sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
313}
314if (strlen(trim($search_ref))) {
315 $sql .= natural_search("p.ref", $search_ref);
316}
317/*if (strlen(trim($search_ref_supplier))) {
318 $sql .= natural_search("f.ref_supplier", $search_ref_supplier);
319}*/
320if (strlen(trim($search_label))) {
321 $sql .= natural_search(array("p.label", "f.libelle"), $search_label);
322}
323if (strlen(trim($search_desc))) {
324 $sql .= natural_search("l.description", $search_desc);
325}
326if (strlen(trim($search_amount))) {
327 $sql .= natural_search("l.total_ht", $search_amount, 1);
328}
329if (strlen(trim($search_account))) {
330 $sql .= natural_search("aa.account_number", $search_account);
331}
332if (strlen(trim($search_vat))) {
333 $sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
334}
335if ($search_date_start) {
336 $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
337}
338if ($search_date_end) {
339 $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
340}
341if (strlen(trim($search_country))) {
342 $arrayofcode = getCountriesInEEC();
343 $country_code_in_EEC = $country_code_in_EEC_without_me = '';
344 foreach ($arrayofcode as $key => $value) {
345 $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
346 if ($value != $mysoc->country_code) {
347 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
348 }
349 }
350 if ($search_country == 'special_allnotme') {
351 $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
352 } elseif ($search_country == 'special_eec') {
353 $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
354 } elseif ($search_country == 'special_eecnotme') {
355 $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
356 } elseif ($search_country == 'special_noteec') {
357 $sql .= " AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
358 } else {
359 $sql .= natural_search("co.code", $search_country);
360 }
361}
362if (strlen(trim($search_tvaintra))) {
363 $sql .= natural_search("s.tva_intra", $search_tvaintra);
364}
365if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
366 $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
367} else {
369}
370$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
371
372// Add where from hooks
373$parameters = array();
374$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
375$sql .= $hookmanager->resPrint;
376
377$sql .= $db->order($sortfield, $sortorder);
378
379// Count total nb of records
380$nbtotalofrecords = '';
381if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
382 $result = $db->query($sql);
383 $nbtotalofrecords = $db->num_rows($result);
384 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
385 $page = 0;
386 $offset = 0;
387 }
388}
389
390$sql .= $db->plimit($limit + 1, $offset);
391
392dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
393// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso)
394// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security
395if ($db->type == 'mysqli') {
396 $db->query("SET SQL_BIG_SELECTS=1");
397}
398
399$result = $db->query($sql);
400if ($result) {
401 $num_lines = $db->num_rows($result);
402 $i = 0;
403
404 $arrayofselected = is_array($toselect) ? $toselect : array();
405
406 $param = '';
407 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
408 $param .= '&contextpage='.urlencode($contextpage);
409 }
410 if ($limit > 0 && $limit != $conf->liste_limit) {
411 $param .= '&limit='.((int) $limit);
412 }
413 if ($search_lineid) {
414 $param .= '&search_lineid='.urlencode((string) ($search_lineid));
415 }
416 if ($search_societe) {
417 $param .= '&search_societe='.urlencode($search_societe);
418 }
419 if ($search_date_startday) {
420 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
421 }
422 if ($search_date_startmonth) {
423 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
424 }
425 if ($search_date_startyear) {
426 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
427 }
428 if ($search_date_endday) {
429 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
430 }
431 if ($search_date_endmonth) {
432 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
433 }
434 if ($search_date_endyear) {
435 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
436 }
437 if ($search_invoice) {
438 $param .= '&search_invoice='.urlencode($search_invoice);
439 }
440 if ($search_ref) {
441 $param .= '&search_ref='.urlencode($search_ref);
442 }
443 if ($search_ref_supplier) {
444 $param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
445 }
446 if ($search_label) {
447 $param .= '&search_label='.urlencode($search_label);
448 }
449 if ($search_desc) {
450 $param .= '&search_desc='.urlencode($search_desc);
451 }
452 if ($search_amount) {
453 $param .= '&search_amount='.urlencode($search_amount);
454 }
455 if ($search_vat) {
456 $param .= '&search_vat='.urlencode($search_vat);
457 }
458 if ($search_country) {
459 $param .= "&search_country=".urlencode($search_country);
460 }
461 if ($search_tvaintra) {
462 $param .= "&search_tvaintra=".urlencode($search_tvaintra);
463 }
464
465 $arrayofmassactions = array(
466 'set_default_account' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount"),
467 'ventil' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
468 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
469 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
470 );
471 //if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
472 //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
473 $massactionbutton = '';
474 if ($massaction !== 'set_default_account') {
475 $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
476 }
477
478 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
479 print '<input type="hidden" name="action" value="ventil">';
480 if ($optioncss != '') {
481 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
482 }
483 print '<input type="hidden" name="token" value="'.newToken().'">';
484 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
485 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
486 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
487 print '<input type="hidden" name="page" value="'.$page.'">';
488
489 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
490 print_barre_liste($langs->trans("InvoiceLines").'<br><span class="opacitymedium small">'.$langs->trans("DescVentilTodoCustomer").'</span>', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
491
492 if ($massaction == 'set_default_account') {
493 $formquestion = array();
494 $formquestion[] = array('type' => 'other',
495 'name' => 'set_default_account',
496 'label' => $langs->trans("AccountancyCode"),
497 'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
498 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
499 }
500
501 if (!empty($msg)) {
502 print $msg.'<br>';
503 }
504
505 $moreforfilter = '';
506
507 print '<div class="div-table-responsive">';
508 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
509
510 // We add search filter
511 print '<tr class="liste_titre_filter">';
512 print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
513 print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
514 //print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
515 print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
516 print '<td class="liste_titre center">';
517 print '<div class="nowrapfordate">';
518 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
519 print '</div>';
520 print '<div class="nowrapfordate">';
521 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
522 print '</div>';
523 print '</td>';
524 print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
525 print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
526 print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
527 print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
528 print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
529 print '<td class="liste_titre">';
530 print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
531 //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
532 print '</td>';
533 print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
534 print '<td class="liste_titre"></td>';
535 print '<td class="liste_titre"></td>';
536 print '<td class="center liste_titre">';
537 $searchpicto = $form->showFilterButtons();
538 print $searchpicto;
539 print '</td>';
540 print "</tr>\n";
541
542 print '<tr class="liste_titre">';
543 print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
544 print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
545 //print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
546 print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
547 print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
548 print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
549 //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
550 print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
551 print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
552 print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
553 print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
554 print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
555 print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
556 print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
557 print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
558 $checkpicto = '';
559 if ($massactionbutton) {
560 $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
561 }
562 print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
563 print "</tr>\n";
564
565 $thirdpartystatic = new Societe($db);
566 $facturefourn_static = new FactureFournisseur($db);
567 $facturefourn_static_det = new SupplierInvoiceLine($db);
568 $product_static = new Product($db);
569
570
571 $accountingaccount_codetotid_cache = array();
572 $suggestedaccountingaccountfor = '';
573 $suggestedaccountingaccountbydefaultfor = '';
574
575 while ($i < min($num_lines, $limit)) {
576 $objp = $db->fetch_object($result);
577
578 // product_type: 0 = service, 1 = product
579 // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
580 // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
581 $code_buy_l = '';
582 $code_buy_p = '';
583 $code_buy_t = '';
584
585 $thirdpartystatic->id = $objp->socid;
586 $thirdpartystatic->name = $objp->name;
587 $thirdpartystatic->client = $objp->client;
588 $thirdpartystatic->fournisseur = $objp->fournisseur;
589 $thirdpartystatic->code_client = $objp->code_client;
590 $thirdpartystatic->code_compta_client = $objp->code_compta_client;
591 $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
592 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
593 $thirdpartystatic->email = $objp->email;
594 $thirdpartystatic->country_code = $objp->country_code;
595 $thirdpartystatic->tva_intra = $objp->tva_intra;
596 $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
597
598 $product_static->ref = $objp->product_ref;
599 $product_static->id = $objp->product_id;
600 $product_static->type = $objp->type;
601 $product_static->label = $objp->product_label;
602 $product_static->status = $objp->status;
603 $product_static->status_buy = $objp->status_buy;
604 $product_static->accountancy_code_sell = $objp->code_sell;
605 $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
606 $product_static->accountancy_code_sell_export = $objp->code_sell_export;
607 $product_static->accountancy_code_buy = $objp->code_buy;
608 $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
609 $product_static->accountancy_code_buy_export = $objp->code_buy_export;
610 $product_static->tva_tx = $objp->tva_tx_prod;
611
612 $facturefourn_static->ref = $objp->ref;
613 $facturefourn_static->id = $objp->facid;
614 $facturefourn_static->type = $objp->ftype;
615 $facturefourn_static->ref_supplier = $objp->ref_supplier;
616 $facturefourn_static->label = $objp->invoice_label;
617 $facturefourn_static->date = $db->jdate($objp->datef);
618 $facturefourn_static->fk_facture_source = $objp->fk_facture_source;
619
620 $facturefourn_static_det->id = $objp->rowid;
621 $facturefourn_static_det->total_ht = $objp->total_ht;
622 $facturefourn_static_det->tva_tx = $objp->tva_tx_line;
623 $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
624 $facturefourn_static_det->product_type = $objp->type_l;
625 $facturefourn_static_det->desc = $objp->description;
626
627 $accountingAccountArray = array(
628 'dom' => $objp->aarowid,
629 'intra' => $objp->aarowid_intra,
630 'export' => $objp->aarowid_export,
631 'thirdparty' => $objp->aarowid_thirdparty);
632
633 $code_buy_p_notset = '';
634 $code_buy_t_notset = '';
635
636 $suggestedid = 0;
637
638 $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
639 if (!is_array($return) && $return < 0) {
640 setEventMessage($accountingAccount->error, 'errors');
641 } else {
642 $suggestedid = $return['suggestedid'];
643 $suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
644 $suggestedaccountingaccountbydefaultfor = $return['suggestedaccountingaccountbydefaultfor'];
645 $code_buy_l = $return['code_l'];
646 $code_buy_p = $return['code_p'];
647 $code_buy_t = $return['code_t'];
648 }
649 //var_dump($return);
650
651 if (!empty($code_buy_p)) {
652 // Value was defined previously
653 } else {
654 $code_buy_p_notset = 'color:orange';
655 }
656 if (empty($code_buy_l) && empty($code_buy_p)) {
657 $code_buy_p_notset = 'color:red';
658 }
659 /*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
660 $code_sell_p_notset = 'color:orange';
661 }*/
662
663 // $code_buy_l is now default code of product/service
664 // $code_buy_p is now code of product/service
665 // $code_buy_t is now code of thirdparty
666 //var_dump($code_buy_l.' - '.$code_buy_p.' - '.$code_buy_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
667
668 print '<tr class="oddeven">';
669
670 // Line id
671 print '<td>'.$facturefourn_static_det->id.'</td>';
672
673 // Ref Invoice
674 print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
675 if ($objp->ref_supplier) {
676 print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
677 }
678 print '</td>';
679
680 // Ref supplier invoice
681 /*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
682 print $objp->ref_supplier;
683 print '</td>';*/
684
685 // Supplier invoice label
686 print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
687 print dol_escape_htmltag($objp->invoice_label);
688 print '</td>';
689
690 // Date
691 print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
692
693 // Ref Product
694 print '<td class="tdoverflowmax100">';
695 if ($product_static->id > 0) {
696 print $product_static->getNomUrl(1);
697 }
698 if ($product_static->label) {
699 print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
700 }
701 print '</td>';
702
703 // Description of line
704 $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
705 print '<td class="tdoverflowmax150 small classfortooltip" title="'.dol_escape_htmltag($text).'">';
706 $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION');
707 print dol_trunc($text, $trunclength);
708 print '</td>';
709
710 print '<td class="right nowraponall amount">';
711 print price($objp->total_ht);
712 print '</td>';
713
714 // Vat rate
715 $code_vat_differ = '';
716 //if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
717 // $code_vat_differ = 'warning bold';
718 //}
719 print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">';
720 print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
721 print '</td>';
722
723 // Thirdparty
724 print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'supplier').'</td>';
725
726 // Country
727 $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label;
728 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelcountry).'">';
729 print dol_escape_htmltag($labelcountry);
730 print '</td>';
731
732 // VAT Num
733 print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
734
735 // Found accounts
736 print '<td class="small">';
737 $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
738 $shelp = '';
739 $ttype = 'help';
740 if ($suggestedaccountingaccountbydefaultfor == 'eec') {
741 $shelp .= $langs->trans("SaleEEC");
742 } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
743 $shelp = $langs->trans("SaleEECWithVAT");
744 } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
745 $shelp = $langs->trans("SaleEECWithoutVATNumber");
746 $ttype = 'warning';
747 } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
748 $shelp .= $langs->trans("SaleExport");
749 }
750 $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
751 print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
752 if ($product_static->id > 0) {
753 print '<br>';
754 $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
755 $shelp = '';
756 $ttype = 'help';
757 if ($suggestedaccountingaccountfor == 'eec') {
758 $shelp = $langs->trans("SaleEEC");
759 } elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
760 $shelp = $langs->trans("SaleEECWithVAT");
761 } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
762 $shelp = $langs->trans("SaleEECWithoutVATNumber");
763 $ttype = 'warning';
764 } elseif ($suggestedaccountingaccountfor == 'export') {
765 $shelp = $langs->trans("SaleExport");
766 }
767 $s .= (empty($code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_buy_p));
768 print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
769 } else {
770 print '<br>';
771 $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
772 $shelp = '';
773 $s .= $langs->trans("NotDefined");
774 print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
775 }
776 if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) {
777 print '<br>';
778 $s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
779 $shelp = '';
780 $s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
781 print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
782 }
783 print '</td>';
784
785 // Suggested accounting account
786 print '<td>';
787 print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
788 print '</td>';
789
790 // Column with checkbox
791 print '<td class="center">';
792 $ischecked = 0;
793 if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
794 $ischecked = 1;
795 }
796
797 if (!empty($toselect)) {
798 $ischecked = 0;
799 if (in_array($objp->rowid."_".$i, $toselect)) {
800 $ischecked = 1;
801 }
802 }
803
804 print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
805 print '</td>';
806
807 print '</tr>';
808 $i++;
809 }
810 if ($num_lines == 0) {
811 print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
812 }
813
814 print '</table>';
815 print "</div>";
816
817 print '</form>';
818} else {
819 print $db->error();
820}
821if ($db->type == 'mysqli') {
822 $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
823}
824
825// Add code to auto check the box when we select an account
826print '<script type="text/javascript">
827jQuery(document).ready(function() {
828 jQuery(".codeventil").change(function() {
829 var s=$(this).attr("id").replace("codeventil", "")
830 console.log(s+" "+$(this).val());
831 if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
832 else jQuery(".checkforselect"+s).prop("checked", true);
833 });
834});
835</script>';
836
837// End of page
838llxFooter();
839$db->close();
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).
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.
Definition wrapper.php:71
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 generation of HTML components for accounting management.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
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...
llxFooter()
Footer empty.
Definition document.php:107
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.