Merge pull request #6759 from ATM-Marc/FIX_supplier_order_rang

FIX supplier order line creation with rang = 0
This commit is contained in:
Laurent Destailleur 2017-05-04 21:06:58 +02:00 committed by GitHub
commit 0c9f268f99

View File

@ -1373,9 +1373,12 @@ class CommandeFournisseur extends CommonOrder
$subprice = price2num($pu,'MU'); $subprice = price2num($pu,'MU');
$rangmax = $this->line_max();
$rang = $rangmax + 1;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
$sql.= " (fk_commande, label, description, date_start, date_end,"; $sql.= " (fk_commande, label, description, date_start, date_end,";
$sql.= " fk_product, product_type,"; $sql.= " fk_product, product_type, rang,";
$sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,";
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit"; $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit";
$sql.= ")"; $sql.= ")";
@ -1384,7 +1387,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").","; $sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").",";
if ($fk_product) { $sql.= $fk_product.","; } if ($fk_product) { $sql.= $fk_product.","; }
else { $sql.= "null,"; } else { $sql.= "null,"; }
$sql.= "'".$product_type."',"; $sql.= "'".$product_type."', ".$rang.",";
$sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2; $sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2;
$sql.= ", '".$localtax1_type."',"; $sql.= ", '".$localtax1_type."',";