Skip to content

Commit

Permalink
Merge pull request #364 from marcosgdf/minor
Browse files Browse the repository at this point in the history
Fixed a problem when adding line into proposal
  • Loading branch information
hregis committed Aug 31, 2012
2 parents 57fa5d6 + bb99e4d commit 4054e5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions htdocs/comm/propal.php
Expand Up @@ -635,19 +635,13 @@
$idprod=GETPOST('idprod', 'int');
$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');
$np_price = GETPOST('np_price');

if (empty($idprod) && GETPOST('type') < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && 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 ''
if (empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++;
Expand Down Expand Up @@ -676,7 +670,7 @@
$label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):'');

// 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_ttc=price2num(GETPOST('price_ttc'), 'MU');
Expand Down Expand Up @@ -753,7 +747,7 @@
}
else
{
$pu_ht=(isset($price_ht)?$price_ht:$np_price);
$pu_ht= $price_ht;
$pu_ttc=price2num(GETPOST('price_ttc'), 'MU');
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
$tva_tx=str_replace('*','',$rate);
Expand Down Expand Up @@ -836,7 +830,6 @@
unset($_POST['buying_price']);

// old method
unset($_POST['np_price']);
unset($_POST['np_desc']);
unset($_POST['dp_desc']);
unset($_POST['np_fournprice']);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/freeproductline_create.tpl.php
Expand Up @@ -80,7 +80,7 @@
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
?>
</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" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
<?php
Expand Down

0 comments on commit 4054e5a

Please sign in to comment.