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';
54$langs->loadLangs(array(
'products',
'bills',
'companies',
'projects'));
56$action =
GETPOST(
'action',
'aZ09');
57$massaction =
GETPOST(
'massaction',
'alpha');
59$confirm =
GETPOST(
'confirm',
'alpha');
60$toselect =
GETPOST(
'toselect',
'array');
61$optioncss =
GETPOST(
'optioncss',
'alpha');
62$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicelist';
65$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
66$search_label =
GETPOST(
"search_label",
"alpha");
67$search_amount_no_tax =
GETPOST(
"search_amount_no_tax",
"alpha");
68$search_amount_all_tax =
GETPOST(
"search_amount_all_tax",
"alpha");
70$search_refsupplier =
GETPOST(
'search_refsupplier',
'alpha');
71$search_type =
GETPOST(
'search_type',
'intcomma');
72$search_subtype =
GETPOST(
'search_subtype',
'intcomma');
73$search_project =
GETPOST(
'search_project',
'alpha');
74$search_company =
GETPOST(
'search_company',
'alpha');
75$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
76$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
77$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
78$search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
79$search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
80$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
81$search_login =
GETPOST(
'search_login',
'alpha');
82$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
83$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
84$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
85$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
86$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
87$search_status =
GETPOST(
'search_status',
'intcomma');
88$search_paymentmode =
GETPOST(
'search_paymentmode',
'intcomma');
89$search_paymentcond =
GETPOST(
'search_paymentcond',
'intcomma');
90$search_town =
GETPOST(
'search_town',
'alpha');
91$search_zip =
GETPOST(
'search_zip',
'alpha');
92$search_state =
GETPOST(
"search_state");
93$search_country =
GETPOST(
"search_country",
'aZ09');
94$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
95$search_user =
GETPOST(
'search_user',
'intcomma');
96$search_sale =
GETPOST(
'search_sale',
'intcomma');
97$search_date_start =
GETPOSTDATE(
'search_date_start',
'',
'tzserver');
98$search_date_end =
GETPOSTDATE(
'search_date_end',
'23:59:59',
'tzserver');
99$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
100$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
101$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
102$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
103$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
104$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
105$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
106$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
107$search_categ_sup =
GETPOST(
"search_categ_sup",
'intcomma');
108$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
109$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
111$option =
GETPOST(
'search_option');
112if ($option ==
'late') {
113 $search_status =
'1';
115$filter =
GETPOST(
'filtre',
'alpha');
119$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
120$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
122if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
126$offset = $limit * $page;
131 $sortfield =
"f.datef,f.rowid";
133$pageprev = $page - 1;
134$pagenext = $page + 1;
139if ($user->socid > 0) {
141 $socid = $user->socid;
144$diroutputmassaction = $conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id;
150$hookmanager->initHooks(array(
'supplierinvoicelist'));
154$extrafields->fetch_name_optionals_label(
$object->table_element);
156$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
159$fieldstosearchall = array(
161 'f.ref_supplier' =>
'RefSupplier',
162 'f.note_public' =>
'NotePublic',
163 's.nom' =>
"ThirdParty",
164 's.code_fournisseur' =>
"SupplierCodeShort",
165 'pd.description' =>
'Description',
167if (empty($user->socid)) {
168 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
171$checkedtypetiers = 0;
173 'f.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
174 'f.ref_supplier' => array(
'label' =>
"RefSupplier",
'checked' => 1,
'position' => 7),
175 'f.type' => array(
'label' =>
"Type",
'checked' => 0,
'position' => 15),
176 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' => 0,
'position' => 17),
177 'f.label' => array(
'label' =>
"Label",
'checked' => 0,
'position' => 20),
178 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' => 1,
'position' => 25),
179 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' => 1,
'position' => 27),
180 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => 0,
'position' => 30),
181 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 41),
182 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0,
'position' => 42),
183 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 43),
184 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 44),
185 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
186 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 46),
187 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 49),
188 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => 1,
'position' => 52),
189 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => 1,
'position' => 50),
190 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 105),
191 'f.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 110),
192 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked' => 0,
'enabled' => $mysoc->localtax1_assuj ==
"1",
'position' => 95),
193 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked' => 0,
'enabled' => $mysoc->localtax2_assuj ==
"1",
'position' => 100),
194 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 1,
'position' => 115),
195 'dynamount_payed' => array(
'label' =>
"Paid",
'checked' => 0,
'position' => 116),
196 'rtp' => array(
'label' =>
"Rest",
'checked' => 0,
'position' => 117),
197 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'position' => 205,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
198 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'position' => 206,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
199 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'position' => 207,
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
200 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'position' => 208,
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
201 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'position' => 209,
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
202 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'position' => 210,
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
203 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' => 0,
'position' => 211,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
204 'u.login' => array(
'label' =>
"Author",
'checked' => -1,
'position' => 500),
205 'f.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 501),
206 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 502),
207 'f.nb_docs' => array(
'label' =>
"Documents",
'checked' => -1,
'position' => 510),
208 'f.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
211include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
213$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
214if (empty($subtypearray)) {
215 unset($arrayfields[
'f.subtype']);
220'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
222if (!isModEnabled(
'supplier_invoice')) {
225if ((!$user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))
226 || (!$user->hasRight(
"supplier_invoice",
"lire") &&
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))) {
230if (!$user->hasRight(
'societe',
'client',
'voir')) {
231 $search_sale = $user->id;
234$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
235$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
236$permissiontodelete = ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer"));
243if (
GETPOST(
'cancel',
'alpha')) {
247if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
251$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
252$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
257if (empty($reshook)) {
259 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
262 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
266 $search_product_category =
'';
268 $search_refsupplier =
"";
270 $search_subtype =
'';
272 $search_project =
'';
273 $search_company =
"";
274 $search_company_alias =
"";
275 $search_amount_no_tax =
"";
276 $search_amount_all_tax =
"";
277 $search_montant_ht =
'';
278 $search_montant_vat =
'';
279 $search_montant_localtax1 =
'';
280 $search_montant_localtax2 =
'';
281 $search_montant_ttc =
'';
283 $search_multicurrency_code =
'';
284 $search_multicurrency_tx =
'';
285 $search_multicurrency_montant_ht =
'';
286 $search_multicurrency_montant_vat =
'';
287 $search_multicurrency_montant_ttc =
'';
289 $search_paymentmode =
'';
290 $search_paymentcond =
'';
294 $search_country =
'';
295 $search_type_thirdparty =
'';
296 $search_date_start =
'';
297 $search_date_end =
'';
298 $search_datelimit_startday =
'';
299 $search_datelimit_startmonth =
'';
300 $search_datelimit_startyear =
'';
301 $search_datelimit_endday =
'';
302 $search_datelimit_endmonth =
'';
303 $search_datelimit_endyear =
'';
304 $search_datelimit_start =
'';
305 $search_datelimit_end =
'';
307 $search_array_options = array();
308 $search_categ_sup = 0;
315 $objectclass =
'FactureFournisseur';
316 $objectlabel =
'SupplierInvoices';
318 $uploaddir = $conf->fournisseur->facture->dir_output;
320 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
322 if ($massaction ==
'banktransfertrequest') {
323 $langs->load(
"withdrawals");
325 if (!$user->hasRight(
"paymentbybanktransfer",
"create")) {
332 $arrayofselected = is_array($toselect) ? $toselect : array();
333 $listofbills = array();
334 foreach ($arrayofselected as $toselectid) {
336 $result = $objecttmp->fetch($toselectid);
338 $totalpaid = $objecttmp->getSommePaiement();
339 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
340 $totaldeposits = $objecttmp->getSumDepositsUsed();
341 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
344 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
345 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
348 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
349 $objecttmp->resteapayer = $remaintopay;
351 } elseif ($reshook < 0) {
353 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
358 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
359 } elseif ($objecttmp->paid || $objecttmp->resteapayer == 0) {
361 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
362 } elseif ($objecttmp->resteapayer < 0) {
364 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
367 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
368 $rsql .=
" , pfd.date_traite as date_traite";
369 $rsql .=
" , pfd.amount";
370 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
371 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
372 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
373 $rsql .=
" WHERE fk_facture_fourn = ".((int) $objecttmp->id);
374 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
375 $rsql .=
" AND pfd.traite = 0";
376 $rsql .=
" ORDER BY pfd.date_demande DESC";
378 $result_sql = $db->query($rsql);
380 $numprlv = $db->num_rows($result_sql);
385 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
386 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'VIR') {
387 $langs->load(
"errors");
389 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
391 $listofbills[] = $objecttmp;
397 if (!empty($listofbills)) {
398 $nbwithdrawrequestok = 0;
399 foreach ($listofbills as $aBill) {
401 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'bank-transfer',
'supplier_invoice');
404 $nbwithdrawrequestok++;
410 if ($nbwithdrawrequestok > 0) {
411 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
423$form =
new Form($db);
426$bankaccountstatic =
new Account($db);
430$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
436 if (empty($search_company)) {
437 $search_company = $soc->name;
441$title = $langs->trans(
"BillsSuppliers").($socid ?
' - '.$soc->name :
'');
442$help_url =
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
448 $sql =
'SELECT DISTINCT';
450$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,";
451$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,";
452$sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
453$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,';
454$sql .=
" f.note_public, f.note_private,";
455$sql .=
" f.fk_user_author,";
456$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,";
457$sql .=
" typent.code as typent_code,";
458$sql .=
" state.code_departement as state_code, state.nom as state_name,";
459$sql .=
" country.code as country_code,";
460$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
461$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';
463if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
464 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
465 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
469$parameters = array();
470$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
471$sql .= $hookmanager->resPrint;
472$sql = preg_replace(
'/,\s*$/',
'', $sql);
477 $sql .=
', SUM(pf.amount) as dynamount_payed';
482$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
483$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
484$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
485$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
486$sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
487if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
488 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
491 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
494 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn';
496$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
497$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
498if ($search_user > 0) {
499 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
500 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
503$parameters = array();
504$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
505$sql .= $hookmanager->resPrint;
506$sql .=
' WHERE f.fk_soc = s.rowid';
507$sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
509 $sql .=
' AND s.rowid = '.((int) $socid);
512 if (is_numeric($search_ref)) {
521if ($search_refsupplier) {
524if ($search_type !=
'' && $search_type >= 0) {
525 if ($search_type ==
'0') {
526 $sql .=
" AND f.type = 0";
528 if ($search_type ==
'1') {
529 $sql .=
" AND f.type = 1";
531 if ($search_type ==
'2') {
532 $sql .=
" AND f.type = 2";
534 if ($search_type ==
'3') {
535 $sql .=
" AND f.type = 3";
540if ($search_subtype !=
'' && $search_subtype !=
'-1') {
541 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
543if ($search_project) {
546if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
547 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
549 if ($search_company) {
552 if ($search_company_alias) {
565if (strlen(trim($search_country))) {
567 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
568 foreach ($arrayofcode as $key => $value) {
569 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
570 if ($value != $mysoc->country_code) {
571 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
574 if ($search_country ==
'special_allnotme') {
575 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
576 } elseif ($search_country ==
'special_eec') {
577 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
578 } elseif ($search_country ==
'special_eecnotme') {
579 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
580 } elseif ($search_country ==
'special_noteec') {
581 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
586if ($search_type_thirdparty !=
'' && $search_type_thirdparty >= 0) {
587 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
589if ($search_montant_ht !=
'') {
592if ($search_montant_vat !=
'') {
595if ($search_montant_localtax1 !=
'') {
596 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
598if ($search_montant_localtax2 !=
'') {
599 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
601if ($search_montant_ttc !=
'') {
604if ($search_multicurrency_code !=
'') {
605 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
607if ($search_multicurrency_tx !=
'') {
608 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
610if ($search_multicurrency_montant_ht !=
'') {
611 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
613if ($search_multicurrency_montant_vat !=
'') {
614 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
616if ($search_multicurrency_montant_ttc !=
'') {
617 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
620 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname'), $search_login);
622if ($search_status !=
'' && $search_status >= 0) {
623 $sql .=
" AND f.fk_statut = ".((int) $search_status);
625if ($search_paymentmode > 0) {
626 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
628if ($search_paymentcond > 0) {
629 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
631if ($search_date_start) {
632 $sql .=
" AND f.datef >= '" . $db->idate($search_date_start) .
"'";
634if ($search_date_end) {
635 $sql .=
" AND f.datef <= '" . $db->idate($search_date_end) .
"'";
637if ($search_datelimit_start) {
638 $sql .=
" AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) .
"'";
640if ($search_datelimit_end) {
641 $sql .=
" AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) .
"'";
643if ($option ==
'late') {
644 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->fournisseur->warning_delay).
"'";
649if ($search_fk_fac_rec_source) {
650 $sql .=
" AND f.fk_fac_rec_source = ".(int) $search_fk_fac_rec_source;
653if ($search_sale && $search_sale !=
'-1') {
654 if ($search_sale == -2) {
655 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
656 } elseif ($search_sale > 0) {
657 $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).
")";
660$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
661$searchCategorySupplierOperator = 0;
663if (!empty($searchCategorySupplierList)) {
664 $searchCategorySupplierSqlList = array();
665 $listofcategoryid =
'';
666 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
667 if (intval($searchCategorySupplier) == -2) {
668 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
669 } elseif (intval($searchCategorySupplier) > 0) {
670 if ($searchCategorySupplierOperator == 0) {
671 $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).
")";
673 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
677 if ($listofcategoryid) {
678 $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).
"))";
680 if ($searchCategorySupplierOperator == 1) {
681 if (!empty($searchCategorySupplierSqlList)) {
682 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
685 if (!empty($searchCategorySupplierSqlList)) {
686 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
691$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
692$searchCategoryProductOperator = 0;
693if (!empty($searchCategoryProductList)) {
694 $searchCategoryProductSqlList = array();
695 $listofcategoryid =
'';
696 foreach ($searchCategoryProductList as $searchCategoryProduct) {
697 if (intval($searchCategoryProduct) == -2) {
698 $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)";
699 } elseif (intval($searchCategoryProduct) > 0) {
700 if ($searchCategoryProductOperator == 0) {
701 $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).
")";
703 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
707 if ($listofcategoryid) {
708 $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).
"))";
710 if ($searchCategoryProductOperator == 1) {
711 if (!empty($searchCategoryProductSqlList)) {
712 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
715 if (!empty($searchCategoryProductSqlList)) {
716 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
720if ($filter && $filter != -1) {
721 $aFilter = explode(
',', $filter);
722 foreach ($aFilter as $fil) {
723 $filt = explode(
':', $fil);
724 $sql .=
" AND ".$db->escape(trim($filt[0])).
" = '".$db->escape(trim($filt[1])).
"'";
731if ($search_user > 0) {
732 $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);
735include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
737$parameters = array();
738$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
739$sql .= $hookmanager->resPrint;
742 $sql .=
" GROUP BY f.rowid, f.ref, f.ref_supplier, f.type, f.subtype, f.datef, f.date_lim_reglement, f.fk_mode_reglement, f.fk_cond_reglement,";
743 $sql .=
" f.total_ht, f.total_ttc, f.total_tva, f.paye, f.close_code, f.fk_statut, f.libelle, f.datec, f.tms,";
744 $sql .=
" f.localtax1, f.localtax2,";
745 $sql .=
' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
746 $sql .=
" f.note_public, f.note_private,";
747 $sql .=
" f.fk_user_author,";
748 $sql .=
' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
749 $sql .=
" typent.code,";
750 $sql .=
" state.code_departement, state.nom,";
751 $sql .=
' country.code,';
752 $sql .=
" p.rowid, p.ref, p.title,";
753 $sql .=
" u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
754 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
755 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
757 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
",ef.".$key :
'');
761 $parameters = array(
'all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
762 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
763 $sql .= $hookmanager->resPrint;
765 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
769$parameters = array();
770$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
771$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
774$nbtotalofrecords =
'';
777 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
778 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
779 $sqlforcount = preg_replace(
'/LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid/',
'', $sqlforcount);
781 $resql = $db->query($sqlforcount);
783 $objforcount = $db->fetch_object($resql);
784 $nbtotalofrecords = $objforcount->nbtotalofrecords;
789 if (($page * $limit) > $nbtotalofrecords) {
797$sql .= $db->order($sortfield, $sortorder);
799 $sql .= $db->plimit($limit + 1, $offset);
803$resql = $db->query($sql);
809$num = $db->num_rows($resql);
812if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
813 $obj = $db->fetch_object($resql);
815 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$id);
822llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-fourn-facture page-list');
824if ($search_fk_fac_rec_source) {
825 require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
826 require_once DOL_DOCUMENT_ROOT .
'/core/lib/invoice.lib.php';
828 $object->fetch((
int) $search_fk_fac_rec_source);
831 print
dol_get_fiche_head($head,
'generated', $langs->trans(
'InvoicesGeneratedFromRec'), -1,
'bill');
837 if (empty($search_company)) {
838 $search_company = $soc->name;
839 $search_company_alias = $soc->name_alias;
843$arrayofselected = is_array($toselect) ? $toselect : array();
845$param =
'&socid='.$socid;
847 $param .=
'&mode='.urlencode($mode);
849if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
850 $param .=
'&contextpage='.urlencode($contextpage);
852if ($limit > 0 && $limit != $conf->liste_limit) {
853 $param .=
'&limit='.((int) $limit);
855if ($optioncss !=
'') {
856 $param .=
'&optioncss='.urlencode($optioncss);
859 $param .=
'&search_all='.urlencode($search_all);
861if ($search_date_start) {
862 $param .=
buildParamDate(
'search_date_start',
null,
'',
'tzserver');
864if ($search_date_end) {
865 $param .=
buildParamDate(
'search_date_end',
null,
'',
'tzserver');
867if ($search_datelimit_startday) {
868 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
870if ($search_datelimit_startmonth) {
871 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
873if ($search_datelimit_startyear) {
874 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
876if ($search_datelimit_endday) {
877 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
879if ($search_datelimit_endmonth) {
880 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
882if ($search_datelimit_endyear) {
883 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
886 $param .=
'&search_ref='.urlencode($search_ref);
888if ($search_refsupplier) {
889 $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
891if ($search_type !=
'') {
892 $param .=
'&search_type='.urlencode($search_type);
894if ($search_subtype !=
'') {
895 $param .=
'&search_subtype='.urlencode($search_subtype);
898 $param .=
'&search_label='.urlencode($search_label);
900if ($search_company) {
901 $param .=
'&search_company='.urlencode($search_company);
903if ($search_company_alias) {
904 $param .=
'&search_company_alias='.urlencode($search_company_alias);
907 $param .=
'&search_login='.urlencode($search_login);
909if ($search_montant_ht !=
'') {
910 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
912if ($search_montant_vat !=
'') {
913 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
915if ($search_montant_localtax1 !=
'') {
916 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
918if ($search_montant_localtax2 !=
'') {
919 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
921if ($search_montant_ttc !=
'') {
922 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
924if ($search_multicurrency_code !=
'') {
925 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
927if ($search_multicurrency_tx !=
'') {
928 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
930if ($search_multicurrency_montant_ht !=
'') {
931 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
933if ($search_multicurrency_montant_vat !=
'') {
934 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
936if ($search_multicurrency_montant_ttc !=
'') {
937 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
939if ($search_amount_no_tax) {
940 $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
942if ($search_amount_all_tax) {
943 $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
945if ($search_status >= 0) {
946 $param .=
"&search_status=".urlencode($search_status);
948if ($search_paymentmode) {
949 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
951if ($search_paymentcond) {
952 $param .=
'&search_paymentcond='.urlencode((
string) ($search_paymentcond));
955 $param .=
'&show_files='.urlencode((
string) ($show_files));
958 $param .=
"&search_option=".urlencode($option);
960if ($search_categ_sup > 0) {
961 $param .=
'&search_categ_sup='.$search_categ_sup;
963if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
964 $param .=
'&search_type_thirdparty='.$search_type_thirdparty;
966if ($search_fk_fac_rec_source) {
967 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
971include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
973$parameters = array(
'param' => &$param);
974$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
975$param .= $hookmanager->resPrint;
978$arrayofmassactions = array(
979 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
980 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
981 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
985if (isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
"paymentbybanktransfer",
"create")) {
986 $langs->load(
'withdrawals');
987 $arrayofmassactions[
'banktransfertrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
989if (!empty($permissiontodelete)) {
990 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
992if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
993 $arrayofmassactions = array();
995$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
997$url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
999 $url .=
'&socid='.urlencode((
string) (
$object->socid));
1002 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1005print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1006if ($optioncss !=
'') {
1007 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1009print
'<input type="hidden" name="token" value="'.newToken().
'">';
1010print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1011print
'<input type="hidden" name="action" value="list">';
1012print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1013print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1014print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1015print
'<input type="hidden" name="page" value="'.$page.
'">';
1016print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1017print
'<input type="hidden" name="page_y" value="">';
1018print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1021$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'));
1022$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'));
1024$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', (
int) ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")));
1026print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_invoice', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1029$topicmail =
"SendBillRef";
1030$modelmail =
"invoice_supplier_send";
1032$trackid =
'sinv'.$object->id;
1033include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1037 foreach ($fieldstosearchall as $key => $val) {
1038 $fieldstosearchall[$key] = $langs->trans($val);
1039 $setupstring .= $key.
"=".$val.
";";
1041 print
'<!-- Search done like if SUPPLIER_INVOICE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1042 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1047if ($user->hasRight(
"user",
"user",
"lire")) {
1048 $langs->load(
"commercial");
1049 $moreforfilter .=
'<div class="divsearchfield">';
1050 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1051 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1052 $moreforfilter .=
'</div>';
1055if ($user->hasRight(
"user",
"user",
"lire")) {
1056 $moreforfilter .=
'<div class="divsearchfield">';
1057 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1058 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
1059 $moreforfilter .=
'</div>';
1062if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1063 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1064 $moreforfilter .=
'<div class="divsearchfield">';
1065 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1066 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1067 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
1068 $moreforfilter .=
'</div>';
1071if (isModEnabled(
'category')) {
1072 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1073 $moreforfilter .=
'<div class="divsearchfield">';
1074 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1075 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $tmptitle);
1076 $moreforfilter .=
'</div>';
1078$parameters = array();
1079$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1080if (empty($reshook)) {
1081 $moreforfilter .= $hookmanager->resPrint;
1083 $moreforfilter = $hookmanager->resPrint;
1086if (!empty($moreforfilter)) {
1087 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1088 print $moreforfilter;
1092$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1093$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1094$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1095$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1097print
'<div class="div-table-responsive">';
1098print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1102print
'<tr class="liste_titre_filter">';
1105 print
'<td class="liste_titre center maxwidthsearch">';
1106 $searchpicto = $form->showFilterButtons(
'left');
1111if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1112 print
'<td class="liste_titre left">';
1113 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1117if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1118 print
'<td class="liste_titre">';
1119 print
'<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).
'">';
1123if (!empty($arrayfields[
'f.type'][
'checked'])) {
1124 print
'<td class="liste_titre maxwidthonsmartphone">';
1131 print $form->selectarray(
'search_type', $typearray, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
1135if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1136 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1137 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1141if (!empty($arrayfields[
'f.label'][
'checked'])) {
1142 print
'<td class="liste_titre">';
1143 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
1147if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1148 print
'<td class="liste_titre center">';
1149 print
'<div class="nowrapfordate">';
1150 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1152 print
'<div class="nowrapfordate">';
1153 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1158if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1159 print
'<td class="liste_titre center">';
1160 print
'<div class="">';
1167 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1169 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>';
1174if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1175 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1178if (!empty($arrayfields[
's.nom'][
'checked'])) {
1179 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1182if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1183 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1186if (!empty($arrayfields[
's.town'][
'checked'])) {
1187 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1190if (!empty($arrayfields[
's.zip'][
'checked'])) {
1191 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1194if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1195 print
'<td class="liste_titre">';
1196 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1200if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1201 print
'<td class="liste_titre center">';
1202 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1206if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1207 print
'<td class="liste_titre maxwidthonsmartphone center">';
1208 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);
1212if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1213 print
'<td class="liste_titre left">';
1214 print $form->getSelectConditionsPaiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
1218if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1219 print
'<td class="liste_titre">';
1220 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100', 1);
1223if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1225 print
'<td class="liste_titre right">';
1226 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1229if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1231 print
'<td class="liste_titre right">';
1232 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1235if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1237 print
'<td class="liste_titre right">';
1238 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1241if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1243 print
'<td class="liste_titre right">';
1244 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1247if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1249 print
'<td class="liste_titre right">';
1250 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1253if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1255 print
'<td class="liste_titre" align="center">';
1258if (!empty($arrayfields[
'u.login'][
'checked'])) {
1260 print
'<td class="liste_titre" align="center">';
1261 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1264if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1265 print
'<td class="liste_titre right">';
1268if (!empty($arrayfields[
'rtp'][
'checked'])) {
1269 print
'<td class="liste_titre">';
1272if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1274 print
'<td class="liste_titre">';
1275 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1278if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1280 print
'<td class="liste_titre">';
1281 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1284if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1286 print
'<td class="liste_titre right">';
1287 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1290if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1292 print
'<td class="liste_titre right">';
1293 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1296if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1298 print
'<td class="liste_titre right">';
1299 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1302if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1303 print
'<td class="liste_titre">';
1306if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1307 print
'<td class="liste_titre right">';
1311include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1314$parameters = array(
'arrayfields' => $arrayfields);
1315$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1316print $hookmanager->resPrint;
1318if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1319 print
'<td class="liste_titre">';
1323if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1324 print
'<td class="liste_titre">';
1328if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1329 print
'<td class="liste_titre center parentonrightofpage">';
1330 $liststatus = array(
'0' => $langs->trans(
"Draft"),
'1' => $langs->trans(
"Unpaid"),
'2' => $langs->trans(
"Paid"));
1332 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'center search_status width100 onrightofpage', 1);
1337 print
'<td class="liste_titre center maxwidthsearch">';
1338 $searchpicto = $form->showFilterButtons();
1345$totalarray = array();
1346$totalarray[
'nbfield'] = 0;
1350print
'<tr class="liste_titre">';
1353 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1354 $totalarray[
'nbfield']++;
1356if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
1358 $totalarray[
'nbfield']++;
1360if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1361 print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
1362 $totalarray[
'nbfield']++;
1364if (!empty($arrayfields[
'f.type'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1366 $totalarray[
'nbfield']++;
1368if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1371if (!empty($arrayfields[
'f.label'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'f.label'][
'label'], $_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
1373 $totalarray[
'nbfield']++;
1375if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1376 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1377 $totalarray[
'nbfield']++;
1379if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1381 $totalarray[
'nbfield']++;
1383if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1385 $totalarray[
'nbfield']++;
1387if (!empty($arrayfields[
's.nom'][
'checked'])) {
1388 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1389 $totalarray[
'nbfield']++;
1391if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1394 $totalarray[
'nbfield']++;
1396if (!empty($arrayfields[
's.town'][
'checked'])) {
1397 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1398 $totalarray[
'nbfield']++;
1400if (!empty($arrayfields[
's.zip'][
'checked'])) {
1401 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1402 $totalarray[
'nbfield']++;
1404if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1405 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.name_alias",
"", $param,
'', $sortfield, $sortorder);
1406 $totalarray[
'nbfield']++;
1408if (!empty($arrayfields[
'state.name_alias'][
'checked'])) {
1409 print_liste_field_titre($arrayfields[
'state.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1410 $totalarray[
'nbfield']++;
1412if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1413 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1414 $totalarray[
'nbfield']++;
1416if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1417 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1418 $totalarray[
'nbfield']++;
1420if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1421 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1422 $totalarray[
'nbfield']++;
1424if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1425 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1426 $totalarray[
'nbfield']++;
1428if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1430 $totalarray[
'nbfield']++;
1432if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1433 print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1434 $totalarray[
'nbfield']++;
1436if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1437 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1438 $totalarray[
'nbfield']++;
1440if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1442 $totalarray[
'nbfield']++;
1444if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1445 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1446 $totalarray[
'nbfield']++;
1448if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1449 print_liste_field_titre($arrayfields[
'f.nb_docs'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1450 $totalarray[
'nbfield']++;
1452if (!empty($arrayfields[
'u.login'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1454 $totalarray[
'nbfield']++;
1456if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1457 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1458 $totalarray[
'nbfield']++;
1460if (!empty($arrayfields[
'rtp'][
'checked'])) {
1461 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1462 $totalarray[
'nbfield']++;
1464if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1465 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1466 $totalarray[
'nbfield']++;
1468if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1469 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1470 $totalarray[
'nbfield']++;
1472if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1473 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'"', $sortfield, $sortorder,
'right ');
1474 $totalarray[
'nbfield']++;
1476if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1477 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1478 $totalarray[
'nbfield']++;
1480if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1481 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1482 $totalarray[
'nbfield']++;
1484if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1485 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1486 $totalarray[
'nbfield']++;
1488if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1489 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1490 $totalarray[
'nbfield']++;
1493include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1495$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1496$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1497print $hookmanager->resPrint;
1498if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1499 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1500 $totalarray[
'nbfield']++;
1502if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1503 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1504 $totalarray[
'nbfield']++;
1506if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1507 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1508 $totalarray[
'nbfield']++;
1512 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1513 $totalarray[
'nbfield']++;
1519$projectstatic =
new Project($db);
1520$userstatic =
new User($db);
1526$savnbfield = $totalarray[
'nbfield'];
1527$totalarray = array();
1528$totalarray[
'nbfield'] = 0;
1529$totalarray[
'val'] = array();
1530$totalarray[
'val'][
'f.total_ht'] = 0;
1531$totalarray[
'val'][
'f.total_vat'] = 0;
1532$totalarray[
'val'][
'f.total_localtax1'] = 0;
1533$totalarray[
'val'][
'f.total_localtax1'] = 0;
1534$totalarray[
'val'][
'f.total_ttc'] = 0;
1535$totalarray[
'val'][
'totalam'] = 0;
1536$totalarray[
'val'][
'rtp'] = 0;
1538$imaxinloop = ($limit ? min($num, $limit) : $num);
1539while ($i < $imaxinloop) {
1540 $obj = $db->fetch_object($resql);
1545 $datelimit = $db->jdate($obj->datelimite);
1547 $userstatic->id = $obj->fk_user_author;
1548 $userstatic->login = $obj->login;
1549 $userstatic->lastname = $obj->lastname;
1550 $userstatic->firstname = $obj->firstname;
1551 $userstatic->email = $obj->user_email;
1552 $userstatic->statut = $obj->user_statut;
1553 $userstatic->status = $obj->user_statut;
1554 $userstatic->entity = $obj->entity;
1555 $userstatic->photo = $obj->photo;
1556 $userstatic->office_phone = $obj->office_phone;
1557 $userstatic->office_fax = $obj->office_fax;
1558 $userstatic->user_mobile = $obj->user_mobile;
1559 $userstatic->job = $obj->job;
1560 $userstatic->gender = $obj->gender;
1561 $facturestatic->id = $obj->facid;
1562 $facturestatic->ref = $obj->ref;
1563 $facturestatic->type = $obj->type;
1564 $facturestatic->subtype = $obj->subtype;
1565 $facturestatic->total_ht = $obj->total_ht;
1566 $facturestatic->total_tva = $obj->total_vat;
1567 $facturestatic->total_ttc = $obj->total_ttc;
1568 $facturestatic->close_code = $obj->close_code;
1569 $facturestatic->ref_supplier = $obj->ref_supplier;
1570 $facturestatic->date_echeance = $db->jdate($obj->datelimite);
1571 $facturestatic->statut = $obj->fk_statut;
1572 $facturestatic->status = $obj->fk_statut;
1573 $facturestatic->note_public = $obj->note_public;
1574 $facturestatic->note_private = $obj->note_private;
1575 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1576 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1577 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1578 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1579 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1580 $thirdparty->id = $obj->socid;
1581 $thirdparty->name = $obj->name;
1582 $thirdparty->name_alias = $obj->alias;
1583 $thirdparty->client = $obj->client;
1584 $thirdparty->fournisseur = $obj->fournisseur;
1585 $thirdparty->code_client = $obj->code_client;
1586 $thirdparty->code_compta_client = $obj->code_compta_client;
1587 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1588 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1589 $thirdparty->email = $obj->email;
1590 $thirdparty->country_code = $obj->country_code;
1592 $paiement = $facturestatic->getSommePaiement();
1593 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1594 $totaldeposits = $facturestatic->getSumDepositsUsed();
1595 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1596 $remaintopay = $obj->total_ttc - $totalpay;
1598 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1599 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1600 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1602 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1603 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1605 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1606 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1610 $multicurrency_remaintopay = 0;
1613 $remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
'',
'rc.fk_facture_source='.$facturestatic->id);
1614 $remaintopay = -$remaincreditnote;
1615 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1616 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1617 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1618 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1621 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1623 $facturestatic->paye = $obj->paye;
1624 $facturestatic->paid = $obj->paye;
1626 $facturestatic->date = $db->jdate($obj->datef);
1632 if ($facturestatic->isCreditNoteUsed()) {
1633 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1637 if ($mode ==
'kanban') {
1639 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1640 print
'<div class="box-flex-container kanban">';
1643 if ($massactionbutton || $massaction) {
1645 if (in_array(
$object->id, $arrayofselected)) {
1650 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $thirdparty->getNomUrl(1,
'', 12),
'selected' => in_array(
$object->id, $arrayofselected));
1651 print $facturestatic->getKanbanView(
'', $arraydata);
1652 if ($i == ($imaxinloop - 1)) {
1659 print
'<tr data-rowid="'.$object->id.
'" class="oddeven '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->fk_statut > 1) ?
'opacitymedium' :
'').
'">';
1663 print
'<td class="nowrap center">';
1664 if ($massactionbutton || $massaction) {
1666 if (in_array($obj->facid, $arrayofselected)) {
1669 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1673 $totalarray[
'nbfield']++;
1676 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1677 print
'<td class="nowraponall">';
1679 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1681 print
'<td class="nobordernopadding nowraponall">';
1682 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1685 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1686 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1687 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1688 print
'</td></tr></table>';
1692 $totalarray[
'nbfield']++;
1697 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1698 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1699 print $obj->ref_supplier;
1702 $totalarray[
'nbfield']++;
1707 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1708 print
'<td class="nowrap">';
1709 print $facturestatic->getLibType();
1712 $totalarray[
'nbfield']++;
1717 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1719 if ($facturestatic->subtype > 0) {
1720 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture_fourn');
1722 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
1726 $totalarray[
'nbfield']++;
1731 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1732 print
'<td class="nowrap tdoverflowmax125" title="'.dol_escape_htmltag($obj->label).
'">';
1736 $totalarray[
'nbfield']++;
1741 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1742 print
'<td class="center nowrap">';
1746 $totalarray[
'nbfield']++;
1751 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1752 print
'<td class="center nowraponall">'.dol_print_date($datelimit,
'day');
1753 if ($facturestatic->hasDelay()) {
1754 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
1758 $totalarray[
'nbfield']++;
1763 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1764 print
'<td class="nowrap">';
1765 if ($obj->project_id > 0) {
1766 $projectstatic->id = $obj->project_id;
1767 $projectstatic->ref = $obj->project_ref;
1768 $projectstatic->title = $obj->project_label;
1769 print $projectstatic->getNomUrl(1);
1773 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1779 print
'<td class="tdoverflowmax125">';
1780 print $thirdparty->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1783 $totalarray[
'nbfield']++;
1787 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1788 print
'<td class="tdoverflowmax150">';
1792 $totalarray[
'nbfield']++;
1796 if (!empty($arrayfields[
's.town'][
'checked'])) {
1797 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1801 $totalarray[
'nbfield']++;
1805 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1806 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1810 $totalarray[
'nbfield']++;
1814 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1815 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">';
1819 $totalarray[
'nbfield']++;
1823 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1824 print
'<td class="center">';
1825 $tmparray =
getCountry($obj->fk_pays,
'all');
1826 print $tmparray[
'label'];
1829 $totalarray[
'nbfield']++;
1833 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1834 print
'<td class="center">';
1835 if (empty($typenArray)) {
1836 $typenArray = $formcompany->typent_array(1);
1838 print $typenArray[$obj->typent_code];
1841 $totalarray[
'nbfield']++;
1846 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1847 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 1,
'', -1, -1, 1);
1848 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1852 $totalarray[
'nbfield']++;
1856 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1857 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
1858 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1862 $totalarray[
'nbfield']++;
1867 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1868 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1870 $totalarray[
'nbfield']++;
1871 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
1873 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
1876 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1877 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_vat).
"</span></td>\n";
1879 $totalarray[
'nbfield']++;
1880 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_vat';
1882 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
1885 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1886 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax1).
"</span></td>\n";
1888 $totalarray[
'nbfield']++;
1889 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
1891 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
1894 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1895 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax2).
"</span></td>\n";
1897 $totalarray[
'nbfield']++;
1898 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
1900 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
1903 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1904 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1906 $totalarray[
'nbfield']++;
1907 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
1909 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
1913 if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1914 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1915 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
1916 $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($facturestatic->id, 2, 0, 0, $facturestatic,
'invoice_supplier').$facturestatic->ref;
1917 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
1918 $nbLinks =
Link::count($db, $facturestatic->element, $facturestatic->id);
1919 $nbTotal = $nbFiles + $nbLinks;
1920 echo
'<td class="center">'.(empty($nbTotal) ?
'' : $nbTotal).
'</td>';
1922 $totalarray[
'nbfield']++;
1927 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1928 print
'<td class="tdoverflowmax100">';
1929 if ($userstatic->id) {
1930 print $userstatic->getNomUrl(-1);
1936 $totalarray[
'nbfield']++;
1941 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1942 print
'<td class="right nowrap"><span class="amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
'').
'</span></td>';
1944 $totalarray[
'nbfield']++;
1945 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
1947 if (empty($totalarray[
'val'][
'totalam'])) {
1948 $totalarray[
'val'][
'totalam'] = 0;
1950 $totalarray[
'val'][
'totalam'] += $totalpay;
1954 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1955 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
1957 $totalarray[
'nbfield']++;
1958 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
1960 $totalarray[
'val'][
'rtp'] += $remaintopay;
1964 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1965 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1967 $totalarray[
'nbfield']++;
1972 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1973 print
'<td class="nowrap">';
1974 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1977 $totalarray[
'nbfield']++;
1981 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1982 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1984 $totalarray[
'nbfield']++;
1988 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1989 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1991 $totalarray[
'nbfield']++;
1995 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1996 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1998 $totalarray[
'nbfield']++;
2002 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2003 print
'<td class="right nowrap"><span class="amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
'').
'</span></td>';
2005 $totalarray[
'nbfield']++;
2010 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2011 print
'<td class="right nowrap"><span class="amount">';
2012 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
'');
2013 print
'</span></td>';
2015 $totalarray[
'nbfield']++;
2021 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2023 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2024 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2025 print $hookmanager->resPrint;
2028 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2029 print
'<td class="center nowraponall">';
2030 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2033 $totalarray[
'nbfield']++;
2037 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2038 print
'<td class="center nowraponall">';
2039 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2042 $totalarray[
'nbfield']++;
2046 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2047 print
'<td class="center nowrap">';
2048 print $facturestatic->getLibStatut(5, $paiement);
2051 $totalarray[
'nbfield']++;
2057 print
'<td class="nowrap center">';
2058 if ($massactionbutton || $massaction) {
2060 if (in_array($obj->facid, $arrayofselected)) {
2063 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2067 $totalarray[
'nbfield']++;
2078include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2083 foreach ($arrayfields as $key => $val) {
2084 if (!empty($val[
'checked'])) {
2088 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2093$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2094$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2095print $hookmanager->resPrint;
2097print
'</table>'.
"\n";
2100print
'</form>'.
"\n";
2102if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2103 $hidegeneratedfilelistifempty = 1;
2104 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2105 $hidegeneratedfilelistifempty = 0;
2108 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2112 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2113 $urlsource .= str_replace(
'&',
'&', $param);
2115 $filedir = $diroutputmassaction;
2116 $genallowed = $permissiontoread;
2117 $delallowed = $permissiontoadd;
2120 print $formfile->showdocuments(
'massfilesarea_supplier_invoice',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 bank accounts.
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.
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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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...
GETPOSTDATE($prefix, $hourTime='', $gm='auto')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.