Skip to content
Snippets Groups Projects
Commit 6e524ff8 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: add predefined lines in a new credit note

parent d100d1ac
Branches
Tags
No related merge requests found
......@@ -186,7 +186,7 @@ if ($_GET['action'] == 'valid')
// On verifie signe facture
if ($facture->type == 2)
{
// Si avoir, le signe doit etre ngatif
// Si avoir, le signe doit etre negatif
if ($facture->total_ht >= 0)
{
$mesg='<div class="error">'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'</div>';
......@@ -572,6 +572,19 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->type = 2;
$facid = $facture->create($user);
// Add predefined lines
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);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment