Merge branch 'ent-9485-14165-filtrado-alertas-metaconsola' into 'develop'
Ent 9485 14165 filtrado alertas metaconsola See merge request artica/pandorafms!5128
This commit is contained in:
commit
d833c7ba39
pandora_console
|
@ -358,7 +358,7 @@ if (!is_user_admin($config['id_user'])) {
|
||||||
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
|
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total']);
|
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total'], true);
|
||||||
$total_templates = $total_templates[0]['total'];
|
$total_templates = $total_templates[0]['total'];
|
||||||
|
|
||||||
$templates = alerts_get_alert_templates(
|
$templates = alerts_get_alert_templates(
|
||||||
|
|
|
@ -795,7 +795,7 @@ function alerts_delete_alert_template($id_alert_template)
|
||||||
*
|
*
|
||||||
* @return mixed Array with selected alert templates or false if something goes wrong.
|
* @return mixed Array with selected alert templates or false if something goes wrong.
|
||||||
*/
|
*/
|
||||||
function alerts_get_alert_templates($filter=false, $fields=false)
|
function alerts_get_alert_templates($filter=false, $fields=false, $total=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -811,32 +811,17 @@ function alerts_get_alert_templates($filter=false, $fields=false)
|
||||||
|
|
||||||
$templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true);
|
$templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true);
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
$limit_sql = '';
|
||||||
case 'mysql':
|
if (isset($offset) && isset($limit) && $total === false) {
|
||||||
case 'postgresql':
|
$limit_sql = " LIMIT $offset, $limit ";
|
||||||
$limit_sql = '';
|
} else {
|
||||||
if (isset($offset) && isset($limit)) {
|
$limit_sql = '';
|
||||||
$limit_sql = " LIMIT $offset, $limit ";
|
|
||||||
} else {
|
|
||||||
$limit_sql = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
|
|
||||||
|
|
||||||
$alert_templates = db_get_all_rows_sql($sql);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$set = [];
|
|
||||||
if (isset($offset) && isset($limit)) {
|
|
||||||
$set['limit'] = $limit;
|
|
||||||
$set['offset'] = $offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
$alert_templates = oracle_recode_query($templates_sql, $set, 'AND', false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
|
||||||
|
|
||||||
|
$alert_templates = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
return $alert_templates;
|
return $alert_templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue