From 2cf88e784784d48d25e24a2f415544b8b56bdaaa Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 17 Oct 2012 10:40:17 +0200 Subject: [PATCH 1/5] New: More import options. Categories Trad: Add es_ES and ca_ES missing translations --- htdocs/core/modules/modCategorie.class.php | 19 +++++++++++++++++++ htdocs/langs/ca_ES/exports.lang | 3 +++ htdocs/langs/es_ES/exports.lang | 5 ++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 5efe476ef34..430de2ca9eb 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -157,6 +157,25 @@ class modCategorie extends DolibarrModules $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; $this->export_sql_end[$r] .=' AND u.entity = '.$conf->entity; $this->export_sql_end[$r] .=' AND u.type = 3'; // Supplier categories + + // Imports + //-------- + + $r=0; + + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="CatList"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); + $this->import_fields_array[$r]=array('ca.label'=>"Label*", + 'ca.type'=>"Type*",'ca.description'=>"Description" + ); + + $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); + $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category", + 'ca.type'=>"1", 'ca.description'=>"Imported category"); } diff --git a/htdocs/langs/ca_ES/exports.lang b/htdocs/langs/ca_ES/exports.lang index dc5bdc0a2a1..d93843631ef 100644 --- a/htdocs/langs/ca_ES/exports.lang +++ b/htdocs/langs/ca_ES/exports.lang @@ -116,3 +116,6 @@ Excel95FormatDesc=Arxiu amb format Excel (.xls)
Aquest és el format n Excel2007FormatDesc=Arxiu amb format Excel (.xlsx)
Aquest és el format natiu d'Excel 2007 (SpreadsheetML). TsvFormatDesc=Arxiu amb format Valors separats per tabulador (. Tsv)
Aquest és un format d'arxiu de text en què els camps són separats per un tabulador [tab]. ExportFieldAutomaticallyAdded=S'ha afegit automàticament el camp %s, ja que evitarà que línies idèntiques siguin considerades com duplicades (amb aquest camp, cada línia tindrà un id propi). +CsvOptions=Opcions de l'arxiu CSV +Separator=Separador +Enclosure=Delimitador de camps \ No newline at end of file diff --git a/htdocs/langs/es_ES/exports.lang b/htdocs/langs/es_ES/exports.lang index 6a65a260046..ccfeba6dfd4 100644 --- a/htdocs/langs/es_ES/exports.lang +++ b/htdocs/langs/es_ES/exports.lang @@ -115,4 +115,7 @@ CSVFormatDesc=Archivo con formato Valores separados por coma (.csv).
E Excel95FormatDesc=Archivo con formato Excel (.xls)
Este es el formato nativo de Excel 95 (BIFF5). Excel2007FormatDesc=Archivo con formato Excel (.xlsx)
Este es el formato nativo de Excel 2007 (SpreadsheetML). TsvFormatDesc=Archivo con formato Valores separados por tabulador (.tsv)
Este es un formato de archivo de texto en el que los campos son separados por un tabulador [tab]. -ExportFieldAutomaticallyAdded=Se ha añadido automáticamente el campo %s, ya que evitará que líneas idénticas sean consideradas como duplicadas (con este campo, cada línea tendrá un id propio). \ No newline at end of file +ExportFieldAutomaticallyAdded=Se ha añadido automáticamente el campo %s, ya que evitará que líneas idénticas sean consideradas como duplicadas (con este campo, cada línea tendrá un id propio). +CsvOptions=Opciones del archivo CSV +Separator=Separador +Enclosure=Delimitador de campos \ No newline at end of file From cf814dc7fd9cbc0ca46284d3ef9cc0d4972be174 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 17 Oct 2012 10:42:16 +0200 Subject: [PATCH 2/5] New: More import options. Categories Trad: Add es_ES and ca_ES missing translations --- htdocs/core/modules/modCategorie.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 430de2ca9eb..be6ecb3e8de 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2012 Juanjo Menent * * 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 From 6f430cc630931883292f12b3bf7dbd9b41e90a45 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 17 Oct 2012 11:43:26 +0200 Subject: [PATCH 3/5] New: More import options. Supplier Products --- htdocs/core/modules/modFournisseur.class.php | 26 ++++++++++++++++++++ htdocs/langs/ca_ES/exports.lang | 3 ++- htdocs/langs/en_US/exports.lang | 3 ++- htdocs/langs/es_ES/exports.lang | 3 ++- htdocs/langs/fr_FR/exports.lang | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 91c52370bc9..ebaf2da4e23 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2012 Juanjo Menent * * 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 @@ -287,6 +288,31 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; $this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity; + + + // Imports + //-------- + // Import product suppliers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="SuppliersProducts"; // Translation key + $this->import_icon[$r]='product'; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); + $this->import_tables_creator_array[$r]=array('sp'=>'fk_user'); + $this->import_fields_array[$r]=array('sp.fk_product'=>"Product*", + 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'RefSupplier', 'sp.price'=>"Price*", + 'sp.quantity'=>"Quantity*",'sp.unitprice'=>'UnitPrice*','sp.tva_tx'=>'VAT' + ); + + $this->import_convertvalue_array[$r]=array( + 'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), + 'spd.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') + ); + $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PR123456", + 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef",'sp.price'=>"50", + 'sp.quantity'=>"1",'sp.unitprice'=>'50','sp.tva_tx'=>'21' + ); } diff --git a/htdocs/langs/ca_ES/exports.lang b/htdocs/langs/ca_ES/exports.lang index d93843631ef..be2f30d45c8 100644 --- a/htdocs/langs/ca_ES/exports.lang +++ b/htdocs/langs/ca_ES/exports.lang @@ -118,4 +118,5 @@ TsvFormatDesc=Arxiu amb format Valors separats per tabulador (. Tsv)
ExportFieldAutomaticallyAdded=S'ha afegit automàticament el camp %s, ja que evitarà que línies idèntiques siguin considerades com duplicades (amb aquest camp, cada línia tindrà un id propi). CsvOptions=Opcions de l'arxiu CSV Separator=Separador -Enclosure=Delimitador de camps \ No newline at end of file +Enclosure=Delimitador de camps +SuppliersProducts=Productes de proveïdors \ No newline at end of file diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 02a04cb3c1a..2d332ff25ca 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -118,4 +118,5 @@ TsvFormatDesc=Tab Separated Value file format (.tsv)
This is a text fi ExportFieldAutomaticallyAdded=Field %s was automatically added. It will avoid you to have similar lines to be treated as duplicate records (with this field added, all ligne will own its own id and will differ). CsvOptions=Csv Options Separator=Separator -Enclosure=Enclosure \ No newline at end of file +Enclosure=Enclosure +SuppliersProducts=Suppliers Products \ No newline at end of file diff --git a/htdocs/langs/es_ES/exports.lang b/htdocs/langs/es_ES/exports.lang index ccfeba6dfd4..0889e50e1f9 100644 --- a/htdocs/langs/es_ES/exports.lang +++ b/htdocs/langs/es_ES/exports.lang @@ -118,4 +118,5 @@ TsvFormatDesc=Archivo con formato Valores separados por tabulador (.tsv)< ExportFieldAutomaticallyAdded=Se ha añadido automáticamente el campo %s, ya que evitará que líneas idénticas sean consideradas como duplicadas (con este campo, cada línea tendrá un id propio). CsvOptions=Opciones del archivo CSV Separator=Separador -Enclosure=Delimitador de campos \ No newline at end of file +Enclosure=Delimitador de campos +SuppliersProducts=Productos de proveedores \ No newline at end of file diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang index 3c99687cd29..e14fb9ace31 100644 --- a/htdocs/langs/fr_FR/exports.lang +++ b/htdocs/langs/fr_FR/exports.lang @@ -119,3 +119,4 @@ ExportFieldAutomaticallyAdded=Le champ %s a été ajouté automatiquement CsvOptions=Options du fichier Csv Separator=Séparateur Enclosure=Délimiteur de champs +SuppliersProducts=Produits Fournisseurs \ No newline at end of file From 23d3b6a7836995dacba02a2489b63abb249b8694 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 17 Oct 2012 12:36:30 +0200 Subject: [PATCH 4/5] New: More import options. Supplier Products --- htdocs/core/modules/modFournisseur.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index ebaf2da4e23..f50742b70ed 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -307,7 +307,7 @@ class modFournisseur extends DolibarrModules $this->import_convertvalue_array[$r]=array( 'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), - 'spd.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') + 'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') ); $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PR123456", 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef",'sp.price'=>"50", From d7dcd3c14b691d6b675981dd515d1e20d3373d65 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 17 Oct 2012 19:02:12 +0200 Subject: [PATCH 5/5] New: More import options. Supplier Products --- htdocs/core/modules/modFournisseur.class.php | 25 ------------------ htdocs/core/modules/modProduct.class.php | 27 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index f50742b70ed..4cf2a554868 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -288,31 +288,6 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; $this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity; - - - // Imports - //-------- - // Import product suppliers - $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="SuppliersProducts"; // Translation key - $this->import_icon[$r]='product'; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); - $this->import_tables_creator_array[$r]=array('sp'=>'fk_user'); - $this->import_fields_array[$r]=array('sp.fk_product'=>"Product*", - 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'RefSupplier', 'sp.price'=>"Price*", - 'sp.quantity'=>"Quantity*",'sp.unitprice'=>'UnitPrice*','sp.tva_tx'=>'VAT' - ); - - $this->import_convertvalue_array[$r]=array( - 'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), - 'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') - ); - $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PR123456", - 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef",'sp.price'=>"50", - 'sp.quantity'=>"1",'sp.unitprice'=>'50','sp.tva_tx'=>'21' - ); } diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 72fe5a31249..b5686489744 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2012 Juanjo Menent * * 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 @@ -191,6 +192,32 @@ class modProduct extends DolibarrModules $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $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.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); + + + if (! empty($conf->fournisseur->enabled)) + { + // Import product suppliers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="SuppliersProducts"; // Translation key + $this->import_icon[$r]='product'; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); + $this->import_tables_creator_array[$r]=array('sp'=>'fk_user'); + $this->import_fields_array[$r]=array('sp.fk_product'=>"Product*", + 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'RefSupplier', 'sp.price'=>"Price*", + 'sp.quantity'=>"Quantity*",'sp.unitprice'=>'UnitPrice*','sp.tva_tx'=>'VAT' + ); + + $this->import_convertvalue_array[$r]=array( + 'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), + 'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') + ); + $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PR123456", + 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef",'sp.price'=>"50", + 'sp.quantity'=>"1",'sp.unitprice'=>'50','sp.tva_tx'=>'21' + ); + } }