Fix: amount into form must be numeric without format

This commit is contained in:
Laurent Destailleur 2018-02-04 23:06:37 +01:00
parent fe57cf697f
commit 354fc4edd0
4 changed files with 20 additions and 20 deletions

View File

@ -305,7 +305,7 @@ if (! GETPOST("source") && $valid)
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -392,7 +392,7 @@ if (GETPOST("source") == 'order' && $valid)
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -480,7 +480,7 @@ if (GETPOST("source") == 'invoice' && $valid)
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -656,7 +656,7 @@ if (GETPOST("source") == 'contractline' && $valid)
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -786,7 +786,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price($valtoshow).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
else {
$valtoshow=$amount;

View File

@ -647,7 +647,7 @@ if (! $source)
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -738,7 +738,7 @@ if ($source == 'order')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -858,7 +858,7 @@ if ($source == 'invoice')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"), 'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"), 'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -1079,7 +1079,7 @@ if ($source == 'contractline')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -1239,7 +1239,7 @@ if ($source == 'membersubscription')
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price($valtoshow).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
else {
$valtoshow=$amount;

View File

@ -387,7 +387,7 @@ if (! GETPOST("source"))
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -472,7 +472,7 @@ if (GETPOST("source") == 'order')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -582,7 +582,7 @@ if (GETPOST("source") == 'invoice')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -780,7 +780,7 @@ if (GETPOST("source") == 'contractline')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -936,7 +936,7 @@ if (GETPOST("source") == 'membersubscription')
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price($valtoshow).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
else {
$valtoshow=$amount;

View File

@ -455,7 +455,7 @@ if (! GETPOST("source"))
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -541,7 +541,7 @@ if (GETPOST("source") == 'order')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -652,7 +652,7 @@ if (GETPOST("source") == 'invoice')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -852,7 +852,7 @@ if (GETPOST("source") == 'contractline')
if (empty($amount) || ! is_numeric($amount))
{
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price(price2num(GETPOST("newamount","alpha"),'MT')).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">';
}
else {
print '<b>'.price($amount).'</b>';
@ -1008,7 +1008,7 @@ if (GETPOST("source") == 'membersubscription')
//$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT');
if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow);
print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price($valtoshow).'">';
print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">';
}
else {
$valtoshow=$amount;