Fix several bugs into edit of supplier lines

This commit is contained in:
Laurent Destailleur 2015-04-18 16:54:00 +02:00
parent 8cd22ae6c8
commit ce81f58986
3 changed files with 12 additions and 11 deletions

View File

@ -53,7 +53,9 @@ if (empty($usemargins)) $usemargins=0;
<td align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
<td><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php if (($line->info_bits & 2) == 2) { ?>
<?php
if (($line->info_bits & 2) == 2) {
?>
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
<?php
$txt='';
@ -90,9 +92,8 @@ if (empty($usemargins)) $usemargins=0;
{
if ($line->fk_product > 0)
{
echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
// Show range
echo get_date_range($line->date_start, $line->date_end);

View File

@ -507,7 +507,8 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
$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]->libelle = $obj->label; // Deprecated
$this->lines[$i]->label = $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]->subprice = $obj->pu_ht;
$this->lines[$i]->pu_ht = $obj->pu_ht;
@ -525,6 +526,7 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->product_type = $obj->product_type;
$this->lines[$i]->product_label = $obj->label;
$this->lines[$i]->info_bits = $obj->info_bits;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code;

View File

@ -547,27 +547,25 @@ if (empty($reshook))
{
$up = price2num(GETPOST('price_ht'));
$price_base_type = 'HT';
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type,'','', $date_start, $date_end);
}
else
{
$up = price2num(GETPOST('price_ttc'));
$price_base_type = 'TTC';
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end);
}
if (GETPOST('idprod'))
if (GETPOST('productid'))
{
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$prod->fetch(GETPOST('productid'));
$label = $prod->description;
if (trim($_POST['desc']) != trim($label)) $label=$_POST['desc'];
if (trim($_POST['product_desc']) != trim($label)) $label=$_POST['product_desc'];
$type = $prod->type;
}
else
{
$label = $_POST['desc'];
$label = $_POST['product_desc'];
$type = $_POST["type"]?$_POST["type"]:0;
}
@ -589,7 +587,7 @@ if (empty($reshook))
}
}
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options);
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options);
if ($result >= 0)
{
unset($_POST['label']);