Commit 66148963 authored by Gerd Schachtschneider's avatar Gerd Schachtschneider
Browse files

update sort, kennzeichen

parent 4e68f967
......@@ -35,7 +35,7 @@ driver = "mysqli"
[_own]
dn = "mpi-magdeburg.mpg.de"
notify = 30
version = 1.0.05
version = 1.0.06
mailto = "db-responsable@<domain>.mpg.de"
mailname = "db-admin"
......
......@@ -37,16 +37,33 @@ class conf_ApplicationDelegate {
function beforeHandleRequest() {
$app = Dataface_Application::getInstance();
$query =& $app->getQuery();
// Sortierung aendern Common
if ( !$_POST AND $query['-table'] == 'list_reiter' AND !@$query['-sort'] ) $query['-sort'] = 'reiter';
if ( !$_POST AND $query['-table'] == 'mpi_ablage' AND !@$query['-sort'] ) $query['-sort'] = 'zeitstempel DESC';
if ( !$_POST and $query['-table'] == 'mpi_users' AND !@$query['-sort'] ) $query['-sort'] = 'zeitstempel DESC';
// Sortierung aendern individuell
if ( !$_POST AND $query['-table'] == 'list_gefahr' AND !@$query['-sort'] ) $query['-sort'] = 'hsatz';
if ( !$_POST AND $query['-table'] == 'list_lgk' AND !@$query['-sort'] ) $query['-sort'] = 'priority';
if ( !$_POST AND $query['-table'] == 'view_gefahr' AND !@$query['-sort'] ) $query['-sort'] = 'kategorie, substanz';
if ( !$_POST AND $query['-table'] == 'view_chemAll' AND !@$query['-sort'] ) $query['-sort'] = 'substanz, gruppe';
if ( !$_POST AND $query['-table'] == 'view_ablageAll' AND !@$query['-sort'] ) $query['-sort'] = 'zeitstempel DESC';
$table = $query['-table'];
// wenn relationship dann kein sort fuer table notwendig, @ verhindert error message in log
if ( !@$query['-relationship'] ) {
if ( !$_POST AND !@$query['-sort'] ) {
// Sortierung aendern Common
if ( $table == 'list_reiter' ) $query['-sort'] = 'reiter';
if ( $table == 'mpi_ablage' ) $query['-sort'] = 'zeitstempel DESC';
if ( $table == 'mpi_users' ) $query['-sort'] = 'zeitstempel DESC';
// Sortierung aendern individuell
if ( $table == 'list_gefahr' ) $query['-sort'] = 'hsatz';
if ( $table == 'list_lgk' ) $query['-sort'] = 'priority';
if ( $table == 'view_gefahr' ) $query['-sort'] = 'kategorie, substanz';
if ( $table == 'view_chemAll' ) $query['-sort'] = 'substanz, gruppe';
if ( $table == 'view_ablageAll' ) $query['-sort'] = 'zeitstempel DESC';
}
/*
} else {
// Sortierung relationship's - wird aber leider in section nicht beachtet, besser ueber __sql__ in relationship,
// aber dann evtl. wieder zeitprobleme (z.B. dateiablage)
if ( !$_POST AND @$query['-relationship'] AND !@$query['-related:sort'] ) {
$relation = $query['-relationship'];
//if ( $relation == 'mengenfluss' ) $query['-related:sort'] = 'zeitstempel DESC';
//if ( $relation == 'wartung' ) $query['-related:sort'] = 'naechste';
//if ( $relation == 'notiz' ) $query['-related:sort'] = 'zeitstempel DESC';
}
*/
}
}
}
......
......@@ -2,25 +2,24 @@
// Cronjob Skript fuer Aktionen ausserhalb der DB
// z.B. Mailbenachrichtigung, Loeschen verwaister Ablagen etc.
// Beispiele folgend
// schachi 2016-06-09
// schachi 2016-06-28
// stelle sicher das dieses Skript in einem Subdir liegt, normalerweise im Ordner cronjobs, sonst gibt es kausale Problem :-(
chdir(__DIR__);
chdir('../');
//print_r (realpath(__DIR__).' '.getcwd()."\n");
if (!is_readable('conf.ini') ) die ('Error loading config file from here '.getcwd()."\n");
if (!is_readable('conf.ini') ) trigger_error ('Error loading config file from here '.getcwd()."\n");
$conf = array();
$conf = parse_ini_file('conf.ini', true);
//print_r ($conf);
if ( !isset( $conf['_database'] ) ) die ('Error loading config file. No database specified.');
if ( !isset( $conf['_database'] ) ) trigger_error ('Error loading config file. No database specified.');
$dbinfo =& $conf['_database'];
if ( !is_array( $dbinfo ) || !isset($dbinfo['host']) || !isset( $dbinfo['user'] ) || !isset( $dbinfo['password'] ) || !isset( $dbinfo['name'] ) ) {
die ('Error loading config file. The database information was not entered correctly.');
trigger_error ('Error loading config file. The database information was not entered correctly.');
}
$db = mysqli_connect($dbinfo['host'], $dbinfo['user'], $dbinfo['password'], $dbinfo['name'] );
if ( !$db ) die ('Failed to connect to MySQL database: '.mysqli_connect_error()."\n");
if ( !$db ) trigger_error ('Failed to connect to MySQL database: '.mysqli_connect_error($db)."\n");
$debug = 0; // 1 = ausgabe und keine Mail an User
$mailto = 0; // 0 = keine Mail an Debugger
......@@ -40,14 +39,14 @@
// loesche alle <table>__history, welche nicht erwuenscht sind
// Xataface hat nur einen globalen Schalter ON/OFF fuer history, aber wer braucht denn alle histories?
$sql = "SELECT reiter FROM view_reiter WHERE reiter IN (SELECT CONCAT(lst.reiter, '__history') AS table_his FROM list_reiter AS lst LEFT JOIN view_reiter AS vReit ON lst.reiter = vReit.reiter WHERE lst.history = '0' AND vReit.table_type = 'BASE TABLE' AND lst.reiter NOT LIKE '%__history') AND table_type = 'BASE TABLE';";
$result = mysqli_query($db, $sql) OR die ('Query failed: '.mysqli_connect_error()."\n");
$result = mysqli_query($db, $sql) OR trigger_error ('Query failed: '.mysqli_error($db)."\n");
$count = mysqli_num_rows($result);
if ( $count >= 1 ) {
while($row = mysqli_fetch_assoc($result)) {
$table = $row['reiter'];
$sql = "DROP TABLE IF EXISTS $table;";
if ($debug) echo "$sql\n";
mysqli_query($db, $sql) OR die ('Query failed: '.mysqli_connect_error()."\n");
mysqli_query($db, $sql) OR trigger_error ('Query failed: '.mysqli_error($db)."\n");
}
}
......
......@@ -163,6 +163,20 @@ END IF;
END IF;
-- CHANGES V1.0.06 - 2016-06-27
-- ****************************
-- fs::conf - Sortierung in ApplicationDelegate.php
-- db::list_gefahr - add field kennzeichen
IF ( SELECT MAX(version) FROM dataface__version ) < '1006' THEN
-- db::list_gefahr - add field kennzeichen
ALTER TABLE list_gefahr ADD kennzeichen VARCHAR(50) NULL AFTER lgk ;
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1006');
END IF;
END;
$$
......
......@@ -40,3 +40,10 @@ widget:label = "Lagerklasse"
widget:type = "select"
vocabulary= "lagerklasse"
filter = 1
[kennzeichen]
widget:label = "Kennzeichen"
widget:type = yui_autocomplete
widget:atts:size = 50
vocabulary = kennzeichen
......@@ -66,6 +66,9 @@ __sql__ = "SELECT ablageID, filename FROM view_ablageAll"
[lagerklasse]
__sql__ = "SELECT lgk,CONCAT(lgk,' : ',beschreibung) from list_lgk"
[kennzeichen]
__sql__ = "SELECT IFNULL(kennzeichen, '--') FROM list_gefahr GROUP BY kennzeichen ORDER BY kennzeichen"
; ENDE
......
__sql__ = "SELECT vGef.*, lGef.cmr, lGef.anweisung, lGef.lgk FROM view_gefahr AS vGef LEFT JOIN list_gefahr AS lGef ON lGef.kategorie = vGef.kategorie"
__sql__ = "SELECT vGef.*, lGef.cmr, lGef.anweisung, lGef.lgk, lGef.kennzeichen FROM view_gefahr AS vGef LEFT JOIN list_gefahr AS lGef ON lGef.kategorie = vGef.kategorie"
; ORDER BY kategorie, substanz
[__global__]
......@@ -41,12 +41,17 @@ widget:label = "BA"
filter = 1
order = 60
[kennzeichen]
widget:type = static
widget:label = "Kennzeichen"
order = 70
[gruppe]
filter = 1
order = 70
order = 80
[bearbeiter]
order = 80
order = 90
[zeitstempel]
order = 90
order = 100
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment