Merge pull request #17865 from ATM-Consulting/NEW_develop_autocomplete_accounting_account_groups

New develop autocomplete accounting account groups
This commit is contained in:
Laurent Destailleur 2021-08-17 19:46:46 +02:00 committed by GitHub
commit aee291d079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,7 +257,16 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '<input type="text" name="pcg_type" list="pcg_type_datalist" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
// autosuggest from existing account types if found
print '<datalist id="pcg_type_datalist">';
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
$sql .= ' WHERE fk_pcg_version = "' . $db->escape($accountsystem->ref) . '"';
$sql .= ' LIMIT 50000'; // just as a sanity check
foreach ($db->getRows($sql) as $obj) {
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
}
print '</datalist>';
print '</td></tr>';
// Category