dolibarr 19.0.3
export_csviso.modules.php
1<?php
2/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24require_once DOL_DOCUMENT_ROOT.'/core/modules/export/exportcsv.class.php';
25
26// avoid timeout for big export
27set_time_limit(0);
28
33{
39 public function __construct($db)
40 {
41 global $conf, $langs;
42 $this->db = $db;
43
44 $this->separator = ',';
45 if (getDolGlobalString('EXPORT_CSV_SEPARATOR_TO_USE')) {
46 $this->separator = $conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
47 }
48
49 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
50
51 $this->escape = '"';
52 $this->enclosure = '"';
53 $this->id = 'csviso'; // Same value then xxx in file name export_xxx.modules.php
54 $this->label = 'CSV ISO-8859-1'; // Label of driver
55 $this->desc = $langs->trans("CSVFormatDesc", $this->separator, $this->enclosure, $this->escape);
56 $this->extension = 'csv'; // Extension for generated file by this driver
57 $this->picto = 'mime/other'; // Picto
58 $this->version = '1.32'; // Driver version
59
60 // If driver use an external library, put its name here
61 $this->label_lib = 'Dolibarr';
62 $this->version_lib = DOL_VERSION;
63 }
64
65 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
75 public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
76 {
77 global $conf;
78 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
79
80 return parent::write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types);
81 }
82
83 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
93 public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
94 {
95 global $conf;
96 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
97
98 return parent::write_record($array_selected_sorted, $objp, $outputlangs, $array_types);
99 }
100}
Class to build export files with format CSV.
Class to build export files with format CSV iso.
__construct($db)
Constructor.
write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
Output title line into file.
write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
Output record line into file.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.