This commit is contained in:
Laurent Destailleur 2020-03-22 20:50:50 +01:00
parent 61deab41f9
commit 94b6fbb223

View File

@ -3509,11 +3509,11 @@ class Form
/** /**
* Return list of payment methods * Return list of payment methods
* *
* @param string $selected Id du mode de paiement pre-selectionne * @param string $selected Id or code or preselected payment mode
* @param string $htmlname Nom de la zone select * @param string $htmlname Name of select field
* @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz)) * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code
* @param int $empty 1=peut etre vide, 0 sinon * @param int $empty 1=can be empty, 0 otherwise
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label * @param int $maxlength Max length of label
* @param int $active Active or not, -1 = all * @param int $active Active or not, -1 = all
@ -3551,9 +3551,12 @@ class Form
elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"';
elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"';
elseif ($format == 3) print '<option value="'.$id.'"'; elseif ($format == 3) print '<option value="'.$id.'"';
// Si selected est text, on compare avec code, sinon avec id // Print attribute selected or not
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected'; if ($format==1 || $format==2) {
elseif ($selected == $id) print ' selected'; if ($selected == $arraytypes['code']) print ' selected';
} else {
if ($selected == $id) print ' selected';
}
print '>'; print '>';
if ($format == 0) $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); if ($format == 0) $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
elseif ($format == 1) $value = $arraytypes['code']; elseif ($format == 1) $value = $arraytypes['code'];