Fixed a problem when adding line into proposal
This commit is contained in:
parent
2aa883c25e
commit
bb99e4d40d
@ -635,19 +635,13 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
|||||||
$idprod=GETPOST('idprod', 'int');
|
$idprod=GETPOST('idprod', 'int');
|
||||||
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = GETPOST('price_ht');
|
||||||
$np_price = GETPOST('np_price');
|
|
||||||
|
|
||||||
if (empty($idprod) && GETPOST('type') < 0)
|
if (empty($idprod) && GETPOST('type') < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
if (empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||||
{
|
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
else if ($conf->global->MAIN_FEATURES_LEVEL < 2 && empty($idprod) && (!($np_price >= 0) || $np_price == '')) // Unit price can be 0 but not ''
|
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -676,7 +670,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
|||||||
$label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):'');
|
$label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):'');
|
||||||
|
|
||||||
// If prices fields are update
|
// If prices fields are update
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($price_ht))
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||||
{
|
{
|
||||||
$pu_ht=price2num($price_ht, 'MU');
|
$pu_ht=price2num($price_ht, 'MU');
|
||||||
$pu_ttc=price2num(GETPOST('price_ttc'), 'MU');
|
$pu_ttc=price2num(GETPOST('price_ttc'), 'MU');
|
||||||
@ -753,7 +747,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht=(isset($price_ht)?$price_ht:$np_price);
|
$pu_ht= $price_ht;
|
||||||
$pu_ttc=price2num(GETPOST('price_ttc'), 'MU');
|
$pu_ttc=price2num(GETPOST('price_ttc'), 'MU');
|
||||||
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
|
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
|
||||||
$tva_tx=str_replace('*','',$rate);
|
$tva_tx=str_replace('*','',$rate);
|
||||||
@ -836,7 +830,6 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
|||||||
unset($_POST['buying_price']);
|
unset($_POST['buying_price']);
|
||||||
|
|
||||||
// old method
|
// old method
|
||||||
unset($_POST['np_price']);
|
|
||||||
unset($_POST['np_desc']);
|
unset($_POST['np_desc']);
|
||||||
unset($_POST['dp_desc']);
|
unset($_POST['dp_desc']);
|
||||||
unset($_POST['np_fournprice']);
|
unset($_POST['np_fournprice']);
|
||||||
|
|||||||
@ -80,7 +80,7 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><input type="text" size="5" name="np_price" value="<?php echo (isset($_POST["np_price"])?$_POST["np_price"]:''); ?>"></td>
|
<td align="right"><input type="text" size="5" name="price_ht" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>"></td>
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user