24@phan-var-force int $formatexportset
25@phan-var-force string $type_export
26@phan-var-force string $filename
27@phan-var-force int<-1,1> $downloadMode
44if (empty($conf) || !is_object($conf)) {
45 print
"Error, template page can't be called as URL";
52$nodateexport =
getDolGlobalInt(
'ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
55$date_export =
"_".dol_print_date(
dol_now(),
'%Y%m%d%H%M%S');
56$startaccountingperiod =
'';
60include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
64if ((substr($accountancyexport->getFormatCode($formatexportset), 0, 3) ==
'fec') && $type_export ==
"general_ledger") {
66 if (empty($search_date_end)) {
70 $datetouseforfilename = $search_date_end;
74 if ($tmparray[
'mon'] < $fiscalmonth || $fiscalmonth == 1) {
75 $tmparray[
'mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1;
77 $tmparray[
'mon'] = $fiscalmonth - 1;
82 $siren = str_replace(
" ",
"", $siren);
83 $completefilename = $siren.
"FEC".$endaccountingperiod.
".txt";
84} elseif ($accountancyexport->getFormatCode($formatexportset) ==
'ciel' && $type_export ==
"general_ledger" &&
getDolGlobalString(
'ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME')) {
85 $completefilename =
"XIMPORT.TXT";
87 $completefilename = ($code ? $code.
"_" :
"").($prefix ? $prefix.
"_" :
"").$filename.($nodateexport ?
"" : $date_export).
".".$format;
91if (is_object($hookmanager)) {
93 $hookmanager->initHooks(array(
'accountancyexportfilename'));
96 'type_export' => $type_export ??
'',
97 'format' => $format ??
'',
98 'format_code' => $accountancyexport->getFormatCode($formatexportset),
99 'code' => $code ??
'',
100 'prefix' => $prefix ??
'',
101 'filename' => $filename ??
'',
102 'period_start' => $startaccountingperiod,
103 'period_end' => $endaccountingperiod ??
'',
104 'siren' => $siren ??
'',
105 'ndate_in_filename' => $nodateexport ?? 0,
106 'now_datetime' => $date_export,
108 'defaultfilename' => $completefilename
112 $reshook = $hookmanager->executeHooks(
'setExportFilename', $parameters, $accountancyexport, $action);
114 if (!empty($hookmanager->resArray[
'filename'])) {
115 $completefilename = $hookmanager->resArray[
'filename'];
116 } elseif ($hookmanager->resPrint !==
'') {
117 $completefilename = $hookmanager->resPrint;
122if (empty($downloadMode)) {
123 header(
'Content-Type: text/csv');
124 header(
'Content-Disposition: attachment;filename=' . $completefilename);
Manage the different format accountancy export.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.