Clean code
This commit is contained in:
parent
aee291d079
commit
9521a9e77f
@ -262,9 +262,13 @@ if ($action == 'create') {
|
||||
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 .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
||||
$sql .= ' LIMIT 50000'; // just as a sanity check
|
||||
foreach ($db->getRows($sql) as $obj) {
|
||||
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
|
||||
}
|
||||
}
|
||||
print '</datalist>';
|
||||
print '</td></tr>';
|
||||
@ -329,7 +333,20 @@ 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 .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
|
||||
$sql .= ' LIMIT 50000'; // just as a sanity check
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
|
||||
}
|
||||
}
|
||||
print '</datalist>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
|
||||
@ -321,6 +321,7 @@ abstract class DoliDB implements Database
|
||||
* Dont add LIMIT to your query, it will be added by this method
|
||||
* @param string $sql the sql query string
|
||||
* @return bool| object
|
||||
* @deprecated
|
||||
*/
|
||||
public function getRow($sql)
|
||||
{
|
||||
@ -338,8 +339,9 @@ abstract class DoliDB implements Database
|
||||
* return all results from query as an array of objects
|
||||
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
|
||||
* be carefull with this method use it only with some limit of results to avoid performences loss
|
||||
* @param string $sql the sql query string
|
||||
* @return bool| array
|
||||
* @param string $sql the sql query string
|
||||
* @return bool| array
|
||||
* @deprecated
|
||||
*/
|
||||
public function getRows($sql)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user