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:int');
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_vat_reverse_charge =
GETPOST(
'search_vat_reverse_charge',
'alpha');
100$search_town =
GETPOST(
'search_town',
'alpha');
101$search_zip =
GETPOST(
'search_zip',
'alpha');
102$search_state =
GETPOST(
"search_state");
103$search_note_private =
GETPOST(
'search_note_private',
'alpha');
104$search_note_public =
GETPOST(
'search_note_public',
'alpha');
105$search_country =
GETPOST(
"search_country",
'aZ09');
106$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
107$search_user =
GETPOST(
'search_user',
'intcomma');
108$search_sale =
GETPOST(
'search_sale',
'intcomma');
109$search_date_start =
GETPOSTDATE(
'search_date_start',
'',
'tzserver');
110$search_date_end =
GETPOSTDATE(
'search_date_end',
'23:59:59',
'tzserver');
111$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
112$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
113$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
114$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
115$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
116$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
117$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
118$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
119$search_categ_sup =
GETPOST(
"search_categ_sup",
'intcomma');
120$searchCategorySupplierInvoiceList =
GETPOST(
'search_category_supplier_invoice_list',
'array:int');
121$searchCategorySupplierInvoiceOperator = 0;
122if (GETPOSTISSET(
'formfilteraction')) {
123 $searchCategorySupplierInvoiceOperator =
GETPOSTINT(
'search_category_supplier_invoice_operator');
125 $searchCategorySupplierInvoiceOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
127$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
128$search_fk_fac_rec_source =
GETPOST(
'search_fk_fac_rec_source',
'int');
130$option =
GETPOST(
'search_option');
131if ($option ==
'late') {
132 $search_status =
'1';
134$filter =
GETPOST(
'filtre',
'alpha');
138$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
139$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
141if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
145$offset = $limit * $page;
150 $sortfield =
"f.datef,f.rowid";
152$pageprev = $page - 1;
153$pagenext = $page + 1;
158if ($user->socid > 0) {
160 $socid = $user->socid;
163$diroutputmassaction = $conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id;
169$hookmanager->initHooks(array(
'supplierinvoicelist'));
173$extrafields->fetch_name_optionals_label(
$object->table_element);
175$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
178$fieldstosearchall = array(
180 'f.ref_supplier' =>
'RefSupplier',
181 'f.note_public' =>
'NotePublic',
182 's.nom' =>
"ThirdParty",
183 's.code_fournisseur' =>
"SupplierCodeShort",
184 'pd.description' =>
'Description',
186if (empty($user->socid)) {
187 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
190$checkedtypetiers =
'0';
192 'f.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5),
193 'f.ref_supplier' => array(
'label' =>
"RefSupplier",
'checked' =>
'1',
'position' => 7),
194 'f.type' => array(
'label' =>
"Type",
'checked' =>
'0',
'position' => 15),
195 'f.subtype' => array(
'label' =>
"InvoiceSubtype",
'checked' =>
'0',
'position' => 17),
196 'f.label' => array(
'label' =>
"Label",
'checked' =>
'0',
'position' => 20),
197 'f.datef' => array(
'label' =>
"DateInvoice",
'checked' =>
'1',
'position' => 25),
198 'f.date_lim_reglement' => array(
'label' =>
"DateDue",
'checked' =>
'1',
'position' => 27),
199 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'1',
'position' => 30,
'enabled' => (
isModEnabled(
'project') ?
'1' :
'0')),
200 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 41),
201 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'0',
'position' => 42),
202 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 43),
203 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 44),
204 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
205 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 46),
206 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 48),
207 'f.vat_reverse_charge' => array(
'label' =>
"VATReverseCharge",
'checked' =>
'0',
'position' => 49,
'enabled' => (
getDolGlobalString(
'ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE') ?
'1' :
'0')),
208 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0',
'position' => 52),
209 'f.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'0',
'position' => 50),
210 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 105),
211 'f.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 110),
212 'f.total_localtax1' => array(
'label' => $langs->transcountry(
"AmountLT1",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (string) (int) (
$mysoc->localtax1_assuj ==
"1"),
'position' => 95),
213 'f.total_localtax2' => array(
'label' => $langs->transcountry(
"AmountLT2",
$mysoc->country_code),
'checked' =>
'0',
'enabled' => (string) (int) (
$mysoc->localtax2_assuj ==
"1"),
'position' => 100),
214 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1',
'position' => 115),
215 'dynamount_payed' => array(
'label' =>
"Paid",
'checked' =>
'0',
'position' => 116),
216 'rtp' => array(
'label' =>
"Rest",
'checked' =>
'0',
'position' => 117),
217 'f.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'position' => 205,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
218 'f.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'position' => 206,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
219 'f.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'position' => 207,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
220 'f.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'position' => 208,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
221 'f.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'position' => 209,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
222 'multicurrency_dynamount_payed' => array(
'label' =>
'MulticurrencyAlreadyPaid',
'position' => 210,
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
223 'multicurrency_rtp' => array(
'label' =>
'MulticurrencyRemainderToPay',
'checked' =>
'0',
'position' => 211,
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
224 'u.login' => array(
'label' =>
"Author",
'checked' =>
'-1',
'position' => 500),
225 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 501),
226 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 502),
227 'f.nb_docs' => array(
'label' =>
"Documents",
'checked' =>
'-1',
'position' => 510),
228 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES') ?
'0' :
'1')),
229 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES') ?
'0' :
'1')),
230 'f.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
233include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
235$parameters = array(
'arrayfields' => &$arrayfields);
236$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
238$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
239if (empty($subtypearray)) {
240 unset($arrayfields[
'f.subtype']);
249if ((!$user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))
250 || (!$user->hasRight(
"supplier_invoice",
"lire") &&
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD'))) {
255if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
256 $search_sale = $user->id;
259$permissiontoread = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
260$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
261$permissiontodelete = ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer"));
268if (
GETPOST(
'cancel',
'alpha')) {
272if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
276$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
277$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
282if (empty($reshook)) {
284 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
287 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
291 $search_product_category =
'';
292 $searchCategorySupplierInvoiceList = array();
294 $search_refsupplier =
"";
296 $search_subtype =
'';
298 $search_project =
'';
299 $search_company =
"";
300 $search_company_alias =
"";
301 $search_amount_no_tax =
"";
302 $search_amount_all_tax =
"";
303 $search_montant_ht =
'';
304 $search_montant_vat =
'';
305 $search_montant_localtax1 =
'';
306 $search_montant_localtax2 =
'';
307 $search_montant_ttc =
'';
309 $search_multicurrency_code =
'';
310 $search_multicurrency_tx =
'';
311 $search_multicurrency_montant_ht =
'';
312 $search_multicurrency_montant_vat =
'';
313 $search_multicurrency_montant_ttc =
'';
315 $search_paymentmode =
'';
316 $search_paymentcond =
'';
317 $search_vat_reverse_charge =
'';
321 $search_country =
'';
322 $search_type_thirdparty =
'';
323 $search_date_start =
'';
324 $search_date_end =
'';
325 $search_datelimit_startday =
'';
326 $search_datelimit_startmonth =
'';
327 $search_datelimit_startyear =
'';
328 $search_datelimit_endday =
'';
329 $search_datelimit_endmonth =
'';
330 $search_datelimit_endyear =
'';
331 $search_datelimit_start =
'';
332 $search_datelimit_end =
'';
333 $search_note_private =
'';
334 $search_note_public =
'';
336 $search_array_options = array();
337 $search_categ_sup = 0;
343 $objectclass =
'FactureFournisseur';
344 $objectlabel =
'SupplierInvoices';
346 $uploaddir = $conf->fournisseur->facture->dir_output;
348 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
350 if ($massaction ==
'banktransfertrequest') {
351 $langs->load(
"withdrawals");
353 if (!$user->hasRight(
"paymentbybanktransfer",
"create")) {
360 $arrayofselected = is_array($toselect) ? $toselect : array();
361 $listofbills = array();
362 foreach ($arrayofselected as $toselectid) {
364 $result = $objecttmp->fetch($toselectid);
366 $totalpaid = $objecttmp->getSommePaiement();
367 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
368 $totaldeposits = $objecttmp->getSumDepositsUsed();
369 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
372 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
373 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
376 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
377 $objecttmp->resteapayer = $remaintopay;
379 } elseif ($reshook < 0) {
381 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
386 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
387 } elseif ($objecttmp->paid || $objecttmp->resteapayer == 0) {
389 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
390 } elseif ($objecttmp->resteapayer < 0) {
392 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
395 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
396 $rsql .=
" , pfd.date_traite as date_traite";
397 $rsql .=
" , pfd.amount";
398 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
399 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
400 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
401 $rsql .=
" WHERE fk_facture_fourn = ".((int) $objecttmp->id);
402 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
403 $rsql .=
" AND pfd.traite = 0";
404 $rsql .=
" ORDER BY pfd.date_demande DESC";
407 $result_sql = $db->query($rsql);
409 $numprlv = $db->num_rows($result_sql);
414 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
415 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'VIR') {
416 $langs->load(
"errors");
418 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
420 $listofbills[] = $objecttmp;
426 if (!empty($listofbills)) {
427 $nbwithdrawrequestok = 0;
428 foreach ($listofbills as $aBill) {
435 $sql =
"SELECT SUM(pfd.amount) as amount";
436 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
438 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int) $aBill->id);
442 $sql .=
" AND pfd.traite = 0";
444 $resql = $db->query($sql);
446 $obj = $db->fetch_object($resql);
448 $pending += (float) $obj->amount;
454 $sqlPending =
"SELECT SUM(pl.amount) as amount";
455 $sqlPending .=
" FROM ".$db->prefix().
"prelevement_lignes as pl";
456 $sqlPending .=
" INNER JOIN ".$db->prefix().
"prelevement as p ON p.fk_prelevement_lignes = pl.rowid";
458 $sqlPending .=
" WHERE p.fk_facture_fourn = ".((int) $aBill->id);
462 $sqlPending .=
" AND (pl.statut IS NULL OR pl.statut = 0)";
463 $resPending = $db->query($sqlPending);
465 if ($objPending = $db->fetch_object($resPending)) {
466 $pending += (float) $objPending->amount;
469 $db->free($resPending);
471 $requestAmount = $aBill->resteapayer - $pending;
472 if ($requestAmount > 0) {
474 $result = $aBill->demande_prelevement($user, $requestAmount,
'bank-transfer',
'supplier_invoice');
477 $nbwithdrawrequestok++;
483 $aBill->error =
'WithdrawRequestErrorNilAmount';
484 $aBill->errors[] = $aBill->error;
488 if ($nbwithdrawrequestok > 0) {
489 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
501$form =
new Form($db);
507$subtypearray =
$object->getArrayOfInvoiceSubtypes(0);
514 if (empty($search_company)) {
515 $search_company = $soc->name;
519$title = $langs->trans(
"BillsSuppliers").($socid && ($soc !==
null) ?
' - '.$soc->name :
'');
520$help_url =
'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
525$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, f.vat_reverse_charge,";
526$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,";
527$sql .=
" f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
528$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,';
529$sql .=
" f.note_public, f.note_private,";
530$sql .=
" f.fk_user_author,";
531$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,";
532$sql .=
" typent.code as typent_code,";
533$sql .=
" state.code_departement as state_code, state.nom as state_name,";
534$sql .=
" country.code as country_code,";
535$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
536$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';
538if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
539 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
540 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
544$parameters = array();
545$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
546$sql .= $hookmanager->resPrint;
547$sql = preg_replace(
'/,\s*$/',
'', $sql);
551$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
552$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
553$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
554$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
555$sql .=
', '.MAIN_DB_PREFIX.
'facture_fourn as f';
556if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
557 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
559$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
560$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
561if ($search_user > 0) {
562 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
563 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
566$parameters = array();
567$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
568$sql .= $hookmanager->resPrint;
569$sql .=
' WHERE f.fk_soc = s.rowid';
570$sql .=
' AND f.entity IN ('.getEntity(
'facture_fourn').
')';
572 $sql .=
' AND s.rowid = '.((int) $socid);
575 if (is_numeric($search_ref)) {
584if ($search_refsupplier) {
587if ($search_type !=
'' && $search_type >= 0) {
588 if ($search_type ==
'0') {
589 $sql .=
" AND f.type = 0";
591 if ($search_type ==
'1') {
592 $sql .=
" AND f.type = 1";
594 if ($search_type ==
'2') {
595 $sql .=
" AND f.type = 2";
597 if ($search_type ==
'3') {
598 $sql .=
" AND f.type = 3";
603if ($search_subtype !=
'' && $search_subtype !=
'-1') {
604 $sql .=
" AND f.subtype IN (".$db->sanitize($db->escape($search_subtype)).
")";
606if ($search_project) {
609if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
610 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
612 if ($search_company) {
615 if ($search_company_alias) {
628if (strlen(trim($search_country))) {
630 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
631 foreach ($arrayofcode as $key => $value) {
632 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
633 if ($value !=
$mysoc->country_code) {
634 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
637 if ($search_country ==
'special_allnotme') {
638 $sql .=
" AND country.code <> '".$db->escape(
$mysoc->country_code).
"'";
639 } elseif ($search_country ==
'special_eec') {
640 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
641 } elseif ($search_country ==
'special_eecnotme') {
642 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
643 } elseif ($search_country ==
'special_noteec') {
644 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
649if ($search_type_thirdparty !=
'' && $search_type_thirdparty >= 0) {
650 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
652if ($search_montant_ht !=
'') {
655if ($search_montant_vat !=
'') {
658if ($search_montant_localtax1 !=
'') {
659 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
661if ($search_montant_localtax2 !=
'') {
662 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
664if ($search_montant_ttc !=
'') {
667if ($search_multicurrency_code !=
'') {
668 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
670if ($search_multicurrency_tx !=
'') {
671 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
673if ($search_multicurrency_montant_ht !=
'') {
674 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
676if ($search_multicurrency_montant_vat !=
'') {
677 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
679if ($search_multicurrency_montant_ttc !=
'') {
680 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
683 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname'), $search_login);
685if ($search_status !=
'' && $search_status >= 0) {
686 $sql .=
" AND f.fk_statut = ".((int) $search_status);
688if ($search_paymentmode > 0) {
689 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
691if ($search_paymentcond > 0) {
692 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentcond);
694if ($search_vat_reverse_charge !=
'') {
695 $sql .=
" AND f.vat_reverse_charge = ".((int) $search_vat_reverse_charge);
697if ($search_date_start) {
698 $sql .=
" AND f.datef >= '" . $db->idate($search_date_start) .
"'";
700if ($search_date_end) {
701 $sql .=
" AND f.datef <= '" . $db->idate($search_date_end) .
"'";
703if ($search_note_public) {
704 $sql .=
" AND f.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
706if ($search_note_private) {
707 $sql .=
" AND f.note_private LIKE '%".$db->escape($db->escapeforlike($search_note_private)).
"%'";
709if ($search_datelimit_start) {
710 $sql .=
" AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) .
"'";
712if ($search_datelimit_end) {
713 $sql .=
" AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) .
"'";
715if ($option ==
'late') {
716 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->fournisseur->warning_delay).
"'";
721if ($search_fk_fac_rec_source) {
722 $sql .=
" AND f.fk_fac_rec_source = ".(int) $search_fk_fac_rec_source;
725if ($search_sale && $search_sale !=
'-1') {
726 if ($search_sale == -2) {
727 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
728 } elseif ($search_sale > 0) {
729 $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).
")";
733if (!empty($searchCategorySupplierInvoiceList)) {
734 $searchCategorySupplierInvoiceSqlList = array();
735 $listofcategoryid =
'';
736 foreach ($searchCategorySupplierInvoiceList as $searchCategorySupplierInvoice) {
737 if (intval($searchCategorySupplierInvoice) == -2) {
738 $searchCategorySupplierInvoiceSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice)";
739 } elseif (intval($searchCategorySupplierInvoice) > 0) {
740 if ($searchCategorySupplierInvoiceOperator == 0) {
741 $searchCategorySupplierInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice AND ck.fk_categorie = ".((int) $searchCategorySupplierInvoice).
")";
743 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierInvoice);
747 if ($listofcategoryid) {
748 $searchCategorySupplierInvoiceSqlList[] =
" EXISTS (SELECT ck.fk_supplier_invoice FROM ".MAIN_DB_PREFIX.
"categorie_supplier_invoice as ck WHERE f.rowid = ck.fk_supplier_invoice AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
750 if ($searchCategorySupplierInvoiceOperator == 1) {
751 if (!empty($searchCategorySupplierInvoiceSqlList)) {
752 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierInvoiceSqlList).
")";
755 if (!empty($searchCategorySupplierInvoiceSqlList)) {
756 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierInvoiceSqlList).
")";
760$searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
761$searchCategorySupplierOperator = 0;
763if (!empty($searchCategorySupplierList)) {
764 $searchCategorySupplierSqlList = array();
765 $listofcategoryid =
'';
766 foreach ($searchCategorySupplierList as $searchCategorySupplier) {
767 if (intval($searchCategorySupplier) == -2) {
768 $searchCategorySupplierSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
769 } elseif (intval($searchCategorySupplier) > 0) {
770 if ($searchCategorySupplierOperator == 0) {
771 $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).
")";
773 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplier);
777 if ($listofcategoryid) {
778 $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).
"))";
780 if ($searchCategorySupplierOperator == 1) {
781 if (!empty($searchCategorySupplierSqlList)) {
782 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierSqlList).
")";
785 if (!empty($searchCategorySupplierSqlList)) {
786 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierSqlList).
")";
791$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
792$searchCategoryProductOperator = 0;
793if (!empty($searchCategoryProductList)) {
794 $searchCategoryProductSqlList = array();
795 $listofcategoryid =
'';
796 foreach ($searchCategoryProductList as $searchCategoryProduct) {
797 if (intval($searchCategoryProduct) == -2) {
798 $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)";
799 } elseif (intval($searchCategoryProduct) > 0) {
800 if ($searchCategoryProductOperator == 0) {
801 $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).
")";
803 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
807 if ($listofcategoryid) {
808 $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).
"))";
810 if ($searchCategoryProductOperator == 1) {
811 if (!empty($searchCategoryProductSqlList)) {
812 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
815 if (!empty($searchCategoryProductSqlList)) {
816 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
820if ($filter && $filter != -1) {
821 $aFilter = explode(
',', $filter);
822 foreach ($aFilter as $fil) {
823 $filt = explode(
':', $fil);
824 $sql .=
" AND ".$db->escape(trim($filt[0])).
" = '".$db->escape(trim($filt[1])).
"'";
829 unset($fieldstosearchall[
'pd.description']);
831 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all, 0, 1);
832 $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)).
"%')";
834 $fieldstosearchall[
'pd.description'] =
'Description';
837if ($search_user > 0) {
838 $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);
841include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
843$parameters = array();
844$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
845if (empty($reshook)) {
846 $sql .= $hookmanager->resPrint;
848 $sql = $hookmanager->resPrint;
852$parameters = array();
853$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
854if (empty($reshook)) {
855 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
857 $sql = $hookmanager->resPrint;
861$nbtotalofrecords =
'';
864 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
866 $resql = $db->query($sqlforcount);
868 $objforcount = $db->fetch_object($resql);
869 $nbtotalofrecords = $objforcount->nbtotalofrecords;
874 if (($page * $limit) > (
int) $nbtotalofrecords) {
882$sql .= $db->order($sortfield, $sortorder);
884 $sql .= $db->plimit($limit + 1, $offset);
888$resql = $db->query($sql);
894$num = $db->num_rows($resql);
897if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
898 $obj = $db->fetch_object($resql);
900 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$id);
907llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-fourn-facture page-list');
909if ($search_fk_fac_rec_source) {
910 require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
911 require_once DOL_DOCUMENT_ROOT .
'/core/lib/invoice.lib.php';
913 $object->fetch((
int) $search_fk_fac_rec_source);
922 if (empty($search_company)) {
923 $search_company = $soc->name;
924 $search_company_alias = $soc->name_alias;
928$arrayofselected = is_array($toselect) ? $toselect : array();
930$param =
'&socid='.$socid;
932 $param .=
'&mode='.urlencode($mode);
934if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
935 $param .=
'&contextpage='.urlencode($contextpage);
937if ($limit > 0 && $limit != $conf->liste_limit) {
938 $param .=
'&limit='.((int) $limit);
940if ($optioncss !=
'') {
941 $param .=
'&optioncss='.urlencode($optioncss);
944 $param .=
'&search_all='.urlencode($search_all);
946if ($search_date_start) {
947 $param .=
buildParamDate(
'search_date_start',
null,
'',
'tzserver');
949if ($search_date_end) {
950 $param .=
buildParamDate(
'search_date_end',
null,
'',
'tzserver');
952if ($search_datelimit_startday) {
953 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
955if ($search_datelimit_startmonth) {
956 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
958if ($search_datelimit_startyear) {
959 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
961if ($search_datelimit_endday) {
962 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
964if ($search_datelimit_endmonth) {
965 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
967if ($search_datelimit_endyear) {
968 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
971 $param .=
'&search_ref='.urlencode($search_ref);
973if ($search_refsupplier) {
974 $param .=
'&search_refsupplier='.urlencode($search_refsupplier);
976if ($search_type !=
'') {
977 $param .=
'&search_type='.urlencode($search_type);
979if ($search_subtype !=
'') {
980 $param .=
'&search_subtype='.urlencode($search_subtype);
983 $param .=
'&search_label='.urlencode($search_label);
985if ($search_company) {
986 $param .=
'&search_company='.urlencode($search_company);
988if ($search_company_alias) {
989 $param .=
'&search_company_alias='.urlencode($search_company_alias);
992 $param .=
'&search_login='.urlencode($search_login);
994if ($searchCategorySupplierInvoiceOperator == 1) {
995 $param .=
"&search_category_supplier_invoice_operator=".urlencode((
string) ($searchCategorySupplierInvoiceOperator));
997foreach ($searchCategorySupplierInvoiceList as $searchCategorySupplierInvoice) {
998 $param .=
"&search_category_invoice_list[]=".urlencode($searchCategorySupplierInvoice);
1000if ($search_montant_ht !=
'') {
1001 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1003if ($search_montant_vat !=
'') {
1004 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1006if ($search_montant_localtax1 !=
'') {
1007 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1009if ($search_montant_localtax2 !=
'') {
1010 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1012if ($search_montant_ttc !=
'') {
1013 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1015if ($search_multicurrency_code !=
'') {
1016 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1018if ($search_multicurrency_tx !=
'') {
1019 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1021if ($search_multicurrency_montant_ht !=
'') {
1022 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1024if ($search_multicurrency_montant_vat !=
'') {
1025 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1027if ($search_multicurrency_montant_ttc !=
'') {
1028 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1030if ($search_amount_no_tax) {
1031 $param .=
'&search_amount_no_tax='.urlencode($search_amount_no_tax);
1033if ($search_amount_all_tax) {
1034 $param .=
'&search_amount_all_tax='.urlencode($search_amount_all_tax);
1036if ($search_status >= 0) {
1037 $param .=
"&search_status=".urlencode($search_status);
1039if ($search_paymentmode) {
1040 $param .=
'&search_paymentmode='.urlencode((
string) ($search_paymentmode));
1042if ($search_paymentcond) {
1043 $param .=
'&search_paymentcond='.urlencode((
string) ($search_paymentcond));
1045if ($search_vat_reverse_charge !=
'') {
1046 $param .=
'&search_vat_reverse_charge='.urlencode((
string) ($search_vat_reverse_charge));
1049 $param .=
'&show_files='.urlencode((
string) ($show_files));
1052 $param .=
"&search_option=".urlencode($option);
1054if ($search_categ_sup > 0) {
1055 $param .=
'&search_categ_sup='.$search_categ_sup;
1057if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
1058 $param .=
'&search_type_thirdparty='.$search_type_thirdparty;
1060if ($search_fk_fac_rec_source) {
1061 $param .=
'&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source;
1065include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1067$parameters = array(
'param' => &$param);
1068$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1069$param .= $hookmanager->resPrint;
1072$arrayofmassactions = array(
1073 'validate' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1074 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1075 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1078if (
isModEnabled(
'category') && $user->hasRight(
"fournisseur",
"facture",
"lire")) {
1079 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1081if (
isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
"paymentbybanktransfer",
"create")) {
1082 $langs->load(
'withdrawals');
1083 $arrayofmassactions[
'banktransfertrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
1085if (!empty($permissiontodelete)) {
1086 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1088if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
1089 $arrayofmassactions = array();
1091$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1093$url = DOL_URL_ROOT.
'/fourn/facture/card.php?action=create';
1095 $url .=
'&socid='.urlencode((
string) (
$object->socid));
1098 $url .=
'&fac_rec='.urlencode((
string)
$object->id);
1101print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1102if ($optioncss !=
'') {
1103 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1105print
'<input type="hidden" name="token" value="'.newToken().
'">';
1106print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1107print
'<input type="hidden" name="action" value="list">';
1108print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1109print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1110print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1111print
'<input type="hidden" name="page" value="'.$page.
'">';
1112print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1113print
'<input type="hidden" name="page_y" value="">';
1114print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1117$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'));
1118$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'));
1120$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', (
int) ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")));
1122print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_invoice', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1125$topicmail =
"SendBillRef";
1126$modelmail =
"invoice_supplier_send";
1128$trackid =
'sinv'.$object->id;
1129include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1133 foreach ($fieldstosearchall as $key => $val) {
1134 $fieldstosearchall[$key] = $langs->trans($val);
1135 $setupstring .= $key.
"=".$val.
";";
1137 print
'<!-- Search done like if SUPPLIER_INVOICE_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1138 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
1143if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1144 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
1146 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_INVOICE, $searchCategorySupplierInvoiceList,
'minwidth300', $searchCategorySupplierInvoiceOperator ? $searchCategorySupplierInvoiceOperator : 0);
1148if ($user->hasRight(
"user",
"user",
"lire")) {
1149 $langs->load(
"commercial");
1150 $moreforfilter .=
'<div class="divsearchfield">';
1151 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1152 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth200');
1153 $moreforfilter .=
'</div>';
1156if ($user->hasRight(
"user",
"user",
"lire")) {
1157 $moreforfilter .=
'<div class="divsearchfield">';
1158 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1159 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'', 0, 0,
'', 0,
'',
'maxwidth200');
1160 $moreforfilter .=
'</div>';
1163if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
1164 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1165 $moreforfilter .=
'<div class="divsearchfield">';
1166 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1167 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
1168 $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);
1169 $moreforfilter .=
'</div>';
1173 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1174 $moreforfilter .=
'<div class="divsearchfield">';
1175 $tmptitle = $langs->trans(
'SuppliersCategoriesShort');
1176 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'supplier', $search_categ_sup,
'search_categ_sup', 1, $tmptitle);
1177 $moreforfilter .=
'</div>';
1179$parameters = array();
1180$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1181if (empty($reshook)) {
1182 $moreforfilter .= $hookmanager->resPrint;
1184 $moreforfilter = $hookmanager->resPrint;
1187if (!empty($moreforfilter)) {
1188 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1189 print $moreforfilter;
1193$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1194$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1195$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1196$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1198print
'<div class="div-table-responsive">';
1199print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1203print
'<tr class="liste_titre_filter">';
1206 print
'<td class="liste_titre center maxwidthsearch">';
1207 $searchpicto = $form->showFilterButtons(
'left');
1212if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1213 print
'<td class="liste_titre left">';
1214 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1218if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1219 print
'<td class="liste_titre">';
1220 print
'<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).
'">';
1224if (!empty($arrayfields[
'f.type'][
'checked'])) {
1225 print
'<td class="liste_titre maxwidthonsmartphone">';
1232 print $form->selectarray(
'search_type', $typearray, $search_type, 1, 0, 0,
'', 0, 0, 0,
'ASC',
'maxwidth100');
1236if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1237 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1238 print $form->selectarray(
'search_subtype', $subtypearray, $search_subtype, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1242if (!empty($arrayfields[
'f.label'][
'checked'])) {
1243 print
'<td class="liste_titre">';
1244 print
'<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
1248if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1249 print
'<td class="liste_titre center">';
1250 print
'<div class="nowrapfordate">';
1251 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1253 print
'<div class="nowrapfordate">';
1254 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1259if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1260 print
'<td class="liste_titre center">';
1261 print
'<div class="">';
1268 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1270 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>';
1275if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1276 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1279if (!empty($arrayfields[
's.nom'][
'checked'])) {
1280 print
'<td class="liste_titre"><input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1283if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1284 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'"></td>';
1287if (!empty($arrayfields[
's.town'][
'checked'])) {
1288 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1291if (!empty($arrayfields[
's.zip'][
'checked'])) {
1292 print
'<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1295if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1296 print
'<td class="liste_titre">';
1297 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1301if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1302 print
'<td class="liste_titre center">';
1303 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1, array(), 1);
1307if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1308 print
'<td class="liste_titre maxwidthonsmartphone center">';
1309 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);
1313if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
1314 print
'<td class="liste_titre center">';
1315 print $form->selectyesno(
'search_vat_reverse_charge', $search_vat_reverse_charge, 1, 0, 1, 1);
1319if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1320 print
'<td class="liste_titre left">';
1321 print $form->getSelectConditionsPaiements($search_paymentcond,
'search_paymentcond', -1, 1, 1,
'maxwidth100');
1325if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1326 print
'<td class="liste_titre">';
1327 print $form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 20, 1,
'maxwidth100', 1);
1330if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1332 print
'<td class="liste_titre right">';
1333 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1336if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1338 print
'<td class="liste_titre right">';
1339 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1342if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1344 print
'<td class="liste_titre right">';
1345 print
'<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).
'">';
1348if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1350 print
'<td class="liste_titre right">';
1351 print
'<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).
'">';
1354if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1356 print
'<td class="liste_titre right">';
1357 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1360if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1362 print
'<td class="liste_titre" align="center">';
1365if (!empty($arrayfields[
'u.login'][
'checked'])) {
1367 print
'<td class="liste_titre" align="center">';
1368 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1371if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1372 print
'<td class="liste_titre right">';
1375if (!empty($arrayfields[
'rtp'][
'checked'])) {
1376 print
'<td class="liste_titre">';
1379if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1381 print
'<td class="liste_titre">';
1382 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1385if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1387 print
'<td class="liste_titre">';
1388 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1391if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1393 print
'<td class="liste_titre right">';
1394 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1397if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1399 print
'<td class="liste_titre right">';
1400 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1403if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1405 print
'<td class="liste_titre right">';
1406 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1409if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1410 print
'<td class="liste_titre">';
1413if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1414 print
'<td class="liste_titre right">';
1418include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1421$parameters = array(
'arrayfields' => $arrayfields);
1422$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1423print $hookmanager->resPrint;
1425if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1426 print
'<td class="liste_titre">';
1430if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1431 print
'<td class="liste_titre">';
1434if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1436 print
'<td class="liste_titre">';
1437 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1440if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1442 print
'<td class="liste_titre">';
1443 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1447if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1448 print
'<td class="liste_titre center parentonrightofpage">';
1449 $liststatus = array(
'0' => $langs->trans(
"Draft"),
'1' => $langs->trans(
"Unpaid"),
'2' => $langs->trans(
"Paid"));
1451 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'center search_status width100 onrightofpage', 1);
1456 print
'<td class="liste_titre center maxwidthsearch">';
1457 $searchpicto = $form->showFilterButtons();
1469print
'<tr class="liste_titre">';
1472 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1475if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1476 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref,f.rowid',
'', $param,
'', $sortfield, $sortorder);
1479if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1480 print_liste_field_titre($arrayfields[
'f.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_supplier',
'', $param,
'', $sortfield, $sortorder);
1483if (!empty($arrayfields[
'f.type'][
'checked'])) {
1484 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1487if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1488 print_liste_field_titre($arrayfields[
'f.subtype'][
'label'], $_SERVER[
"PHP_SELF"],
'f.subtype',
'', $param,
'', $sortfield, $sortorder);
1490if (!empty($arrayfields[
'f.label'][
'checked'])) {
1491 print_liste_field_titre($arrayfields[
'f.label'][
'label'], $_SERVER[
'PHP_SELF'],
"f.libelle,f.rowid",
'', $param,
'', $sortfield, $sortorder);
1494if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1495 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef,f.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1498if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1499 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'', $sortfield, $sortorder,
'center ');
1502if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1503 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1506if (!empty($arrayfields[
's.nom'][
'checked'])) {
1507 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1510if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1512 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1515if (!empty($arrayfields[
's.town'][
'checked'])) {
1516 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1519if (!empty($arrayfields[
's.zip'][
'checked'])) {
1520 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1523if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1524 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.name_alias",
"", $param,
'', $sortfield, $sortorder);
1527if (!empty($arrayfields[
'state.name_alias'][
'checked'])) {
1528 print_liste_field_titre($arrayfields[
'state.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1531if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1532 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1535if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1536 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1539if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
1540 print_liste_field_titre($arrayfields[
'f.vat_reverse_charge'][
'label'], $_SERVER[
"PHP_SELF"],
"f.vat_reverse_charge",
"", $param,
"", $sortfield, $sortorder,
'center ');
1543if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1544 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1547if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1548 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1551if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1552 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1555if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
1556 print_liste_field_titre($arrayfields[
'f.total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1559if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1560 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'', $sortfield, $sortorder,
'right ');
1563if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1564 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'', $sortfield, $sortorder,
'right ');
1567if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1568 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1571if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
1572 print_liste_field_titre($arrayfields[
'f.nb_docs'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1575if (!empty($arrayfields[
'u.login'][
'checked'])) {
1576 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1579if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1580 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1583if (!empty($arrayfields[
'rtp'][
'checked'])) {
1584 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
1587if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1588 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1591if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1592 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1595if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1596 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'"', $sortfield, $sortorder,
'right ');
1599if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1600 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1603if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1604 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1607if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1608 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1611if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1612 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
1616include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1618$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1619$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1620print $hookmanager->resPrint;
1621if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1622 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1625if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1626 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1629if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1630 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1633if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1634 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1637if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1638 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"fk_statut,paye,type",
"", $param,
'', $sortfield, $sortorder,
'center ');
1643 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1650$projectstatic =
new Project($db);
1651$userstatic =
new User($db);
1669$imaxinloop = ($limit ? min($num, $limit) : $num);
1670while ($i < $imaxinloop) {
1671 $obj = $db->fetch_object($resql);
1676 $datelimit = $db->jdate($obj->datelimite);
1678 $userstatic->id = $obj->fk_user_author;
1679 $userstatic->login = $obj->login;
1680 $userstatic->lastname = $obj->lastname;
1681 $userstatic->firstname = $obj->firstname;
1682 $userstatic->email = $obj->user_email;
1683 $userstatic->statut = $obj->user_statut;
1684 $userstatic->status = $obj->user_statut;
1685 $userstatic->entity = $obj->entity;
1686 $userstatic->photo = $obj->photo;
1687 $userstatic->office_phone = $obj->office_phone;
1688 $userstatic->office_fax = $obj->office_fax;
1689 $userstatic->user_mobile = $obj->user_mobile;
1690 $userstatic->job = $obj->job;
1691 $userstatic->gender = $obj->gender;
1692 $facturestatic->id = $obj->facid;
1693 $facturestatic->ref = $obj->ref;
1694 $facturestatic->type = $obj->type;
1695 $facturestatic->subtype = $obj->subtype;
1696 $facturestatic->total_ht = $obj->total_ht;
1697 $facturestatic->total_tva = $obj->total_vat;
1698 $facturestatic->total_ttc = $obj->total_ttc;
1699 $facturestatic->close_code = $obj->close_code;
1700 $facturestatic->ref_supplier = $obj->ref_supplier;
1701 $facturestatic->date_echeance = $db->jdate($obj->datelimite);
1702 $facturestatic->statut = $obj->fk_statut;
1703 $facturestatic->status = $obj->fk_statut;
1704 $facturestatic->note_public = $obj->note_public;
1705 $facturestatic->note_private = $obj->note_private;
1706 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1707 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1708 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1709 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1710 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1711 $thirdparty->id = $obj->socid;
1712 $thirdparty->name = $obj->name;
1713 $thirdparty->name_alias = $obj->alias;
1714 $thirdparty->client = $obj->client;
1715 $thirdparty->fournisseur = $obj->fournisseur;
1716 $thirdparty->code_client = $obj->code_client;
1717 $thirdparty->code_compta_client = $obj->code_compta_client;
1718 $thirdparty->code_fournisseur = $obj->code_fournisseur;
1719 $thirdparty->code_compta_fournisseur = $obj->code_compta_fournisseur;
1720 $thirdparty->email = $obj->email;
1721 $thirdparty->country_code = $obj->country_code;
1723 $paiement = $facturestatic->getSommePaiement();
1724 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1725 $totaldeposits = $facturestatic->getSumDepositsUsed();
1726 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1727 $remaintopay = $obj->total_ttc - $totalpay;
1729 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1730 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1731 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1733 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1734 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1736 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1737 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1741 $multicurrency_remaintopay = 0;
1744 $remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id);
1745 $remaintopay = -$remaincreditnote;
1746 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1747 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdparty,
null,
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1748 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1749 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1752 $facturestatic->alreadypaid = ($paiement ? $paiement : 0);
1754 $facturestatic->paye = $obj->paye;
1755 $facturestatic->paid = $obj->paye;
1757 $facturestatic->date = $db->jdate($obj->datef);
1763 if ($facturestatic->isCreditNoteUsed()) {
1764 $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
1768 if ($mode ==
'kanban') {
1770 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1771 print
'<div class="box-flex-container kanban">';
1774 if ($massactionbutton || $massaction) {
1776 if (in_array(
$object->id, $arrayofselected)) {
1781 $arraydata = array(
'alreadypaid' => $paiement,
'thirdparty' => $thirdparty->getNomUrl(1,
'', 12),
'selected' => in_array(
$object->id, $arrayofselected));
1782 print $facturestatic->getKanbanView(
'', $arraydata);
1783 if ($i == ($imaxinloop - 1)) {
1790 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select '.((
getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->fk_statut > 1) ?
'opacitymedium' :
'').
'">';
1794 print
'<td class="nowrap center">';
1795 if ($massactionbutton || $massaction) {
1797 if (in_array($obj->facid, $arrayofselected)) {
1800 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1807 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1808 print
'<td class="nowraponall">';
1810 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1812 print
'<td class="nobordernopadding nowraponall">';
1813 print $facturestatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1816 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1817 $subdir =
get_exdir($obj->facid, 2, 0, 0, $facturestatic,
'invoice_supplier').dol_sanitizeFileName($obj->ref);
1818 print $formfile->getDocumentsLink(
'facture_fournisseur', $subdir, $filedir);
1819 print
'</td></tr></table>';
1828 if (!empty($arrayfields[
'f.ref_supplier'][
'checked'])) {
1829 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).
'">';
1830 print $obj->ref_supplier;
1838 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1839 print
'<td class="nowrap">';
1840 print $facturestatic->getLibType();
1848 if (!empty($arrayfields[
'f.subtype'][
'checked'])) {
1850 if ($facturestatic->subtype > 0) {
1851 $labeltoshow = $facturestatic->getSubtypeLabel(
'facture_fourn');
1853 print
'<td class="nowraponall tdoverflowmax300" title="'.$labeltoshow.
'">';
1862 if (!empty($arrayfields[
'f.label'][
'checked'])) {
1863 print
'<td class="nowrap tdoverflowmax125" title="'.dol_escape_htmltag($obj->label).
'">';
1872 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1873 print
'<td class="center nowrap">';
1882 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1883 print
'<td class="center nowraponall">'.dol_print_date($datelimit,
'day');
1884 if ($facturestatic->hasDelay()) {
1885 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
1894 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1895 print
'<td class="nowrap">';
1896 if ($obj->project_id > 0) {
1897 $projectstatic->id = $obj->project_id;
1898 $projectstatic->ref = $obj->project_ref;
1899 $projectstatic->title = $obj->project_label;
1900 print $projectstatic->getNomUrl(1);
1909 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1910 print
'<td class="tdoverflowmax125">';
1911 print $thirdparty->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1918 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1919 print
'<td class="tdoverflowmax150">';
1927 if (!empty($arrayfields[
's.town'][
'checked'])) {
1928 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
1936 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1937 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
1945 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1946 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">';
1954 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1955 print
'<td class="center">';
1956 $tmparray =
getCountry($obj->fk_pays,
'all');
1957 print $tmparray[
'label'];
1964 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1965 print
'<td class="center">';
1966 if (empty($typenArray)) {
1967 $typenArray = $formcompany->typent_array(1);
1969 print $typenArray[$obj->typent_code];
1976 if (!empty($arrayfields[
'f.vat_reverse_charge'][
'checked'])) {
1977 print
'<td class="center">';
1978 print
yn($obj->vat_reverse_charge);
1986 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1987 $s = $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 1,
'', -1, -1, 1);
1988 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1996 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1997 $s = $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
1998 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2007 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2008 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2013 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2016 if (!empty($arrayfields[
'f.total_vat'][
'checked'])) {
2017 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_vat).
"</span></td>\n";
2022 $totalarray[
'val'][
'f.total_vat'] += $obj->total_vat;
2025 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2026 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax1).
"</span></td>\n";
2031 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2034 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2035 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_localtax2).
"</span></td>\n";
2040 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2043 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2044 print
'<td class="right nowrap"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2049 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2053 if (!empty($arrayfields[
'f.nb_docs'][
'checked'])) {
2054 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
2055 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
2056 $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($facturestatic->id, 2, 0, 0, $facturestatic,
'invoice_supplier').$facturestatic->ref;
2057 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
2058 $nbLinks =
Link::count($db, $facturestatic->element, $facturestatic->id);
2059 $nbTotal = $nbFiles + $nbLinks;
2060 echo
'<td class="center">'.(empty($nbTotal) ?
'' : $nbTotal).
'</td>';
2067 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2068 print
'<td class="tdoverflowmax100">';
2069 if ($userstatic->id) {
2070 print $userstatic->getNomUrl(-1);
2081 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2082 print
'<td class="right nowrap"><span class="amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
'').
'</span></td>';
2091 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2092 print
'<td class="right nowrap">'.(!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ').
'</td>';
2101 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2102 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2109 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2110 print
'<td class="nowrap">';
2111 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2118 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2119 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2125 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2126 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2132 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2133 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2139 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2140 print
'<td class="right nowrap"><span class="amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
'').
'</span></td>';
2147 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2148 print
'<td class="right nowrap"><span class="amount">';
2149 print(!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
'');
2150 print
'</span></td>';
2158 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2160 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2161 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2162 print $hookmanager->resPrint;
2165 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2166 print
'<td class="center nowraponall">';
2167 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2174 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2175 print
'<td class="center nowraponall">';
2176 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2183 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2184 print
'<td class="sensiblehtmlcontent center">';
2185 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
2192 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2193 print
'<td class="sensiblehtmlcontent center">';
2194 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
2201 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2202 print
'<td class="center nowrap">';
2203 print $facturestatic->getLibStatut(5, $paiement);
2212 print
'<td class="nowrap center">';
2213 if ($massactionbutton || $massaction) {
2215 if (in_array($obj->facid, $arrayofselected)) {
2218 print
'<input id="cb'.$obj->facid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2233include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2238 foreach ($arrayfields as $key => $val) {
2239 if (!empty($val[
'checked'])) {
2243 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2248$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2249$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2250print $hookmanager->resPrint;
2252print
'</table>'.
"\n";
2255print
'</form>'.
"\n";
2257if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2258 $hidegeneratedfilelistifempty = 1;
2259 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2260 $hidegeneratedfilelistifempty = 0;
2263 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
2267 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2268 $urlsource .= str_replace(
'&',
'&', $param);
2270 $filedir = $diroutputmassaction;
2271 $genallowed = $permissiontoread;
2272 $delallowed = $permissiontoadd;
2275 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(! $sortfield) if(! $sortorder) $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_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.