41require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
63$langs->loadLangs(array(
'products',
'bills',
'companies',
'projects'));
65$action =
GETPOST(
'action',
'aZ09');
66$massaction =
GETPOST(
'massaction',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$toselect =
GETPOST(
'toselect',
'array');
70$optioncss =
GETPOST(
'optioncss',
'alpha');
71$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicelist';
74$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
75$search_label =
GETPOST(
"search_label",
"alpha");
76$search_amount_no_tax =
GETPOST(
"search_amount_no_tax",
"alpha");
77$search_amount_all_tax =
GETPOST(
"search_amount_all_tax",
"alpha");
79$search_refsupplier =
GETPOST(
'search_refsupplier',
'alpha');
80$search_type =
GETPOST(
'search_type',
'intcomma');
81$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
82$search_project =
GETPOST(
'search_project',
'alpha');
83$search_company =
GETPOST(
'search_company',
'alpha');
84$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
85$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
86$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
87$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
88$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
89$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
90$search_login =
GETPOST(
'search_login',
'alpha');
91$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
92$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
93$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
94$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
95$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
96$search_status =
GETPOST(
'search_status',
'intcomma');
97$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
98$search_paymentcond =
GETPOST(
'search_paymentcond') ?
GETPOSTINT(
'search_paymentcond') :
'';
99$search_town =
GETPOST(
'search_town',
'alpha');
100$search_zip =
GETPOST(
'search_zip',
'alpha');
101$search_state =
GETPOST(
"search_state");
102$search_country =
GETPOST(
"search_country",
'aZ09');
103$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
104$search_user =
GETPOST(
'search_user',
'intcomma');
105$search_sale =
GETPOST(
'search_sale',
'intcomma');
106$search_date_start =
GETPOSTDATE(
'search_date_start',
'',
'tzserver');
107$search_date_end =
GETPOSTDATE(
'search_date_end',
'23:59:59',
'tzserver');
108$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
109$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
110$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
111$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
112$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
113$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
114$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
115$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
116$search_categ_sup =
GETPOST(
"search_categ_sup",
'intcomma');
117$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
118$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
120$option =
GETPOST(
'search_option');
121if ($option ==
'late') {
122 $search_status =
'1';
124$filter =
GETPOST(
'filtre',
'alpha');
128$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
129$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
131if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
135$offset = $limit * $page;
140 $sortfield =
"f.datef,f.rowid";
142$pageprev = $page - 1;
143$pagenext = $page + 1;
148if ($user->socid > 0) {
150 $socid = $user->socid;
153$diroutputmassaction =
$conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id;
159$hookmanager->initHooks(array(
'supplierinvoicelist'));
163$extrafields->fetch_name_optionals_label(
$object->table_element);
165$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
168$fieldstosearchall = array(
170 'f.ref_supplier' =>
'RefSupplier',
171 'f.note_public' =>
'NotePublic',
172 's.nom' =>
"ThirdParty",
173 's.code_fournisseur' =>
"SupplierCodeShort",
174 'pd.description' =>
'Description',
176if (empty($user->socid)) {
177 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
180$checkedtypetiers =
'0';
182 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
183 'f.ref_supplier' => array(
'label' =>
"RefSupplier",
'checked' =>
'1',
'position' => 7),
184 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
185 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
186 'f.label' => array(
'label' =>
"Label",
'checked' =>
'0',
'position' => 20),
187 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 25),
188 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 27),
189 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'0',
'position' => 30),
190 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 41),
191 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'0',
'position' => 42),
192 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 43),
193 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 44),
194 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
195 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 46),
196 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 49),
197 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'1',
'position' => 52),
198 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'1',
'position' => 50),
199 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 105),
200 'f.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 110),
201 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) ($mysoc->localtax1_assuj ==
"1"),
'position' => 95),
202 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' =>
'0',
'enabled' => (
string) (
int) ($mysoc->localtax2_assuj ==
"1"),
'position' => 100),
203 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1',
'position' => 115),
204 'dynamount_payed' => array(
'label' =>
"Paid",
'checked' =>
'0',
'position' => 116),
205 'rtp' => array(
'label' =>
"Rest",
'checked' =>
'0',
'position' => 117),
206 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'position' => 205,
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
207 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'position' => 206,
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
208 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'position' => 207,
'checked' =>
'0',
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
209 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'position' => 208,
'checked' =>
'0',
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
210 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'position' => 209,
'checked' =>
'0',
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
211 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'position' => 210,
'checked' =>
'0',
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
212 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'position' => 211,
'enabled' => (!isModEnabled(
"multicurrency") ?
'0' :
'1')),
213 'u.login' => array(
'label' =>
"Author",
'checked' =>
'-1',
'position' => 500),
214 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
215 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 502),
216 'f.nb_docs' => array(
'label' =>
"Documents",
'checked' =>
'-1',
'position' => 510),
217 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
220include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
222$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
223if (empty($subtypearray)) {
224 unset($arrayfields[
'f.subtype']);
230if (!isModEnabled(
'supplier_invoice')) {
233if ((!$user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))
234 || (!$user->hasRight(
"supplier_invoice",
"lire") &&
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))) {
239if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
240 $search_sale = $user->id;
243$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
244$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
245$permissiontodelete = ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer"));
252if (
GETPOST(
'cancel',
'alpha')) {
256if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
260$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
261$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
266if (empty($reshook)) {
268 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
271 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
275 $search_product_category =
'';
277 $search_refsupplier =
"";
279 $search_subtype =
'';
281 $search_project =
'';
282 $search_company =
"";
283 $search_company_alias =
"";
284 $search_amount_no_tax =
"";
285 $search_amount_all_tax =
"";
286 $search_montant_ht =
'';
287 $search_montant_vat =
'';
288 $search_montant_localtax1 =
'';
289 $search_montant_localtax2 =
'';
290 $search_montant_ttc =
'';
292 $search_multicurrency_code =
'';
293 $search_multicurrency_tx =
'';
294 $search_multicurrency_montant_ht =
'';
295 $search_multicurrency_montant_vat =
'';
296 $search_multicurrency_montant_ttc =
'';
298 $search_paymentmode =
'';
299 $search_paymentcond =
'';
303 $search_country =
'';
304 $search_type_thirdparty =
'';
305 $search_date_start =
'';
306 $search_date_end =
'';
307 $search_datelimit_startday =
'';
308 $search_datelimit_startmonth =
'';
309 $search_datelimit_startyear =
'';
310 $search_datelimit_endday =
'';
311 $search_datelimit_endmonth =
'';
312 $search_datelimit_endyear =
'';
313 $search_datelimit_start =
'';
314 $search_datelimit_end =
'';
316 $search_array_options = array();
317 $search_categ_sup = 0;
323 $objectclass =
'FactureFournisseur';
324 $objectlabel =
'SupplierInvoices';
326 $uploaddir =
$conf->fournisseur->facture->dir_output;
328 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
330 if ($massaction ==
'banktransfertrequest') {
331 $langs->load(
"withdrawals");
333 if (!$user->hasRight(
"paymentbybanktransfer",
"create")) {
340 $arrayofselected = is_array($toselect) ? $toselect : array();
341 $listofbills = array();
342 foreach ($arrayofselected as $toselectid) {
344 $result = $objecttmp->fetch($toselectid);
346 $totalpaid = $objecttmp->getSommePaiement();
347 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
348 $totaldeposits = $objecttmp->getSumDepositsUsed();
349 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
352 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
353 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
356 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
357 $objecttmp->resteapayer = $remaintopay;
359 } elseif ($reshook < 0) {
361 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
366 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
367 } elseif ($objecttmp->paid || $objecttmp->resteapayer == 0) {
369 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
370 } elseif ($objecttmp->resteapayer < 0) {
372 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
375 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
376 $rsql .=
" , pfd.date_traite as date_traite";
377 $rsql .=
" , pfd.amount";
378 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
379 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
380 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
381 $rsql .=
" WHERE fk_facture_fourn = ".((int) $objecttmp->id);
382 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
383 $rsql .=
" AND pfd.traite = 0";
384 $rsql .=
" ORDER BY pfd.date_demande DESC";
387 $result_sql = $db->query($rsql);
389 $numprlv = $db->num_rows($result_sql);
394 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
395 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'VIR') {
396 $langs->load(
"errors");
398 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
400 $listofbills[] = $objecttmp;
406 if (!empty($listofbills)) {
407 $nbwithdrawrequestok = 0;
408 foreach ($listofbills as $aBill) {
415 $sql =
"SELECT SUM(pfd.amount) as amount";
416 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
418 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int) $aBill->id);
422 $sql .=
" AND pfd.traite = 0";
424 $resql = $db->query($sql);
426 $obj = $db->fetch_object($resql);
428 $pending += (float) $obj->amount;
434 $sqlPending =
"SELECT SUM(pl.amount) as amount";
435 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
436 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
438 $sqlPending .=
" WHERE p.fk_facture_fourn = ".((int) $aBill->id);
442 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
443 $resPending = $db->query($sqlPending);
445 if ($objPending = $db->fetch_object($resPending)) {
446 $pending += (float) $objPending->amount;
449 $db->free($resPending);
451 $requestAmount = $aBill->resteapayer - $pending;
452 if ($requestAmount > 0) {
454 $result = $aBill->demande_prelevement($user, $requestAmount,
'bank-transfer',
'supplier_invoice');
457 $nbwithdrawrequestok++;
463 $aBill->error =
'WithdrawRequestErrorNilAmount';
464 $aBill->errors[] = $aBill->error;
468 if ($nbwithdrawrequestok > 0) {
469 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
481$form =
new Form($db);
487$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
494 if (empty($search_company)) {
495 $search_company = $soc->name;
499$title = $langs->trans(
"BillsSuppliers").($socid && ($soc !==
null) ?
' - '.$soc->name :
'');
500$help_url =
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
505$sql .=
" f.rowid as facid, f.ref, f.ref_supplier, f.type, f.subtype, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement,";
506$sql .=
" f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.close_code, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_modification,";
507$sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
508$sql .=
' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
509$sql .=
" f.note_public, f.note_private,";
510$sql .=
" f.fk_user_author,";
511$sql .=
" s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
512$sql .=
" typent.code as typent_code,";
513$sql .=
" state.code_departement as state_code, state.nom as state_name,";
514$sql .=
" country.code as country_code,";
515$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
516$sql .=
' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
518if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
519 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
520 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
524$parameters = array();
525$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
526$sql .= $hookmanager->resPrint;
527$sql = preg_replace(
'/,\s*$/',
'', $sql);
531$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
532$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
533$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
534$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
535$sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
536if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
537 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
539$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
540$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
541if ($search_user > 0) {
542 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
543 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
546$parameters = array();
547$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
548$sql .= $hookmanager->resPrint;
549$sql .=
' WHERE f.fk_soc = s.rowid';
550$sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
552 $sql .=
' AND s.rowid = '.((int) $socid);
555 if (is_numeric($search_ref)) {
564if ($search_refsupplier) {
567if ($search_type !=
'' && $search_type >= 0) {
568 if ($search_type ==
'0') {
569 $sql .=
" AND f.type = 0";
571 if ($search_type ==
'1') {
572 $sql .=
" AND f.type = 1";
574 if ($search_type ==
'2') {
575 $sql .=
" AND f.type = 2";
577 if ($search_type ==
'3') {
578 $sql .=
" AND f.type = 3";
583if ($search_subtype !=
'' && $search_subtype !=
'-1') {
584 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
586if ($search_project) {
589if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
590 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
592 if ($search_company) {
595 if ($search_company_alias) {
608if (strlen(trim($search_country))) {
610 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
611 foreach ($arrayofcode as $key => $value) {
612 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
613 if ($value != $mysoc->country_code) {
614 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
617 if ($search_country ==
'special_allnotme') {
618 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
619 } elseif ($search_country ==
'special_eec') {
620 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
621 } elseif ($search_country ==
'special_eecnotme') {
622 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
623 } elseif ($search_country ==
'special_noteec') {
624 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
629if ($search_type_thirdparty !=
'' && $search_type_thirdparty >= 0) {
630 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
632if ($search_montant_ht !=
'') {
635if ($search_montant_vat !=
'') {
638if ($search_montant_localtax1 !=
'') {
639 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
641if ($search_montant_localtax2 !=
'') {
642 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
644if ($search_montant_ttc !=
'') {
647if ($search_multicurrency_code !=
'') {
648 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
650if ($search_multicurrency_tx !=
'') {
651 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
653if ($search_multicurrency_montant_ht !=
'') {
654 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
656if ($search_multicurrency_montant_vat !=
'') {
657 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
659if ($search_multicurrency_montant_ttc !=
'') {
660 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
663 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname'), $search_login);
665if ($search_status !=
'' && $search_status >= 0) {
666 $sql .=
" AND f.fk_statut = ".((int) $search_status);
668if ($search_paymentmode > 0) {
669 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
671if ($search_paymentcond > 0) {
672 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
674if ($search_date_start) {
675 $sql .=
" AND f.datef >= '" . $db->idate($search_date_start) .
"'";
677if ($search_date_end) {
678 $sql .=
" AND f.datef <= '" . $db->idate($search_date_end) .
"'";
680if ($search_datelimit_start) {
681 $sql .=
" AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) .
"'";
683if ($search_datelimit_end) {
684 $sql .=
" AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) .
"'";
686if ($option ==
'late') {
687 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() -
$conf->facture->fournisseur->warning_delay).
"'";
692if ($search_fk_fac_rec_source) {
693 $sql .=
" AND f.fk_fac_rec_source = ".(int) $search_fk_fac_rec_source;
696if ($search_sale && $search_sale !=
'-1') {
697 if ($search_sale == -2) {
698 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
699 } elseif ($search_sale > 0) {
700 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
703$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
704$searchCategorySupplierOperator = 0;
706if (!empty($searchCategorySupplierList)) {
707 $searchCategorySupplierSqlList = array();
708 $listofcategoryid =
'';
709 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
710 if (intval($searchCategorySupplier) == -2) {
711 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
712 } elseif (intval($searchCategorySupplier) > 0) {
713 if ($searchCategorySupplierOperator == 0) {
714 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).
")";
716 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
720 if ($listofcategoryid) {
721 $searchCategorySupplierSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
723 if ($searchCategorySupplierOperator == 1) {
724 if (!empty($searchCategorySupplierSqlList)) {
725 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
728 if (!empty($searchCategorySupplierSqlList)) {
729 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
734$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
735$searchCategoryProductOperator = 0;
736if (!empty($searchCategoryProductList)) {
737 $searchCategoryProductSqlList = array();
738 $listofcategoryid =
'';
739 foreach ($searchCategoryProductList as $searchCategoryProduct) {
740 if (intval($searchCategoryProduct) == -2) {
741 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product)";
742 } elseif (intval($searchCategoryProduct) > 0) {
743 if ($searchCategoryProductOperator == 0) {
744 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
746 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
750 if ($listofcategoryid) {
751 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
753 if ($searchCategoryProductOperator == 1) {
754 if (!empty($searchCategoryProductSqlList)) {
755 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
758 if (!empty($searchCategoryProductSqlList)) {
759 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
763if ($filter && $filter != -1) {
764 $aFilter = explode(
',', $filter);
765 foreach ($aFilter as $fil) {
766 $filt = explode(
':', $fil);
767 $sql .=
" AND ".$db->escape(trim($filt[0])).
" = '".$db->escape(trim($filt[1])).
"'";
772 unset($fieldstosearchall[
'pd.description']);
774 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all, 0, 1);
775 $sql .=
" OR EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture_fourn_det as pd WHERE f.rowid = pd.fk_facture_fourn AND pd.description LIKE '%".$db->escape($db->escapeforlike($search_all)).
"%')";
777 $fieldstosearchall[
'pd.description'] =
'Description';
780if ($search_user > 0) {
781 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user);
784include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
786$parameters = array();
787$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
788$sql .= $hookmanager->resPrint;
791$parameters = array();
792$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
793$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
796$nbtotalofrecords =
'';
799 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
801 $resql = $db->query($sqlforcount);
803 $objforcount = $db->fetch_object($resql);
804 $nbtotalofrecords = $objforcount->nbtotalofrecords;
809 if (($page * $limit) > $nbtotalofrecords) {
817$sql .= $db->order($sortfield, $sortorder);
819 $sql .= $db->plimit($limit + 1, $offset);
823$resql = $db->query($sql);
829$num = $db->num_rows($resql);
832if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
833 $obj = $db->fetch_object($resql);
835 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$id);
842llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-fourn-facture page-list');
844if ($search_fk_fac_rec_source) {
845 require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
846 require_once DOL_DOCUMENT_ROOT .
'/core/lib/invoice.lib.php';
848 $object->fetch((
int) $search_fk_fac_rec_source);
851 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
857 if (empty($search_company)) {
858 $search_company = $soc->name;
859 $search_company_alias = $soc->name_alias;
863$arrayofselected = is_array($toselect) ? $toselect : array();
865$param =
'&socid='.$socid;
867 $param .=
'&mode='.urlencode($mode);
869if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
870 $param .=
'&contextpage='.urlencode($contextpage);
872if ($limit > 0 && $limit !=
$conf->liste_limit) {
873 $param .=
'&limit='.((int) $limit);
875if ($optioncss !=
'') {
876 $param .=
'&optioncss='.urlencode($optioncss);
879 $param .=
'&search_all='.urlencode($search_all);
881if ($search_date_start) {
882 $param .=
buildParamDate(
'search_date_start',
null,
'',
'tzserver');
884if ($search_date_end) {
885 $param .=
buildParamDate(
'search_date_end',
null,
'',
'tzserver');
887if ($search_datelimit_startday) {
888 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
890if ($search_datelimit_startmonth) {
891 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
893if ($search_datelimit_startyear) {
894 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
896if ($search_datelimit_endday) {
897 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
899if ($search_datelimit_endmonth) {
900 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
902if ($search_datelimit_endyear) {
903 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
906 $param .=
'&search_ref='.urlencode($search_ref);
908if ($search_refsupplier) {
909 $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
911if ($search_type !=
'') {
912 $param .=
'&search_type='.urlencode($search_type);
914if ($search_subtype !=
'') {
915 $param .=
'&search_subtype='.urlencode($search_subtype);
918 $param .=
'&search_label='.urlencode($search_label);
920if ($search_company) {
921 $param .=
'&search_company='.urlencode($search_company);
923if ($search_company_alias) {
924 $param .=
'&search_company_alias='.urlencode($search_company_alias);
927 $param .=
'&search_login='.urlencode($search_login);
929if ($search_montant_ht !=
'') {
930 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
932if ($search_montant_vat !=
'') {
933 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
935if ($search_montant_localtax1 !=
'') {
936 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
938if ($search_montant_localtax2 !=
'') {
939 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
941if ($search_montant_ttc !=
'') {
942 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
944if ($search_multicurrency_code !=
'') {
945 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
947if ($search_multicurrency_tx !=
'') {
948 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
950if ($search_multicurrency_montant_ht !=
'') {
951 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
953if ($search_multicurrency_montant_vat !=
'') {
954 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
956if ($search_multicurrency_montant_ttc !=
'') {
957 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
959if ($search_amount_no_tax) {
960 $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
962if ($search_amount_all_tax) {
963 $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
965if ($search_status >= 0) {
966 $param .=
"&search_status=".urlencode($search_status);
968if ($search_paymentmode) {
969 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
971if ($search_paymentcond) {
972 $param .=
'&search_paymentcond='.urlencode((
string) ($search_paymentcond));
975 $param .=
'&show_files='.urlencode((
string) ($show_files));
978 $param .=
"&search_option=".urlencode($option);
980if ($search_categ_sup > 0) {
981 $param .=
'&search_categ_sup='.$search_categ_sup;
983if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
984 $param .=
'&search_type_thirdparty='.$search_type_thirdparty;
986if ($search_fk_fac_rec_source) {
987 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
991include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
993$parameters = array(
'param' => &$param);
994$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
995$param .= $hookmanager->resPrint;
998$arrayofmassactions = array(
999 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1000 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1001 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1005if (isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
"paymentbybanktransfer",
"create")) {
1006 $langs->load(
'withdrawals');
1007 $arrayofmassactions[
'banktransfertrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
1009if (!empty($permissiontodelete)) {
1010 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1012if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
1013 $arrayofmassactions = array();
1015$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1017$url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
1019 $url .=
'&socid='.urlencode((
string) (
$object->socid));
1022 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1025print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1026if ($optioncss !=
'') {
1027 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1029print
'<input type="hidden" name="token" value="'.newToken().
'">';
1030print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1031print
'<input type="hidden" name="action" value="list">';
1032print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1033print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1034print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1035print
'<input type="hidden" name="page" value="'.$page.
'">';
1036print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1037print
'<input type="hidden" name="page_y" value="">';
1038print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1041$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'));
1042$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'));
1044$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', (
int) ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")));
1046print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_invoice', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1049$topicmail =
"SendBillRef";
1050$modelmail =
"invoice_supplier_send";
1052$trackid =
'sinv'.$object->id;
1053include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1057 foreach ($fieldstosearchall as $key => $val) {
1058 $fieldstosearchall[$key] = $langs->trans($val);
1059 $setupstring .= $key.
"=".$val.
";";
1061 print
'<!-- Search done like if SUPPLIER_INVOICE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1062 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1067if ($user->hasRight(
"user",
"user",
"lire")) {
1068 $langs->load(
"commercial");
1069 $moreforfilter .=
'<div class="divsearchfield">';
1070 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1071 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1072 $moreforfilter .=
'</div>';
1075if ($user->hasRight(
"user",
"user",
"lire")) {
1076 $moreforfilter .=
'<div class="divsearchfield">';
1077 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1078 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'', 0, 0,
'', 0,
'',
'maxwidth200');
1079 $moreforfilter .=
'</div>';
1082if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1083 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1084 $moreforfilter .=
'<div class="divsearchfield">';
1085 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1086 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1087 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
1088 $moreforfilter .=
'</div>';
1091if (isModEnabled(
'category')) {
1092 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1093 $moreforfilter .=
'<div class="divsearchfield">';
1094 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1095 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $tmptitle);
1096 $moreforfilter .=
'</div>';
1098$parameters = array();
1099$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1100if (empty($reshook)) {
1101 $moreforfilter .= $hookmanager->resPrint;
1103 $moreforfilter = $hookmanager->resPrint;
1106if (!empty($moreforfilter)) {
1107 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1108 print $moreforfilter;
1112$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1113$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1114$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1115$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1117print
'<div class="div-table-responsive">';
1118print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1122print
'<tr class="liste_titre_filter">';
1125 print
'<td class="liste_titre center maxwidthsearch">';
1126 $searchpicto = $form->showFilterButtons(
'left');
1131if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1132 print
'<td class="liste_titre left">';
1133 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1137if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1138 print
'<td class="liste_titre">';
1139 print
'<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).
'">';
1143if (!empty($arrayfields[
'f.type'][
'checked'])) {
1144 print
'<td class="liste_titre maxwidthonsmartphone">';
1151 print $form->selectarray(
'search_type', $typearray, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
1155if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1156 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1157 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1161if (!empty($arrayfields[
'f.label'][
'checked'])) {
1162 print
'<td class="liste_titre">';
1163 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
1167if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1168 print
'<td class="liste_titre center">';
1169 print
'<div class="nowrapfordate">';
1170 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1172 print
'<div class="nowrapfordate">';
1173 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1178if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1179 print
'<td class="liste_titre center">';
1180 print
'<div class="">';
1187 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1189 print
'<div class="nowraponall inline-block valignmiddle"><input type="checkbox" class="valignmiddle" name="search_option" id="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'><label for="search_option" class="valignmiddle">'.$langs->trans(
"Alert").
'</label></div>';
1194if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1195 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1198if (!empty($arrayfields[
's.nom'][
'checked'])) {
1199 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1202if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1203 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1206if (!empty($arrayfields[
's.town'][
'checked'])) {
1207 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1210if (!empty($arrayfields[
's.zip'][
'checked'])) {
1211 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1214if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1215 print
'<td class="liste_titre">';
1216 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1220if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1221 print
'<td class="liste_titre center">';
1222 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1226if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1227 print
'<td class="liste_titre maxwidthonsmartphone center">';
1228 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' :
$conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1232if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1233 print
'<td class="liste_titre left">';
1234 print $form->getSelectConditionsPaiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
1238if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1239 print
'<td class="liste_titre">';
1240 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100', 1);
1243if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1245 print
'<td class="liste_titre right">';
1246 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1249if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1251 print
'<td class="liste_titre right">';
1252 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1255if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1257 print
'<td class="liste_titre right">';
1258 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1261if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1263 print
'<td class="liste_titre right">';
1264 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1267if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1269 print
'<td class="liste_titre right">';
1270 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1273if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1275 print
'<td class="liste_titre" align="center">';
1278if (!empty($arrayfields[
'u.login'][
'checked'])) {
1280 print
'<td class="liste_titre" align="center">';
1281 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1284if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1285 print
'<td class="liste_titre right">';
1288if (!empty($arrayfields[
'rtp'][
'checked'])) {
1289 print
'<td class="liste_titre">';
1292if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1294 print
'<td class="liste_titre">';
1295 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1298if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1300 print
'<td class="liste_titre">';
1301 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1304if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1306 print
'<td class="liste_titre right">';
1307 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1310if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1312 print
'<td class="liste_titre right">';
1313 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1316if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1318 print
'<td class="liste_titre right">';
1319 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1322if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1323 print
'<td class="liste_titre">';
1326if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1327 print
'<td class="liste_titre right">';
1331include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1334$parameters = array(
'arrayfields' => $arrayfields);
1335$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1336print $hookmanager->resPrint;
1338if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1339 print
'<td class="liste_titre">';
1343if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1344 print
'<td class="liste_titre">';
1348if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1349 print
'<td class="liste_titre center parentonrightofpage">';
1350 $liststatus = array(
'0' => $langs->trans(
"Draft"),
'1' => $langs->trans(
"Unpaid"),
'2' => $langs->trans(
"Paid"));
1352 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'center search_status width100 onrightofpage', 1);
1357 print
'<td class="liste_titre center maxwidthsearch">';
1358 $searchpicto = $form->showFilterButtons();
1370print
'<tr class="liste_titre">';
1373 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1376if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
1380if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
1384if (!empty($arrayfields[
'f.type'][
'checked'])) {
1385 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1388if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1389 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1391if (!empty($arrayfields[
'f.label'][
'checked'])) {
1392 print_liste_field_titre($arrayfields[
'f.label'][
'label'], $_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
1395if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1399if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1400 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1403if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1404 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1407if (!empty($arrayfields[
's.nom'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1411if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1413 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1416if (!empty($arrayfields[
's.town'][
'checked'])) {
1417 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1420if (!empty($arrayfields[
's.zip'][
'checked'])) {
1421 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1424if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1425 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.name_alias",
"", $param,
'', $sortfield, $sortorder);
1428if (!empty($arrayfields[
'state.name_alias'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
'state.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1432if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1433 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1436if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1437 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1440if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1444if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1445 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1448if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1449 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1452if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1456if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1457 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1460if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1461 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1464if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1465 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1468if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1469 print_liste_field_titre($arrayfields[
'f.nb_docs'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1472if (!empty($arrayfields[
'u.login'][
'checked'])) {
1473 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1476if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1477 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1480if (!empty($arrayfields[
'rtp'][
'checked'])) {
1481 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1484if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1485 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1488if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1492if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1493 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'"', $sortfield, $sortorder,
'right ');
1496if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1497 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1500if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1501 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1504if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1505 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1508if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1509 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1513include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1515$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1516$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1517print $hookmanager->resPrint;
1518if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1519 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1522if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1523 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1526if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1527 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1532 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1539$projectstatic =
new Project($db);
1540$userstatic =
new User($db);
1558$imaxinloop = ($limit ? min($num, $limit) : $num);
1559while ($i < $imaxinloop) {
1560 $obj = $db->fetch_object($resql);
1565 $datelimit = $db->jdate($obj->datelimite);
1567 $userstatic->id = $obj->fk_user_author;
1568 $userstatic->login = $obj->login;
1569 $userstatic->lastname = $obj->lastname;
1570 $userstatic->firstname = $obj->firstname;
1571 $userstatic->email = $obj->user_email;
1572 $userstatic->statut = $obj->user_statut;
1573 $userstatic->status = $obj->user_statut;
1574 $userstatic->entity = $obj->entity;
1575 $userstatic->photo = $obj->photo;
1576 $userstatic->office_phone = $obj->office_phone;
1577 $userstatic->office_fax = $obj->office_fax;
1578 $userstatic->user_mobile = $obj->user_mobile;
1579 $userstatic->job = $obj->job;
1580 $userstatic->gender = $obj->gender;
1581 $facturestatic->id = $obj->facid;
1582 $facturestatic->ref = $obj->ref;
1583 $facturestatic->type = $obj->type;
1584 $facturestatic->subtype = $obj->subtype;
1585 $facturestatic->total_ht = $obj->total_ht;
1586 $facturestatic->total_tva = $obj->total_vat;
1587 $facturestatic->total_ttc = $obj->total_ttc;
1588 $facturestatic->close_code = $obj->close_code;
1589 $facturestatic->ref_supplier = $obj->ref_supplier;
1590 $facturestatic->date_echeance = $db->jdate($obj->datelimite);
1591 $facturestatic->statut = $obj->fk_statut;
1592 $facturestatic->status = $obj->fk_statut;
1593 $facturestatic->note_public = $obj->note_public;
1594 $facturestatic->note_private = $obj->note_private;
1595 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1596 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1597 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1598 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1599 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1600 $thirdparty->id = $obj->socid;
1601 $thirdparty->name = $obj->name;
1602 $thirdparty->name_alias = $obj->alias;
1603 $thirdparty->client = $obj->client;
1604 $thirdparty->fournisseur = $obj->fournisseur;
1605 $thirdparty->code_client = $obj->code_client;
1606 $thirdparty->code_compta_client = $obj->code_compta_client;
1607 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1608 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1609 $thirdparty->email = $obj->email;
1610 $thirdparty->country_code = $obj->country_code;
1612 $paiement = $facturestatic->getSommePaiement();
1613 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1614 $totaldeposits = $facturestatic->getSumDepositsUsed();
1615 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1616 $remaintopay = $obj->total_ttc - $totalpay;
1618 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1619 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1620 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1622 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1623 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1625 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1626 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1630 $multicurrency_remaintopay = 0;
1633 $remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id);
1634 $remaintopay = -$remaincreditnote;
1635 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1636 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1637 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1638 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1641 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1643 $facturestatic->paye = $obj->paye;
1644 $facturestatic->paid = $obj->paye;
1646 $facturestatic->date = $db->jdate($obj->datef);
1652 if ($facturestatic->isCreditNoteUsed()) {
1653 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1657 if ($mode ==
'kanban') {
1659 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1660 print
'<div class="box-flex-container kanban">';
1663 if ($massactionbutton || $massaction) {
1665 if (in_array(
$object->id, $arrayofselected)) {
1670 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $thirdparty->getNomUrl(1,
'', 12),
'selected' => in_array(
$object->id, $arrayofselected));
1671 print $facturestatic->getKanbanView(
'', $arraydata);
1672 if ($i == ($imaxinloop - 1)) {
1679 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->fk_statut > 1) ?
'opacitymedium' :
'').
'">';
1683 print
'<td class="nowrap center">';
1684 if ($massactionbutton || $massaction) {
1686 if (in_array($obj->facid, $arrayofselected)) {
1689 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1696 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1697 print
'<td class="nowraponall">';
1699 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1701 print
'<td class="nobordernopadding nowraponall">';
1702 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1705 $filedir =
$conf->fournisseur->facture->dir_output.
'/'.
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1706 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1707 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1708 print
'</td></tr></table>';
1717 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1718 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1719 print $obj->ref_supplier;
1727 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1728 print
'<td class="nowrap">';
1729 print $facturestatic->getLibType();
1737 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1739 if ($facturestatic->subtype > 0) {
1740 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture_fourn');
1742 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
1751 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1752 print
'<td class="nowrap tdoverflowmax125" title="'.dol_escape_htmltag($obj->label).
'">';
1761 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1762 print
'<td class="center nowrap">';
1771 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1772 print
'<td class="center nowraponall">'.dol_print_date($datelimit,
'day');
1773 if ($facturestatic->hasDelay()) {
1774 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
1783 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1784 print
'<td class="nowrap">';
1785 if ($obj->project_id > 0) {
1786 $projectstatic->id = $obj->project_id;
1787 $projectstatic->ref = $obj->project_ref;
1788 $projectstatic->title = $obj->project_label;
1789 print $projectstatic->getNomUrl(1);
1798 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1799 print
'<td class="tdoverflowmax125">';
1800 print $thirdparty->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1807 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1808 print
'<td class="tdoverflowmax150">';
1816 if (!empty($arrayfields[
's.town'][
'checked'])) {
1817 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1825 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1826 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1834 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1835 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">';
1843 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1844 print
'<td class="center">';
1845 $tmparray =
getCountry($obj->fk_pays,
'all');
1846 print $tmparray[
'label'];
1853 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1854 print
'<td class="center">';
1855 if (empty($typenArray)) {
1856 $typenArray = $formcompany->typent_array(1);
1858 print $typenArray[$obj->typent_code];
1866 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1867 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 1,
'', -1, -1, 1);
1868 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1876 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1877 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
1878 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1887 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1888 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1893 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
1896 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1897 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_vat).
"</span></td>\n";
1902 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
1905 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1906 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax1).
"</span></td>\n";
1911 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
1914 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1915 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax2).
"</span></td>\n";
1920 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
1923 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1924 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1929 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
1933 if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1934 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1935 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
1936 $upload_dir =
$conf->fournisseur->facture->dir_output.
'/'.
get_exdir($facturestatic->id, 2, 0, 0, $facturestatic,
'invoice_supplier').$facturestatic->ref;
1937 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
1938 $nbLinks =
Link::count($db, $facturestatic->element, $facturestatic->id);
1939 $nbTotal = $nbFiles + $nbLinks;
1940 echo
'<td class="center">'.(empty($nbTotal) ?
'' : $nbTotal).
'</td>';
1947 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1948 print
'<td class="tdoverflowmax100">';
1949 if ($userstatic->id) {
1950 print $userstatic->getNomUrl(-1);
1961 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1962 print
'<td class="right nowrap"><span class="amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
'').
'</span></td>';
1971 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1972 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
1981 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1982 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1989 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1990 print
'<td class="nowrap">';
1991 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1998 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1999 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2005 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2006 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2012 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2013 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2019 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2020 print
'<td class="right nowrap"><span class="amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
'').
'</span></td>';
2027 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2028 print
'<td class="right nowrap"><span class="amount">';
2029 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
'');
2030 print
'</span></td>';
2038 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2040 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2041 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2042 print $hookmanager->resPrint;
2045 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2046 print
'<td class="center nowraponall">';
2047 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2054 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2055 print
'<td class="center nowraponall">';
2056 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2063 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2064 print
'<td class="center nowrap">';
2065 print $facturestatic->getLibStatut(5, $paiement);
2074 print
'<td class="nowrap center">';
2075 if ($massactionbutton || $massaction) {
2077 if (in_array($obj->facid, $arrayofselected)) {
2080 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2095include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2100 foreach ($arrayfields as $key => $val) {
2101 if (!empty($val[
'checked'])) {
2105 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2110$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2111$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2112print $hookmanager->resPrint;
2114print
'</table>'.
"\n";
2117print
'</form>'.
"\n";
2119if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2120 $hidegeneratedfilelistifempty = 1;
2121 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2122 $hidegeneratedfilelistifempty = 0;
2125 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2129 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2130 $urlsource .= str_replace(
'&',
'&', $param);
2132 $filedir = $diroutputmassaction;
2133 $genallowed = $permissiontoread;
2134 $delallowed = $permissiontoadd;
2137 print $formfile->showdocuments(
'massfilesarea_supplier_invoice',
'', $filedir, $urlsource, 0, (
int) $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 absolute discounts.
Class to manage suppliers invoices.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const TYPE_REPLACEMENT
Replacement invoice.
const TYPE_STANDARD
Standard invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage suppliers.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
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.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
buildParamDate($prefix, $timestamp=null, $hourTime='', $gm='auto')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
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...
supplier_invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.