diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d4102873dae..88386521079 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1778,7 +1778,7 @@ abstract class CommonObject $this->multicurrency_code = $code; list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code); - if ($rate) $this->setMulticurrencyRate($rate); + if ($rate) $this->setMulticurrencyRate($rate,2); return 1; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index dfceb8d4e73..ff3d109613f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1236,6 +1236,9 @@ class CommandeFournisseur extends CommonOrder // insert products details into database for ($i=0;$i<$num;$i++) { + + $this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline() + $result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $this->lines[$i]->desc, $this->lines[$i]->subprice, diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7f5496094f7..6e701662f07 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -357,8 +357,8 @@ class FactureFournisseur extends CommonInvoice dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); foreach ($this->lines as $i => $val) { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql .= ' VALUES ('.$this->id.')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; $resql_insert=$this->db->query($sql); if ($resql_insert) @@ -376,7 +376,14 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->fk_product, 'HT', (! empty($this->lines[$i]->info_bits)?$this->lines[$i]->info_bits:''), - $this->lines[$i]->product_type + $this->lines[$i]->product_type, + $this->lines[$i]->remise_percent, + false, + $this->lines[$i]->date_start, + $this->lines[$i]->date_end, + $this->lines[$i]->array_options, + $this->lines[$i]->fk_unit, + $this->lines[$i]->pu_ht_devise ); } else @@ -398,8 +405,8 @@ class FactureFournisseur extends CommonInvoice //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. if (! is_object($line)) $line = (object) $line; - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql .= ' VALUES ('.$this->id.')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; $resql_insert=$this->db->query($sql); if ($resql_insert) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a51da110195..bbec3ea6ed6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -904,6 +904,9 @@ if (empty($reshook)) 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 special_code into addline and updateline methods + $object->special_code = $lines[$i]->special_code; + // 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,