Ajout de champs supplmentaire dans l'export des commandes.

rcupration des notes prives et public de propal  commande.
Ajout option dans la config du module commande qui permet de valider la commande aprs cloture de la propale, permet de ne pas passer par une commande provisoire.
This commit is contained in:
Regis Houssin 2007-03-21 16:54:31 +00:00
parent b932fc7845
commit 24fc3a898e
5 changed files with 32 additions and 13 deletions

View File

@ -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

View File

@ -1075,7 +1075,7 @@ else
print '</tr>';
// Sociét
// Société
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
@ -1183,7 +1183,20 @@ else
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
}
print '</td></tr>';
print '</td>';
//Note public lorsque le module expedition n'est pas activé
if (!$conf->projet->enabled) $nbrow--;
if (!$conf->expedition->enabled)
{
$nbrow--;
if ($conf->projet->enabled) $nbrow--;
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
print nl2br($commande->note_public);
print '</td>';
}
print '</tr>';
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');

View File

@ -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"));
}

View File

@ -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

View File

@ -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