mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
FIX proposed new feature: autocomplete for accounting account groups
This commit is contained in:
@@ -258,13 +258,13 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
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 a.rowid as rowid, a.code as code, a.label FROM '.MAIN_DB_PREFIX.'c_accounting_category as a WHERE a.active=1';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<option value="' . dol_escape_htmltag($obj->code) . '">';
|
||||
}
|
||||
$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>';
|
||||
|
||||
Reference in New Issue
Block a user