mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed search in alert templates, when DB is Oracle. Tiquet: #3231
This commit is contained in:
parent
52d47e012c
commit
053d0298a1
@ -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.
|
* @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) {
|
||||||
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…
x
Reference in New Issue
Block a user