2
0
forked from Wavyzz/dolibarr

Quelques amliorations diverses sur gestion des xpditions

This commit is contained in:
Laurent Destailleur
2006-07-14 13:26:19 +00:00
parent 7facc82362
commit 1b6d7d5de4
15 changed files with 252 additions and 331 deletions

View File

@@ -943,9 +943,8 @@ class Commande extends CommonObject
{
if ($user->rights->commande->creer)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET model_pdf = '$modelpdf'";
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
$sql.= " WHERE rowid = ".$this->id;
if ($this->db->query($sql) )
{
@@ -970,7 +969,7 @@ class Commande extends CommonObject
$this->lignes = array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
$sql.= ' l.remise_percent, l.subprice, l.rang, l.coef, l.label,';
$sql.= ' p.ref as product_ref, p.description as product_desc';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
$sql.= ' WHERE l.fk_commande = '.$this->id;
@@ -1001,9 +1000,10 @@ class Commande extends CommonObject
$ligne->coef = $objp->coef;
$ligne->rang = $objp->rang;
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->ref = $objp->product_ref;
$ligne->ref = $objp->product_ref;
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->fk_product_type= $objp->fk_product_type; // Produit ou service
$this->lignes[$i] = $ligne;
$i++;
@@ -1012,14 +1012,27 @@ class Commande extends CommonObject
}
return $this->lignes;
}
/**
* \brief Renvoie nombre de lignes de type produits. Doit etre appel<65> apr<70>s fetch_lignes
* \return int <0 si ko, Nbre de lignes produits sinon
*/
function getNbOfProductsLines()
{
$nb=0;
foreach($this->lignes as $ligne)
{
if ($ligne->fk_product_type == 0) $nb++;
}
return $nb;
}
/**
*
*
*/
function fetch_adresse_livraison($id)
*
*
*/
function fetch_adresse_livraison($id)
{
$idadresse = $id;
$adresse = new Societe($this->db);
@@ -1414,7 +1427,7 @@ class Commande extends CommonObject
}
/**
* \brief Renvoi la liste des propal (<28>ventuellement filtr<74>e sur un user) dans un tableau
* \brief Renvoi la liste des commandes (<28>ventuellement filtr<74>e sur un user) dans un tableau
* \param brouillon 0=non brouillon, 1=brouillon
* \param user Objet user de filtre
* \return int -1 si erreur, tableau r<>sultat si ok