diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d8a1a1d824e..63cf162e7e2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -444,10 +444,10 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->description = $obj->description; $this->lines[$i]->product_ref = $obj->product_ref; // Internal reference - $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated. Replace with next line - //$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref into ref_supplier into table llx_facture_fourn_det and update it into updateline - $this->lines[$i]->libelle = $obj->label; // deprecated - $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit + $this->lines[$i]->ref = $obj->product_ref; // deprecated. + $this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline + $this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order) + $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit $this->lines[$i]->pu_ht = $obj->pu_ht; $this->lines[$i]->pu_ttc = $obj->pu_ttc; $this->lines[$i]->tva_tx = $obj->tva_tx; @@ -1034,6 +1034,8 @@ class FactureFournisseur extends CommonInvoice * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue). * + * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. + * * @param string $desc Description de la ligne * @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note) * @param double $txtva Taux de tva force, sinon -1 diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 0f15ff42885..402be19f17a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -373,6 +373,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( $desc, $lines[$i]->subprice, @@ -632,19 +633,17 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) { $ht = price2num($_POST['amount']); $price_base_type = 'HT'; - - //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else - { + { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tauxtva,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } - } + //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 + // FIXME Must add $productsupplier->ref_supplier and $productsupplier->label if there were loaded by get_buyprice previously. + $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + } } //print "xx".$tva_tx; exit;