Fix: We discard negative lines on invoices
This commit is contained in:
parent
b6ebc8306a
commit
c9d3aba7e8
@ -26,7 +26,7 @@
|
|||||||
* \file htdocs/compta/facture.php
|
* \file htdocs/compta/facture.php
|
||||||
* \ingroup facture
|
* \ingroup facture
|
||||||
* \brief Page to create/see an invoice
|
* \brief Page to create/see an invoice
|
||||||
* \version $Id: facture.php,v 1.848 2011/07/10 20:03:40 eldy Exp $
|
* \version $Id: facture.php,v 1.849 2011/07/17 19:58:55 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('../main.inc.php');
|
require('../main.inc.php');
|
||||||
@ -739,18 +739,24 @@ if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
for ($i=0;$i<$num;$i++)
|
for ($i=0;$i<$num;$i++)
|
||||||
{
|
{
|
||||||
|
if ($lines[$i]->subprice < 0)
|
||||||
|
{
|
||||||
|
// Negative line, we create a discount line
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Positive line
|
||||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
// TODO mutualiser
|
|
||||||
$date_start=false;
|
$date_start=false;
|
||||||
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue;
|
||||||
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
|
||||||
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
|
||||||
|
|
||||||
//Date end
|
//Date end
|
||||||
// TODO mutualiser
|
|
||||||
$date_end=false;
|
$date_end=false;
|
||||||
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue;
|
||||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||||
@ -797,6 +803,7 @@ if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
$fk_parent_line = $result;
|
$fk_parent_line = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
if (! empty($object->hooks))
|
if (! empty($object->hooks))
|
||||||
@ -3241,5 +3248,5 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date: 2011/07/10 20:03:40 $ - $Revision: 1.848 $');
|
llxFooter('$Date: 2011/07/17 19:58:55 $ - $Revision: 1.849 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user