From 970645e8fc3db2ae2d3d359cef41aba354347a3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Jun 2009 18:44:53 +0000 Subject: [PATCH] Qual: Now module services and products are two completely separated modules. --- htdocs/includes/modules/modProduit.class.php | 20 +++++++-------- htdocs/includes/modules/modService.class.php | 27 ++++++++++++++++++++ htdocs/langs/en_US/products.lang | 3 ++- htdocs/langs/fr_FR/products.lang | 3 ++- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php index 0ee645177ac..8ac011ed884 100644 --- a/htdocs/includes/modules/modProduit.class.php +++ b/htdocs/includes/modules/modProduit.class.php @@ -74,9 +74,9 @@ class modProduit extends DolibarrModules // Config pages $this->config_page_url = array("produit.php"); - $this->langfiles = array("products","companies","stocks"); + $this->langfiles = array("products","companies","stocks","bills"); - // Constantes + // Constants $this->const = array(); $r=0; @@ -131,18 +131,18 @@ class modProduit extends DolibarrModules $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]="ProductsOrServices"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("produit","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.envente'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.envente'=>"OnSell",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge ($this->export_fields_array[$r],array('p.stock'=>'Stock')); - $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.envente'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product'); + $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.envente'=>"product",'p.datec'=>"product",'p.tms'=>"product"); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge ($this->export_entities_array[$r],array('p.stock'=>'product')); - $this->export_alias_array[$r]=array('p.rowid'=>"id",'p.ref'=>"ref",'p.fk_product_type'=>"type",'p.label'=>"label",'p.description'=>"description",'p.note'=>"note",'p.price'=>"price",'p.tva_tx'=>'vat','p.envente'=>"onsell",'p.duration'=>"duration",'p.datec'=>'datecreation','p.tms'=>'datemodification'); + $this->export_alias_array[$r]=array('p.rowid'=>"id",'p.ref'=>"ref",'p.label'=>"label",'p.description'=>"description",'p.note'=>"note",'p.price_base_type'=>'pricebase','p.price'=>"priceht",'p.price_ttc'=>"pricettc",'p.tva_tx'=>'vat','p.envente'=>"onsell",'p.datec'=>'datecreation','p.tms'=>'datemodification'); if (! empty($conf->stock->enabled)) $this->export_alias_array[$r]=array_merge ($this->export_alias_array[$r],array('p.stock'=>'stock')); $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; - $this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity = '.$conf->entity; // Imports @@ -151,10 +151,10 @@ class modProduit extends DolibarrModules $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="ProductsOrServices"; // Translation key + $this->import_label[$r]="Products"; // Translation key //$this->import_permission[$r]=array(array("societe","import")); - $this->import_fields_array[$r]=array('p.ref'=>"Ref",'p.fk_product_type'=>"Type",'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.fk_product_type'=>"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_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_sql_start[$r]='INSERT INTO '.MAIN_DB_PREFIX.'produit as s'; $this->import_sql_end[$r] =''; diff --git a/htdocs/includes/modules/modService.class.php b/htdocs/includes/modules/modService.class.php index 98ec01fc033..6dfc12ed707 100644 --- a/htdocs/includes/modules/modService.class.php +++ b/htdocs/includes/modules/modService.class.php @@ -48,6 +48,8 @@ class modService extends DolibarrModules */ function modService($DB) { + global $conf; + $this->db = $DB ; $this->numero = 53 ; @@ -70,6 +72,10 @@ class modService extends DolibarrModules $this->depends = array(); $this->requiredby = array("modContrat"); + // Config pages + $this->config_page_url = array("produit"); + $this->langfiles = array("products","companies","bills"); + // Constants $this->const = array(); @@ -109,6 +115,27 @@ class modService extends DolibarrModules $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; + + + // Exports + //-------- + $r=0; + + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("service","export")); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.envente'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge ($this->export_fields_array[$r],array('p.stock'=>'Stock')); + $this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.envente'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service"); + if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge ($this->export_entities_array[$r],array('p.stock'=>'product')); + $this->export_alias_array[$r]=array('p.rowid'=>"id",'p.ref'=>"ref",'p.label'=>"label",'p.description'=>"description",'p.note'=>"note",'p.price_base_type'=>'pricebase','p.price'=>"priceht",'p.price_ttc'=>"pricettc",'p.tva_tx'=>'vat','p.envente'=>"onsell",'p.duration'=>"duration",'p.datec'=>'datecreation','p.tms'=>'datemodification'); + if (! empty($conf->stock->enabled)) $this->export_alias_array[$r]=array_merge ($this->export_alias_array[$r],array('p.stock'=>'stock')); + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity = '.$conf->entity; + } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 2edeb4566ce..054b8c5ffe0 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -122,7 +122,8 @@ ConfirmDeleteProduct=Are you sure you want to delete this product/service? ProductDeleted=Product/Service "%s" deleted from database. DeletePicture=Delete a picture ConfirmDeletePicture=Are you sure you want to delete this picture ? -ExportDataset_produit_1=Products and services +ExportDataset_produit_1=Products +ExportDataset_service_1=Services DeleteProductLine=Delete product line ConfirmDeleteProductLine=Are you sure you want to delete this product line? NoProductMatching=No product/service match your criteria diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 82c7e49f7ce..ce07266f599 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -122,7 +122,8 @@ ConfirmDeleteProduct=Etes-vous sûr de vouloir supprimer ce produit/service ? ProductDeleted=Le produit/service "%s" à été supprimé de la base. DeletePicture=Supprimer une photo ConfirmDeletePicture=Etes-vous sûr de vouloir supprimer cette photo ? -ExportDataset_produit_1=Produits et services +ExportDataset_produit_1=Produits +ExportDataset_service_1=Services DeleteProductLine=Supprimer ligne produit ConfirmDeleteProductLine=Êtes-vous sûr de vouloir effacer cette ligne produit ? NoProductMatching=Aucun produit/service ne répond au critère