From b5a43c8d1d2be9df9a772799791048c2ff598a88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 21:31:43 +0200 Subject: [PATCH] FIX #17502 --- htdocs/compta/facture/card.php | 11 ++++------- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 252b8ac65a2..48b7c505264 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2955,12 +2955,12 @@ if ($action == 'create') { // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value if (empty($cond_reglement_id)) { - $cond_reglement_id = GETPOST("cond_reglement_id"); + $cond_reglement_id = GETPOST("cond_reglement_id", 'int'); } // when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value if (empty($mode_reglement_id)) { - $mode_reglement_id = GETPOST("mode_reglement_id"); + $mode_reglement_id = GETPOST("mode_reglement_id", 'int'); } if (!empty($soc->id)) { @@ -3563,12 +3563,9 @@ if ($action == 'create') { // Bank Account if (!empty($conf->banque->enabled)) { - if (GETPOSTISSET('fk_account')) { - $fk_account = GETPOST('fk_account', 'int'); - } - print ''.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="paddingrightonly"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, '', 1); + $fk_account = GETPOST('fk_account', 'int'); + print img_picto('', 'bank_account', 'class="paddingrightonly"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, '', 1); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0d4b8b177b9..ba953282d2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -294,7 +294,7 @@ function dol_shutdown() } /** - * Return true if we are in a context of submitting the parameter $paramname + * Return true if we are in a context of submitting the parameter $paramname from a POST of a form. * * @param string $paramname Name or parameter to test * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty)