Merge pull request #9919 from atm-john/Fix_clone_fourn_invoice

Fix clone fourn order and invoice lines special code
This commit is contained in:
Laurent Destailleur 2018-10-30 14:55:50 +01:00 committed by GitHub
commit cb2a5baa45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

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

View File

@ -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)
@ -398,8 +398,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)

View File

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