diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 9e0ef94cd83..cbc220db2a3 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -126,7 +126,7 @@ class Commande extends CommonObject $this->lines[$i] = $CommLigne; } - $this->socid = $propal->socid; + $this->socid = $propal->socid; $this->projetid = $propal->projetidp; $this->cond_reglement_id = $propal->cond_reglement_id; $this->mode_reglement_id = $propal->mode_reglement_id; @@ -134,6 +134,8 @@ class Commande extends CommonObject $this->adresse_livraison_id = $propal->adresse_livraison_id; $this->contact_id = $propal->contactid; $this->ref_client = $propal->ref_client; + $this->note = $propal->note; + $this->note_public = $propal->note_public; /* Définit la société comme un client */ $soc = new Societe($this->db); @@ -406,13 +408,14 @@ class Commande extends CommonObject $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande ('; - $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_public, ref_client,'; + $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client,'; $sql.= ' model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison,'; $sql.= ' remise_absolue, remise_percent)'; $sql.= ' VALUES ('.$this->socid.', now(), '.$user->id.', '.$this->projetid.','; $sql.= ' '.$this->db->idate($this->date_commande).','; $sql.= ' '.$this->source.', '; $sql.= " '".addslashes($this->note)."', "; + $sql.= " '".addslashes($this->note_public)."', "; $sql.= " '".addslashes($this->ref_client)."', '".$this->modelpdf."', '".$this->cond_reglement_id."', '".$this->mode_reglement_id."',"; $sql.= " '".($this->date_livraison?$this->db->idate($this->date_livraison):'null')."',"; $sql.= " '".$this->adresse_livraison_id."',"; @@ -454,11 +457,11 @@ class Commande extends CommonObject // Mise a jour ref $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; if ($this->db->query($sql)) - { - if ($this->id && $this->propale_id) - { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_pr (fk_commande, fk_propale) VALUES ('.$this->id.','.$this->propale_id.')'; - $this->db->query($sql); + { + if ($this->id && $this->propale_id) + { + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_pr (fk_commande, fk_propale) VALUES ('.$this->id.','.$this->propale_id.')'; + $this->db->query($sql); // On récupère les différents contact interne et externe $prop = New Propal($this->db, $this->socid, $this->propale_id); @@ -489,6 +492,7 @@ class Commande extends CommonObject // Fin appel triggers $this->db->commit(); + #$this->valid($user); return $this->id; } else diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index fe8b7e30533..51c85e19ca9 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1075,7 +1075,7 @@ else print ''; - // Sociét + // Société print '
| '; print $langs->trans('PaymentMode'); diff --git a/htdocs/includes/modules/modCommande.class.php b/htdocs/includes/modules/modCommande.class.php index b300f137798..e68b6bd584f 100644 --- a/htdocs/includes/modules/modCommande.class.php +++ b/htdocs/includes/modules/modCommande.class.php @@ -163,9 +163,9 @@ class modCommande extends DolibarrModules $r++; $this->export_code[$r]=$this->id.'_'.$r; $this->export_label[$r]='Commandes clients et lignes de commande'; - $this->export_fields_array[$r]=array('s.idp'=>"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.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty"); - $this->export_entities_array[$r]=array('s.idp'=>"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'=>"order",'c.ref'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>'order','c.note'=>"order",'cd.rowid'=>'order_line','cd.description'=>"order_line",'cd.tva_tx'=>"order_line",'cd.qty'=>"order_line"); - $this->export_alias_array[$r]=array('s.idp'=>"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.fk_soc'=>"fk_soc",'c.date_creation'=>"datecreation",'c.date_commande'=>"dateorder",'c.amount_ht'=>"amount",'c.remise_percent'=>"globaldiscount",'c.total_ht'=>"totalht",'c.total_ttc'=>"totalttc",'c.facture'=>"invoicee",'c.fk_statut'=>'status','c.note'=>"note",'cd.rowid'=>'lineid','cd.description'=>"linedescription",'cd.tva_tx'=>"linevatrate",'cd.qty'=>"lineqty"); + $this->export_fields_array[$r]=array('s.idp'=>"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.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'p.ref'=>'RefProduct','p.label'=>'Label','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.total_ht'=>"TotalHT",'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty"); + $this->export_entities_array[$r]=array('s.idp'=>"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'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>'order','c.note'=>"order",'p.ref'=>'product','p.label'=>'product','cd.rowid'=>'order_line','cd.description'=>"order_line",'cd.total_ht'=>"order_line",'cd.tva_tx'=>"order_line",'cd.qty'=>"order_line"); + $this->export_alias_array[$r]=array('s.idp'=>"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.date_creation'=>"datecreation",'c.date_commande'=>"dateorder",'c.amount_ht'=>"amount",'c.remise_percent'=>"globaldiscount",'c.total_ht'=>"totalht",'c.total_ttc'=>"totalttc",'c.facture'=>"invoicee",'c.fk_statut'=>'status','c.note'=>"note",'p.ref'=>'refproduct','p.label'=>'label','cd.rowid'=>'lineid','cd.description'=>"linedescription",'cd.total_ht'=>"totalht",'cd.tva_tx'=>"linevatrate",'cd.qty'=>"lineqty"); $this->export_sql[$r]="select distinct "; $i=0; foreach ($this->export_alias_array[$r] as $key => $value) @@ -174,7 +174,7 @@ class modCommande extends DolibarrModules else $i++; $this->export_sql[$r].=$key.' as '.$value; } - $this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'commandedet as cd, '.MAIN_DB_PREFIX.'societe as s WHERE c.fk_soc = s.idp AND c.rowid = cd.fk_commande'; + $this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'commandedet as cd, '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'product as p WHERE c.fk_soc = s.idp AND c.rowid = cd.fk_commande AND cd.fk_product = p.rowid'; $this->export_permission[$r]=array(array("commande","commande","export")); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4641ea1163d..17e99f86a11 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -491,6 +491,7 @@ OrdersSetup=Orders' management setup OrdersNumberingModules=Orders numbering modules OrdersModelModule=Order documents models HideTreadedOrders=Hide the treated orders in the list +ValidOrderAfterPropalClosed=To validate the order after proposal closer, makes it possible not to step by the provisional order ##### Fiche inter ##### FicheinterNumberingModules=Intervention numbering modules TemplatePDFInterventions=Intervention card documents models diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index e6c541fbd9c..3a4ca6cd985 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -490,6 +490,7 @@ OrdersSetup=Configuration du module Commandes OrdersNumberingModules=Modules de numérotation des commandes OrdersModelModule=Modèles de document des commandes HideTreadedOrders=Cacher les commandes traitées de la liste +ValidOrderAfterPropalClosed=Valider la commande après la clôture de la propale, permet de ne pas passer par la commande provisoire ##### Fiche inter ##### FicheinterNumberingModules=Modules de numérotation des fiches interventions TemplatePDFInterventions=Modèle de documents des fiches d'interventions |