From 3b54afc9b23b2612573dfe2894d3d1e00f85ed28 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 23 Feb 2018 12:12:36 +0100 Subject: [PATCH] Fix type lines import --- htdocs/compta/facture/card.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5de04fb3068..2b8e39016a4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2095,7 +2095,7 @@ if (empty($reshook)) && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION)) { $fromElement = GETPOST('fromelement'); - $fromElementid = intval(GETPOST('fromelementid')); + $fromElementid = GETPOST('fromelementid'); $importLines = GETPOST('line_checkbox'); if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) @@ -2110,11 +2110,11 @@ if (empty($reshook)) $error = 0; foreach($importLines as $lineId) { + $lineId = intval($lineId); $originLine = new $lineClassName($db); - if($originLine->fetch( $fromElementid ) > 0) + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) { - $originLine->fetch_optionals(intval($fromElementid)); - + $originLine->fetch_optionals($lineId); $desc = $originLine->desc; $pu_ht = $originLine->subprice; $qty = $originLine->qty; @@ -2130,7 +2130,7 @@ if (empty($reshook)) $fk_remise_except = $originLine->fk_remise_except; $price_base_type='HT'; $pu_ttc=0; - $type = $object->type; + $type = $originLine->product_type; $rang=$nextRang++; $special_code = $originLine->special_code; $origin = $originLine->element; @@ -2146,7 +2146,6 @@ if (empty($reshook)) $pu_ht_devise = $originLine->multicurrency_subprice; $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise); - if($res > 0){ $importCount++; }else{