This commit is contained in:
Laurent Destailleur 2026-01-24 19:24:19 +01:00
parent 6b8214ea6a
commit 06e2e60364

View file

@ -4936,16 +4936,16 @@ class Form
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can be used to set default value but scope is all application, probably not what you want.
* See instead to force the default value by the caller.
*
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
* @param int $addempty Add an empty entry
* @param int $noinfoadmin 0=Add admin info, 1=Disable admin info
* @param string $morecss Add more CSS on select tag
* @param float $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
* 0 : use default deposit percentage from entry
* > 0 : force deposit percentage (for example, from company object)
* @return string String for the HTML select component
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Name of the select zone
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
* @param int $addempty Add an empty entry
* @param int $noinfoadmin 0=Add admin info, 1=Disable admin info
* @param string $morecss Add more CSS on select tag
* @param float $deposit_percent If < 0 : deposit_percent input makes no sense (for example, in list filters)
* If 0 : use default deposit percentage from entry
* If > 0 : force deposit percentage (for example, from company object)
* @return string String for the HTML select component
*/
public function getSelectConditionsPaiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1)
{
@ -4957,9 +4957,9 @@ class Form
$this->load_cache_conditions_paiements();
// Set default value if not already set by caller
if (empty($selected) && strpos($htmlname, 'search_') !== 0 && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
if (empty($selected) && strpos($htmlname, 'search_') !== 0 && getDolGlobalInt('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
$selected = getDolGlobalInt('MAIN_DEFAULT_PAYMENT_TERM_ID');
}
$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
@ -6554,7 +6554,7 @@ class Form
* Show a form to select payment conditions
*
* @param string $page Page
* @param string $selected Id condition pre-selectionne
* @param string $selected Id of preselected payment term
* @param string $htmlname Name of select html field
* @param int<0,1> $addempty Add empty entry
* @param ''|'direct-debit'|'bank-transfer' $type Type ('direct-debit' or 'bank-transfer')
@ -6570,6 +6570,8 @@ class Form
// phpcs:enable
global $langs;
$selected = (int) $selected;
$out = '';
if ($htmlname != "none") {
@ -6579,7 +6581,7 @@ class Form
if ($type) {
$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
}
$out .= $this->getSelectConditionsPaiements((int) $selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
$out .= '</form>';
} else {