FIX #5068
This commit is contained in:
parent
d5f221452e
commit
f972b15f5f
@ -611,6 +611,18 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('propalid') > 0) {
|
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(
|
$result = $propal->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
@ -628,7 +640,7 @@ if (empty($reshook))
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
$buyprice,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -642,6 +654,18 @@ if (empty($reshook))
|
|||||||
|
|
||||||
setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
|
setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
|
||||||
} elseif (GETPOST('commandeid') > 0) {
|
} 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(
|
$result = $commande->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
@ -662,7 +686,7 @@ if (empty($reshook))
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
0,
|
$buyprice,
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
$object->fk_unit
|
$object->fk_unit
|
||||||
@ -673,6 +697,18 @@ if (empty($reshook))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} elseif (GETPOST('factureid') > 0) {
|
} 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(
|
$result = $facture->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
@ -696,7 +732,7 @@ if (empty($reshook))
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
0,
|
$buyprice,
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
100,
|
100,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user