mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Work on import module
This commit is contained in:
@@ -68,7 +68,7 @@ class ImportCsv extends ModeleImports
|
||||
$this->version_lib=DOL_VERSION;
|
||||
|
||||
$this->separator=',';
|
||||
if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
|
||||
if (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->IMPORT_CSV_SEPARATOR_TO_USE;
|
||||
}
|
||||
|
||||
function getDriverId()
|
||||
@@ -102,6 +102,48 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Output header of an example file for this format
|
||||
* \param langs Output language
|
||||
*/
|
||||
function write_header_example($outputlangs)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Output title line of an example file for this format
|
||||
* \param langs Output language
|
||||
*/
|
||||
function write_title_example($outputlangs,$headerlinefields)
|
||||
{
|
||||
$s='';
|
||||
$s.=join($this->separator,$headerlinefields);
|
||||
return $s."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Output record of an example file for this format
|
||||
* \param langs Output language
|
||||
*/
|
||||
function write_record_example($outputlangs,$contentlinevalues)
|
||||
{
|
||||
$s='';
|
||||
$s.=join($this->separator,$contentlinevalues);
|
||||
return $s."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Output footer of an example file for this format
|
||||
* \param langs Output language
|
||||
*/
|
||||
function write_footer_example($outputlangs)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Open output file
|
||||
* \param file Path of filename
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -24,7 +24,6 @@
|
||||
* \brief File of parent class for import file readers
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ class modProduit extends DolibarrModules
|
||||
//$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_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_sql_start[$r]='INSERT INTO '.MAIN_DB_PREFIX.'produit as s';
|
||||
$this->import_sql_end[$r] ='';
|
||||
|
||||
@@ -191,6 +191,7 @@ class modSociete extends DolibarrModules
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ExportDataset_company_1';
|
||||
$this->export_icon[$r]='company';
|
||||
$this->export_permission[$r]=array(array("societe","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Effectif","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','fk_stcomm'=>'ProspectStatus');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.prefix_comm'=>"company",'s.client'=>"company",'s.fournisseur'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'t.libelle'=>"company",'ce.code'=>"company","cfj.libelle"=>"company",'s.fk_prospectlevel'=>'company','fk_stcomm'=>'company');
|
||||
@@ -229,9 +230,11 @@ class modSociete extends DolibarrModules
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]='ImportDataset_company_1';
|
||||
$this->import_icon[$r]='company';
|
||||
//$this->import_permission[$r]=array(array("societe","export"));
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name",'s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Effectif","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','fk_stcomm'=>'ProspectStatus');
|
||||
$this->import_entities_array[$r]=array('s.nom'=>"company",'s.prefix_comm'=>"company",'s.client'=>"company",'s.fournisseur'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'t.libelle'=>"company",'ce.code'=>"company","cfj.libelle"=>"company",'s.fk_prospectlevel'=>'company','fk_stcomm'=>'company');
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name",'s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_type'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_status"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus');
|
||||
$this->import_entities_array[$r]=array('s.nom'=>"company",'s.prefix_comm'=>"company",'s.client'=>"company",'s.fournisseur'=>"company",'s.datec'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'s.fk_type'=>"company",'s.fk_effectif'=>"company","s.fk_status"=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company');
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"A company",'s.prefix_comm'=>"comp",'s.client'=>'0 or 1','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'YYYY-MM-DD'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'p.code'=>"US",'s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_type'=>"XXX",'s.fk_effectif'=>"YYY","s.fk_status"=>"ZZZ",'s.fk_prospectlevel'=>'AAA','s.fk_stcomm'=>'BBB');
|
||||
|
||||
$this->import_sql_start[$r]='INSERT INTO '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->import_sql_end[$r] ='';
|
||||
|
||||
Reference in New Issue
Block a user