Fix: code optimization for compatibility plugins
This commit is contained in:
parent
d5b3ab4e4f
commit
86240b90c5
@ -665,25 +665,6 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
$facture->remise_absolue = $_POST['remise_absolue'];
|
$facture->remise_absolue = $_POST['remise_absolue'];
|
||||||
$facture->remise_percent = $_POST['remise_percent'];
|
$facture->remise_percent = $_POST['remise_percent'];
|
||||||
|
|
||||||
// If some invoice's lines already known
|
|
||||||
if (! $_POST['propalid'] && ! $_POST['commandeid'] && ! $_POST['contratid'])
|
|
||||||
{
|
|
||||||
$facid = $facture->create($user);
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $NBLINES; $i++)
|
|
||||||
{
|
|
||||||
if ($_POST['idprod'.$i])
|
|
||||||
{
|
|
||||||
$product=new Product($db);
|
|
||||||
$product->fetch($_POST['idprod'.$i]);
|
|
||||||
$startday=dol_mktime(12, 0 , 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
|
|
||||||
$endday=dol_mktime(12, 0 , 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
|
|
||||||
$result=$facture->addline($facid,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If creation from proposal
|
// If creation from proposal
|
||||||
if ($_POST['propalid'])
|
if ($_POST['propalid'])
|
||||||
{
|
{
|
||||||
@ -742,7 +723,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If creation from order
|
// If creation from order
|
||||||
if ($_POST['commandeid'])
|
else if ($_POST['commandeid'])
|
||||||
{
|
{
|
||||||
$facture->commandeid = $_POST['commandeid'];
|
$facture->commandeid = $_POST['commandeid'];
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
@ -800,7 +781,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If creation from contract
|
// If creation from contract
|
||||||
if ($_POST['contratid'])
|
else if ($_POST['contratid'])
|
||||||
{
|
{
|
||||||
$facture->contratid = $_POST['contratid'];
|
$facture->contratid = $_POST['contratid'];
|
||||||
$facid = $facture->create($user);
|
$facid = $facture->create($user);
|
||||||
@ -854,6 +835,23 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If some invoice's lines already known
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$facid = $facture->create($user);
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $NBLINES; $i++)
|
||||||
|
{
|
||||||
|
if ($_POST['idprod'.$i])
|
||||||
|
{
|
||||||
|
$product=new Product($db);
|
||||||
|
$product->fetch($_POST['idprod'.$i]);
|
||||||
|
$startday=dol_mktime(12, 0 , 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
|
||||||
|
$endday=dol_mktime(12, 0 , 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
|
||||||
|
$result=$facture->addline($facid,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user