mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
Database update uses a different file for filters
- Added system/filtersupdate.php to collect all the filters and to perform an insert or an update in the database - Removed filters from system/dbupdate_3.3.php - Updated system/checksystem.php to call system/filtersupdate.php
This commit is contained in:
@@ -73,6 +73,16 @@ echo '<div>';
|
|||||||
require_once('phrasesupdate.php');
|
require_once('phrasesupdate.php');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
// ******** filtersupdate ************/
|
||||||
|
echo '<H2>Filters time!</H2>';
|
||||||
|
|
||||||
|
echo '<div>';
|
||||||
|
echo 'filtersupdate.php wird aufgerufen...';
|
||||||
|
echo '</div>';
|
||||||
|
echo '<div>';
|
||||||
|
require_once('filtersupdate.php');
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
|
||||||
// ******** Berechtigungen Prüfen ************/
|
// ******** Berechtigungen Prüfen ************/
|
||||||
echo '<h2>Berechtigungen pruefen</h2>';
|
echo '<h2>Berechtigungen pruefen</h2>';
|
||||||
|
|||||||
+1
-84
@@ -1878,89 +1878,6 @@ if($result = $db->db_query("SELECT obj_description('public.ci_apikey'::regclass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterSentApplicationAll' AND app='infocenter'"))
|
|
||||||
{
|
|
||||||
if($db->db_num_rows($result)==0)
|
|
||||||
{
|
|
||||||
$qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort,
|
|
||||||
default_filter, filter, oe_kurzbz)
|
|
||||||
VALUES ('infocenter', 'PersonActions', 'InfoCenterSentApplicationAll', NULL, '{Alle}', 1, false,
|
|
||||||
'{\"name\": \"Abgeschickt - Alle\", \"columns\": [{\"name\": \"Vorname\"},
|
|
||||||
{\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, {\"name\": \"LockUser\"},
|
|
||||||
{\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, {\"name\": \"StgAbgeschickt\"}],
|
|
||||||
\"filters\": [{\"name\": \"AnzahlAbgeschickt\", \"option\": \"\",
|
|
||||||
\"condition\": \"0\", \"operation\": \"gt\"}]}', NULL);";
|
|
||||||
if(!$db->db_query($qry))
|
|
||||||
echo '<strong>Filter: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Filter InfoCenterSentApplicationAll hinzugefuegt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterSentApplication3days' AND app='infocenter'"))
|
|
||||||
{
|
|
||||||
if($db->db_num_rows($result)==0)
|
|
||||||
{
|
|
||||||
$qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort,
|
|
||||||
default_filter, filter, oe_kurzbz)
|
|
||||||
VALUES ('infocenter', 'PersonActions', 'InfoCenterSentApplication3days', NULL,
|
|
||||||
'{\"3 Tage keine Aktion\"}', 2, false, '{\"name\": \"Abgeschickt - 3 Tage keine Aktion\",
|
|
||||||
\"columns\": [{\"name\": \"Vorname\"}, {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"},
|
|
||||||
{\"name\": \"LockUser\"}, {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"},
|
|
||||||
{\"name\": \"StgAbgeschickt\"}],
|
|
||||||
\"filters\": [{\"name\": \"LastAction\", \"option\": \"days\", \"condition\": \"3\",
|
|
||||||
\"operation\": \"gt\"}, {\"name\": \"AnzahlAbgeschickt\", \"option\": \"\",
|
|
||||||
\"condition\": \"0\", \"operation\": \"gt\"}]}', NULL);";
|
|
||||||
|
|
||||||
if(!$db->db_query($qry))
|
|
||||||
echo '<strong>Filter: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Filter InfoCenterSentApplication3days hinzugefuegt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterNotSentApplicationAll' AND app='infocenter'"))
|
|
||||||
{
|
|
||||||
if($db->db_num_rows($result)==0)
|
|
||||||
{
|
|
||||||
$qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort,
|
|
||||||
default_filter, filter, oe_kurzbz)
|
|
||||||
VALUES ('infocenter', 'PersonActions', 'InfoCenterNotSentApplicationAll', NULL, '{Alle}', 1, false,
|
|
||||||
'{\"name\": \"Nicht abgeschickt - Alle\", \"columns\": [{\"name\": \"Vorname\"},
|
|
||||||
{\"name\": \"Nachname\"}, {\"name\": \"LastAction\"}, {\"name\": \"LockUser\"},
|
|
||||||
{\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"}, {\"name\": \"StgAbgeschickt\"}],
|
|
||||||
\"filters\": [{\"name\": \"SendDate\", \"option\": \"\",
|
|
||||||
\"condition\": \"\", \"operation\": \"nset\"}]}', NULL);";
|
|
||||||
|
|
||||||
if(!$db->db_query($qry))
|
|
||||||
echo '<strong>Filter: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Filter InfoCenterNotSentApplicationAll hinzugefuegt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($result = @$db->db_query("SELECT * FROM system.tbl_filters WHERE filter_kurzbz='InfoCenterNotSentApplication14Days' AND app='infocenter'"))
|
|
||||||
{
|
|
||||||
if($db->db_num_rows($result)==0)
|
|
||||||
{
|
|
||||||
$qry = "INSERT INTO system.tbl_filters(app, dataset_name, filter_kurzbz, person_id, description, sort,
|
|
||||||
default_filter, filter, oe_kurzbz)
|
|
||||||
VALUES ('infocenter', 'PersonActions', 'InfoCenterNotSentApplication14Days', NULL,
|
|
||||||
'{\"14 Tage keine Aktion\"}', 2, false, '{\"name\": \"Nicht abgeschickt - 14 Tage keine Aktion\",
|
|
||||||
\"columns\": [{\"name\": \"Vorname\"}, {\"name\": \"Nachname\"}, {\"name\": \"LastAction\"},
|
|
||||||
{\"name\": \"LockUser\"}, {\"name\": \"Studiensemester\"}, {\"name\": \"SendDate\"},
|
|
||||||
{\"name\": \"StgAbgeschickt\"}], \"filters\": [{\"name\": \"LastAction\", \"option\": \"days\",
|
|
||||||
\"condition\": \"14\", \"operation\": \"gt\"}, {\"name\": \"SendDate\", \"option\": \"\",
|
|
||||||
\"condition\": \"\", \"operation\": \"nset\"}]}', NULL);
|
|
||||||
";
|
|
||||||
|
|
||||||
if(!$db->db_query($qry))
|
|
||||||
echo '<strong>Filter: '.$db->db_last_error().'</strong><br>';
|
|
||||||
else
|
|
||||||
echo '<br>Filter InfoCenterNotSentApplication14Days hinzugefuegt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$result = @$db->db_query("SELECT projekt_id FROM fue.tbl_projekt LIMIT 1"))
|
if (!$result = @$db->db_query("SELECT projekt_id FROM fue.tbl_projekt LIMIT 1"))
|
||||||
{
|
{
|
||||||
$qry = "CREATE SEQUENCE fue.tbl_projekt_projekt_id_seq
|
$qry = "CREATE SEQUENCE fue.tbl_projekt_projekt_id_seq
|
||||||
@@ -2267,7 +2184,7 @@ if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants
|
|||||||
if($db->db_num_rows($result)==0)
|
if($db->db_num_rows($result)==0)
|
||||||
{
|
{
|
||||||
$qry = "GRANT DELETE ON system.tbl_log TO web;";
|
$qry = "GRANT DELETE ON system.tbl_log TO web;";
|
||||||
|
|
||||||
if(!$db->db_query($qry))
|
if(!$db->db_query($qry))
|
||||||
echo '<strong>Permission Log: '.$db->db_last_error().'</strong><br>';
|
echo '<strong>Permission Log: '.$db->db_last_error().'</strong><br>';
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,390 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2013 FH Technikum-Wien
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Array of filters to be added or updated in the database
|
||||||
|
$filters = array(
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterSentApplicationAll',
|
||||||
|
'description' => '{Alle}',
|
||||||
|
'sort' => 1,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Abgeschickt - Alle",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "AnzahlAbgeschickt",
|
||||||
|
"option": "",
|
||||||
|
"condition": "0",
|
||||||
|
"operation": "gt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterSentApplication3days',
|
||||||
|
'description' => '{"3 Tage keine Aktion"}',
|
||||||
|
'sort' => 2,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Abgeschickt - 3 Tage keine Aktion",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "LastAction",
|
||||||
|
"option": "days",
|
||||||
|
"condition": "3",
|
||||||
|
"operation": "gt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AnzahlAbgeschickt",
|
||||||
|
"option": "",
|
||||||
|
"condition": "0",
|
||||||
|
"operation": "gt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterNotSentApplicationAll',
|
||||||
|
'description' => '{Alle}',
|
||||||
|
'sort' => 1,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Nicht abgeschickt - Alle",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"
|
||||||
|
},
|
||||||
|
{"name": "StgNichtAbgeschickt"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "StgAktiv"},
|
||||||
|
{"name": "Studiensemester"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "SendDate",
|
||||||
|
"option": "",
|
||||||
|
"condition": "",
|
||||||
|
"operation": "nset"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterNotSentApplication14Days',
|
||||||
|
'description' => '{"14 Tage keine Aktion"}',
|
||||||
|
'sort' => 3,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Nicht abgeschickt - 14 Tage keine Aktion",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"},
|
||||||
|
{"name": "StgNichtAbgeschickt"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "StgAktiv"},
|
||||||
|
{"name": "Studiensemester"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "LastAction",
|
||||||
|
"option": "days",
|
||||||
|
"condition": "14",
|
||||||
|
"operation": "gt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SendDate",
|
||||||
|
"option": "",
|
||||||
|
"condition": "",
|
||||||
|
"operation": "nset"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterSentApplicationLt3days',
|
||||||
|
'description' => '{"< 3 Tage"}',
|
||||||
|
'sort' => 3,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Abgeschickt - Aktion innert der letzten 3 Tage",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "LastAction",
|
||||||
|
"option": "days",
|
||||||
|
"condition": "3",
|
||||||
|
"operation": "lt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AnzahlAbgeschickt",
|
||||||
|
"option": "",
|
||||||
|
"condition": "0",
|
||||||
|
"operation": "gt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterNotSentApplication5DaysOnline',
|
||||||
|
'description' => '{"5 Tage keine BewAktion"}',
|
||||||
|
'sort' => 2,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Nicht abgeschickt - 5 Tage keine Aktion durch BewerberIn",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "Nation"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"},
|
||||||
|
{"name": "StgNichtAbgeschickt"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "StgAktiv"},
|
||||||
|
{"name": "Studiensemester"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "SendDate",
|
||||||
|
"option": "",
|
||||||
|
"condition": "",
|
||||||
|
"operation": "nset"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "LastAction",
|
||||||
|
"option": "days",
|
||||||
|
"condition": "5",
|
||||||
|
"operation": "gt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "User/Operator",
|
||||||
|
"option": "",
|
||||||
|
"condition": "online",
|
||||||
|
"operation": "contains"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterFreigegeben5days',
|
||||||
|
'description' => '{"5 Tage Letzte Aktion"}',
|
||||||
|
'sort' => 1,
|
||||||
|
'default_filter' => true,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Freigegeben - 5 Tage Letzte Aktion",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"}
|
||||||
|
],
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "LastAction",
|
||||||
|
"option": "days",
|
||||||
|
"condition": "5",
|
||||||
|
"operation": "lt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'app' => 'infocenter',
|
||||||
|
'dataset_name' => 'PersonActions',
|
||||||
|
'filter_kurzbz' => 'InfoCenterFreigegebenAlle',
|
||||||
|
'description' => '{Alle}',
|
||||||
|
'sort' => 2,
|
||||||
|
'default_filter' => false,
|
||||||
|
'filter' => '
|
||||||
|
{
|
||||||
|
"name": "Freigegeben - Alle",
|
||||||
|
"columns": [
|
||||||
|
{"name": "Vorname"},
|
||||||
|
{"name": "Nachname"},
|
||||||
|
{"name": "StgAbgeschickt"},
|
||||||
|
{"name": "LastAction"},
|
||||||
|
{"name": "User/Operator"},
|
||||||
|
{"name": "LockUser"}
|
||||||
|
],
|
||||||
|
"filters": []
|
||||||
|
}
|
||||||
|
',
|
||||||
|
'oe_kurzbz' => null,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Loop through the filters array
|
||||||
|
for ($filtersCounter = 0; $filtersCounter < count($filters); $filtersCounter++)
|
||||||
|
{
|
||||||
|
$filter = $filters[$filtersCounter]; // single filter definition
|
||||||
|
|
||||||
|
// If it's an array and contains the required number of elements
|
||||||
|
// and contains the required fields
|
||||||
|
if (is_array($filter) && count($filter) == 8
|
||||||
|
&& isset($filter['app']) && isset($filter['dataset_name'])
|
||||||
|
&& isset($filter['filter_kurzbz']) && isset($filter['description'])
|
||||||
|
&& isset($filter['filter']))
|
||||||
|
{
|
||||||
|
$selectFilterQuery = 'SELECT filter_id
|
||||||
|
FROM system.tbl_filters
|
||||||
|
WHERE app = '.$db->db_add_param($filter['app']).
|
||||||
|
' AND dataset_name = '.$db->db_add_param($filter['dataset_name']).
|
||||||
|
' AND filter_kurzbz = '.$db->db_add_param($filter['filter_kurzbz']);
|
||||||
|
|
||||||
|
// If no error occurred while loading a filter from the DB
|
||||||
|
if ($dbFilterDefinition = @$db->db_query($selectFilterQuery))
|
||||||
|
{
|
||||||
|
// If NO filters were loaded: insert
|
||||||
|
if ($db->db_num_rows($dbFilterDefinition) == 0)
|
||||||
|
{
|
||||||
|
$insertFilterQuery = 'INSERT INTO system.tbl_filters (
|
||||||
|
app,
|
||||||
|
dataset_name,
|
||||||
|
filter_kurzbz,
|
||||||
|
person_id,
|
||||||
|
description,
|
||||||
|
sort,
|
||||||
|
default_filter,
|
||||||
|
filter,
|
||||||
|
oe_kurzbz
|
||||||
|
) VALUES (
|
||||||
|
'.$db->db_add_param($filter['app']).',
|
||||||
|
'.$db->db_add_param($filter['dataset_name']).',
|
||||||
|
'.$db->db_add_param($filter['filter_kurzbz']).',
|
||||||
|
null,
|
||||||
|
'.$db->db_add_param($filter['description']).',
|
||||||
|
'.$db->db_add_param($filter['sort']).',
|
||||||
|
'.$db->db_add_param($filter['default_filter']).',
|
||||||
|
'.$db->db_add_param($filter['filter']).',
|
||||||
|
'.$db->db_add_param($filter['oe_kurzbz']).'
|
||||||
|
)';
|
||||||
|
|
||||||
|
if (!@$db->db_query($insertFilterQuery)) // checks query execution
|
||||||
|
{
|
||||||
|
echo '<strong>An error occurred while inserting filters: '.$db->db_last_error().'</strong><br>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo 'Filter added: '.$filter['app'].' - '.$filter['dataset_name'].' - '.$filter['filter_kurzbz'].'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // otherwise if the filter is already present in the DB: update
|
||||||
|
{
|
||||||
|
if ($filterDb = $db->db_fetch_object($dbFilterDefinition))
|
||||||
|
{
|
||||||
|
$updateFilterQuery = 'UPDATE system.tbl_filters SET
|
||||||
|
app = '.$db->db_add_param($filter['app']).',
|
||||||
|
dataset_name = '.$db->db_add_param($filter['dataset_name']).',
|
||||||
|
filter_kurzbz = '.$db->db_add_param($filter['filter_kurzbz']).',
|
||||||
|
person_id = null,
|
||||||
|
description = '.$db->db_add_param($filter['description']).',
|
||||||
|
sort = '.$db->db_add_param($filter['sort']).',
|
||||||
|
default_filter = '.$db->db_add_param($filter['default_filter']).',
|
||||||
|
filter = '.$db->db_add_param($filter['filter']).',
|
||||||
|
oe_kurzbz = '.$db->db_add_param($filter['oe_kurzbz']).'
|
||||||
|
WHERE filter_id = '.$db->db_add_param($filterDb->filter_id);
|
||||||
|
|
||||||
|
if (!@$db->db_query($updateFilterQuery)) // checks query execution
|
||||||
|
{
|
||||||
|
echo '<strong>An error occurred while inserting filters: '.$db->db_last_error().'</strong><br>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo 'Filter updated: '.$filter['app'].' - '.$filter['dataset_name'].' - '.$filter['filter_kurzbz'].'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // otherwise if errors occurred
|
||||||
|
{
|
||||||
|
echo '<strong>An error occurred while inserting filters: '.$db->db_last_error().'</strong><br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user