Skip to content
Snippets Groups Projects
Commit 8d8325fe authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Work on import module

parent e3b0cabe
Branches
No related tags found
No related merge requests found
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
/** /**
* \class Import * \class Import
* \brief Classe permettant la gestion des imports * \brief Class to manage imports
*/ */
class Import class Import
{ {
/** /**
* \brief Constructeur de la classe * \brief Constructor
* \param DB Database handler * \param DB Database handler
*/ */
function Import($DB) function Import($DB)
...@@ -126,7 +126,9 @@ class Import ...@@ -126,7 +126,9 @@ class Import
$this->array_import_code[$i]=$module->import_code[$r]; $this->array_import_code[$i]=$module->import_code[$r];
// Libelle du dataset export // Libelle du dataset export
$this->array_import_label[$i]=$module->getDatasetLabel($r); $this->array_import_label[$i]=$module->getDatasetLabel($r);
// Tableau des champ a exporter (cle=champ, valeur=libelle) // Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i]=$module->import_tables_array[$r];
// Array of fiels to import (key=field, value=label)
$this->array_import_fields[$i]=$module->import_fields_array[$r]; $this->array_import_fields[$i]=$module->import_fields_array[$r];
// Tableau des entites a exporter (cle=champ, valeur=entite) // Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_import_entities[$i]=$module->import_entities_array[$r]; $this->array_import_entities[$i]=$module->import_entities_array[$r];
......
...@@ -717,6 +717,8 @@ if ($step == 4 && $datatoimport) ...@@ -717,6 +717,8 @@ if ($step == 4 && $datatoimport)
$i++; $i++;
$entity=$objimport->array_import_entities[0][$code]; $entity=$objimport->array_import_entities[0][$code];
$tablealias=eregi_replace('\..*$','',$code);
$tablename=$objimport->array_import_tables[0][$tablealias];
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity; $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity; $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
...@@ -724,7 +726,7 @@ if ($step == 4 && $datatoimport) ...@@ -724,7 +726,7 @@ if ($step == 4 && $datatoimport)
print '<td style="font-weight: normal">'; print '<td style="font-weight: normal">';
$text=$langs->trans($label); $text=$langs->trans($label);
if (eregi('\*$',$label)) $text='<b>'.$text.'</b>'; if (eregi('\*$',$label)) $text='<b>'.$text.'</b>';
$htmltext=$langs->trans("Table").": ?<br>".$langs->trans("Field").': '.$code; $htmltext=$langs->trans("Table").": ".$tablename."<br>".$langs->trans("Field").': '.$code;
print $html->textwithpicto($text,$htmltext); print $html->textwithpicto($text,$htmltext);
print '</td>'; print '</td>';
......
...@@ -153,6 +153,7 @@ class modProduit extends DolibarrModules ...@@ -153,6 +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_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'produit');
$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");
......
...@@ -232,6 +232,7 @@ class modSociete extends DolibarrModules ...@@ -232,6 +232,7 @@ class modSociete extends DolibarrModules
$this->import_label[$r]='ImportDataset_company_1'; $this->import_label[$r]='ImportDataset_company_1';
$this->import_icon[$r]='company'; $this->import_icon[$r]='company';
//$this->import_permission[$r]=array(array("societe","export")); //$this->import_permission[$r]=array(array("societe","export"));
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'societe');
$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_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_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_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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment