diff --git a/ChangeLog b/ChangeLog
index deae6f69d1b..61ee86334ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,8 +4,8 @@ English Dolibarr changelog
***** Changelog for 2.7 compared to 2.6 *****
For users:
-- New: Add filter on status in emailing selector for Dolibarr users.
-
+- New: Can export commercial proposals
+
For translators:
- Update some language files.
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index 7b942912db1..6c014e039c7 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -39,6 +39,7 @@ if (! $user->admin)
$entitytoicon=array(
'invoice'=>'bill','invoice_line'=>'bill',
'order'=>'order' ,'order_line'=>'order',
+ 'propal'=>'propal', 'propal_line'=>'propal',
'intervention'=>'intervention' ,'inter_line'=>'intervention',
'member'=>'user' ,'member_type'=>'group','subscription'=>'payment',
'tax'=>'generic' ,'tax_type'=>'generic',
@@ -53,6 +54,7 @@ $entitytolang=array( // Translation code
'company'=>'Company','contact'=>'Contact',
'invoice'=>'Bill','invoice_line'=>'InvoiceLine',
'order'=>'Order','order_line'=>'OrderLine',
+ 'propal'=>'Proposal','propal_line'=>'ProposalLine',
'intervention'=>'Intervention' ,'inter_line'=>'InterLine',
'member'=>'Member','member_type'=>'MemberType','subscription'=>'Subscription',
'tax'=>'SocialContribution','tax_type'=>'DictionnarySocialContributions',
diff --git a/htdocs/includes/modules/modPropale.class.php b/htdocs/includes/modules/modPropale.class.php
index f545ef8345d..30c20e62bf9 100644
--- a/htdocs/includes/modules/modPropale.class.php
+++ b/htdocs/includes/modules/modPropale.class.php
@@ -68,7 +68,9 @@ class modPropale extends DolibarrModules
// Dependancies
$this->depends = array("modSociete","modCommercial");
+ $this->requiredby = array();
$this->config_page_url = array("propale.php");
+ $this->langfiles = array("propal","bills","companies","deliveries","products");
// Constants
$this->const = array();
@@ -129,6 +131,29 @@ class modPropale extends DolibarrModules
$this->rights[6][3] = 0; // La permission est-elle une permission par defaut
$this->rights[6][4] = 'supprimer';
+ $this->rights[6][0] = 28; // id de la permission
+ $this->rights[6][1] = 'Exporter les propositions commerciales et attributs'; // libelle de la permission
+ $this->rights[6][2] = 'r'; // type de la permission (deprecie a ce jour)
+ $this->rights[6][3] = 0; // La permission est-elle une permission par defaut
+ $this->rights[6][4] = 'export';
+
+ // Exports
+ //--------
+ $r=0;
+
+ $r++;
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
+ $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r]=array(array("propale","export"));
+ $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefClient",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'Label');
+ $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
+ $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','c.rowid'=>"orderid",'c.ref'=>"ref",'c.ref_client'=>"refclient",'c.fk_soc'=>"fk_soc",'c.datec'=>"datecreation",'c.datep'=>"datepropal",'c.fin_validite'=>"dateendpropal",'c.remise_percent'=>"globaldiscount",'c.total_ht'=>"totalht",'c.total'=>"totalttc",'c.fk_statut'=>'status','c.note'=>"note",'c.date_livraison'=>'datedelivery','cd.rowid'=>'lineid','cd.description'=>"linedescription",'cd.product_type'=>'linetype','cd.tva_tx'=>"linevatrate",'cd.qty'=>"lineqty",'cd.total_ht'=>"lientotalht",'cd.total_tva'=>"linetotalvat",'cd.total_ttc'=>"linetotalttc",'p.rowid'=>'idproduct','p.ref'=>'refproduct','p.label'=>'label');
+
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'propal as c, '.MAIN_DB_PREFIX.'propaldet as cd, '.MAIN_DB_PREFIX.'societe as s)';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)';
+ $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
+ $this->export_sql_end[$r] .=' AND s.entity = '.$conf->entity;
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index a2a0d0d9b44..aad2db8ef47 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -344,6 +344,7 @@ Permission24=Validate commercial proposals
Permission25=Send commercial proposals
Permission26=Close commercial proposals
Permission27=Delete commercial proposals
+Permission28=Export commercial proposals
Permission31=Read products/services
Permission32=Create/modify products/services
Permission33=Command products/services
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 57f23abae51..fce6cdc99c2 100755
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -5,6 +5,7 @@ SuppliersOrdersArea=Suppliers orders area
OrderCard=Order card
Order=Order
Orders=Orders
+OrderLine=Order line
OrderFollow=Follow up
OrderContact=Order contact
OrderDate=Order date
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 2f5c4e49ec4..cf3ed65a5a1 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -1,5 +1,7 @@
# Dolibarr language file - en_US - products
CHARSET=UTF-8
+ProductRef=Product ref.
+ProductLabel=Product label
ProductServiceCard=Products/Services card
Products=Products
Services=Services
diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang
index 95804979f6f..f3b5c1c5229 100644
--- a/htdocs/langs/en_US/propal.lang
+++ b/htdocs/langs/en_US/propal.lang
@@ -59,6 +59,7 @@ FileNotUploaded=The file was not uploaded
FileUploaded=The file was successfully uploaded
AssociatedDocuments=Documents associated with the proposal:
ErrorCantOpenDir=Can't open directory
+DatePropal=Date of proposal
DateEndPropal=Date end validity
DateEndPropalShort=Date end
ValidityDuration=Validity duration
@@ -77,6 +78,8 @@ DefaultProposalDurationValidity=Default commercial proposal validity duration (i
UseCustomerContactAsPropalRecipientIfExist=Use customer contact address if defined instead of third party address as proposal recipient address
ClonePropal=Clone commercial proposal
ConfirmClonePropal=Are you sure you want to clone this commercial proposal %s ?
+ProposalsAndProposalsLines=Commercial proposal and lines
+ProposalLine=Proposal line
# Document models
DocModelAzurDescription=A complete proposal model (logo...)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 3bb3fde6210..d1aa0498fac 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -343,6 +343,7 @@ Permission24 = Valider les propositions commerciales
Permission25 = Envoyer les propositions commerciales
Permission26 = Clôturer les propositions commerciales
Permission27 = Supprimer les propositions commerciales
+Permission28 = Exporter les propositions commerciales
Permission31 = Consulter les produits/services
Permission32 = Créer/modifier les produits/services
Permission33 = Commander les produits/services
diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang
index f6c13ea2e08..6b9bf697e06 100755
--- a/htdocs/langs/fr_FR/orders.lang
+++ b/htdocs/langs/fr_FR/orders.lang
@@ -5,6 +5,7 @@ SuppliersOrdersArea=Espace commandes fournisseurs
OrderCard=Fiche commande
Order=Commande
Orders=Commandes
+OrderLine=Ligne de commande
OrderFollow=Suivi
OrderContact=Contacts commande
OrderDate=Date commande
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index 32be2b2ca5a..cd621abf194 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -1,5 +1,7 @@
# Dolibarr language file - fr_FR - products
CHARSET=UTF-8
+ProductRef=Réf. produit
+ProductLabel=Libellé produit
ProductServiceCard=Fiche produit/service
Products=Produits
Services=Services
diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang
index d075ae4563f..ac27a9492f7 100644
--- a/htdocs/langs/fr_FR/propal.lang
+++ b/htdocs/langs/fr_FR/propal.lang
@@ -59,6 +59,7 @@ FileNotUploaded=Le fichier n'a pas été téléchargé
FileUploaded=Le fichier a été téléchargé avec succès
AssociatedDocuments=Documents associés à la proposition :
ErrorCantOpenDir=Impossible d'ouvrir le répertoire
+DatePropal=Date proposition
DateEndPropal=Date fin validité
DateEndPropalShort=Date fin
ValidityDuration=Durée de validité
@@ -77,6 +78,8 @@ DefaultProposalDurationValidity=Délai de validité par défaut (en jours)
UseCustomerContactAsPropalRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des propositions
ClonePropal=Cloner proposition commerciale
ConfirmClonePropal=Etes-vous sur de vouloir cloner cette proposition commerciale %s ?
+ProposalsAndProposalsLines=Propositions commerciales clientes et lignes de propositions
+ProposalLine=Ligne de proposition
# Documents models
DocModelAzurDescription=Modèle de propositions commerciales complet (logo...)