Fixed search in alert templates, when DB is Oracle. Tiquet: #3231
(cherry picked from commit 053d0298a1
)
This commit is contained in:
parent
65b709f954
commit
5e4b9c4b45
|
@ -649,7 +649,46 @@ function alerts_delete_alert_template ($id_alert_template) {
|
|||
* @return mixed Array with selected alert templates or false if something goes wrong.
|
||||
*/
|
||||
function alerts_get_alert_templates ($filter = false, $fields = false) {
|
||||
return @db_get_all_rows_filter ('talert_templates', $filter, $fields);
|
||||
global $config;
|
||||
|
||||
if (isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
unset($filter['offset']);
|
||||
}
|
||||
|
||||
if (isset($filter['limit'])) {
|
||||
$limit = $filter['limit'];
|
||||
unset($filter['limit']);
|
||||
}
|
||||
|
||||
$templates_sql = @db_get_all_rows_filter ('talert_templates', $filter, $fields, 'AND', false, true);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$limit_sql = '';
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$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 = array();
|
||||
if (isset($offset) && isset($limit)) {
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
}
|
||||
|
||||
$alert_templates = oracle_recode_query ($templates_sql, $set, 'AND', false);
|
||||
break;
|
||||
}
|
||||
return $alert_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue