Work on import module

This commit is contained in:
Laurent Destailleur 2009-09-28 20:06:15 +00:00
parent b52944dd35
commit 80d4b9b26c
15 changed files with 241 additions and 184 deletions

View File

@ -701,7 +701,7 @@ if ($step == 4 && $datatoexport)
print '<td colspan="2">'.$langs->trans("AvailableFormats").'</td>'; print '<td colspan="2">'.$langs->trans("AvailableFormats").'</td>';
print '<td>'.$langs->trans("LibraryUsed").'</td>'; print '<td>'.$langs->trans("LibraryUsed").'</td>';
print '<td align="right">'.$langs->trans("LibraryVersion").'</td>'; print '<td align="right">'.$langs->trans("LibraryVersion").'</td>';
print '</tr>'; print '</tr>'."\n";
$liste=$objmodelexport->liste_modeles($db); $liste=$objmodelexport->liste_modeles($db);
foreach($liste as $key) foreach($liste as $key)
@ -709,7 +709,9 @@ if ($step == 4 && $datatoexport)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td width="16">'.img_picto_common($key,$objmodelexport->getPicto($key)).'</td>'; print '<td width="16">'.img_picto_common($key,$objmodelexport->getPicto($key)).'</td>';
print '<td>'.$objmodelexport->getDriverLabel($key).'</td><td>'.$objmodelexport->getLibLabel($key).'</td><td align="right">'.$objmodelexport->getLibVersion($key).'</td></tr>'; $text=$objmodelexport->getDriverDesc($key);
print '<td>'.$html->textwithpicto($objmodelexport->getDriverLabel($key),$text).'</td>';
print '<td>'.$objmodelexport->getLibLabel($key).'</td><td align="right">'.$objmodelexport->getLibVersion($key).'</td></tr>'."\n";
} }
print '</table>'; print '</table>';

View File

@ -41,6 +41,8 @@ $export->load_arrays($user);
* View * View
*/ */
$html=new Form($db);
llxHeader('',$langs->trans("ExportsArea"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones'); llxHeader('',$langs->trans("ExportsArea"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
print_fiche_titre($langs->trans("ExportsArea")); print_fiche_titre($langs->trans("ExportsArea"));
@ -73,7 +75,8 @@ foreach($liste as $key)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td width="16">'.img_picto_common($model->getDriverLabel($key),$model->getPicto($key)).'</td>'; print '<td width="16">'.img_picto_common($model->getDriverLabel($key),$model->getPicto($key)).'</td>';
print '<td>'.dol_trunc($model->getDriverLabel($key),24).'</td>'; $text=$model->getDriverDesc($key);
print '<td>'.$html->textwithpicto($model->getDriverLabel($key),$text).'</td>';
print '<td>'.$model->getLibLabel($key).'</td>'; print '<td>'.$model->getLibLabel($key).'</td>';
print '<td nowrap="nowrap" align="right">'.$model->getLibVersion($key).'</td>'; print '<td nowrap="nowrap" align="right">'.$model->getLibVersion($key).'</td>';
print '</tr>'; print '</tr>';

View File

@ -72,9 +72,9 @@ class Form
} }
/** /**
* \brief Affiche un texte+picto avec tooltip sur texte ou sur picto * \brief Show a text and picto with tooltip on text or picto
* \param text Texte a afficher * \param text Texte a afficher
* \param htmltext Contenu html du tooltip, code en html * \param htmltext Contenu html du tooltip, code en Html / UTF8
* \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et force en Ajax * \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et force en Ajax
* \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres * \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
* \param img Code img du picto * \param img Code img du picto
@ -93,11 +93,12 @@ class Form
$paramfortooltippicto =''; $paramfortooltippicto ='';
// Sanitize tooltip // Sanitize tooltip
$htmltext=ereg_replace("'","\'",$htmltext); $htmltext=str_replace("\\","\\\\",$htmltext);
$htmltext=ereg_replace("&#039;","\'",$htmltext); $htmltext=str_replace("'","\'",$htmltext);
$htmltext=ereg_replace("\r","",$htmltext); $htmltext=str_replace("&#039;","\'",$htmltext);
$htmltext=ereg_replace("<br>\n","<br>",$htmltext); $htmltext=str_replace("\r","",$htmltext);
$htmltext=ereg_replace("\n","",$htmltext); $htmltext=str_replace("<br>\n","<br>",$htmltext);
$htmltext=str_replace("\n","",$htmltext);
if ($conf->use_javascript_ajax && $tooltipon == 4) if ($conf->use_javascript_ajax && $tooltipon == 4)
{ {
@ -116,7 +117,7 @@ class Form
{ {
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$htmltext=eregi_replace('"',"\'",$htmltext); $htmltext=eregi_replace('"',"&quot;",$htmltext);
if ($tooltipon==1 || $tooltipon==3) if ($tooltipon==1 || $tooltipon==3)
{ {
$paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"'; $paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"';

View File

@ -709,7 +709,7 @@ if ($step == 4 && $datatoimport)
foreach($fieldstarget as $code=>$label) foreach($fieldstarget as $code=>$label)
{ {
$var=!$var; $var=!$var;
print '<tr class="liste_total" height="20">'; print '<tr '.$bc[$var].' height="20">';
$i++; $i++;
@ -717,8 +717,13 @@ if ($step == 4 && $datatoimport)
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity; $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity; $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
print '<td nowrap="nowrap" style="font-weight: normal">'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>'; print '<td nowrap="nowrap" style="font-weight: normal">=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
print '<td style="font-weight: normal">'.$langs->trans($label).' ('.$code.')</td>'; print '<td style="font-weight: normal">';
$text=$langs->trans($label);
if (eregi('\*$',$label)) $text='<b>'.$text.'</b>';
$htmltext=$langs->trans("Table").": ?<br>".$langs->trans("Field").': '.$code;
print $html->textwithpicto($text,$htmltext);
print '</td>';
print '</tr>'; print '</tr>';
$save_select.=$bit; $save_select.=$bit;
@ -740,7 +745,7 @@ if ($step == 4 && $datatoimport)
{ {
if (empty($fieldsplaced[$key])) if (empty($fieldsplaced[$key]))
{ {
$var=!$var; //$var=!$var;
$nbofnotimportedfields++; $nbofnotimportedfields++;
show_elem($fieldssource,$lefti,$key,'',$var); show_elem($fieldssource,$lefti,$key,'',$var);
//print '> '.$lefti.'-'.$key; //print '> '.$lefti.'-'.$key;
@ -855,8 +860,8 @@ if ($step == 4 && $datatoimport)
print '</tr>'; print '</tr>';
$var=false; $var=false;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><input name="import_name" size="32" value=""></td><td align="right">'; print '<td><input name="import_name" size="48" value=""></td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" value="'.$langs->trans("SaveImportProfile").'">';
print '</td></tr>'; print '</td></tr>';
// List of existing import profils // List of existing import profils
@ -1001,7 +1006,7 @@ function show_elem($fieldssource,$i,$pos,$key,$var)
print '<div style="padding: 0px 0px 0px 0px;" id="boxto_'.$pos.'">'."\n"; print '<div style="padding: 0px 0px 0px 0px;" id="boxto_'.$pos.'">'."\n";
print '<table summary="boxtable'.$pos.'" width="100%" class="nobordernopadding">'."\n"; print '<table summary="boxtable'.$pos.'" width="100%" class="nobordernopadding">'."\n";
print '<tr class="liste_total" height="20">'; print '<tr '.$bc[$var].' height="20">';
if ($pos && $pos > sizeof($fieldssource)) // NoFields if ($pos && $pos > sizeof($fieldssource)) // NoFields
{ {
print '<td class="nocellnopadding" width="16" style="font-weight: normal">'; print '<td class="nocellnopadding" width="16" style="font-weight: normal">';

View File

@ -39,6 +39,8 @@ $import->load_arrays($user);
* View * View
*/ */
$html=new Form($db);
llxHeader('',$langs->trans("ImportArea"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones'); llxHeader('',$langs->trans("ImportArea"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
print_fiche_titre($langs->trans("ImportArea")); print_fiche_titre($langs->trans("ImportArea"));
@ -70,7 +72,8 @@ foreach($liste as $key)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td width="16">'.img_picto_common($model->getDriverLabel($key),$model->getPicto($key)).'</td>'; print '<td width="16">'.img_picto_common($model->getDriverLabel($key),$model->getPicto($key)).'</td>';
print '<td>'.dol_trunc($model->getDriverLabel($key),24).'</td>'; $text=$model->getDriverDesc($key);
print '<td>'.$html->textwithpicto($model->getDriverLabel($key),$text).'</td>';
print '<td>'.$model->getLibLabel($key).'</td>'; print '<td>'.$model->getLibLabel($key).'</td>';
print '<td nowrap="nowrap" align="right">'.$model->getLibVersion($key).'</td>'; print '<td nowrap="nowrap" align="right">'.$model->getLibVersion($key).'</td>';
print '</tr>'; print '</tr>';

View File

@ -1,21 +1,21 @@
<?php <?php
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*/ */
/** /**
* \file htdocs/includes/modules/export/export_csv.modules.php * \file htdocs/includes/modules/export/export_csv.modules.php
@ -34,93 +34,99 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/export/modules_export.php");
*/ */
class ExportCsv extends ModeleExports class ExportCsv extends ModeleExports
{ {
var $id; var $id;
var $label; var $label;
var $extension; var $extension;
var $version; var $version;
var $label_lib; var $label_lib;
var $version_lib; var $version_lib;
var $separator; var $separator;
var $handle; // Handle fichier var $handle; // Handle fichier
/** /**
* \brief Constructeur * \brief Constructeur
* \param db Handler acces base de donnee * \param db Handler acces base de donnee
*/ */
function ExportCsv($db) function ExportCsv($db)
{ {
global $conf; global $conf;
$this->db = $db; $this->db = $db;
$this->separator=','; $this->separator=',';
if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE; if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
$this->escape="\\"; $this->escape='"';
$this->string='"'; $this->string='"';
$this->id='csv'; // Same value then xxx in file name export_xxx.modules.php $this->id='csv'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Csv (Comma Separated Value, separator="'.$this->separator.'")'; // Label of driver $this->label='Csv'; // Label of driver
$this->extension='csv'; // Extension for generated file by this driver $this->desc='<b>Comma Separated Value</b> file format (.csv). This is a text file format.<br>Fields are separated by separator [ '.$this->separator.' ]. If separator is found inside a field content, field is rounded by round character [ '.$this->string.' ]. Escape character to escape round character is [ '.$this->escape.' ].';
$this->picto='mime/other'; // Picto $this->extension='csv'; // Extension for generated file by this driver
$ver=split(' ','$Revision$'); $this->picto='mime/other'; // Picto
$this->version=$ver[2]; // Driver version $ver=split(' ','$Revision$');
$this->version=$ver[2]; // Driver version
// If driver use an external library, put its name here // If driver use an external library, put its name here
$this->label_lib='Dolibarr'; $this->label_lib='Dolibarr';
$this->version_lib=DOL_VERSION; $this->version_lib=DOL_VERSION;
} }
function getDriverId() function getDriverId()
{ {
return $this->id; return $this->id;
} }
function getDriverLabel() function getDriverLabel()
{ {
return $this->label; return $this->label;
} }
function getDriverExtension() function getDriverDesc()
{ {
return $this->extension; return $this->desc;
} }
function getDriverVersion() function getDriverExtension()
{ {
return $this->version; return $this->extension;
} }
function getLibLabel() function getDriverVersion()
{ {
return $this->label_lib; return $this->version;
} }
function getLibVersion() function getLibLabel()
{ {
return $this->version_lib; return $this->label_lib;
} }
function getLibVersion()
{
return $this->version_lib;
}
/** /**
* \brief Open output file * \brief Open output file
* \param file Path of filename * \param file Path of filename
* \return int <0 if KO, >=0 if OK * \return int <0 if KO, >=0 if OK
*/ */
function open_file($file,$outputlangs) function open_file($file,$outputlangs)
{ {
global $langs; global $langs;
dol_syslog("ExportCsv::open_file file=".$file); dol_syslog("ExportCsv::open_file file=".$file);
$ret=1; $ret=1;
$outputlangs->load("exports"); $outputlangs->load("exports");
$this->handle = fopen($file, "wt"); $this->handle = fopen($file, "wt");
if (! $this->handle) if (! $this->handle)
{ {
$langs->load("errors"); $langs->load("errors");
$this->error=$langs->trans("ErrorFailToCreateFile",$file); $this->error=$langs->trans("ErrorFailToCreateFile",$file);
@ -134,115 +140,115 @@ class ExportCsv extends ModeleExports
* \brief Output header into file * \brief Output header into file
* \param langs Output language * \param langs Output language
*/ */
function write_header($outputlangs) function write_header($outputlangs)
{ {
return 0; return 0;
} }
/** /**
* \brief Output title line into file * \brief Output title line into file
* \param langs Output language * \param langs Output language
*/ */
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs) function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
{ {
global $conf; global $conf;
if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
{ {
$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
} }
else else
{ {
$outputlangs->charset_output = 'ISO-8859-1'; $outputlangs->charset_output = 'ISO-8859-1';
} }
foreach($array_selected_sorted as $code => $value) foreach($array_selected_sorted as $code => $value)
{ {
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]); $newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);
$newvalue=$this->csv_clean($newvalue); $newvalue=$this->csv_clean($newvalue);
fwrite($this->handle,$newvalue.$this->separator); fwrite($this->handle,$newvalue.$this->separator);
} }
fwrite($this->handle,"\n"); fwrite($this->handle,"\n");
return 0; return 0;
} }
/** /**
* \brief Output record line into file * \brief Output record line into file
*/ */
function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs) function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs)
{ {
global $conf; global $conf;
if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
{ {
$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
} }
else else
{ {
$outputlangs->charset_output = 'ISO-8859-1'; $outputlangs->charset_output = 'ISO-8859-1';
} }
$this->col=0; $this->col=0;
foreach($array_selected_sorted as $code => $value) foreach($array_selected_sorted as $code => $value)
{ {
$alias=$array_alias[$code]; $alias=$array_alias[$code];
if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.'); if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
$newvalue=$outputlangs->convToOutputCharset($objp->$alias); $newvalue=$outputlangs->convToOutputCharset($objp->$alias);
// Translation newvalue // Translation newvalue
if (eregi('^\((.*)\)$',$newvalue,$reg)) if (eregi('^\((.*)\)$',$newvalue,$reg))
{ {
$newvalue=$outputlangs->transnoentities($reg[1]); $newvalue=$outputlangs->transnoentities($reg[1]);
} }
$newvalue=$this->csv_clean($newvalue); $newvalue=$this->csv_clean($newvalue);
fwrite($this->handle,$newvalue.$this->separator); fwrite($this->handle,$newvalue.$this->separator);
$this->col++; $this->col++;
} }
fwrite($this->handle,"\n"); fwrite($this->handle,"\n");
return 0; return 0;
} }
/** /**
* \brief Output footer into file * \brief Output footer into file
* \param outputlangs Output language * \param outputlangs Output language
*/ */
function write_footer($outputlangs) function write_footer($outputlangs)
{ {
return 0; return 0;
} }
/** /**
* \brief Close file handle * \brief Close file handle
*/ */
function close_file() function close_file()
{ {
fclose($this->handle); fclose($this->handle);
return 0; return 0;
} }
/** /**
* Clean a cell to respect rules of CSV file cells * Clean a cell to respect rules of CSV file cells
* @param newvalue String to clean * @param newvalue String to clean
* @return string Value cleaned * @return string Value cleaned
*/ */
function csv_clean($newvalue) function csv_clean($newvalue)
{ {
$addquote=0; $addquote=0;
// Rule Dolibarr: No HTML // Rule Dolibarr: No HTML
$newvalue=dol_string_nohtmltag($newvalue); $newvalue=dol_string_nohtmltag($newvalue);
// Rule 1 CSV: No CR, LF in cells // Rule 1 CSV: No CR, LF in cells
$newvalue=ereg_replace("\r",'',$newvalue); $newvalue=ereg_replace("\r",'',$newvalue);
$newvalue=ereg_replace("\n",'\n',$newvalue); $newvalue=ereg_replace("\n",'\n',$newvalue);
// Rule 2 CSV: If value contains ", we must duplicate ", and add " // Rule 2 CSV: If value contains ", we must escape with ", and add "
if (ereg('"',$newvalue)) if (ereg('"',$newvalue))
{ {
$addquote=1; $addquote=1;
@ -250,13 +256,13 @@ class ExportCsv extends ModeleExports
} }
// Rule 3 CSV: If value contains separator, we must add " // Rule 3 CSV: If value contains separator, we must add "
if (ereg($this->separator,$newvalue)) if (ereg($this->separator,$newvalue))
{ {
$addquote=1; $addquote=1;
} }
return ($addquote?'"':'').$newvalue.($addquote?'"':''); return ($addquote?'"':'').$newvalue.($addquote?'"':'');
} }
} }

View File

@ -63,6 +63,7 @@ class ExportExcel extends ModeleExports
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php $this->id='excel'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Excel'; // Label of driver $this->label='Excel'; // Label of driver
$this->desc='Native <b>Excel 95</b> file format (.xls)';
$this->extension='xls'; // Extension for generated file by this driver $this->extension='xls'; // Extension for generated file by this driver
$this->picto='mime/xls'; // Picto $this->picto='mime/xls'; // Picto
$ver=split(' ','$Revision$'); $ver=split(' ','$Revision$');
@ -85,6 +86,11 @@ class ExportExcel extends ModeleExports
return $this->label; return $this->label;
} }
function getDriverDesc()
{
return $this->desc;
}
function getDriverExtension() function getDriverExtension()
{ {
return $this->extension; return $this->extension;

View File

@ -57,7 +57,8 @@ class ExportTsv extends ModeleExports
$this->db = $db; $this->db = $db;
$this->id='tsv'; // Same value then xxx in file name export_xxx.modules.php $this->id='tsv'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Tsv (Tab Separated Value)'; // Label of driver $this->label='Tsv'; // Label of driver
$this->desc='<b>Tab Separated Value</b> file format (.tsv)';
$this->extension='tsv'; // Extension for generated file by this driver $this->extension='tsv'; // Extension for generated file by this driver
$this->picto='mime/other'; // Picto $this->picto='mime/other'; // Picto
$ver=split(' ','$Revision$'); $ver=split(' ','$Revision$');
@ -78,6 +79,11 @@ class ExportTsv extends ModeleExports
return $this->label; return $this->label;
} }
function getDriverDesc()
{
return $this->desc;
}
function getDriverExtension() function getDriverExtension()
{ {
return $this->extension; return $this->extension;

View File

@ -81,6 +81,7 @@ class ModeleExports
$this->picto[$module->id]=$module->picto; $this->picto[$module->id]=$module->picto;
// Driver properties // Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel(); $this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion(); $this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->liblabel[$module->id]=$module->getLibLabel();
@ -110,6 +111,14 @@ class ModeleExports
return $this->driverlabel[$key]; return $this->driverlabel[$key];
} }
/**
* \brief Renvoi le descriptif d'un driver export
*/
function getDriverDesc($key)
{
return $this->driverdesc[$key];
}
/** /**
* \brief Renvoi version d'un driver export * \brief Renvoi version d'un driver export
*/ */

View File

@ -58,11 +58,12 @@ class ImportCsv extends ModeleImports
$this->separator=','; $this->separator=',';
if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE; if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
$this->escape="\\"; $this->escape='"';
$this->string='"'; $this->string='"';
$this->id='csv'; // Same value then xxx in file name export_xxx.modules.php $this->id='csv'; // Same value then xxx in file name export_xxx.modules.php
$this->label='Csv (Comma Separated Value, separator="'.$this->separator.'")'; // Label of driver $this->label='Csv'; // Label of driver
$this->desc='<b>Comma Separated Value</b> file format (.csv). This is a text file format.<br>Fields are separated by separator [ '.$this->separator.' ]. If separator is found inside a field content, field is rounded by round character [ '.$this->string.' ]. Escape character to escape round character is [ '.$this->escape.' ].';
$this->extension='csv'; // Extension for generated file by this driver $this->extension='csv'; // Extension for generated file by this driver
$this->picto='mime/other'; // Picto $this->picto='mime/other'; // Picto
$ver=split(' ','$Revision$'); $ver=split(' ','$Revision$');
@ -83,6 +84,11 @@ class ImportCsv extends ModeleImports
return $this->label; return $this->label;
} }
function getDriverDesc()
{
return $this->desc;
}
function getDriverExtension() function getDriverExtension()
{ {
return $this->extension; return $this->extension;

View File

@ -80,6 +80,7 @@ class ModeleImports
$this->picto[$module->id]=$module->picto; $this->picto[$module->id]=$module->picto;
// Driver properties // Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel(); $this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion(); $this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->liblabel[$module->id]=$module->getLibLabel();
@ -102,7 +103,7 @@ class ModeleImports
} }
/** /**
* \brief Renvoi libelle d'un driver export * \brief Renvoi libelle d'un driver import
*/ */
function getDriverLabel($key) function getDriverLabel($key)
{ {
@ -110,7 +111,15 @@ class ModeleImports
} }
/** /**
* \brief Renvoi version d'un driver export * \brief Renvoi la description d'un driver import
*/
function getDriverDesc($key)
{
return $this->driverdesc[$key];
}
/**
* \brief Renvoi version d'un driver import
*/ */
function getDriverVersion($key) function getDriverVersion($key)
{ {

View File

@ -153,7 +153,7 @@ class modProduit extends DolibarrModules
$this->import_code[$r]=$this->rights_class.'_'.$r; $this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Products"; // Translation key $this->import_label[$r]="Products"; // Translation key
//$this->import_permission[$r]=array(array("societe","import")); //$this->import_permission[$r]=array(array("societe","import"));
$this->import_fields_array[$r]=array('p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.envente'=>"OnSell",'p.duration'=>"Duration"); $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.envente'=>"OnSell*",'p.duration'=>"Duration");
$this->import_entities_array[$r]=array('p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product"); $this->import_entities_array[$r]=array('p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product");
$this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.envente'=>"0 or 1",'p.duration'=>"1y"); $this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.envente'=>"0 or 1",'p.duration'=>"1y");

View File

@ -155,7 +155,6 @@ MemberDeletedInDolibarr = Membre %s eliminat de Dolibarr
MemberSubscriptionAddedInDolibarr = Subscripció del membre %s afegida a Dolibar MemberSubscriptionAddedInDolibarr = Subscripció del membre %s afegida a Dolibar
##### Export ##### = = ##### Export ##### = =
ExportsArea = Àrea d'exportacions ExportsArea = Àrea d'exportacions
AvailableFormats = Formats disponibles
LibraryUsed = Llibreria utilitzada LibraryUsed = Llibreria utilitzada
LibraryVersion = Versió LibraryVersion = Versió
ExportableDatas = Dades exportables ExportableDatas = Dades exportables

View File

@ -30,7 +30,7 @@ FieldsOrder=Fields order
FieldsTitle=Fields title FieldsTitle=Fields title
ChooseExportFormat=Choose export format ChooseExportFormat=Choose export format
NowClickToGenerateToBuildExportFile=Now, click on "Generate" to build export file... NowClickToGenerateToBuildExportFile=Now, click on "Generate" to build export file...
AvailableFormats=Formats disponibles AvailableFormats=Available formats
LibraryShort=Library LibraryShort=Library
LibraryUsed=Library used LibraryUsed=Library used
LibraryVersion=Version LibraryVersion=Version
@ -63,8 +63,9 @@ ChooseFormatOfFileToImport=Choose file format to use as import file format by cl
ChooseFileToImport=Upload file then click on picto %s to select file as source import file... ChooseFileToImport=Upload file then click on picto %s to select file as source import file...
SourceFileFormat=Source file format SourceFileFormat=Source file format
FieldsInSourceFile=Fields in source file FieldsInSourceFile=Fields in source file
FieldsInTargetDatabase=Target fields in Dolibarr database FieldsInTargetDatabase=Target fields in Dolibarr database (*=mandatory)
NoFields=No fields NoFields=No fields
MoveField=Move field column number %s MoveField=Move field column number %s
ExampleOfImportFile=Example_of_import_file ExampleOfImportFile=Example_of_import_file
SaveImportProfile=Save this import profile
ErrorImportDuplicateProfil=Failed to save this import profile with this name. An existing profile already exists with this name. ErrorImportDuplicateProfil=Failed to save this import profile with this name. An existing profile already exists with this name.

View File

@ -63,8 +63,9 @@ ChooseFileToImport=Ajouter le fichier à importer puis cliquez sur le picto %s p
DownloadEmptyExample=Télécharger fichier vierge exemple DownloadEmptyExample=Télécharger fichier vierge exemple
SourceFileFormat=Format du fichier source SourceFileFormat=Format du fichier source
FieldsInSourceFile=Champs dans le fichier source FieldsInSourceFile=Champs dans le fichier source
FieldsInTargetDatabase=Champs cibles dans la base Dolibarr FieldsInTargetDatabase=Champs cibles dans la base Dolibarr (*=obligatoire)
NoFields=Aucun champ NoFields=Aucun champ
MoveField=Déplacer champ colonne numéro %s MoveField=Déplacer champ colonne numéro %s
ExampleOfImportFile=Exemple_de_fichier_import ExampleOfImportFile=Exemple_de_fichier_import
SaveImportProfile=Sauvegarder ce profil d'import
ErrorImportDuplicateProfil=Impossible de sauvegarder le profil d'import sous ce nom. Un profil existant existe déjà pour ce nom. ErrorImportDuplicateProfil=Impossible de sauvegarder le profil d'import sous ce nom. Un profil existant existe déjà pour ce nom.