From 88532cbbfd1180b2ff6059fb386c94c927c52c3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2008 06:17:48 +0000 Subject: [PATCH] New: Export stocks --- htdocs/exports/export.php | 8 ++++++-- htdocs/includes/modules/modStock.class.php | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index c6c378e55c7..3ff868d7671 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -41,7 +41,9 @@ $entitytoicon=array( 'tax'=>'generic' ,'tax_type'=>'generic', 'account'=>'account', 'payment'=>'payment', - 'product'=>'product'); + 'product'=>'product','stock'=>'stock', + 'other'=>'generic', + ); $entitytolang=array( // Translation code 'user'=>'User', 'company'=>'Company','contact'=>'Contact', @@ -51,7 +53,9 @@ $entitytolang=array( // Translation code 'tax'=>'SocialContribution','tax_type'=>'DictionnarySocialContributions', 'account'=>'BankTransactions', 'payment'=>'Payment', - 'product'=>'Product'); + 'product'=>'Product','stock'=>'Stock', + 'other'=>'Other' + ); $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); $datatoexport=isset($_GET["datatoexport"])? $_GET["datatoexport"] : (isset($_POST["datatoexport"])?$_POST["datatoexport"]:''); diff --git a/htdocs/includes/modules/modStock.class.php b/htdocs/includes/modules/modStock.class.php index 6c89fef454c..abcdea06a63 100644 --- a/htdocs/includes/modules/modStock.class.php +++ b/htdocs/includes/modules/modStock.class.php @@ -120,14 +120,14 @@ class modStock 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_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_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_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_label[$r]="Stocks"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("stock","lire")); + $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','ps.reel'=>'RealStock','e.rowid'=>'IdWarehouse','e.label'=>'LabelWareHouse','e.label'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.cp'=>'Zip','e.ville'=>'Town'); + $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','ps.reel'=>'other','e.rowid'=>'stock','e.label'=>'stock','e.label'=>'stock','e.lieu'=>'stock','e.address'=>'stock','e.cp'=>'stock','e.ville'=>'stock'); + $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','ps.reel'=>'quantity','e.rowid'=>'idwarehouse','e.label'=>'labelwarehouse','e.label'=>'descwarehouse','e.lieu'=>'lieuwarehouse','e.address'=>'addresswarehouse','e.cp'=>'zipwarehouse','e.ville'=>'townwarehouse'); $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; - + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e'; + $this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid'; } /**