$localtax2_tx = $prod->localtax2_tx; } else { if ($facfou->socid) { $societe=new Societe($db); $societe->fetch($facfou->socid); } $label = $_POST['label']; $type = $_POST["type"]?$_POST["type"]:0; $localtax1tx= get_localtax($_POST['tauxtva'], 1, $societe); $localtax2tx= get_localtax($_POST['tauxtva'], 2, $societe); } $result=$facfou->updateline($_GET['lineid'], $label, $pu, $_POST['tauxtva'], $localtax1tx, $localtax2tx, $_POST['qty'], $_POST['idprod'], $price_base_type, 0, $type); if ($result >= 0) { unset($_POST['label']); } } } if ($_GET['action'] == 'addline') { $facfou = new FactureFournisseur($db, '', $_GET['facid']); $ret=$facfou->fetch($_GET['facid']); if ($ret < 0) { dol_print_error($db,$facfou->error); exit;
if (GETPOST('idprod')) { $prod = new Product($db); $prod->fetch($_POST['idprod']); $label = $prod->description; if (trim($_POST['desc']) != trim($label)) { $label = $_POST['desc']; } $type = $prod->type; } else { $label = $_POST['desc']; $type = $_POST["type"] ? $_POST["type"] : 0; } $localtax1tx = get_localtax($_POST['tauxtva'], 1, $mysoc, $object->thirdparty); $localtax2tx = get_localtax($_POST['tauxtva'], 2, $mysoc, $object->thirdparty); $remise_percent = GETPOST('remise_percent'); $result = $object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { unset($_POST['label']); } } } elseif ($action == 'addline') { $ret = $object->fetch($id); if ($ret < 0) { dol_print_error($db, $object->error); exit; } $ret = $object->fetch_thirdparty(); if (GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) { $idprod = 0; $product = new Product($db); if (GETPOST('idprodfournprice') == '') {