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:
parent
b932fc7845
commit
24fc3a898e
@ -126,7 +126,7 @@ class Commande extends CommonObject
|
|||||||
$this->lines[$i] = $CommLigne;
|
$this->lines[$i] = $CommLigne;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->socid = $propal->socid;
|
$this->socid = $propal->socid;
|
||||||
$this->projetid = $propal->projetidp;
|
$this->projetid = $propal->projetidp;
|
||||||
$this->cond_reglement_id = $propal->cond_reglement_id;
|
$this->cond_reglement_id = $propal->cond_reglement_id;
|
||||||
$this->mode_reglement_id = $propal->mode_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->adresse_livraison_id = $propal->adresse_livraison_id;
|
||||||
$this->contact_id = $propal->contactid;
|
$this->contact_id = $propal->contactid;
|
||||||
$this->ref_client = $propal->ref_client;
|
$this->ref_client = $propal->ref_client;
|
||||||
|
$this->note = $propal->note;
|
||||||
|
$this->note_public = $propal->note_public;
|
||||||
|
|
||||||
/* Définit la société comme un client */
|
/* Définit la société comme un client */
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
@ -406,13 +408,14 @@ class Commande extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (';
|
$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.= ' model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison,';
|
||||||
$sql.= ' remise_absolue, remise_percent)';
|
$sql.= ' remise_absolue, remise_percent)';
|
||||||
$sql.= ' VALUES ('.$this->socid.', now(), '.$user->id.', '.$this->projetid.',';
|
$sql.= ' VALUES ('.$this->socid.', now(), '.$user->id.', '.$this->projetid.',';
|
||||||
$sql.= ' '.$this->db->idate($this->date_commande).',';
|
$sql.= ' '.$this->db->idate($this->date_commande).',';
|
||||||
$sql.= ' '.$this->source.', ';
|
$sql.= ' '.$this->source.', ';
|
||||||
$sql.= " '".addslashes($this->note)."', ";
|
$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.= " '".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->date_livraison?$this->db->idate($this->date_livraison):'null')."',";
|
||||||
$sql.= " '".$this->adresse_livraison_id."',";
|
$sql.= " '".$this->adresse_livraison_id."',";
|
||||||
@ -454,11 +457,11 @@ class Commande extends CommonObject
|
|||||||
// Mise a jour ref
|
// Mise a jour ref
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if ($this->id && $this->propale_id)
|
if ($this->id && $this->propale_id)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_pr (fk_commande, fk_propale) VALUES ('.$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);
|
$this->db->query($sql);
|
||||||
|
|
||||||
// On récupère les différents contact interne et externe
|
// On récupère les différents contact interne et externe
|
||||||
$prop = New Propal($this->db, $this->socid, $this->propale_id);
|
$prop = New Propal($this->db, $this->socid, $this->propale_id);
|
||||||
@ -489,6 +492,7 @@ class Commande extends CommonObject
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
#$this->valid($user);
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1075,7 +1075,7 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Sociét
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -1183,7 +1183,20 @@ else
|
|||||||
{
|
{
|
||||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
|
$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 '<tr><td height="10">';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
|
|||||||
@ -163,9 +163,9 @@ class modCommande extends DolibarrModules
|
|||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]=$this->id.'_'.$r;
|
$this->export_code[$r]=$this->id.'_'.$r;
|
||||||
$this->export_label[$r]='Commandes clients et lignes de commande';
|
$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_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.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_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.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_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 ";
|
$this->export_sql[$r]="select distinct ";
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($this->export_alias_array[$r] as $key => $value)
|
foreach ($this->export_alias_array[$r] as $key => $value)
|
||||||
@ -174,7 +174,7 @@ class modCommande extends DolibarrModules
|
|||||||
else $i++;
|
else $i++;
|
||||||
$this->export_sql[$r].=$key.' as '.$value;
|
$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"));
|
$this->export_permission[$r]=array(array("commande","commande","export"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -491,6 +491,7 @@ OrdersSetup=Orders' management setup
|
|||||||
OrdersNumberingModules=Orders numbering modules
|
OrdersNumberingModules=Orders numbering modules
|
||||||
OrdersModelModule=Order documents models
|
OrdersModelModule=Order documents models
|
||||||
HideTreadedOrders=Hide the treated orders in the list
|
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 #####
|
##### Fiche inter #####
|
||||||
FicheinterNumberingModules=Intervention numbering modules
|
FicheinterNumberingModules=Intervention numbering modules
|
||||||
TemplatePDFInterventions=Intervention card documents models
|
TemplatePDFInterventions=Intervention card documents models
|
||||||
|
|||||||
@ -490,6 +490,7 @@ OrdersSetup=Configuration du module Commandes
|
|||||||
OrdersNumberingModules=Modules de numérotation des commandes
|
OrdersNumberingModules=Modules de numérotation des commandes
|
||||||
OrdersModelModule=Modèles de document des commandes
|
OrdersModelModule=Modèles de document des commandes
|
||||||
HideTreadedOrders=Cacher les commandes traitées de la liste
|
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 #####
|
##### Fiche inter #####
|
||||||
FicheinterNumberingModules=Modules de numérotation des fiches interventions
|
FicheinterNumberingModules=Modules de numérotation des fiches interventions
|
||||||
TemplatePDFInterventions=Modèle de documents des fiches d'interventions
|
TemplatePDFInterventions=Modèle de documents des fiches d'interventions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user