22 if (empty($conf) || !is_object($conf)) {
23 print
"Error, template page can't be called as URL";
30 $nodateexport =
getDolGlobalInt(
'ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
33 $date_export =
"_".dol_print_date(
dol_now(),
'%Y%m%d%H%M%S');
36 header(
'Content-Type: text/csv');
38 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
42 if (($accountancyexport->getFormatCode($formatexportset) ==
'fec' || $accountancyexport->getFormatCode($formatexportset) ==
'fec2')
43 && $type_export ==
"general_ledger") {
45 if (empty($search_date_end)) {
49 $datetouseforfilename = $search_date_end;
51 $fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
53 if ($tmparray[
'mon'] <= $fiscalmonth) {
54 $tmparray[
'mon'] = $fiscalmonth;
56 $tmparray[
'mon'] = $fiscalmonth;
62 $completefilename = $siren.
"FEC".$endaccountingperiod.
".txt";
63 } elseif ($accountancyexport->getFormatCode($formatexportset) ==
'ciel' && $type_export ==
"general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
64 $completefilename =
"XIMPORT.TXT";
66 $completefilename = ($code ? $code.
"_" :
"").($prefix ? $prefix.
"_" :
"").$filename.($nodateexport ?
"" : $date_export).
".".$format;
69 header(
'Content-Disposition: attachment;filename='.$completefilename);