39 require
'../../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
47 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
62 $langs->loadLangs(array(
'bills',
'companies',
'products',
'categories'));
64 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
65 $projectid = (
GETPOST(
'projectid') ?
GETPOST(
'projectid',
'int') : 0);
69 $socid =
GETPOST(
'socid',
'int');
71 $action =
GETPOST(
'action',
'aZ09');
72 $massaction =
GETPOST(
'massaction',
'alpha');
73 $show_files =
GETPOST(
'show_files',
'int');
74 $confirm =
GETPOST(
'confirm',
'alpha');
75 $toselect =
GETPOST(
'toselect',
'array');
76 $optioncss =
GETPOST(
'optioncss',
'alpha');
77 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicelist';
79 if ($contextpage ==
'poslist') {
83 $lineid =
GETPOST(
'lineid',
'int');
84 $userid =
GETPOST(
'userid',
'int');
86 $search_refcustomer =
GETPOST(
'search_refcustomer',
'alpha');
87 $search_type =
GETPOST(
'search_type',
'int');
88 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
89 $search_project =
GETPOST(
'search_project',
'alpha');
90 $search_company =
GETPOST(
'search_company',
'alpha');
91 $search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
92 $search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
93 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
94 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
95 $search_montant_localtax1 =
GETPOST(
'search_montant_localtax1',
'alpha');
96 $search_montant_localtax2 =
GETPOST(
'search_montant_localtax2',
'alpha');
97 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
98 $search_login =
GETPOST(
'search_login',
'alpha');
99 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
100 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
101 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
102 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
103 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
104 $search_status =
GETPOST(
'search_status',
'intcomma');
105 $search_paymentmode =
GETPOST(
'search_paymentmode',
'int');
106 $search_paymentterms =
GETPOST(
'search_paymentterms',
'int');
107 $search_module_source =
GETPOST(
'search_module_source',
'alpha');
108 $search_pos_source =
GETPOST(
'search_pos_source',
'alpha');
109 $search_town =
GETPOST(
'search_town',
'alpha');
110 $search_zip =
GETPOST(
'search_zip',
'alpha');
111 $search_state =
GETPOST(
"search_state");
112 $search_country =
GETPOST(
"search_country",
'alpha');
113 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
114 $search_user =
GETPOST(
'search_user',
'int');
115 $search_sale =
GETPOST(
'search_sale',
'int');
116 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
117 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
118 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
119 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
120 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
121 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
122 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
123 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
124 $search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
125 $search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
126 $search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
127 $search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
128 $search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
129 $search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
130 $search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
131 $search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
132 $search_datelimit_startday =
GETPOST(
'search_datelimit_startday',
'int');
133 $search_datelimit_startmonth =
GETPOST(
'search_datelimit_startmonth',
'int');
134 $search_datelimit_startyear =
GETPOST(
'search_datelimit_startyear',
'int');
135 $search_datelimit_endday =
GETPOST(
'search_datelimit_endday',
'int');
136 $search_datelimit_endmonth =
GETPOST(
'search_datelimit_endmonth',
'int');
137 $search_datelimit_endyear =
GETPOST(
'search_datelimit_endyear',
'int');
138 $search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
139 $search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
140 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
141 $search_product_category =
GETPOST(
'search_product_category',
'int');
142 $search_fac_rec_source_title =
GETPOST(
"search_fac_rec_source_title",
'alpha');
143 $search_btn =
GETPOST(
'button_search',
'alpha');
144 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
146 $option =
GETPOST(
'search_option');
147 if ($option ==
'late') {
148 $search_status =
'1';
150 $filtre =
GETPOST(
'filtre',
'alpha');
152 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
153 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
154 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
156 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
159 $offset = $limit * $page;
160 if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status ==
'1') {
161 $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
167 $sortfield =
'f.datef';
169 $pageprev = $page - 1;
170 $pagenext = $page + 1;
173 $fieldid = (!empty($ref) ?
'ref' :
'rowid');
174 if (!empty($user->socid)) {
175 $socid = $user->socid;
177 $result =
restrictedArea($user,
'facture', $id,
'',
'',
'fk_soc', $fieldid);
179 $diroutputmassaction = $conf->facture->dir_output.
'/temp/massgeneration/'.$user->id;
188 $hookmanager->initHooks(array(
'invoicelist'));
192 $extrafields->fetch_name_optionals_label($object->table_element);
194 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
197 $fieldstosearchall = array(
199 'f.ref_client'=>
'RefCustomer',
200 'f.note_public'=>
'NotePublic',
201 's.nom'=>
"ThirdParty",
202 's.name_alias'=>
"AliasNameShort",
205 'pd.description'=>
'Description',
207 if (empty($user->socid)) {
208 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
211 $checkedtypetiers = 0;
212 $arrayfields = array(
213 'f.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
214 'f.ref_client'=>array(
'label'=>
"RefCustomer",
'checked'=>-1,
'position'=>10),
215 'f.type'=>array(
'label'=>
"Type",
'checked'=>0,
'position'=>15),
216 'f.datef'=>array(
'label'=>
"DateInvoice",
'checked'=>1,
'position'=>20),
217 'f.date_valid'=>array(
'label'=>
"DateValidation",
'checked'=>0,
'position'=>22),
218 'f.date_lim_reglement'=>array(
'label'=>
"DateDue",
'checked'=>1,
'position'=>25),
219 'f.date_closing'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>30),
220 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>40),
221 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1),
'position'=>41),
222 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>50),
223 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>1,
'position'=>51),
224 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
225 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>55),
226 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1,
'position'=>60),
227 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>65),
228 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>70),
229 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>75),
230 'f.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>1,
'position'=>80),
231 'f.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>1,
'position'=>85),
232 'f.module_source'=>array(
'label'=>
"POSModule",
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1),
'position'=>90),
233 'f.pos_source'=>array(
'label'=>
"POSTerminal",
'checked'=>($contextpage ==
'poslist' ? 1 : 0),
'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1),
'position'=>91),
234 'f.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>95),
235 'f.total_tva'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>100),
236 'f.total_localtax1'=>array(
'label'=>$langs->transcountry(
"AmountLT1", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax1_assuj ==
"1"),
'position'=>110),
237 'f.total_localtax2'=>array(
'label'=>$langs->transcountry(
"AmountLT2", $mysoc->country_code),
'checked'=>0,
'enabled'=>($mysoc->localtax2_assuj ==
"1"),
'position'=>120),
238 'f.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>130),
239 'dynamount_payed'=>array(
'label'=>
"Received",
'checked'=>0,
'position'=>140),
240 'rtp'=>array(
'label'=>
"Rest",
'checked'=>0,
'position'=>150),
241 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>165),
242 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>166),
243 'f.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>280),
244 'f.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>285),
245 'f.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>290),
246 'f.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>291),
247 'f.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>292),
248 'multicurrency_dynamount_payed'=>array(
'label'=>
'MulticurrencyAlreadyPaid',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>295),
249 'multicurrency_rtp'=>array(
'label'=>
'MulticurrencyRemainderToPay',
'checked'=>0,
'enabled'=>(!
isModEnabled(
'multicurrency') ? 0 : 1),
'position'=>296),
250 'total_pa' => array(
'label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE ==
'1') ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!
isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
251 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!
isModEnabled(
'margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
252 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!
isModEnabled(
'margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
253 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!
isModEnabled(
'margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
254 'f.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
255 'f.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>502),
256 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
257 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
258 'f.fk_fac_rec_source'=>array(
'label'=>
'GeneratedFromTemplate',
'checked'=>0,
'position'=>520,
'enabled'=>
'1'),
259 'f.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
262 if (
getDolGlobalString(
"INVOICE_USE_SITUATION") && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
263 $arrayfields[
'f.retained_warranty'] = array(
'label'=>$langs->trans(
"RetainedWarranty"),
'checked'=>0,
'position'=>86);
266 foreach ($object->fields as $key => $val) {
268 if (!empty($val[
'visible'])) {
269 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
271 if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists(
't.'.$key, $arrayfields)) { $newkey =
't.'.$key; } elseif (array_key_exists(
'f.'.$key, $arrayfields)) { $newkey =
'f.'.$key; } elseif (array_key_exists(
's.'.$key, $arrayfields)) { $newkey =
's.'.$key; }
273 $arrayfields[$newkey] = array(
274 'label'=>$val[
'label'],
275 'checked'=>(($visible < 0) ? 0 : 1),
276 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
277 'position'=>$val[
'position'],
278 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
284 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
294 if (
GETPOST(
'cancel',
'alpha')) {
298 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
302 $parameters = array(
'socid'=>$socid);
303 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
308 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
311 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha')) {
314 $search_product_category =
'';
316 $search_refcustomer =
'';
318 $search_project_ref =
'';
319 $search_project =
'';
320 $search_company =
'';
321 $search_company_alias =
'';
322 $search_parent_name =
'';
323 $search_montant_ht =
'';
324 $search_montant_vat =
'';
325 $search_montant_localtax1 =
'';
326 $search_montant_localtax2 =
'';
327 $search_montant_ttc =
'';
329 $search_multicurrency_code =
'';
330 $search_multicurrency_tx =
'';
331 $search_multicurrency_montant_ht =
'';
332 $search_multicurrency_montant_vat =
'';
333 $search_multicurrency_montant_ttc =
'';
335 $search_paymentmode =
'';
336 $search_paymentterms =
'';
337 $search_module_source =
'';
338 $search_pos_source =
'';
342 $search_country =
'';
343 $search_type_thirdparty =
'';
344 $search_date_startday =
'';
345 $search_date_startmonth =
'';
346 $search_date_startyear =
'';
347 $search_date_endday =
'';
348 $search_date_endmonth =
'';
349 $search_date_endyear =
'';
350 $search_date_start =
'';
351 $search_date_end =
'';
352 $search_date_valid_startday =
'';
353 $search_date_valid_startmonth =
'';
354 $search_date_valid_startyear =
'';
355 $search_date_valid_endday =
'';
356 $search_date_valid_endmonth =
'';
357 $search_date_valid_endyear =
'';
358 $search_date_valid_start =
'';
359 $search_date_valid_end =
'';
360 $search_datelimit_startday =
'';
361 $search_datelimit_startmonth =
'';
362 $search_datelimit_startyear =
'';
363 $search_datelimit_endday =
'';
364 $search_datelimit_endmonth =
'';
365 $search_datelimit_endyear =
'';
366 $search_datelimit_start =
'';
367 $search_datelimit_end =
'';
368 $search_fac_rec_source_title =
'';
370 $search_array_options = array();
371 $search_categ_cus = 0;
376 if (empty($reshook)) {
377 $objectclass =
'Facture';
378 $objectlabel =
'Invoices';
379 $permissiontoread = $user->hasRight(
"facture",
"lire");
380 $permissiontoadd = $user->hasRight(
"facture",
"creer");
381 $permissiontodelete = $user->hasRight(
"facture",
"supprimer");
382 $uploaddir = $conf->facture->dir_output;
383 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
386 if ($action ==
'makepayment_confirm' && !empty($user->rights->facture->paiement)) {
387 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
388 $arrayofselected = is_array($toselect) ? $toselect : array();
389 if (!empty($arrayofselected)) {
390 $bankid =
GETPOST(
'bankid',
'int');
391 $paiementid =
GETPOST(
'paiementid',
'int');
393 if (empty($paiementdate)) {
394 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Date")),
null,
'errors');
396 $action =
'makepayment';
400 foreach ($arrayofselected as $toselectid) {
403 $result = $facture->fetch($toselectid);
412 $paiementAmount = $facture->getSommePaiement();
413 $totalcreditnotes = $facture->getSumCreditNotesUsed();
414 $totaldeposits = $facture->getSumDepositsUsed();
415 $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
416 $remaintopay =
price2num($facture->total_ttc - $totalpay);
417 if ($remaintopay != 0) {
418 $resultBank = $facture->setBankAccount($bankid);
419 if ($resultBank < 0) {
424 $paiement->datepaye = $paiementdate;
425 $paiement->amounts[$facture->id] = $remaintopay;
426 $paiement->multicurrency_amounts[$facture->id] = $remaintopay;
427 $paiement->paiementid = $paiementid;
428 $paiement_id = $paiement->create($user, 1, $facture->thirdparty);
429 if ($paiement_id < 0) {
430 $langs->load(
"errors");
431 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
434 $result = $paiement->addPaymentToBank($user,
'payment',
'', $bankid,
'',
'');
436 $langs->load(
"errors");
437 setEventMessages($facture->ref.
' '.$langs->trans($paiement->error), $paiement->errors,
'errors');
443 setEventMessage($langs->trans(
'NoPaymentAvailable', $facture->ref),
'warnings');
447 setEventMessage($langs->trans(
'BulkPaymentNotPossibleForInvoice', $facture->ref),
'warnings');
452 if (empty($errorpayment)) {
453 setEventMessage($langs->trans(
'PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
461 } elseif ($massaction ==
'withdrawrequest') {
462 $langs->load(
"withdrawals");
464 if (!$user->rights->prelevement->bons->creer) {
471 $arrayofselected = is_array($toselect) ? $toselect : array();
472 $listofbills = array();
473 foreach ($arrayofselected as $toselectid) {
475 $result = $objecttmp->fetch($toselectid);
477 $totalpaid = $objecttmp->getSommePaiement();
478 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
479 $totaldeposits = $objecttmp->getSumDepositsUsed();
480 $objecttmp->resteapayer =
price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
483 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"Draft"), $objecttmp->errors,
'errors');
484 } elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
486 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
487 } elseif ($objecttmp->resteapayer < 0) {
489 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
492 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
493 $rsql .=
" , pfd.date_traite as date_traite";
494 $rsql .=
" , pfd.amount";
495 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
496 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
497 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
498 $rsql .=
" WHERE fk_facture = ".((int) $objecttmp->id);
499 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
500 $rsql .=
" AND pfd.traite = 0";
501 $rsql .=
" ORDER BY pfd.date_demande DESC";
503 $result_sql = $db->query($rsql);
505 $numprlv = $db->num_rows($result_sql);
510 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
511 } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code !=
'PRE') {
513 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"BadPaymentMethod"), $objecttmp->errors,
'errors');
515 $listofbills[] = $objecttmp;
521 if (!empty($listofbills)) {
522 $nbwithdrawrequestok = 0;
523 foreach ($listofbills as $aBill) {
525 $result = $aBill->demande_prelevement($user, $aBill->resteapayer,
'direct-debit',
'facture');
528 $nbwithdrawrequestok++;
534 if ($nbwithdrawrequestok > 0) {
535 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
554 $bankaccountstatic =
new Account($db);
555 $facturestatic =
new Facture($db);
557 $companystatic =
new Societe($db);
558 $companyparent =
new Societe($db);
559 $company_url_list = array();
561 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
562 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
565 if ($sall || $search_user > 0) {
566 $sql =
'SELECT DISTINCT';
568 $sql .=
' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
569 $sql .=
' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
570 $sql .=
' f.fk_user_author,';
571 $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,';
572 $sql .=
' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
573 $sql .=
' f.paye as paye, f.fk_statut, f.close_code,';
574 $sql .=
' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
575 $sql .=
' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
576 $sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, 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,';
577 $sql .=
" s.parent as fk_parent,";
578 $sql .=
" s2.nom as name2,";
579 $sql .=
' typent.code as typent_code,';
580 $sql .=
' state.code_departement as state_code, state.nom as state_name,';
581 $sql .=
' country.code as country_code,';
582 $sql .=
' f.fk_fac_rec_source,';
583 $sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
584 $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';
594 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
595 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
596 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
600 $parameters = array();
601 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
602 $sql .= $hookmanager->resPrint;
606 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
607 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
608 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
609 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
610 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
611 $sql .=
', '.MAIN_DB_PREFIX.
'facture as f';
612 if ($sortfield ==
"f.datef") {
613 $sql .= $db->hintindex(
'idx_facture_datef');
615 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
616 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
626 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facturedet as pd ON f.rowid=pd.fk_facture';
628 if (!empty($search_fac_rec_source_title)) {
629 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_rec as facrec ON f.fk_fac_rec_source=facrec.rowid';
631 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = f.fk_projet";
632 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user AS u ON f.fk_user_author = u.rowid';
634 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
635 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
637 if ($search_user > 0) {
638 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
639 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
642 $parameters = array();
643 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
644 $sql .= $hookmanager->resPrint;
646 $sql .=
' WHERE f.fk_soc = s.rowid';
647 $sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
648 if (empty($user->rights->societe->client->voir) && !$socid) {
649 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
652 $sql .=
' AND s.rowid = '.((int) $socid);
656 $sql .=
' AND f.fk_user_author IS NULL';
658 $sql .=
' AND f.fk_user_author = '.((int) $userid);
664 if ($search_refcustomer) {
667 if ($search_type !=
'' && $search_type !=
'-1') {
668 $sql .=
" AND f.type IN (".$db->sanitize($db->escape($search_type)).
")";
670 if ($search_project_ref) {
673 if ($search_project) {
676 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
677 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
679 if ($search_company) {
682 if ($search_company_alias) {
686 if ($search_parent_name) {
698 if (strlen(trim($search_country))) {
700 $country_code_in_EEC = $country_code_in_EEC_without_me =
'';
701 foreach ($arrayofcode as $key => $value) {
702 $country_code_in_EEC .= ($country_code_in_EEC ?
"," :
"").
"'".$value.
"'";
703 if ($value != $mysoc->country_code) {
704 $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ?
"," :
"").
"'".$value.
"'";
707 if ($search_country ==
'special_allnotme') {
708 $sql .=
" AND country.code <> '".$db->escape($mysoc->country_code).
"'";
709 } elseif ($search_country ==
'special_eec') {
710 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC, 1).
")";
711 } elseif ($search_country ==
'special_eecnotme') {
712 $sql .=
" AND country.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).
")";
713 } elseif ($search_country ==
'special_noteec') {
714 $sql .=
" AND country.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).
")";
719 if ($search_type_thirdparty !=
'' && $search_type_thirdparty !=
'-1') {
720 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
722 if ($search_montant_ht !=
'') {
725 if ($search_montant_vat !=
'') {
728 if ($search_montant_localtax1 !=
'') {
729 $sql .=
natural_search(
'f.localtax1', $search_montant_localtax1, 1);
731 if ($search_montant_localtax2 !=
'') {
732 $sql .=
natural_search(
'f.localtax2', $search_montant_localtax2, 1);
734 if ($search_montant_ttc !=
'') {
737 if ($search_multicurrency_code !=
'') {
738 $sql .=
" AND f.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
740 if ($search_multicurrency_tx !=
'') {
741 $sql .=
natural_search(
'f.multicurrency_tx', $search_multicurrency_tx, 1);
743 if ($search_multicurrency_montant_ht !=
'') {
744 $sql .=
natural_search(
'f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
746 if ($search_multicurrency_montant_vat !=
'') {
747 $sql .=
natural_search(
'f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
749 if ($search_multicurrency_montant_ttc !=
'') {
750 $sql .=
natural_search(
'f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
753 $sql .=
natural_search(array(
'u.login',
'u.firstname',
'u.lastname'), $search_login);
755 if ($search_status !=
'-1' && $search_status !=
'') {
756 if (is_numeric($search_status) && $search_status >= 0) {
757 if ($search_status ==
'0') {
758 $sql .=
" AND f.fk_statut = 0";
760 if ($search_status ==
'1') {
761 $sql .=
" AND f.fk_statut = 1";
763 if ($search_status ==
'2') {
764 $sql .=
" AND f.fk_statut = 2";
766 if ($search_status ==
'3') {
767 $sql .=
" AND f.fk_statut = 3";
770 $sql .=
" AND f.fk_statut IN (".$db->sanitize($db->escape($search_status)).
")";
774 if ($search_paymentmode > 0) {
775 $sql .=
" AND f.fk_mode_reglement = ".((int) $search_paymentmode);
777 if ($search_paymentterms > 0) {
778 $sql .=
" AND f.fk_cond_reglement = ".((int) $search_paymentterms);
780 if ($search_module_source) {
783 if ($search_pos_source) {
786 if ($search_date_start) {
787 $sql .=
" AND f.datef >= '".$db->idate($search_date_start).
"'";
789 if ($search_date_end) {
790 $sql .=
" AND f.datef <= '".$db->idate($search_date_end).
"'";
792 if ($search_date_valid_start) {
793 $sql .=
" AND f.date_valid >= '".$db->idate($search_date_valid_start).
"'";
795 if ($search_date_valid_end) {
796 $sql .=
" AND f.date_valid <= '".$db->idate($search_date_valid_end).
"'";
798 if ($search_datelimit_start) {
799 $sql .=
" AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start).
"'";
801 if ($search_datelimit_end) {
802 $sql .=
" AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end).
"'";
804 if ($option ==
'late') {
805 $sql .=
" AND f.date_lim_reglement < '".$db->idate(
dol_now() - $conf->facture->client->warning_delay).
"'";
807 if ($search_sale > 0) {
808 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
810 if ($search_user > 0) {
811 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user);
813 if (!empty($search_fac_rec_source_title)) {
814 $sql .=
natural_search(
'facrec.titre', $search_fac_rec_source_title);
817 $searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
818 $searchCategoryProductOperator = 0;
819 if (!empty($searchCategoryProductList)) {
820 $searchCategoryProductSqlList = array();
821 $listofcategoryid =
'';
822 foreach ($searchCategoryProductList as $searchCategoryProduct) {
823 if (intval($searchCategoryProduct) == -2) {
824 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product)";
825 } elseif (intval($searchCategoryProduct) > 0) {
826 if ($searchCategoryProductOperator == 0) {
827 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
829 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
833 if ($listofcategoryid) {
834 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
836 if ($searchCategoryProductOperator == 1) {
837 if (!empty($searchCategoryProductSqlList)) {
838 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
841 if (!empty($searchCategoryProductSqlList)) {
842 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
846 $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();
847 $searchCategoryCustomerOperator = 0;
849 if (!empty($searchCategoryCustomerList)) {
850 $searchCategoryCustomerSqlList = array();
851 $listofcategoryid =
'';
852 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
853 if (intval($searchCategoryCustomer) == -2) {
854 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
855 } elseif (intval($searchCategoryCustomer) > 0) {
856 if ($searchCategoryCustomerOperator == 0) {
857 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).
")";
859 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
863 if ($listofcategoryid) {
864 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
866 if ($searchCategoryCustomerOperator == 1) {
867 if (!empty($searchCategoryCustomerSqlList)) {
868 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
871 if (!empty($searchCategoryCustomerSqlList)) {
872 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
877 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
879 $parameters = array();
880 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
881 $sql .= $hookmanager->resPrint;
920 $parameters = array();
921 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
922 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
926 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
928 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
929 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
930 $resql = $db->query($sqlforcount);
932 $objforcount = $db->fetch_object(
$resql);
946 $sql .= $db->order($sortfield, $sortorder);
948 $sql .= $db->plimit($limit + 1, $offset);
951 $resql = $db->query($sql);
954 $num = $db->num_rows(
$resql);
956 $arrayofselected = is_array($toselect) ? $toselect : array();
958 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
959 $obj = $db->fetch_object(
$resql);
962 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$id);
966 llxHeader(
'', $langs->trans(
'CustomersInvoices'),
'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
971 if (empty($search_company)) {
972 $search_company = $soc->name;
976 $param =
'&socid='.urlencode($socid);
977 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
978 $param .=
'&contextpage='.urlencode($contextpage);
980 if ($limit > 0 && $limit != $conf->liste_limit) {
981 $param .=
'&limit='.urlencode($limit);
984 $param .=
'&sall='.urlencode($sall);
986 if ($search_date_startday) {
987 $param .=
'&search_date_startday='.urlencode($search_date_startday);
989 if ($search_date_startmonth) {
990 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
992 if ($search_date_startyear) {
993 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
995 if ($search_date_endday) {
996 $param .=
'&search_date_endday='.urlencode($search_date_endday);
998 if ($search_date_endmonth) {
999 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
1001 if ($search_date_endyear) {
1002 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
1004 if ($search_date_valid_startday) {
1005 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
1007 if ($search_date_valid_startmonth) {
1008 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
1010 if ($search_date_valid_startyear) {
1011 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
1013 if ($search_date_valid_endday) {
1014 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
1016 if ($search_date_valid_endmonth) {
1017 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
1019 if ($search_date_valid_endyear) {
1020 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
1022 if ($search_datelimit_startday) {
1023 $param .=
'&search_datelimit_startday='.urlencode($search_datelimit_startday);
1025 if ($search_datelimit_startmonth) {
1026 $param .=
'&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
1028 if ($search_datelimit_startyear) {
1029 $param .=
'&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
1031 if ($search_datelimit_endday) {
1032 $param .=
'&search_datelimit_endday='.urlencode($search_datelimit_endday);
1034 if ($search_datelimit_endmonth) {
1035 $param .=
'&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
1037 if ($search_datelimit_endyear) {
1038 $param .=
'&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
1041 $param .=
'&search_ref='.urlencode($search_ref);
1043 if ($search_refcustomer) {
1044 $param .=
'&search_refcustomer='.urlencode($search_refcustomer);
1046 if ($search_project_ref) {
1047 $param .=
'&search_project_ref='.urlencode($search_project_ref);
1049 if ($search_project) {
1050 $param .=
'&search_project='.urlencode($search_project);
1052 if ($search_type !=
'') {
1053 $param .=
'&search_type='.urlencode($search_type);
1055 if ($search_company) {
1056 $param .=
'&search_company='.urlencode($search_company);
1058 if ($search_company_alias) {
1059 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1061 if ($search_parent_name !=
'') {
1062 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1065 $param .=
'&search_town='.urlencode($search_town);
1068 $param .=
'&search_zip='.urlencode($search_zip);
1070 if ($search_country) {
1071 $param .=
"&search_country=".urlencode($search_country);
1073 if ($search_type_thirdparty !=
'') {
1074 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1076 if ($search_sale > 0) {
1077 $param .=
'&search_sale='.urlencode($search_sale);
1079 if ($search_user > 0) {
1080 $param .=
'&search_user='.urlencode($search_user);
1082 if ($search_login) {
1083 $param .=
'&search_login='.urlencode($search_login);
1085 if ($search_product_category > 0) {
1086 $param .=
'&search_product_category='.urlencode($search_product_category);
1088 if ($search_montant_ht !=
'') {
1089 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
1091 if ($search_montant_vat !=
'') {
1092 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
1094 if ($search_montant_localtax1 !=
'') {
1095 $param .=
'&search_montant_localtax1='.urlencode($search_montant_localtax1);
1097 if ($search_montant_localtax2 !=
'') {
1098 $param .=
'&search_montant_localtax2='.urlencode($search_montant_localtax2);
1100 if ($search_montant_ttc !=
'') {
1101 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
1103 if ($search_multicurrency_code !=
'') {
1104 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1106 if ($search_multicurrency_tx !=
'') {
1107 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1109 if ($search_multicurrency_montant_ht !=
'') {
1110 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1112 if ($search_multicurrency_montant_vat !=
'') {
1113 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1115 if ($search_multicurrency_montant_ttc !=
'') {
1116 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1118 if ($search_status !=
'') {
1119 $param .=
'&search_status='.urlencode($search_status);
1121 if ($search_paymentmode > 0) {
1122 $param .=
'&search_paymentmode='.urlencode($search_paymentmode);
1124 if ($search_paymentterms > 0) {
1125 $param .=
'&search_paymentterms='.urlencode($search_paymentterms);
1127 if ($search_module_source) {
1128 $param .=
'&search_module_source='.urlencode($search_module_source);
1130 if ($search_pos_source) {
1131 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1134 $param .=
'&show_files='.urlencode($show_files);
1137 $param .=
"&search_option=".urlencode($option);
1139 if ($optioncss !=
'') {
1140 $param .=
'&optioncss='.urlencode($optioncss);
1142 if ($search_categ_cus > 0) {
1143 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1145 if (!empty($search_fac_rec_source_title)) {
1146 $param .=
'&search_fac_rec_source_title='.urlencode($search_fac_rec_source_title);
1150 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1152 $parameters = array();
1153 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1154 $param .= $hookmanager->resPrint;
1156 $arrayofmassactions = array(
1157 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
1158 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1159 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1160 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
1163 if (!empty($user->rights->facture->paiement)) {
1164 $arrayofmassactions[
'makepayment'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakePaymentAndClassifyPayed");
1166 if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
1167 $langs->load(
"withdrawals");
1168 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeWithdrawRequest");
1170 if (!empty($user->rights->facture->supprimer)) {
1171 if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
1172 $arrayofmassactions[
'predeletedraft'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Deletedraft");
1173 } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) {
1174 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1177 if (in_array($massaction, array(
'presend',
'predelete',
'makepayment'))) {
1178 $arrayofmassactions = array();
1180 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1183 if ($contextpage !=
'poslist') {
1184 $url = DOL_URL_ROOT.
'/compta/facture/card.php?action=create';
1185 if (!empty($socid)) {
1186 $url .=
'&socid='.$socid;
1188 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewBill'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
"facture",
"creer"));
1192 print
'<form method="POST" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1194 if ($optioncss !=
'') {
1195 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1197 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1198 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1199 if (!in_array($massaction, array(
'makepayment'))) {
1200 print
'<input type="hidden" name="action" value="list">';
1202 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1203 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1204 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1205 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1206 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1208 print_barre_liste($langs->trans(
'BillsCustomers').
' '.($socid > 0 ?
' '.$soc->name :
''), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1210 $topicmail =
"SendBillRef";
1211 $modelmail =
"facture_send";
1212 $objecttmp =
new Facture($db);
1213 $trackid =
'inv'.$object->id;
1214 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1216 if ($massaction ==
'makepayment') {
1218 $formquestion = array(
1222 array(
'type' =>
'date',
'name' =>
'datepaiment',
'label' => $langs->trans(
"Date"),
'datenow' => 1),
1223 array(
'type' =>
'other',
'name' =>
'paiementid',
'label' => $langs->trans(
"PaymentMode"),
'value' =>
$form->select_types_paiements(
GETPOST(
'search_paymentmode'),
'paiementid',
'', 0, 0, 1, 0, 1,
'', 1)),
1224 array(
'type' =>
'other',
'name' =>
'bankid',
'label' => $langs->trans(
"BankAccount"),
'value'=>
$form->select_comptes(
'',
'bankid', 0,
'', 0,
'', 0,
'', 1)),
1227 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
'MakePaymentAndClassifyPayed'), $langs->trans(
'EnterPaymentReceivedFromCustomer'),
'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
1232 foreach ($fieldstosearchall as $key => $val) {
1233 $fieldstosearchall[$key] = $langs->trans($val);
1235 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
1239 $moreforfilter =
'';
1240 if ($user->hasRight(
"user",
"user",
"lire")) {
1241 $langs->load(
"commercial");
1242 $moreforfilter .=
'<div class="divsearchfield">';
1243 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1244 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250');
1245 $moreforfilter .=
'</div>';
1248 if ($user->hasRight(
"user",
"user",
"lire")) {
1249 $moreforfilter .=
'<div class="divsearchfield">';
1250 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1251 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
1252 $moreforfilter .=
'</div>';
1255 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1256 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1257 $moreforfilter .=
'<div class="divsearchfield">';
1258 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1259 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1260 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth250', 1);
1261 $moreforfilter .=
'</div>';
1263 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1264 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1265 $moreforfilter .=
'<div class="divsearchfield">';
1266 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1267 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle);
1268 $moreforfilter .=
'</div>';
1270 $parameters = array();
1271 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1272 if (empty($reshook)) {
1273 $moreforfilter .= $hookmanager->resPrint;
1275 $moreforfilter = $hookmanager->resPrint;
1278 if ($moreforfilter) {
1279 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1280 print $moreforfilter;
1284 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1285 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
1288 if ($massactionbutton && $contextpage !=
'poslist') {
1289 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
1292 print
'<div class="div-table-responsive">';
1293 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1296 print
'<tr class="liste_titre_filter">';
1298 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1300 print
'<td class="liste_titre center actioncolumn">';
1301 $searchpicto =
$form->showFilterButtons(
'left');
1306 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1307 print
'<td class="liste_titre">';
1311 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1312 print
'<td class="liste_titre" align="left">';
1313 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1317 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1318 print
'<td class="liste_titre">';
1319 print
'<input class="flat maxwidth50imp" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).
'">';
1323 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1324 print
'<td class="liste_titre maxwidthonsmartphone">';
1331 if (!empty($conf->global->INVOICE_USE_SITUATION)) {
1335 print
$form->selectarray(
'search_type', $listtype, $search_type, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
1339 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1340 print
'<td class="liste_titre center">';
1341 print
'<div class="nowrap">';
1342 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1344 print
'<div class="nowrap">';
1345 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1350 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1351 print
'<td class="liste_titre center">';
1352 print
'<div class="nowrap">';
1353 print
$form->selectDate($search_date_valid_start ? $search_date_valid_start : -1,
'search_date_valid_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1355 print
'<div class="nowrap">';
1356 print
$form->selectDate($search_date_valid_end ? $search_date_valid_end : -1,
'search_date_valid_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1361 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1362 print
'<td class="liste_titre center">';
1363 print
'<div class="nowrap">';
1370 print
$form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"Before"));
1371 print
'<br><input type="checkbox" name="search_option" value="late"'.($option ==
'late' ?
' checked' :
'').
'> '.$langs->trans(
"Alert");
1376 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1377 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.$search_project_ref.
'"></td>';
1380 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1381 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.
'"></td>';
1384 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1385 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.$search_company.
'"'.($socid > 0 ?
" disabled" :
"").
'></td>';
1388 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1389 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.$search_company_alias.
'"></td>';
1392 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1393 print
'<td class="liste_titre">';
1394 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1398 if (!empty($arrayfields[
's.town'][
'checked'])) {
1399 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1402 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1403 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1406 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1407 print
'<td class="liste_titre">';
1408 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1412 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1413 print
'<td class="liste_titre" align="center">';
1414 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth150imp maxwidth150',
'code2', 1, 0, 1,
null, 1);
1418 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1419 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1420 print
$form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'maxwidth100', 1);
1424 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1425 print
'<td class="liste_titre">';
1426 print
$form->select_types_paiements($search_paymentmode,
'search_paymentmode',
'', 0, 1, 1, 0, 1,
'minwidth100 maxwidth100', 1);
1430 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1431 print
'<td class="liste_titre">';
1432 print
$form->getSelectConditionsPaiements($search_paymentterms,
'search_paymentterms', -1, 1, 1,
'minwidth100 maxwidth100');
1436 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1437 print
'<td class="liste_titre">';
1438 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1442 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1443 print
'<td class="liste_titre">';
1444 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1447 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1449 print
'<td class="liste_titre right">';
1450 print
'<input class="flat" type="text" size="4" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
1453 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1455 print
'<td class="liste_titre right">';
1456 print
'<input class="flat" type="text" size="4" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
1459 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1461 print
'<td class="liste_titre right">';
1462 print
'<input class="flat" type="text" size="4" name="search_montant_localtax1" value="'.$search_montant_localtax1.
'">';
1465 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1467 print
'<td class="liste_titre right">';
1468 print
'<input class="flat" type="text" size="4" name="search_montant_localtax2" value="'.$search_montant_localtax2.
'">';
1471 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1473 print
'<td class="liste_titre right">';
1474 print
'<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
1477 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1479 print
'<td class="liste_titre" align="center">';
1480 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1483 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1484 print
'<td class="liste_titre"></td>';
1486 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1487 print
'<td class="liste_titre" align="right">';
1490 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1491 print
'<td class="liste_titre right">';
1494 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1495 print
'<td class="liste_titre right">';
1498 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1500 print
'<td class="liste_titre">';
1501 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1504 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1506 print
'<td class="liste_titre">';
1507 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1510 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1512 print
'<td class="liste_titre right">';
1513 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1516 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1518 print
'<td class="liste_titre right">';
1519 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1522 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1524 print
'<td class="liste_titre right">';
1525 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1528 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1529 print
'<td class="liste_titre">';
1532 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1533 print
'<td class="liste_titre right">';
1536 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1537 print
'<td class="liste_titre right">';
1540 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1541 print
'<td class="liste_titre right">';
1544 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1545 print
'<td class="liste_titre right">';
1548 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1549 print
'<td class="liste_titre right">';
1554 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1557 $parameters = array(
'arrayfields'=>$arrayfields);
1558 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1559 print $hookmanager->resPrint;
1561 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1562 print
'<td class="liste_titre">';
1566 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1567 print
'<td class="liste_titre">';
1571 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1572 print
'<td class="liste_titre">';
1575 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1577 print
'<td class="liste_titre">';
1580 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1582 print
'<td class="liste_titre">';
1585 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1587 print
'<td class="liste_titre maxwidthonsmartphone right">';
1588 print
'<input class="flat maxwidth50imp" type="text" name="search_fac_rec_source_title" id="search_fac_rec_source_title" value="'.dol_escape_htmltag($search_fac_rec_source_title).
'">';
1592 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1593 print
'<td class="liste_titre maxwidthonsmartphone right">';
1594 $liststatus = array(
'0'=>$langs->trans(
"BillShortStatusDraft"),
'0,1'=>$langs->trans(
"BillShortStatusDraft").
'+'.$langs->trans(
"BillShortStatusNotPaid"),
'1'=>$langs->trans(
"BillShortStatusNotPaid"),
'1,2'=>$langs->trans(
"BillShortStatusNotPaid").
'+'.$langs->trans(
"BillShortStatusPaid"),
'2'=>$langs->trans(
"BillShortStatusPaid"),
'3'=>$langs->trans(
"BillShortStatusCanceled"));
1595 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage', 1);
1599 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1600 print
'<td class="liste_titre center actioncolumn">';
1601 $searchpicto =
$form->showFilterButtons();
1607 print
'<tr class="liste_titre">';
1609 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1610 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1613 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1616 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1617 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
'PHP_SELF'],
'f.ref',
'', $param,
'', $sortfield, $sortorder);
1619 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1620 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'f.ref_client',
'', $param,
'', $sortfield, $sortorder);
1622 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1623 print_liste_field_titre($arrayfields[
'f.type'][
'label'], $_SERVER[
"PHP_SELF"],
'f.type',
'', $param,
'', $sortfield, $sortorder);
1625 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1626 print_liste_field_titre($arrayfields[
'f.datef'][
'label'], $_SERVER[
'PHP_SELF'],
'f.datef',
'', $param,
'align="center"', $sortfield, $sortorder);
1628 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1629 print_liste_field_titre($arrayfields[
'f.date_valid'][
'label'], $_SERVER[
'PHP_SELF'],
'f.date_valid',
'', $param,
'align="center"', $sortfield, $sortorder);
1631 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1632 print_liste_field_titre($arrayfields[
'f.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_lim_reglement",
'', $param,
'align="center"', $sortfield, $sortorder);
1634 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1635 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
'PHP_SELF'],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
1637 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1638 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
'PHP_SELF'],
"p.title",
'', $param,
'', $sortfield, $sortorder);
1640 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1641 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1643 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1644 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1646 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1647 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1649 if (!empty($arrayfields[
's.town'][
'checked'])) {
1650 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1652 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1653 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1655 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1656 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1658 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1659 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'align="center"', $sortfield, $sortorder);
1661 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1662 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'align="center"', $sortfield, $sortorder);
1664 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
1665 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_mode_reglement",
"", $param,
"", $sortfield, $sortorder);
1667 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
1668 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_cond_reglement",
"", $param,
"", $sortfield, $sortorder);
1670 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
1671 print_liste_field_titre($arrayfields[
'f.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
1673 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
1674 print_liste_field_titre($arrayfields[
'f.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
1676 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
1677 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1679 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
1680 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1682 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
1683 print_liste_field_titre($arrayfields[
'f.total_localtax1'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax1',
'', $param,
'class="right"', $sortfield, $sortorder);
1685 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
1686 print_liste_field_titre($arrayfields[
'f.total_localtax2'][
'label'], $_SERVER[
'PHP_SELF'],
'f.localtax2',
'', $param,
'class="right"', $sortfield, $sortorder);
1688 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
1689 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1691 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1692 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1694 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1695 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1697 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
1698 print_liste_field_titre($arrayfields[
'f.retained_warranty'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'align="right"', $sortfield, $sortorder);
1700 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
1701 print_liste_field_titre($arrayfields[
'dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1703 if (!empty($arrayfields[
'rtp'][
'checked'])) {
1704 print_liste_field_titre($arrayfields[
'rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1706 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
1707 print_liste_field_titre($arrayfields[
'f.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1709 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
1710 print_liste_field_titre($arrayfields[
'f.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1712 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
1713 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1715 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
1716 print_liste_field_titre($arrayfields[
'f.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1718 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
1719 print_liste_field_titre($arrayfields[
'f.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'f.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1721 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
1722 print_liste_field_titre($arrayfields[
'multicurrency_dynamount_payed'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1724 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
1725 print_liste_field_titre($arrayfields[
'multicurrency_rtp'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1727 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1728 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1730 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1731 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1733 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1734 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1736 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1737 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1740 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1742 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1743 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1744 print $hookmanager->resPrint;
1745 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1746 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1748 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1749 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1751 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
1752 print_liste_field_titre($arrayfields[
'f.date_closing'][
'label'], $_SERVER[
"PHP_SELF"],
"f.date_closing",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
1754 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1755 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1757 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1758 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1760 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
1761 print_liste_field_titre($arrayfields[
'f.fk_fac_rec_source'][
'label'], $_SERVER[
"PHP_SELF"],
"facrec.titre",
"", $param,
'', $sortfield, $sortorder);
1763 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1764 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut,f.paye,f.type",
"", $param,
'class="right"', $sortfield, $sortorder);
1766 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1767 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
1772 $projectstatic =
new Project($db);
1774 $userstatic =
new User($db);
1778 $typenArray = $formcompany->typent_array(1);
1779 $totalarray = array();
1780 $totalarray[
'nbfield'] = 0;
1781 $totalarray[
'val'] = array();
1782 $totalarray[
'val'][
'f.total_tva'] = 0;
1783 $totalarray[
'val'][
'f.total_ht'] = 0;
1784 $totalarray[
'val'][
'f.total_ttc'] = 0;
1786 $with_margin_info =
false;
1788 !empty($arrayfields[
'total_pa'][
'checked'])
1789 || !empty($arrayfields[
'total_margin'][
'checked'])
1790 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1791 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1794 $with_margin_info =
true;
1799 $savnbfield = $totalarray[
'nbfield'];
1800 $totalarray[
'nbfield'] = 0;
1801 $imaxinloop = ($limit ? min($num, $limit) : $num);
1802 while ($i < $imaxinloop) {
1803 $obj = $db->fetch_object(
$resql);
1805 $datelimit = $db->jdate($obj->datelimite);
1807 $facturestatic->id = $obj->id;
1808 $facturestatic->ref = $obj->ref;
1809 $facturestatic->ref_client = $obj->ref_client;
1810 $facturestatic->type = $obj->type;
1811 $facturestatic->total_ht = $obj->total_ht;
1812 $facturestatic->total_tva = $obj->total_tva;
1813 $facturestatic->total_ttc = $obj->total_ttc;
1814 $facturestatic->multicurrency_code = $obj->multicurrency_code;
1815 $facturestatic->multicurrency_tx = $obj->multicurrency_tx;
1816 $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1817 $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1818 $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1819 $facturestatic->statut = $obj->fk_statut;
1820 $facturestatic->status = $obj->fk_statut;
1821 $facturestatic->close_code = $obj->close_code;
1822 $facturestatic->total_ttc = $obj->total_ttc;
1823 $facturestatic->paye = $obj->paye;
1824 $facturestatic->socid = $obj->fk_soc;
1826 $facturestatic->date = $db->jdate($obj->datef);
1827 $facturestatic->date_validation = $db->jdate($obj->date_valid);
1828 $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
1830 $facturestatic->note_public = $obj->note_public;
1831 $facturestatic->note_private = $obj->note_private;
1833 if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
1834 $facturestatic->retained_warranty = $obj->retained_warranty;
1835 $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
1836 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1837 $facturestatic->situation_final = $obj->retained_warranty_date_limit;
1838 $facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
1839 $facturestatic->situation_counter = $obj->situation_counter;
1842 $companystatic->id = $obj->socid;
1843 $companystatic->name = $obj->name;
1844 $companystatic->name_alias = $obj->alias;
1845 $companystatic->client = $obj->client;
1846 $companystatic->fournisseur = $obj->fournisseur;
1847 $companystatic->code_client = $obj->code_client;
1848 $companystatic->code_compta_client = $obj->code_compta_client;
1849 $companystatic->code_fournisseur = $obj->code_fournisseur;
1850 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1851 $companystatic->email = $obj->email;
1852 $companystatic->phone = $obj->phone;
1853 $companystatic->fax = $obj->fax;
1854 $companystatic->address = $obj->address;
1855 $companystatic->zip = $obj->zip;
1856 $companystatic->town = $obj->town;
1857 $companystatic->country_code = $obj->country_code;
1859 $projectstatic->id = $obj->project_id;
1860 $projectstatic->ref = $obj->project_ref;
1861 $projectstatic->title = $obj->project_label;
1863 $paiement = $facturestatic->getSommePaiement();
1864 $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
1865 $totaldeposits = $facturestatic->getSumDepositsUsed();
1866 $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
1867 $remaintopay =
price2num($facturestatic->total_ttc - $totalpay);
1868 $multicurrency_paiement = $facturestatic->getSommePaiement(1);
1869 $multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
1870 $multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
1871 $multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
1872 $multicurrency_remaintopay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
1876 $multicurrency_remaintopay = 0;
1879 $remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id);
1880 $remaintopay = -$remaincreditnote;
1881 $totalpay =
price2num($facturestatic->total_ttc - $remaintopay);
1882 $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic,
'',
'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
1883 $multicurrency_remaintopay = -$multicurrency_remaincreditnote;
1884 $multicurrency_totalpay =
price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
1887 $facturestatic->alreadypaid = $paiement;
1889 $marginInfo = array();
1890 if ($with_margin_info ===
true) {
1891 $facturestatic->fetch_lines();
1892 $marginInfo = $formmargin->getMarginInfosArray($facturestatic);
1893 $total_ht += $obj->total_ht;
1894 $total_margin += $marginInfo[
'total_margin'];
1897 print
'<tr class="oddeven"';
1898 if ($contextpage ==
'poslist') {
1899 print
' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.
'\',
function() {parent.$.colorbox.close();
';
1900 if (strpos($obj->ref, 'PROV
') !== false) {
1901 //If is a draft invoice, load var to be able to add products
1902 $place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
1903 print 'parent.place=\
''.$place.
'\'';
1911 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1912 print
'<td class="nowrap" align="center">';
1913 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1915 if (in_array($obj->id, $arrayofselected)) {
1918 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1924 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
1925 print
'<td>'.(($offset * $limit) + $i).
'</td>';
1929 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
1930 print
'<td class="nowraponall">';
1932 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1934 print
'<td class="nobordernopadding nowraponall">';
1935 if ($contextpage ==
'poslist') {
1938 print $facturestatic->getNomUrl(1,
'', 200, 0,
'', 0, 1);
1943 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->id;
1944 print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
1951 $totalarray[
'nbfield']++;
1956 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
1957 print
'<td class="nowrap tdoverflowmax200">';
1961 $totalarray[
'nbfield']++;
1966 if (!empty($arrayfields[
'f.type'][
'checked'])) {
1967 print
'<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().
'">';
1968 print $facturestatic->getLibType(2);
1971 $totalarray[
'nbfield']++;
1976 if (!empty($arrayfields[
'f.datef'][
'checked'])) {
1977 print
'<td align="center" class="nowraponall">';
1981 $totalarray[
'nbfield']++;
1986 if (!empty($arrayfields[
'f.date_valid'][
'checked'])) {
1987 print
'<td align="center" class="nowraponall">';
1991 $totalarray[
'nbfield']++;
1996 if (!empty($arrayfields[
'f.date_lim_reglement'][
'checked'])) {
1997 print
'<td align="center" class="nowraponall">'.dol_print_date($datelimit,
'day');
1998 if ($facturestatic->hasDelay()) {
1999 print
img_warning($langs->trans(
'Alert').
' - '.$langs->trans(
'Late'));
2003 $totalarray[
'nbfield']++;
2008 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2009 print
'<td class="nocellnopadd nowraponall">';
2010 if ($obj->project_id > 0) {
2011 print $projectstatic->getNomUrl(1);
2015 $totalarray[
'nbfield']++;
2020 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2021 print
'<td class="nowraponall">';
2022 if ($obj->project_id > 0) {
2027 $totalarray[
'nbfield']++;
2032 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2033 print
'<td class="tdoverflowmax200">';
2034 if ($contextpage ==
'poslist') {
2037 print $companystatic->getNomUrl(1,
'customer', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2041 $totalarray[
'nbfield']++;
2045 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2046 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name_alias).
'">';
2050 $totalarray[
'nbfield']++;
2054 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2055 print
'<td class="tdoverflowmax200">';
2056 if ($obj->fk_parent > 0) {
2057 if (!isset($company_url_list[$obj->fk_parent])) {
2058 $companyparent =
new Societe($db);
2059 $res = $companyparent->fetch($obj->fk_parent);
2061 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2064 if (isset($company_url_list[$obj->fk_parent])) {
2065 print $company_url_list[$obj->fk_parent];
2070 $totalarray[
'nbfield']++;
2074 if (!empty($arrayfields[
's.town'][
'checked'])) {
2075 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2079 $totalarray[
'nbfield']++;
2083 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2084 print
'<td class="nowraponall">';
2088 $totalarray[
'nbfield']++;
2092 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2093 print
"<td>".dol_escape_htmltag($obj->state_name).
"</td>\n";
2095 $totalarray[
'nbfield']++;
2099 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2100 print
'<td class="center">';
2101 $tmparray =
getCountry($obj->fk_pays,
'all');
2102 print $tmparray[
'label'];
2105 $totalarray[
'nbfield']++;
2109 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2110 print
'<td class="center">';
2111 if (!is_array($typenArray) || count($typenArray) == 0) {
2112 $typenArray = $formcompany->typent_array(1);
2114 print $typenArray[$obj->typent_code];
2117 $totalarray[
'nbfield']++;
2121 if (!empty($arrayfields[
'staff.code'][
'checked'])) {
2122 print
'<td class="center">';
2123 if (!is_array($conf->cache[
'staff']) || count($conf->cache[
'staff']) == 0) {
2124 $conf->cache[
'staff'] = $formcompany->effectif_array(1);
2126 print $conf->cache[
'staff'][$obj->staff_code];
2129 $totalarray[
'nbfield']++;
2134 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
2135 $s =
$form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1, 0,
'', 1);
2136 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2140 $totalarray[
'nbfield']++;
2145 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
2146 $s =
$form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', -1, -1, 1);
2147 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
2151 $totalarray[
'nbfield']++;
2156 if (!empty($arrayfields[
'f.module_source'][
'checked'])) {
2161 $totalarray[
'nbfield']++;
2166 if (!empty($arrayfields[
'f.pos_source'][
'checked'])) {
2171 $totalarray[
'nbfield']++;
2176 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
2177 print
'<td class="right nowraponall amount">'.price($obj->total_ht).
"</td>\n";
2179 $totalarray[
'nbfield']++;
2182 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ht';
2184 $totalarray[
'val'][
'f.total_ht'] += $obj->total_ht;
2187 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
2188 print
'<td class="right nowraponall amount">'.price($obj->total_tva).
"</td>\n";
2190 $totalarray[
'nbfield']++;
2193 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_tva';
2195 $totalarray[
'val'][
'f.total_tva'] += $obj->total_tva;
2198 if (!empty($arrayfields[
'f.total_localtax1'][
'checked'])) {
2199 print
'<td class="right nowraponall amount">'.price($obj->total_localtax1).
"</td>\n";
2201 $totalarray[
'nbfield']++;
2204 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax1';
2206 $totalarray[
'val'][
'f.total_localtax1'] += $obj->total_localtax1;
2209 if (!empty($arrayfields[
'f.total_localtax2'][
'checked'])) {
2210 print
'<td class="right nowraponall amount">'.price($obj->total_localtax2).
"</td>\n";
2212 $totalarray[
'nbfield']++;
2215 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_localtax2';
2217 $totalarray[
'val'][
'f.total_localtax2'] += $obj->total_localtax2;
2220 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
2221 print
'<td class="right nowraponall amount">'.price($obj->total_ttc).
"</td>\n";
2223 $totalarray[
'nbfield']++;
2226 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'f.total_ttc';
2228 $totalarray[
'val'][
'f.total_ttc'] += $obj->total_ttc;
2231 $userstatic->id = $obj->fk_user_author;
2232 $userstatic->login = $obj->login;
2233 $userstatic->lastname = $obj->lastname;
2234 $userstatic->firstname = $obj->firstname;
2235 $userstatic->email = $obj->user_email;
2236 $userstatic->statut = $obj->user_statut;
2237 $userstatic->entity = $obj->entity;
2238 $userstatic->photo = $obj->photo;
2239 $userstatic->office_phone = $obj->office_phone;
2240 $userstatic->office_fax = $obj->office_fax;
2241 $userstatic->user_mobile = $obj->user_mobile;
2242 $userstatic->job = $obj->job;
2243 $userstatic->gender = $obj->gender;
2246 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2247 print
'<td class="tdoverflowmax200">';
2248 if ($userstatic->id) {
2249 print $userstatic->getNomUrl(-1);
2255 $totalarray[
'nbfield']++;
2259 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2262 if ($obj->socid > 0) {
2263 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2264 if ($listsalesrepresentatives < 0) {
2267 $nbofsalesrepresentative = count($listsalesrepresentatives);
2268 if ($nbofsalesrepresentative > 6) {
2270 print $nbofsalesrepresentative;
2271 } elseif ($nbofsalesrepresentative > 0) {
2273 foreach ($listsalesrepresentatives as $val) {
2274 $userstatic->id = $val[
'id'];
2275 $userstatic->lastname = $val[
'lastname'];
2276 $userstatic->firstname = $val[
'firstname'];
2277 $userstatic->email = $val[
'email'];
2278 $userstatic->statut = $val[
'statut'];
2279 $userstatic->entity = $val[
'entity'];
2280 $userstatic->photo = $val[
'photo'];
2281 $userstatic->login = $val[
'login'];
2282 $userstatic->office_phone = $val[
'office_phone'];
2283 $userstatic->office_fax = $val[
'office_fax'];
2284 $userstatic->user_mobile = $val[
'user_mobile'];
2285 $userstatic->job = $val[
'job'];
2286 $userstatic->gender = $val[
'gender'];
2288 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2290 if ($j < $nbofsalesrepresentative) {
2302 $totalarray[
'nbfield']++;
2306 if (!empty($arrayfields[
'f.retained_warranty'][
'checked'])) {
2307 print
'<td align="right">'.(!empty($obj->retained_warranty) ?
price($obj->retained_warranty).
'%' :
' ').
'</td>';
2310 if (!empty($arrayfields[
'dynamount_payed'][
'checked'])) {
2311 print
'<td class="right nowraponall amount">'.(!empty($totalpay) ?
price($totalpay, 0, $langs) :
' ').
'</td>';
2313 $totalarray[
'nbfield']++;
2316 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalam';
2318 $totalarray[
'val'][
'totalam'] += $totalpay;
2322 if (!empty($arrayfields[
'rtp'][
'checked'])) {
2323 print
'<td class="right nowraponall amount">';
2324 print (!empty($remaintopay) ?
price($remaintopay, 0, $langs) :
' ');
2327 $totalarray[
'nbfield']++;
2330 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'rtp';
2332 $totalarray[
'val'][
'rtp'] += $remaintopay;
2337 if (!empty($arrayfields[
'f.multicurrency_code'][
'checked'])) {
2338 print
'<td class="nowraponall tdoverflowmax125" title="'.dol_escape_htmltag($obj->multicurrency_code.
' - '.$langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code)).
'">';
2339 if (empty($conf->global->MAIN_SHOW_ONLY_CODE_MULTICURRENCY)) {
2340 print $langs->transnoentitiesnoconv(
'Currency'.$obj->multicurrency_code);
2346 $totalarray[
'nbfield']++;
2351 if (!empty($arrayfields[
'f.multicurrency_tx'][
'checked'])) {
2352 print
'<td class="nowraponall">';
2353 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2356 $totalarray[
'nbfield']++;
2360 if (!empty($arrayfields[
'f.multicurrency_total_ht'][
'checked'])) {
2361 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht).
"</td>\n";
2363 $totalarray[
'nbfield']++;
2367 if (!empty($arrayfields[
'f.multicurrency_total_vat'][
'checked'])) {
2368 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat).
"</td>\n";
2370 $totalarray[
'nbfield']++;
2374 if (!empty($arrayfields[
'f.multicurrency_total_ttc'][
'checked'])) {
2375 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc).
"</td>\n";
2377 $totalarray[
'nbfield']++;
2380 if (!empty($arrayfields[
'multicurrency_dynamount_payed'][
'checked'])) {
2381 print
'<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?
price($multicurrency_totalpay, 0, $langs) :
' ').
'</td>';
2383 $totalarray[
'nbfield']++;
2388 if (!empty($arrayfields[
'multicurrency_rtp'][
'checked'])) {
2389 print
'<td class="right nowraponall">';
2390 print (!empty($multicurrency_remaintopay) ?
price($multicurrency_remaintopay, 0, $langs) :
' ');
2393 $totalarray[
'nbfield']++;
2398 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2399 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2401 $totalarray[
'nbfield']++;
2405 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2406 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2408 $totalarray[
'nbfield']++;
2411 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2413 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2416 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2417 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2419 $totalarray[
'nbfield']++;
2423 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2424 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'],
null,
null,
null,
null, 2).
'%').
'</td>';
2426 $totalarray[
'nbfield']++;
2429 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2431 if ($i >= $imaxinloop - 1) {
2432 if (!empty($total_ht)) {
2433 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2435 $totalarray[
'val'][
'total_mark_rate'] =
'';
2441 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2443 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2444 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2445 print $hookmanager->resPrint;
2447 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
2448 print
'<td class="nowraponall center">';
2449 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2452 $totalarray[
'nbfield']++;
2456 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
2457 print
'<td class="nowraponall center">';
2458 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2461 $totalarray[
'nbfield']++;
2465 if (!empty($arrayfields[
'f.date_closing'][
'checked'])) {
2466 print
'<td class="nowraponall center">';
2467 print
dol_print_date($db->jdate($obj->date_closing),
'dayhour',
'tzuser');
2470 $totalarray[
'nbfield']++;
2474 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
2475 print
'<td class="center">';
2479 $totalarray[
'nbfield']++;
2483 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
2484 print
'<td class="center">';
2488 $totalarray[
'nbfield']++;
2492 if (!empty($arrayfields[
'f.fk_fac_rec_source'][
'checked'])) {
2493 print
'<td class="center">';
2494 if (!empty($obj->fk_fac_rec_source)) {
2496 $result = $facrec->fetch($obj->fk_fac_rec_source);
2500 print $facrec->getNomUrl();
2505 $totalarray[
'nbfield']++;
2509 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
2510 print
'<td class="nowrap right">';
2511 print $facturestatic->getLibStatut(5, $paiement);
2514 $totalarray[
'nbfield']++;
2520 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2521 print
'<td class="nowrap" align="center">';
2522 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
2524 if (in_array($obj->id, $arrayofselected)) {
2527 print
'<input id="cb'.$obj->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2532 $totalarray[
'nbfield']++;
2540 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2546 foreach ($arrayfields as $key => $val) {
2547 if (!empty($val[
'checked'])) {
2551 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2556 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2557 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2558 print $hookmanager->resPrint;
2560 print
'</table>'.
"\n";
2561 print
'</div>'.
"\n";
2563 print
'</form>'.
"\n";
2566 if ($contextpage !=
'poslist') {
2567 $hidegeneratedfilelistifempty = 1;
2568 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2569 $hidegeneratedfilelistifempty = 0;
2573 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2574 $urlsource .= str_replace(
'&',
'&', $param);
2576 $filedir = $diroutputmassaction;
2577 $genallowed = $user->hasRight(
"facture",
"lire");
2578 $delallowed = $user->hasRight(
"facture",
"creer");
2581 print $formfile->showdocuments(
'massfilesarea_invoices',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_CLOSED
Classified paid.
Class to manage invoice templates.
Class to manage payments of customer invoices.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$formconfirm
if ($action == 'delbookkeepingyear') {
$nbtotalofrecords
Count total nb of records.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.