194 public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
199 $selectlabel = array();
200 foreach ($array_selected_sorted as $code => $value) {
201 if (strpos($code,
' as ') == 0) {
202 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $code);
204 $alias = substr($code, strpos($code,
' as ') + 4);
207 dol_syslog(
'Bad value for field with code='.$code.
'. Try to redefine export.', LOG_WARNING);
211 $newvalue = $array_export_fields_label[$code];
214 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
215 $newvalue =
csvClean($newvalue, $outputlangs->charset_output, $this->separator);
217 fwrite($this->handle, $newvalue.$this->separator);
218 $typefield = isset($array_types[$code]) ? $array_types[$code] :
'';
220 if (preg_match(
'/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
221 $selectlabel[$code.
"_label"] = $newvalue.
"_label";
225 foreach ($selectlabel as $key => $value) {
226 fwrite($this->handle, $value.$this->separator);
228 fwrite($this->handle,
"\n");
243 public function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
252 $selectlabelvalues = array();
253 foreach ($array_selected_sorted as $code => $value) {
254 if (strpos($code,
' as ') == 0) {
255 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $code);
257 $alias = substr($code, strpos($code,
' as ') + 4);
260 dol_syslog(
'Bad value for field with code='.$code.
'. Try to redefine export.', LOG_WARNING);
264 $newvalue = $objp->$alias;
265 $typefield = isset($array_types[$code]) ? $array_types[$code] :
'';
268 if (preg_match(
'/^\((.*)\)$/i', $newvalue, $reg)) {
269 $newvalue = $outputlangs->transnoentities($reg[1]);
273 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
274 $newvalue =
csvClean($newvalue, $outputlangs->charset_output, $this->separator);
276 if (preg_match(
'/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
278 if (is_array($array) && !empty($newvalue)) {
279 $array = $array[
'options'];
280 $selectlabelvalues[$code.
"_label"] = $array[$newvalue];
282 $selectlabelvalues[$code.
"_label"] =
"";
286 fwrite($this->handle, $newvalue.$this->separator);
289 foreach ($selectlabelvalues as $key => $value) {
290 fwrite($this->handle, $value.$this->separator);
294 fwrite($this->handle,
"\n");