25 if (empty($conf) || !is_object($conf)) {
26 print
"Error, template page can't be called as URL";
33 $nodateexport =
getDolGlobalInt(
'ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
36 $date_export =
"_".dol_print_date(
dol_now(),
'%Y%m%d%H%M%S');
39 if (empty($downloadMode)) {
40 header(
'Content-Type: text/csv');
43 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
47 if (($accountancyexport->getFormatCode($formatexportset) ==
'fec' || $accountancyexport->getFormatCode($formatexportset) ==
'fec2')
48 && $type_export ==
"general_ledger") {
50 if (empty($search_date_end)) {
54 $datetouseforfilename = $search_date_end;
56 $fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
58 if ($tmparray[
'mon'] < $fiscalmonth || $fiscalmonth == 1) {
59 $tmparray[
'mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1;
61 $tmparray[
'mon'] = $fiscalmonth - 1;
67 $completefilename = $siren.
"FEC".$endaccountingperiod.
".txt";
68 } elseif ($accountancyexport->getFormatCode($formatexportset) ==
'ciel' && $type_export ==
"general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
69 $completefilename =
"XIMPORT.TXT";
71 $completefilename = ($code ? $code.
"_" :
"").($prefix ? $prefix.
"_" :
"").$filename.($nodateexport ?
"" : $date_export).
".".$format;
74 if (empty($downloadMode)) {
75 header(
'Content-Disposition: attachment;filename=' . $completefilename);