Fix sanitize amount

This commit is contained in:
Laurent Destailleur 2020-04-18 16:05:26 +02:00
parent 16806da9b5
commit de74c447cc

View File

@ -51,8 +51,8 @@ if ($action == 'add')
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$amount = GETPOST('amount', 'alpha'); $amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$amountto = GETPOST('amountto', 'alpha'); $amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
if (!$label) if (!$label)
{ {
@ -115,9 +115,9 @@ if ($action == 'add')
$typeto = 'LIQ'; $typeto = 'LIQ';
} }
if (!$error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * price2num($amount), '', '', $user); if (!$error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, price2num(-1 * $amount), '', '', $user);
if (!($bank_line_id_from > 0)) $error++; if (!($bank_line_id_from > 0)) $error++;
if (!$error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amountto), '', '', $user); if (!$error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, $amountto, '', '', $user);
if (!($bank_line_id_to > 0)) $error++; if (!($bank_line_id_to > 0)) $error++;
if (!$error) $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); if (!$error) $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
@ -246,7 +246,6 @@ print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo
print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>'; print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>';
print '</tr>'; print '</tr>';
$var = false;
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
$form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1); $form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1);
print "</td>"; print "</td>";