dolibarr 21.0.0-beta
export_csviso.modules.php
1<?php
2/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26require_once DOL_DOCUMENT_ROOT.'/core/modules/export/exportcsv.class.php';
27
28// avoid timeout for big export
29set_time_limit(0);
30
35{
41 public function __construct($db)
42 {
43 global $conf, $langs;
44 $this->db = $db;
45
46 $this->separator = ',';
47 if (getDolGlobalString('EXPORT_CSV_SEPARATOR_TO_USE')) {
48 $this->separator = getDolGlobalString('EXPORT_CSV_SEPARATOR_TO_USE');
49 }
50
51 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
52
53 $this->escape = '"';
54 $this->enclosure = '"';
55 $this->id = 'csviso'; // Same value then xxx in file name export_xxx.modules.php
56 $this->label = 'CSV ISO-8859-1'; // Label of driver
57 $this->desc = $langs->trans("CSVFormatDesc", $this->separator, $this->enclosure, $this->escape);
58 $this->extension = 'csv'; // Extension for generated file by this driver
59 $this->picto = 'mime/other'; // Picto
60 $this->version = '1.32'; // Driver version
61
62 // If driver use an external library, put its name here
63 $this->label_lib = 'Dolibarr';
64 $this->version_lib = DOL_VERSION;
65 }
66
67 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
77 public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
78 {
79 global $conf;
80 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
81
82 return parent::write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types);
83 }
84
85 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
95 public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
96 {
97 global $conf;
98 $conf->global->EXPORT_CSV_FORCE_CHARSET = 'ISO-8859-1';
99
100 return parent::write_record($array_selected_sorted, $objp, $outputlangs, $array_types);
101 }
102}
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 a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79