Qual: Uniformize code
This commit is contained in:
parent
2f100d0d72
commit
c0774485f9
@ -126,18 +126,8 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
{
|
{
|
||||||
if (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice']))
|
if (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice']))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($id);
|
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
||||||
if ($ret < 0)
|
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
||||||
{
|
|
||||||
dol_print_error($db,$object->error);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($object->socid)
|
|
||||||
{
|
|
||||||
$societe=new Societe($db);
|
|
||||||
$societe->fetch($object->socid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
// Ecrase $desc par celui du produit
|
// Ecrase $desc par celui du produit
|
||||||
@ -149,13 +139,6 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
$productsupplier = new ProductFournisseur($db);
|
$productsupplier = new ProductFournisseur($db);
|
||||||
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty);
|
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty);
|
||||||
|
|
||||||
//$societe='';
|
|
||||||
/*if ($object->socid)
|
|
||||||
{
|
|
||||||
$societe=new Societe($db);
|
|
||||||
$societe->fetch($object->socid);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if ($idprod > 0)
|
if ($idprod > 0)
|
||||||
{
|
{
|
||||||
$res=$productsupplier->fetch($idprod);
|
$res=$productsupplier->fetch($idprod);
|
||||||
@ -170,12 +153,12 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
|
|
||||||
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
|
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
|
||||||
|
|
||||||
$tva_tx = get_default_tva($societe,$mysoc,$productsupplier->id);
|
$tva_tx = get_default_tva($object->thirdparty,$mysoc,$productsupplier->id);
|
||||||
$type = $productsupplier->type;
|
$type = $productsupplier->type;
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$localtax1_tx= get_localtax($tva_tx, 1, $societe);
|
$localtax1_tx= get_localtax($tva_tx, 1, $object->thirdparty);
|
||||||
$localtax2_tx= get_localtax($tva_tx, 2, $societe);
|
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
|
||||||
|
|
||||||
$result=$object->addline(
|
$result=$object->addline(
|
||||||
$desc,
|
$desc,
|
||||||
@ -206,8 +189,8 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
$tva_tx = price2num($_POST['tva_tx']);
|
$tva_tx = price2num($_POST['tva_tx']);
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
$localtax1_tx= get_localtax($tva_tx, 1, $societe);
|
$localtax1_tx= get_localtax($tva_tx, 1, $object->thirdparty);
|
||||||
$localtax2_tx= get_localtax($tva_tx, 2, $societe);
|
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
|
||||||
|
|
||||||
if (! $_POST['dp_desc'])
|
if (! $_POST['dp_desc'])
|
||||||
{
|
{
|
||||||
@ -271,13 +254,11 @@ if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $
|
|||||||
if ($product->fetch($_POST["elrowid"]) < 0) dol_print_error($db);
|
if ($product->fetch($_POST["elrowid"]) < 0) dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->fetch($id) < 0) dol_print_error($db);
|
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
||||||
|
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
||||||
|
|
||||||
$societe=new Societe($db);
|
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$object->thirdparty);
|
||||||
$societe->fetch($object->socid);
|
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$object->thirdparty);
|
||||||
|
|
||||||
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$societe);
|
|
||||||
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$societe);
|
|
||||||
|
|
||||||
$result = $object->updateline(
|
$result = $object->updateline(
|
||||||
$_POST['elrowid'],
|
$_POST['elrowid'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user