Skip to content

Commit

Permalink
FIX #5068
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 12, 2016
1 parent d5f2214 commit f972b15
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions htdocs/product/card.php
Expand Up @@ -609,8 +609,20 @@
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
}
}

if (GETPOST('propalid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}

$result = $propal->addline(
$desc,
$pu_ht,
Expand All @@ -628,7 +640,7 @@
0,
0,
0,
0,
$buyprice,
'',
'',
'',
Expand All @@ -642,6 +654,18 @@

setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
} elseif (GETPOST('commandeid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}

$result = $commande->addline(
$desc,
$pu_ht,
Expand All @@ -662,7 +686,7 @@
0,
0,
null,
0,
$buyprice,
'',
0,
$object->fk_unit
Expand All @@ -673,6 +697,18 @@
exit;
}
} elseif (GETPOST('factureid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}

$result = $facture->addline(
$desc,
$pu_ht,
Expand All @@ -696,7 +732,7 @@
0,
0,
null,
0,
$buyprice,
'',
0,
100,
Expand Down

0 comments on commit f972b15

Please sign in to comment.