4 |
andreas |
1 |
<?
|
|
|
2 |
require_once('version.inc');
|
|
|
3 |
require_once('dbaccess.inc');
|
|
|
4 |
require_once('language.inc');
|
|
|
5 |
require_once('header.inc');
|
|
|
6 |
require_once('crypt.inc');
|
|
|
7 |
require_once('settings.inc');
|
|
|
8 |
require_once('helper.inc');
|
|
|
9 |
|
|
|
10 |
if (isset($_REQUEST['mi'])) { $knopf = 30; $headline = 5; }
|
|
|
11 |
/*
|
|
|
12 |
0: Verwalter
|
|
|
13 |
1: Administrator
|
|
|
14 |
2: Projektleiter
|
|
|
15 |
3: Mitarbeiter
|
|
|
16 |
4: Kontroller
|
|
|
17 |
5: Kein Zugang!
|
|
|
18 |
6: Ressourcenmanager
|
|
|
19 |
7: Revisor
|
|
|
20 |
*/
|
|
|
21 |
$drm = array(true, false, true, true, false, true, false, true);
|
|
|
22 |
|
|
|
23 |
require_once('menu.inc');
|
|
|
24 |
|
|
|
25 |
function EditMitarbeiter() {
|
|
|
26 |
global $menu;
|
|
|
27 |
global $headline;
|
|
|
28 |
global $rstufe;
|
|
|
29 |
global $unum;
|
|
|
30 |
|
|
|
31 |
# Zunaechst pruefen wir, ob der Anwender ueberhaupt dazu berechtigt
|
|
|
32 |
# ist.
|
|
|
33 |
if ($rstufe != 1 && $rstufe != 4 && $rstufe != 6) {
|
|
|
34 |
Error(GetMessage(-1, 50, "Berechtigungsfehler!"));
|
|
|
35 |
return;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
$nav = "menu=$menu&headline=$headline";
|
|
|
39 |
echo "<form name=\"edit_mi\" action=\"edit_mi.php\" method=\"post\">\n";
|
|
|
40 |
echo "<input type=\"hidden\" name=\"headline\" value=\"$headline\">\n";
|
|
|
41 |
echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
|
|
|
42 |
echo "<input type=\"hidden\" name=\"minew\" value=\"minew\">\n";
|
|
|
43 |
|
|
|
44 |
if ($rstufe != 4) {
|
|
|
45 |
echo "<table class=\"indent\"><tr><td>";
|
|
|
46 |
Button("Neuer Mitarbeiter", "edit_mi");
|
|
|
47 |
echo "</td></tr></table>\n";
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
$db = OpenDB();
|
|
|
51 |
$query = "select count(*) from mitarbeiter";
|
|
|
52 |
$result = QueryDB($db, $query);
|
|
|
53 |
$data = fetchDB($result, 0);
|
|
|
54 |
|
|
|
55 |
if ($data[0] > 0) {
|
|
|
56 |
echo "<table class=\"sel\">\n";
|
|
|
57 |
echo "<tr><th class=\"sel\">Aktion</th><th class=\"sel\">Name</th>";
|
|
|
58 |
echo "<th class=\"sel\">Land</th><th class=\"sel\">Rolle</th></tr>\n";
|
|
|
59 |
|
|
|
60 |
$query = "select mi_num, mi_vname, mi_nname, mi_land, mi_rstufe ";
|
|
|
61 |
$query .= "from mitarbeiter order by mi_nname, mi_vname";
|
|
|
62 |
$result = QueryDB($db, $query);
|
|
|
63 |
$numrows = numrowsDB($result);
|
|
|
64 |
$row = 0;
|
|
|
65 |
|
|
|
66 |
while ($row < $numrows) {
|
|
|
67 |
$data = fetchDB($result, $row);
|
|
|
68 |
$mi_num = $data[0];
|
|
|
69 |
$mi_vname = $data[1];
|
|
|
70 |
$mi_nname = $data[2];
|
|
|
71 |
$mi_land = $data[3];
|
|
|
72 |
$mi_rstufe = $data[4];
|
|
|
73 |
|
|
|
74 |
$query = "select kl_land from key_land where kl_num = $mi_land";
|
|
|
75 |
$result2 = QueryDB($db, $query);
|
|
|
76 |
$data = fetchDB($result2, 0);
|
|
|
77 |
$land = $data[0];
|
|
|
78 |
|
|
|
79 |
$query = "select count(*) from allocation where al_ressource = $mi_num";
|
|
|
80 |
|
|
|
81 |
if (!($result2 = QueryDB($db, $query))) {
|
|
|
82 |
closeDB($db);
|
|
|
83 |
return;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
$data = fetchDB($result2, 0);
|
|
|
87 |
$anz = $data[0];
|
|
|
88 |
|
|
|
89 |
$query = "select count(*) from wdone where wd_minum = $mi_num";
|
|
|
90 |
|
|
|
91 |
if (!($result2 = QueryDB($db, $query))) {
|
|
|
92 |
closeDB($db);
|
|
|
93 |
return;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
$data = fetchDB($result2, 0);
|
|
|
97 |
$anz += $data[0];
|
|
|
98 |
|
|
|
99 |
$query = "select count(*) from project where pr_pl = $mi_num or pr_plav = $mi_num";
|
|
|
100 |
|
|
|
101 |
if (!($result2 = QueryDB($db, $query))) {
|
|
|
102 |
closeDB($db);
|
|
|
103 |
return;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
$data = fetchDB($result2, 0);
|
|
|
107 |
$anz += $data[0];
|
|
|
108 |
echo "<tr><td class=\"sel\"><a href=\"#\" onClick=\"javascript:MoveTo('edit_mi.php','miedit=$mi_num&$nav')\"><img src=\"image/edit.png\" border=0 alt=\"Edit\"></a>";
|
|
|
109 |
|
|
|
110 |
if ($rstufe != 4 && $anz <= 0)
|
|
|
111 |
echo "<a href=\"#\" onClick=\"javascript:MoveTo('edit_mi.php','midel=$mi_num&$nav')\"><img src=\"image/editdelete.png\" border=0 alt=\"Loeschen\"></a>";
|
|
|
112 |
|
|
|
113 |
echo "</td>\n";
|
|
|
114 |
echo "<td class=\"sel\">$mi_nname $mi_vname</td><td class=\"sel\">$land</td>";
|
|
|
115 |
echo "<td class=\"sel\">";
|
|
|
116 |
|
|
|
117 |
switch ($mi_rstufe) {
|
|
|
118 |
case 0: echo "Verwalter"; break;
|
|
|
119 |
case 1: echo "Administrator"; break;
|
|
|
120 |
case 2: echo "Projektleiter"; break;
|
|
|
121 |
case 3: echo "Mitarbeiter"; break;
|
|
|
122 |
case 4: echo "Kontroller"; break;
|
|
|
123 |
case 5: echo "Kein Zugang!"; break;
|
|
|
124 |
case 6: echo "Ressourcenmanager"; break;
|
|
|
125 |
case 7: echo "Revisor"; break;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
echo "</td></tr>\n";
|
|
|
129 |
$row++;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
echo "</table>\n";
|
|
|
133 |
|
|
|
134 |
if ($rstufe != 4) {
|
|
|
135 |
echo "<table class=\"indent\"><tr><td>";
|
|
|
136 |
Button("Neuer Mitarbeiter", "edit_mi");
|
|
|
137 |
echo "</td></tr></table>\n";
|
|
|
138 |
}
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
echo "</form>\n";
|
|
|
142 |
closeDB($db);
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
function Tagsatz($db, $mi_num=0) {
|
|
|
146 |
global $menu;
|
|
|
147 |
global $headline;
|
|
|
148 |
global $verrmodul;
|
|
|
149 |
global $stdwhg;
|
|
|
150 |
global $dtformatshort;
|
|
|
151 |
global $VisualDate;
|
|
|
152 |
|
|
|
153 |
if (!$verrmodul)
|
|
|
154 |
return true;
|
|
|
155 |
|
|
|
156 |
if (!isset($mi_num) || $mi_num <= 0) {
|
|
|
157 |
$update = false;
|
|
|
158 |
$ini_array = parse_ini_file("setup/ration.dat");
|
|
|
159 |
$tg_valid_from = date($dtformatshort);
|
|
|
160 |
$tg_amount = $ini_array['amount'];
|
|
|
161 |
$tg_nightr = $ini_array['nightr'];
|
|
|
162 |
$tg_ration = $ini_array['ration'];
|
|
|
163 |
$tg_kmcar = $ini_array['kmcar'];
|
|
|
164 |
$tg_kmdrain = $ini_array['kmdrain'];
|
|
|
165 |
$tg_kmplain = $ini_array['kmplain'];
|
|
|
166 |
$tg_whg = $stdwhg;
|
|
|
167 |
} else {
|
|
|
168 |
$update = true;
|
|
|
169 |
$dtdb = GetDBDateFormat();
|
|
|
170 |
$query = "select tg_num, tg_amount, tg_nightr, tg_ration, ";
|
|
|
171 |
$query .= "tg_kmcar, tg_kmdrain, tg_kmplain, tg_whg, to_char(tg_valid_from, '$dtdb') ";
|
|
|
172 |
$query .= "from tagsatz where tg_minum = $mi_num and ";
|
|
|
173 |
$query .= "tg_valid_to is NULL";
|
|
|
174 |
|
|
|
175 |
if (!($result = QueryDB($db, $query)))
|
|
|
176 |
return false;
|
|
|
177 |
|
|
|
178 |
if (numrowsDB($result) > 0) {
|
|
|
179 |
$data = fetchDB($result, 0);
|
|
|
180 |
$tg_num = $data[0];
|
|
|
181 |
$tg_amount = $data[1];
|
|
|
182 |
$tg_nightr = $data[2];
|
|
|
183 |
$tg_ration = $data[3];
|
|
|
184 |
$tg_kmcar = $data[4];
|
|
|
185 |
$tg_kmdrain = $data[5];
|
|
|
186 |
$tg_kmplain = $data[6];
|
|
|
187 |
$tg_whg = $data[7];
|
|
|
188 |
$tg_valid_from = $data[8];
|
|
|
189 |
echo "<input type=\"hidden\" name=\"tg_num\" value=\"$tg_num\">\n";
|
|
|
190 |
} else {
|
|
|
191 |
$ini_array = parse_ini_file("setup/ration.dat");
|
|
|
192 |
$tg_valid_from = $ini_array['valid_from'];
|
|
|
193 |
|
|
|
194 |
if (isset($tg_valid_from) && strlen($tg_valid_from) == 10) {
|
|
|
195 |
$darr = explode("-", $tg_valid_from);
|
|
|
196 |
$dt = mktime(0, 0, 0, $darr[1], $darr[2], $darr[0]);
|
|
|
197 |
$tg_valid_from = date($dtformatshort, $dt);
|
|
|
198 |
} else
|
|
|
199 |
$tg_valid_from = date($dtformatshort);
|
|
|
200 |
|
|
|
201 |
$tg_amount = $ini_array['amount'];
|
|
|
202 |
$tg_nightr = $ini_array['nightr'];
|
|
|
203 |
$tg_ration = $ini_array['ration'];
|
|
|
204 |
$tg_kmcar = $ini_array['kmcar'];
|
|
|
205 |
$tg_kmdrain = $ini_array['kmdrain'];
|
|
|
206 |
$tg_kmplain = $ini_array['kmplain'];
|
|
|
207 |
$tg_whg = $stdwhg;
|
|
|
208 |
}
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
$query = "select wh_whg from key_whg where wh_num = $tg_whg";
|
|
|
212 |
|
|
|
213 |
if (!($result = QueryDB($db, $query)))
|
|
|
214 |
return false;
|
|
|
215 |
|
|
|
216 |
$data = fetchDB($result, 0);
|
|
|
217 |
$wh_whg = $data[0];
|
|
|
218 |
?>
|
|
|
219 |
<tr>
|
|
|
220 |
<th class="sel" colspan=2>Verrechnung</th>
|
|
|
221 |
</tr>
|
|
|
222 |
<tr>
|
|
|
223 |
<td>Beträge gültig ab (<? echo "$VisualDate"; ?>):</td>
|
|
|
224 |
<td><input type="text" class="inputmust" name="tg_valid_from" value="<? echo "$tg_valid_from"; ?>" size=10 maxlength=10 onChange="javascript:CheckDate(this, false)"></td>
|
|
|
225 |
</tr>
|
|
|
226 |
<tr>
|
|
|
227 |
<td>Tagsatz:</td>
|
|
|
228 |
<td><input type="text" class="inputmust" name="tg_amount" value="<? echo FormatNum($tg_amount, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
229 |
</tr>
|
|
|
230 |
<tr>
|
|
|
231 |
<td>Nächtigungspauschale:</td>
|
|
|
232 |
<td><input type="text" name="tg_nightr" value="<? echo FormatNum($tg_nightr, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
233 |
</tr>
|
|
|
234 |
<tr>
|
|
|
235 |
<td>Tagesdiäten:</td>
|
|
|
236 |
<td><input type="text" name="tg_ration" value="<? echo FormatNum($tg_ration, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
237 |
</tr>
|
|
|
238 |
<tr>
|
|
|
239 |
<td>Kilometerpauschale PKW:</td>
|
|
|
240 |
<td><input type="text" name="tg_kmcar" value="<? echo FormatNum($tg_kmcar, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
241 |
</tr>
|
|
|
242 |
<tr>
|
|
|
243 |
<td>Kilometerpauschale Zug:</td>
|
|
|
244 |
<td><input type="text" name="tg_kmdrain" value="<? echo FormatNum($tg_kmdrain, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
245 |
</tr>
|
|
|
246 |
<tr>
|
|
|
247 |
<td>Kilometerpauschale Flugzeug:</td>
|
|
|
248 |
<td><input type="text" name="tg_kmplain" value="<? echo FormatNum($tg_kmplain, 2); ?>" size=16 maxlength=16><? echo "$wh_whg"; ?></td>
|
|
|
249 |
</tr>
|
|
|
250 |
<tr>
|
|
|
251 |
<td>Währung:</td>
|
|
|
252 |
<td><select name="tg_whg">
|
|
|
253 |
<?
|
|
|
254 |
$query = "select wh_num, wh_whg, wh_bez from key_whg order by wh_num";
|
|
|
255 |
|
|
|
256 |
if (!($result = QueryDB($db, $query)))
|
|
|
257 |
return false;
|
|
|
258 |
|
|
|
259 |
$rows = numrowsDB($result);
|
|
|
260 |
$j = 0;
|
|
|
261 |
|
|
|
262 |
while ($j < $rows) {
|
|
|
263 |
$data = fetchDB($result, $j);
|
|
|
264 |
$wh_num = $data[0];
|
|
|
265 |
$wh_whg = $data[1];
|
|
|
266 |
$wh_bez = $data[2];
|
|
|
267 |
|
|
|
268 |
echo "<option value=\"$wh_num\"";
|
|
|
269 |
|
|
|
270 |
if ($wh_num == $tg_whg)
|
|
|
271 |
echo " selected";
|
|
|
272 |
|
|
|
273 |
echo ">$wh_whg $wh_bez</option>\n";
|
|
|
274 |
$j++;
|
|
|
275 |
}
|
|
|
276 |
?>
|
|
|
277 |
</select>
|
|
|
278 |
</td>
|
|
|
279 |
</tr>
|
|
|
280 |
<?
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
function NewMi($unum, $headline, $menu, $rstufe) {
|
|
|
284 |
$db = OpenDB();
|
|
|
285 |
?>
|
|
|
286 |
<form name="edit" action="edit_mi.php" method="post">
|
|
|
287 |
<input type="hidden" name="unum" value="<? echo "$unum"; ?>">
|
|
|
288 |
<input type="hidden" name="headline" value="6">
|
|
|
289 |
<input type="hidden" name="menu" value="<? echo "$menu"; ?>">
|
|
|
290 |
<input type="hidden" name="rstufe" value="<? echo "$rstufe"; ?>">
|
|
|
291 |
<input type="hidden" name="func" value="CheckNewMi">
|
|
|
292 |
<br>
|
|
|
293 |
<table class="indent"><tr><td>
|
|
|
294 |
<?php
|
|
|
295 |
ButtonLink(GetMessage($db, 21, "Zurück"), "forms.php", "unum=$unum&headline=$headline&menu=$menu&rstufe=$rstufe");
|
|
|
296 |
?>
|
|
|
297 |
</td></tr></table>
|
|
|
298 |
<table class="input">
|
|
|
299 |
<tr>
|
|
|
300 |
<th class="sel" colspan = 2><? Output($db, 51, "Neuen Mitarbeiter anlegen"); ?></th>
|
|
|
301 |
</tr>
|
|
|
302 |
<tr>
|
|
|
303 |
<td><? Output($db, 52, "Vorname:"); ?></td>
|
|
|
304 |
<td><input type="text" class="inputmust" name="vname" size=40 maxlength=50></td>
|
|
|
305 |
</tr>
|
|
|
306 |
<tr>
|
|
|
307 |
<td><? Output($db, 53, "Nachname:"); ?></td>
|
|
|
308 |
<td><input type="text" class="inputmust" name="nname" size=40 maxlength=50></td>
|
|
|
309 |
</tr>
|
|
|
310 |
<tr>
|
|
|
311 |
<td><? Output($db, 54, "Land:"); ?></td>
|
|
|
312 |
<td><select name="land"><?php
|
|
|
313 |
$query = "select kl_num, kl_land from key_land order by kl_land";
|
|
|
314 |
$result = QueryDB($db, $query);
|
|
|
315 |
$numrows = numrowsDB($result);
|
|
|
316 |
$row = 0;
|
|
|
317 |
|
|
|
318 |
while ($row < $numrows) {
|
|
|
319 |
$data = fetchDB($result, $row);
|
|
|
320 |
$kl_num = $data[0];
|
|
|
321 |
$kl_land = $data[1];
|
|
|
322 |
echo "<option value=\"$kl_num\">$kl_land</option>\n";
|
|
|
323 |
$row++;
|
|
|
324 |
}
|
|
|
325 |
?>
|
|
|
326 |
</select>
|
|
|
327 |
</td>
|
|
|
328 |
</tr>
|
|
|
329 |
<tr>
|
|
|
330 |
<td><? Output($db, 55, "Abteilung:"); ?></td>
|
|
|
331 |
<td><select name="abt"><?php
|
|
|
332 |
$query = "select ka_num, ka_abt from key_abt order by ka_abt";
|
|
|
333 |
$result = QueryDB($db, $query);
|
|
|
334 |
$numrows = numrowsDB($result);
|
|
|
335 |
$row = 0;
|
|
|
336 |
|
|
|
337 |
while ($row < $numrows) {
|
|
|
338 |
$data = fetchDB($result, $row);
|
|
|
339 |
$ka_num = $data[0];
|
|
|
340 |
$ka_abt = $data[1];
|
|
|
341 |
echo "<option value=\"$ka_num\">$ka_abt</option>\n";
|
|
|
342 |
$row++;
|
|
|
343 |
}
|
|
|
344 |
?>
|
|
|
345 |
</select>
|
|
|
346 |
</td>
|
|
|
347 |
</tr>
|
|
|
348 |
<tr>
|
|
|
349 |
<td><? Output($db, 56, "Telefonnummer:"); ?></td>
|
|
|
350 |
<td><input type="text" name="tel" size=30 maxlength=50></td>
|
|
|
351 |
</tr>
|
|
|
352 |
<tr>
|
|
|
353 |
<td><? Output($db, 57, "E-Mailadresse:"); ?></td>
|
|
|
354 |
<td><input type="text" name="mail" size=40 maxlength=80></td>
|
|
|
355 |
</tr>
|
|
|
356 |
<tr>
|
|
|
357 |
<td><? Output($db, 58, "Planbar:"); ?></td>
|
|
|
358 |
<td><input type="checkbox" name="planbar" value="1" checked></td>
|
|
|
359 |
</tr>
|
|
|
360 |
<tr>
|
|
|
361 |
<td><? Output($db, 59, "Sprache:"); ?></td>
|
|
|
362 |
<td><select name="mi_lang">
|
|
|
363 |
<option value="ger">Deutsch</option>
|
|
|
364 |
<option value="eng">English</option>
|
|
|
365 |
</select>
|
|
|
366 |
</td>
|
|
|
367 |
</tr>
|
|
|
368 |
<?
|
|
|
369 |
Tagsatz($db);
|
|
|
370 |
?>
|
|
|
371 |
<tr>
|
|
|
372 |
<th class="sel" colspan=2><? Output($db, 60, "Zugangsdaten"); ?></th>
|
|
|
373 |
</tr>
|
|
|
374 |
<tr>
|
|
|
375 |
<td><? Output($db, 61, "Benutzername:"); ?></td>
|
|
|
376 |
<td><input type="text" class="inputmust" name="userid" size=8 maxlength=8></td>
|
|
|
377 |
</tr>
|
|
|
378 |
<td><? Output($db, 62, "Berechtigungsstufe:"); ?></td>
|
|
|
379 |
<td><select name="mi_rstufe">
|
|
|
380 |
<option value="0"><? Output($db, 63, "Verwaltung (nur!)"); ?></option>
|
|
|
381 |
<option value="1"><? Output($db, 64, "Administrator"); ?></option>
|
|
|
382 |
<option value="2"><? Output($db, 65, "Projektleiter"); ?></option>
|
|
|
383 |
<option value="3"><? Output($db, 66, "Mitarbeiter"); ?></option>
|
|
|
384 |
<option value="4"><? Output($db, 67, "Kontroller"); ?></option>
|
|
|
385 |
<option value="5"><? Output($db, 68, "Kein Zugang"); ?></option>
|
|
|
386 |
<option value="6"><? Output($db, 69, "Ressourcenmanager"); ?></option>
|
|
|
387 |
<option value="7"><? Output($db, 70, "Revisor"); ?></option>
|
|
|
388 |
</select>
|
|
|
389 |
</td>
|
|
|
390 |
</tr>
|
|
|
391 |
<tr>
|
|
|
392 |
<td><? Output($db, 71, "Passwort:"); ?></td>
|
|
|
393 |
<td><input type="password" class="inputmust" name="pass1" size=8 maxlength=8></td>
|
|
|
394 |
</tr>
|
|
|
395 |
<tr>
|
|
|
396 |
<td><? Output($db, 72, "Passwort Vergleich:"); ?></td>
|
|
|
397 |
<td><input type="password" name="pass2" size=8 maxlength=8></td>
|
|
|
398 |
</tr>
|
|
|
399 |
</table>
|
|
|
400 |
<table class="indent"><tr><td>
|
|
|
401 |
<?
|
|
|
402 |
ButtonSubmit(GetMessage($db, 45, "Speichern"), "edit");
|
|
|
403 |
?>
|
|
|
404 |
</td></tr></table>
|
|
|
405 |
</form>
|
|
|
406 |
<?
|
|
|
407 |
closeDB($db);
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
function EditMi($minum, $unum, $headline, $menu, $rstufe) {
|
|
|
411 |
global $verrmodul;
|
|
|
412 |
global $verrmodul;
|
|
|
413 |
$db = OpenDB();
|
|
|
414 |
|
|
|
415 |
if ($minum > 0) {
|
|
|
416 |
$query = "select mi_vname, mi_nname, mi_land, mi_abt, mi_tel,";
|
|
|
417 |
$query = $query . "mi_mail, mi_rstufe, mi_userid, mi_passwd, mi_hacker, mi_plan, mi_lang ";
|
|
|
418 |
$query = $query . "from mitarbeiter where mi_num = $minum";
|
|
|
419 |
$result = QueryDB($db, $query);
|
|
|
420 |
$numrows = numrowsDB($result);
|
|
|
421 |
|
|
|
422 |
if ($numrows != 1) {
|
|
|
423 |
Error(GetMessage($db, 73, "Error: Mitarbeiter %d wurde nicht gefunden!", $minum));
|
|
|
424 |
return;
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
$data = fetchDB($result, 0);
|
|
|
428 |
$mi_vname = $data[0];
|
|
|
429 |
$mi_nname = $data[1];
|
|
|
430 |
$mi_land = $data[2];
|
|
|
431 |
$mi_abt = $data[3];
|
|
|
432 |
$mi_tel = $data[4];
|
|
|
433 |
$mi_mail = $data[5];
|
|
|
434 |
$mi_rstufe = $data[6];
|
|
|
435 |
$mi_userid = $data[7];
|
|
|
436 |
$mi_passwd = $data[8];
|
|
|
437 |
$mi_hacker = $data[9];
|
|
|
438 |
$mi_plan = $data[10];
|
|
|
439 |
$mi_lang = trim($data[11]);
|
|
|
440 |
|
|
|
441 |
if (CheckTrue($mi_plan))
|
|
|
442 |
$mi_plan = 1;
|
|
|
443 |
else
|
|
|
444 |
$mi_plan = 0;
|
|
|
445 |
} else {
|
|
|
446 |
$mi_vname = $_REQUEST['vname'];
|
|
|
447 |
$mi_nname = $_REQUEST['nname'];
|
|
|
448 |
$mi_land = $_REQUEST['land'];
|
|
|
449 |
$mi_abt = $_REQUEST['abt'];
|
|
|
450 |
$mi_tel = $_REQUEST['tel'];
|
|
|
451 |
$mi_mail = $_REQUEST['mail'];
|
|
|
452 |
$mi_rstufe = $_REQUEST['mi_rstufe'];
|
|
|
453 |
$mi_userid = $_REQUEST['userid'];
|
|
|
454 |
$mi_passwd = $_REQUEST['pass1'];
|
|
|
455 |
$mi_plan = $_REQUEST['planbar'];
|
|
|
456 |
$mi_hacker = $_REQUEST['mi_hacker'];
|
|
|
457 |
$mi_lang = $_REQUEST['mi_lang'];
|
|
|
458 |
echo "<p class=\"cry\">" . GetMessage($db, 84, "Eingabefehler!") . "</p>\n";
|
|
|
459 |
}
|
|
|
460 |
?>
|
|
|
461 |
<form name="edit" action="edit_mi.php" method="post">
|
|
|
462 |
<input type="hidden" name="unum" value="<? echo "$unum"; ?>">
|
|
|
463 |
<?php
|
|
|
464 |
if ($minum <= 0) {
|
|
|
465 |
echo "<input type=\"hidden\" name=\"headline\" value=\"6\">\n";
|
|
|
466 |
} else {
|
|
|
467 |
echo "<input type=\"hidden\" name=\"headline\" value=\"7\">\n";
|
|
|
468 |
}
|
|
|
469 |
?>
|
|
|
470 |
<input type="hidden" name="menu" value="<? echo "$menu"; ?>">
|
|
|
471 |
<input type="hidden" name="rstufe" value="<? echo "$rstufe"; ?>">
|
|
|
472 |
<input type="hidden" name="minum" value="<? echo "$minum"; ?>">
|
|
|
473 |
<?php
|
|
|
474 |
if ($minum > 0)
|
|
|
475 |
echo "<input type=\"hidden\" name=\"func\" value=\"CheckEditMi\">\n";
|
|
|
476 |
else
|
|
|
477 |
echo "<input type=\"hidden\" name=\"func\" value=\"CheckNewMi\">\n";
|
|
|
478 |
|
|
|
479 |
echo "<br><table class=\"indent\"><tr><td>\n";
|
|
|
480 |
ButtonLink(GetMessage($db, 21, "Zurück"), "forms.php", "unum=$unum&headline=$headline&menu=$menu&rstufe=$rstufe");
|
|
|
481 |
?>
|
|
|
482 |
</td></tr></table>
|
|
|
483 |
<table class="input">
|
|
|
484 |
<tr>
|
|
|
485 |
<th class="sel" colspan=2><? Output($db, 74, "Mitarbeiter editieren"); ?></th>
|
|
|
486 |
</tr>
|
|
|
487 |
<tr>
|
|
|
488 |
<td><? Output($db, 52, "Vorname:"); ?></td>
|
|
|
489 |
<td><input type="text" class="inputmust" name="vname" value="<? echo "$mi_vname"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=40 maxlength=50></td>
|
|
|
490 |
</tr>
|
|
|
491 |
<tr>
|
|
|
492 |
<td><? Output($db, 53, "Nachname:"); ?></td>
|
|
|
493 |
<td><input type="text" class="inputmust" name="nname" value="<? echo "$mi_nname"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=40 maxlength=50></td>
|
|
|
494 |
</tr>
|
|
|
495 |
<tr>
|
|
|
496 |
<td><? Output($db, 54, "Land:"); ?></td>
|
|
|
497 |
<td><select name="land" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?>><?php
|
|
|
498 |
$query = "select kl_num, kl_land from key_land order by kl_land";
|
|
|
499 |
$result = QueryDB($db, $query);
|
|
|
500 |
$numrows = numrowsDB($result);
|
|
|
501 |
$row = 0;
|
|
|
502 |
|
|
|
503 |
while ($row < $numrows) {
|
|
|
504 |
$data = fetchDB($result, $row);
|
|
|
505 |
$kl_num = $data[0];
|
|
|
506 |
$kl_land = $data[1];
|
|
|
507 |
|
|
|
508 |
if ($kl_num == $mi_land) {
|
|
|
509 |
echo "<option selected value=\"$kl_num\">$kl_land</option>\n";
|
|
|
510 |
} else {
|
|
|
511 |
echo "<option value=\"$kl_num\">$kl_land</option>\n";
|
|
|
512 |
}
|
|
|
513 |
|
|
|
514 |
$row++;
|
|
|
515 |
}
|
|
|
516 |
?>
|
|
|
517 |
</select>
|
|
|
518 |
</td>
|
|
|
519 |
</tr>
|
|
|
520 |
<tr>
|
|
|
521 |
<td><? Output($db, 55, "Abteilung:"); ?></td>
|
|
|
522 |
<td><select name="abt" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?>><?php
|
|
|
523 |
$query = "select ka_num, ka_abt from key_abt order by ka_abt";
|
|
|
524 |
$result = QueryDB($db, $query);
|
|
|
525 |
$numrows = numrowsDB($result);
|
|
|
526 |
$row = 0;
|
|
|
527 |
|
|
|
528 |
while ($row < $numrows) {
|
|
|
529 |
$data = fetchDB($result, $row);
|
|
|
530 |
$ka_num = $data[0];
|
|
|
531 |
$ka_abt = $data[1];
|
|
|
532 |
|
|
|
533 |
if ($ka_num == $mi_abt) {
|
|
|
534 |
echo "<option selected value=\"$ka_num\">$ka_abt</option>\n";
|
|
|
535 |
} else {
|
|
|
536 |
echo "<option value=\"$ka_num\">$ka_abt</option>\n";
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
$row++;
|
|
|
540 |
}
|
|
|
541 |
?>
|
|
|
542 |
</select>
|
|
|
543 |
</td>
|
|
|
544 |
</tr>
|
|
|
545 |
<tr>
|
|
|
546 |
<td><? Output($db, 56, "Telefonnummer:"); ?></td>
|
|
|
547 |
<td><input type="text" name="tel" value="<? echo "$mi_tel"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=30 maxlength=50></td>
|
|
|
548 |
</tr>
|
|
|
549 |
<tr>
|
|
|
550 |
<td><? Output($db, 57, "E-Mailadresse:"); ?></td>
|
|
|
551 |
<td><input type="text" name="mail" value="<? echo "$mi_mail"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=40 maxlength=80></td>
|
|
|
552 |
</tr>
|
|
|
553 |
<tr>
|
|
|
554 |
<td><? Output($db, 58, "Planbar:"); ?></td>
|
|
|
555 |
<td><input type="checkbox" name="planbar" <? if (isset($mi_plan) && $mi_plan) echo "checked"; if ($rstufe == 4 && !$verrmodul) echo " disabled"; ?>></td>
|
|
|
556 |
</tr>
|
|
|
557 |
<tr>
|
|
|
558 |
<td><? Output($db, 59, "Sprache:"); ?></td>
|
|
|
559 |
<td><select name="mi_lang" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?>>
|
|
|
560 |
<option <? if ($mi_lang == "ger") echo "selected"; ?> value="ger">Deutsch</option>
|
|
|
561 |
<option <? if ($mi_lang == "eng") echo "selected"; ?> value="eng">English</option>
|
|
|
562 |
</select>
|
|
|
563 |
</td>
|
|
|
564 |
</tr>
|
|
|
565 |
<?
|
|
|
566 |
Tagsatz($db, $minum);
|
|
|
567 |
?>
|
|
|
568 |
<tr>
|
|
|
569 |
<th class="sel" colspan=2><? Output($db, 60, "Zugangsdaten"); ?></th>
|
|
|
570 |
</tr>
|
|
|
571 |
<tr>
|
|
|
572 |
<td><? Output($db, 61, "Benutzername:"); ?></td>
|
|
|
573 |
<td><input type="text" class="inputmust" name="userid" value="<? echo "$mi_userid"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=8 maxlength=8></td>
|
|
|
574 |
</tr>
|
|
|
575 |
<tr>
|
|
|
576 |
<td><? Output($db, 62, "Berechtigungsstufe:"); ?></td>
|
|
|
577 |
<td><select name="mi_rstufe" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?>>
|
|
|
578 |
<option <? if ($mi_rstufe == 0) { echo "selected"; } ?> value="0"><? Output($db, 63, "Verwaltung (nur!)"); ?></option>
|
|
|
579 |
<option <? if ($mi_rstufe == 1) { echo "selected"; } ?> value="1"><? Output($db, 64, "Administrator"); ?></option>
|
|
|
580 |
<option <? if ($mi_rstufe == 2) { echo "selected"; } ?> value="2"><? Output($db, 65, "Projektleiter"); ?></option>
|
|
|
581 |
<option <? if ($mi_rstufe == 3) { echo "selected"; } ?> value="3"><? Output($db, 66, "Mitarbeiter"); ?></option>
|
|
|
582 |
<option <? if ($mi_rstufe == 4) { echo "selected"; } ?> value="4"><? Output($db, 67, "Kontroller"); ?></option>
|
|
|
583 |
<option <? if ($mi_rstufe == 5) { echo "selected"; } ?> value="5"><? Output($db, 68, "Kein Zugang"); ?></option>
|
|
|
584 |
<option <? if ($mi_rstufe == 6) { echo "selected"; } ?> value="6"><? Output($db, 69, "Ressourcenmanager"); ?></option>
|
|
|
585 |
<option <? if ($mi_rstufe == 7) { echo "selected"; } ?> value="7"><? Output($db, 70, "Revisor"); ?></option>
|
|
|
586 |
</select>
|
|
|
587 |
</td>
|
|
|
588 |
</tr>
|
|
|
589 |
<tr>
|
|
|
590 |
<td><? Output($db, 71, "Passwort:"); ?></td>
|
|
|
591 |
<td><input type="password" class="inputmust" name="pass1" value="<? echo "$mi_passwd"; ?>" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=8></td>
|
|
|
592 |
</tr>
|
|
|
593 |
<tr>
|
|
|
594 |
<td><? Output($db, 72, "Passwort Vergleich:"); ?></td>
|
|
|
595 |
<td><input type="password" name="pass2" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> size=8 maxlength=8></td>
|
|
|
596 |
</tr>
|
|
|
597 |
<?php
|
|
|
598 |
if ($mi_hacker > 0) {
|
|
|
599 |
?>
|
|
|
600 |
<tr>
|
|
|
601 |
<td><? Output($db, 75, "Hackerkennzeichen löschen?:"); ?></td>
|
|
|
602 |
<td><input type="checkbox" name="mi_hacker" <? if ($rstufe == 4 && !$verrmodul) echo "disabled"; ?> value=1></td>
|
|
|
603 |
</tr>
|
|
|
604 |
<?php
|
|
|
605 |
}
|
|
|
606 |
?>
|
|
|
607 |
</table>
|
|
|
608 |
<table class="indent"><tr><td>
|
|
|
609 |
<?
|
|
|
610 |
ButtonSubmit(GetMessage($db, 45, "Speichern"), "edit");
|
|
|
611 |
?>
|
|
|
612 |
</td></tr></table>
|
|
|
613 |
</form>
|
|
|
614 |
<?
|
|
|
615 |
closeDB($db);
|
|
|
616 |
}
|
|
|
617 |
|
|
|
618 |
function CheckNewMi($unum, $headline, $menu, $rstufe) {
|
|
|
619 |
global $verrmodul;
|
|
|
620 |
|
|
|
621 |
$mi_vname = $_REQUEST['vname'];
|
|
|
622 |
$mi_nname = $_REQUEST['nname'];
|
|
|
623 |
$mi_land = $_REQUEST['land'];
|
|
|
624 |
$mi_abt = $_REQUEST['abt'];
|
|
|
625 |
$mi_tel = $_REQUEST['tel'];
|
|
|
626 |
$mi_mail = $_REQUEST['mail'];
|
|
|
627 |
$mi_rstufe = $_REQUEST['mi_rstufe'];
|
|
|
628 |
$mi_userid = $_REQUEST['userid'];
|
|
|
629 |
$mi_plan = $_REQUEST['planbar'];
|
|
|
630 |
$mi_lang = $_REQUEST['mi_lang'];
|
|
|
631 |
$pass1 = $_REQUEST['pass1'];
|
|
|
632 |
$pass2 = $_REQUEST['pass2'];
|
|
|
633 |
|
|
|
634 |
if ($verrmodul) {
|
|
|
635 |
$tg_valid_from = $_REQUEST['tg_valid_from'];
|
|
|
636 |
$tg_amount = $_REQUEST['tg_amount'];
|
|
|
637 |
$tg_nightr = $_REQUEST['tg_nightr'];
|
|
|
638 |
$tg_ration = $_REQUEST['tg_ration'];
|
|
|
639 |
$tg_kmcar = $_REQUEST['tg_kmcar'];
|
|
|
640 |
$tg_kmdrain = $_REQUEST['tg_kmdrain'];
|
|
|
641 |
$tg_kmplain = $_REQUEST['tg_kmplain'];
|
|
|
642 |
$tg_whg = $_REQUEST['tg_whg'];
|
|
|
643 |
}
|
|
|
644 |
|
|
|
645 |
$err = 0;
|
|
|
646 |
|
|
|
647 |
if ($rstufe != 4 && !strlen($mi_vname)) {
|
|
|
648 |
Error(GetMessage(-1, 76, "Sie müssen einen Vornamen eingeben!"));
|
|
|
649 |
$err = 1;
|
|
|
650 |
}
|
|
|
651 |
|
|
|
652 |
if ($rstufe != 4 && !strlen($mi_nname)) {
|
|
|
653 |
Error(GetMessage(-1, 77, "Sie müssen einen Nachnamen eingeben!"));
|
|
|
654 |
$err = 1;
|
|
|
655 |
}
|
|
|
656 |
|
|
|
657 |
if ($rstufe != 4 && $mi_rstufe != 5 && (strlen($pass1) < 4 || $pass1 != $pass2)) {
|
|
|
658 |
Error(GetMessage(-1, 78, "Sie müssen zwei mal das gleiche Passwort eingeben und es muss mindestens 4 Zeichen lang sein!"));
|
|
|
659 |
$err = 1;
|
|
|
660 |
}
|
|
|
661 |
|
|
|
662 |
if ($verrmodul) {
|
|
|
663 |
if (!isset($tg_valid_from) || strlen($tg_valid_from) < 6 || str_wordcount($tg_valid_from, ".") != 3) {
|
|
|
664 |
Error(GetMessage(-1, 79, "Kein oder ungültiges Datum! Sie müssen ein gültiges Datum eingeben!"));
|
|
|
665 |
$err = 1;
|
|
|
666 |
}
|
|
|
667 |
|
|
|
668 |
if (!isset($tg_amount) || strlen($tg_amount) <= 0 || $tg_amount <= 0.0) {
|
|
|
669 |
Error(GetMessage(-1, 80, "Sie müssen einen Tagsatz größer 0,0 eingeben!"));
|
|
|
670 |
$err = 1;
|
|
|
671 |
}
|
|
|
672 |
|
|
|
673 |
$tg_valid_from = DateToDBDate($tg_valid_from);
|
|
|
674 |
}
|
|
|
675 |
|
|
|
676 |
$db = OpenDB();
|
|
|
677 |
|
|
|
678 |
if ($rstufe != 4) {
|
|
|
679 |
$query = "select count(*) from mitarbeiter where mi_userid = '$mi_userid'";
|
|
|
680 |
|
|
|
681 |
if (!($result = QueryDB($db, $query)))
|
|
|
682 |
return;
|
|
|
683 |
|
|
|
684 |
$data = fetchDB($result, 0);
|
|
|
685 |
$anz = $data[0];
|
|
|
686 |
|
|
|
687 |
if ($anz > 0) {
|
|
|
688 |
Error(GetMessage(-1, 81, "Der von ihnen angegebene >>Benutzername<< existiert bereits!<br> Bitte verwenden sie einen anderen, bisher noch nicht verwendeten Benutzernamen!"));
|
|
|
689 |
$err = 1;
|
|
|
690 |
}
|
|
|
691 |
}
|
|
|
692 |
|
|
|
693 |
if ($err == 1) {
|
|
|
694 |
EditMi(0, $unum, $headline, $menu, $rstufe);
|
|
|
695 |
return false;
|
|
|
696 |
}
|
|
|
697 |
|
|
|
698 |
# An dieser Stelle haben wir eine gepruefte Datenbasis, welche wir
|
|
|
699 |
# als neuen Datensatz speichern koennen.
|
|
|
700 |
$query = "select co_mitarbeiter from counter";
|
|
|
701 |
|
|
|
702 |
if (!($result = QueryDB($db, $query))) {
|
|
|
703 |
closeDB($db);
|
|
|
704 |
return false;
|
|
|
705 |
}
|
|
|
706 |
|
|
|
707 |
$data = fetchDB($result, 0);
|
|
|
708 |
$mi_num = $data[0] + 1;
|
|
|
709 |
|
|
|
710 |
if ($verrmodul) {
|
|
|
711 |
$query = "select co_tagsatz from counter";
|
|
|
712 |
|
|
|
713 |
if (!($result = QueryDB($db, $query))) {
|
|
|
714 |
closeDB($db);
|
|
|
715 |
return false;
|
|
|
716 |
}
|
|
|
717 |
|
|
|
718 |
$data = fetchDB($result, 0);
|
|
|
719 |
$tg_num = $data[0] + 1;
|
|
|
720 |
}
|
|
|
721 |
|
|
|
722 |
if ($rstufe != 4) {
|
|
|
723 |
QueryDB($db, "begin");
|
|
|
724 |
|
|
|
725 |
if ($mi_rstufe == 5)
|
|
|
726 |
$mi_passwd = "";
|
|
|
727 |
else
|
|
|
728 |
$mi_passwd = md5($pass1);
|
|
|
729 |
|
|
|
730 |
if (isset($mi_plan))
|
|
|
731 |
$mi_plan = "true";
|
|
|
732 |
else
|
|
|
733 |
$mi_plan = "false";
|
|
|
734 |
|
|
|
735 |
$query = "insert into mitarbeiter (mi_num, mi_vname, mi_nname, mi_land, ";
|
|
|
736 |
$query .= "mi_abt, mi_tel, mi_mail, mi_rstufe, mi_userid, mi_passwd, ";
|
|
|
737 |
$query .= "mi_hacker, mi_plan, mi_lang) ";
|
|
|
738 |
$query .= "values ($mi_num, '$mi_vname', '$mi_nname', $mi_land, ";
|
|
|
739 |
$query .= "$mi_abt, '$mi_tel', '$mi_mail', $mi_rstufe, '$mi_userid',";
|
|
|
740 |
$query .= "'$mi_passwd', 0, $mi_plan, '$mi_lang')";
|
|
|
741 |
|
|
|
742 |
if (!QueryDB($db, $query)) {
|
|
|
743 |
QueryDB($db, "rollback");
|
|
|
744 |
closeDB($db);
|
|
|
745 |
return false;
|
|
|
746 |
}
|
|
|
747 |
|
|
|
748 |
$query = "update counter set co_mitarbeiter = $mi_num";
|
|
|
749 |
|
|
|
750 |
if (!QueryDB($db, $query)) {
|
|
|
751 |
QueryDB($db, "rollback");
|
|
|
752 |
closeDB($db);
|
|
|
753 |
return false;
|
|
|
754 |
}
|
|
|
755 |
}
|
|
|
756 |
|
|
|
757 |
if ($verrmodul) {
|
|
|
758 |
$tg_amount = str_replace(",", ".", $tg_amount);
|
|
|
759 |
$tg_nightr = str_replace(",", ".", $tg_nightr);
|
|
|
760 |
$tg_ration = str_replace(",", ".", $tg_ration);
|
|
|
761 |
$tg_kmcar = str_replace(",", ".", $tg_kmcar);
|
|
|
762 |
$tg_kmdrain = str_replace(",", ".", $tg_kmdrain);
|
|
|
763 |
$tg_kmplain = str_replace(",", ".", $tg_kmplain);
|
|
|
764 |
|
|
|
765 |
$query = "insert into tagsatz (tg_num, tg_valid_from, tg_amount, ";
|
|
|
766 |
$query .= "tg_nightr, tg_ration, tg_kmcar, tg_kmdrain, ";
|
|
|
767 |
$query .= "tg_kmplain, tg_whg, tg_minum) values ($tg_num, ";
|
|
|
768 |
$query .= "'$tg_valid_from', $tg_amount, ";
|
|
|
769 |
$query .= "$tg_nightr, $tg_ration, $tg_kmcar, $tg_kmdrain, ";
|
|
|
770 |
$query .= "$tg_kmplain, $tg_whg, $mi_num)";
|
|
|
771 |
|
|
|
772 |
if (!QueryDB($db, $query)) {
|
|
|
773 |
QueryDB($db, "rollback");
|
|
|
774 |
closeDB($db);
|
|
|
775 |
return false;
|
|
|
776 |
}
|
|
|
777 |
|
|
|
778 |
$query = "update counter set co_tagsatz = $tg_num";
|
|
|
779 |
|
|
|
780 |
if (!QueryDB($db, $query)) {
|
|
|
781 |
QueryDB($db, "rollback");
|
|
|
782 |
closeDB($db);
|
|
|
783 |
return false;
|
|
|
784 |
}
|
|
|
785 |
}
|
|
|
786 |
|
|
|
787 |
QueryDB($db, "commit");
|
|
|
788 |
Journal(201, "Mitarbeiter: $mi_num = $mi_nname $mi_vname", $db);
|
|
|
789 |
closeDB($db);
|
|
|
790 |
return true;
|
|
|
791 |
}
|
|
|
792 |
|
|
|
793 |
function CheckEditMi($mi_num, $unum, $headline, $menu, $rstufe) {
|
|
|
794 |
global $verrmodul;
|
|
|
795 |
|
|
|
796 |
$mi_vname = $_REQUEST['vname'];
|
|
|
797 |
$mi_nname = $_REQUEST['nname'];
|
|
|
798 |
$mi_land = $_REQUEST['land'];
|
|
|
799 |
$mi_abt = $_REQUEST['abt'];
|
|
|
800 |
$mi_tel = $_REQUEST['tel'];
|
|
|
801 |
$mi_mail = $_REQUEST['mail'];
|
|
|
802 |
$mi_rstufe = $_REQUEST['mi_rstufe'];
|
|
|
803 |
$mi_userid = $_REQUEST['userid'];
|
|
|
804 |
$mi_plan = $_REQUEST['planbar'];
|
|
|
805 |
$mi_lang = $_REQUEST['mi_lang'];
|
|
|
806 |
$pass1 = $_REQUEST['pass1'];
|
|
|
807 |
$pass2 = $_REQUEST['pass2'];
|
|
|
808 |
$mi_hacker = $_REQUEST['mi_hacker'];
|
|
|
809 |
|
|
|
810 |
if ($verrmodul) {
|
|
|
811 |
$tg_num = $_REQUEST['tg_num'];
|
|
|
812 |
$tg_valid_from = $_REQUEST['tg_valid_from'];
|
|
|
813 |
$tg_amount = $_REQUEST['tg_amount'];
|
|
|
814 |
$tg_nightr = $_REQUEST['tg_nightr'];
|
|
|
815 |
$tg_ration = $_REQUEST['tg_ration'];
|
|
|
816 |
$tg_kmcar = $_REQUEST['tg_kmcar'];
|
|
|
817 |
$tg_kmdrain = $_REQUEST['tg_kmdrain'];
|
|
|
818 |
$tg_kmplain = $_REQUEST['tg_kmplain'];
|
|
|
819 |
$tg_whg = $_REQUEST['tg_whg'];
|
|
|
820 |
}
|
|
|
821 |
|
|
|
822 |
$err = 0;
|
|
|
823 |
|
|
|
824 |
if ($rstufe != 4 && !strlen($mi_vname)) {
|
|
|
825 |
Error(GetMessage(-1, 76, "Sie müssen einen Vornamen eingeben!"));
|
|
|
826 |
$err = 1;
|
|
|
827 |
}
|
|
|
828 |
|
|
|
829 |
if ($rstufe != 4 && !strlen($mi_nname)) {
|
|
|
830 |
Error(GetMessage(-1, 77, "Sie müssen einen Nachnamen eingeben!\n"));
|
|
|
831 |
$err = 1;
|
|
|
832 |
}
|
|
|
833 |
|
|
|
834 |
if ($verrmodul) {
|
|
|
835 |
if (!isset($tg_valid_from) || strlen($tg_valid_from) < 6 || str_wordcount($tg_valid_from, ".") != 3) {
|
|
|
836 |
Error(GetMessage(-1, 79, "Kein oder ungültiges Datum! Sie müssen ein gültiges Datum eingeben!"));
|
|
|
837 |
$err = 1;
|
|
|
838 |
}
|
|
|
839 |
|
|
|
840 |
if (!isset($tg_amount) || strlen($tg_amount) <= 0 || $tg_amount <= 0.0) {
|
|
|
841 |
Error(GetMessage(-1, 80, "Sie müssen einen Tagsatz größer 0,0 eingeben!"));
|
|
|
842 |
$err = 1;
|
|
|
843 |
}
|
|
|
844 |
|
|
|
845 |
$tg_valid_from = DateToDBDate($tg_valid_from);
|
|
|
846 |
}
|
|
|
847 |
|
|
|
848 |
if ($rstufe != 4 && $mi_rstufe != 5 && strlen($pass1) == 32 && !strlen($pass2)) {
|
|
|
849 |
$pass2 = $pass1;
|
|
|
850 |
}
|
|
|
851 |
|
|
|
852 |
if ($rstufe != 4 && $mi_rstufe != 5) {
|
|
|
853 |
if (strlen($pass1) > 8 && strlen($pass1) != 32) {
|
|
|
854 |
Error(GetMessage(-1, 82, "Ungültiges Passwort!"));
|
|
|
855 |
$err = 1;
|
|
|
856 |
} else if (strlen($pass1) < 4 || $pass1 != $pass2) {
|
|
|
857 |
Error(GetMessage(-1, 78, "Sie müssen zwei mal das gleiche Passwort eingeben und es muss mindestens 4 Zeichen lang sein!\n"));
|
|
|
858 |
$err = 1;
|
|
|
859 |
}
|
|
|
860 |
}
|
|
|
861 |
|
|
|
862 |
if ($err == 1) {
|
|
|
863 |
EditMi($mi_num, $unum, $headline, $menu, $rstufe);
|
|
|
864 |
return false;
|
|
|
865 |
}
|
|
|
866 |
|
|
|
867 |
# An dieser Stelle haben wir eine gepruefte Datenbasis, welche wir
|
|
|
868 |
# als neuen Datensatz speichern koennen.
|
|
|
869 |
if ($rstufe != 4 && $mi_rstufe != 5) {
|
|
|
870 |
if (strlen($pass1) <= 8) {
|
|
|
871 |
$mi_passwd = md5($pass1);
|
|
|
872 |
} else {
|
|
|
873 |
$mi_passwd = $pass1;
|
|
|
874 |
}
|
|
|
875 |
} else {
|
|
|
876 |
$mi_passwd = "";
|
|
|
877 |
}
|
|
|
878 |
|
|
|
879 |
if (isset($mi_plan))
|
|
|
880 |
$mi_plan = "true";
|
|
|
881 |
else
|
|
|
882 |
$mi_plan = "false";
|
|
|
883 |
|
|
|
884 |
$db = OpenDB();
|
|
|
885 |
|
|
|
886 |
if ($verrmodul) {
|
|
|
887 |
if (isset($tg_num) && $tg_num > 0) {
|
|
|
888 |
$query = "select count(*) from tagsatz where ";
|
|
|
889 |
$query .= "tg_valid_from > '$tg_valid_from' and ";
|
|
|
890 |
$query .= "tg_minum = $mi_num";
|
|
|
891 |
|
|
|
892 |
if (!($result = QueryDB($db, $query))) {
|
|
|
893 |
closeDB($db);
|
|
|
894 |
return false;
|
|
|
895 |
}
|
|
|
896 |
|
|
|
897 |
$data = fetchDB($result, 0);
|
|
|
898 |
|
|
|
899 |
if ($data[0] > 0) {
|
|
|
900 |
Error(GetMessage($db, 83, "Das \"gültig ab\"−Datum ist kleiner als das zuletzt gespeicherte!"));
|
|
|
901 |
EditMi($mi_num, $unum, $headline, $menu, $rstufe);
|
|
|
902 |
return false;
|
|
|
903 |
}
|
|
|
904 |
|
|
|
905 |
$query = "select to_char(tg_valid_from, 'YYYY-MM-DD') from tagsatz where tg_num = $tg_num";
|
|
|
906 |
|
|
|
907 |
if (!($result = QueryDB($db, $query))) {
|
|
|
908 |
closeDB($db);
|
|
|
909 |
return false;
|
|
|
910 |
}
|
|
|
911 |
|
|
|
912 |
$data = fetchDB($result, 0);
|
|
|
913 |
|
|
|
914 |
if ($tg_valid_from == $data[0])
|
|
|
915 |
$update = true;
|
|
|
916 |
else
|
|
|
917 |
$update = false;
|
|
|
918 |
} else
|
|
|
919 |
$update = false;
|
|
|
920 |
|
|
|
921 |
if (!$update) {
|
|
|
922 |
$query = "select co_tagsatz from counter";
|
|
|
923 |
|
|
|
924 |
if (!($result = QueryDB($db, $query))) {
|
|
|
925 |
closeDB($db);
|
|
|
926 |
return false;
|
|
|
927 |
}
|
|
|
928 |
|
|
|
929 |
$data = fetchDB($result, 0);
|
|
|
930 |
$co_tagsatz = $data[0] + 1;
|
|
|
931 |
}
|
|
|
932 |
}
|
|
|
933 |
|
|
|
934 |
if (!QueryDB($db, "begin")) {
|
|
|
935 |
closeDB($db);
|
|
|
936 |
return false;
|
|
|
937 |
}
|
|
|
938 |
|
|
|
939 |
if ($rstufe != 4) {
|
|
|
940 |
$query = "update mitarbeiter set ";
|
|
|
941 |
$query .= "mi_vname = '$mi_vname', mi_nname = '$mi_nname', mi_land = $mi_land, ";
|
|
|
942 |
$query .= "mi_abt = $mi_abt, mi_tel = '$mi_tel', mi_mail = '$mi_mail', ";
|
|
|
943 |
$query .= "mi_rstufe = $mi_rstufe, mi_userid = '$mi_userid', mi_passwd = '$mi_passwd', ";
|
|
|
944 |
$query .= "mi_plan = $mi_plan, mi_lang = '$mi_lang' ";
|
|
|
945 |
|
|
|
946 |
if (isset($mi_hacker)) {
|
|
|
947 |
$query .= ", mi_hacker = 0 ";
|
|
|
948 |
}
|
|
|
949 |
|
|
|
950 |
$query = $query . "where mi_num = $mi_num";
|
|
|
951 |
|
|
|
952 |
if (!QueryDB($db, $query)) {
|
|
|
953 |
closeDB($db);
|
|
|
954 |
return false;
|
|
|
955 |
}
|
|
|
956 |
}
|
|
|
957 |
|
|
|
958 |
if ($verrmodul) {
|
|
|
959 |
$tg_amount = str_replace(",", ".", $tg_amount);
|
|
|
960 |
$tg_nightr = str_replace(",", ".", $tg_nightr);
|
|
|
961 |
$tg_ration = str_replace(",", ".", $tg_ration);
|
|
|
962 |
$tg_kmcar = str_replace(",", ".", $tg_kmcar);
|
|
|
963 |
$tg_kmdrain = str_replace(",", ".", $tg_kmdrain);
|
|
|
964 |
$tg_kmplain = str_replace(",", ".", $tg_kmplain);
|
|
|
965 |
|
|
|
966 |
if ($update) {
|
|
|
967 |
$query = "update tagsatz set tg_amount = $tg_amount, ";
|
|
|
968 |
$query .= "tg_nightr = $tg_nightr, tg_ration = $tg_ration, ";
|
|
|
969 |
$query .= "tg_kmcar = $tg_kmcar, tg_kmdrain = $tg_kmdrain, ";
|
|
|
970 |
$query .= "tg_kmplain = $tg_kmplain, tg_whg = $tg_whg where ";
|
|
|
971 |
$query .= "tg_num = $tg_num";
|
|
|
972 |
|
|
|
973 |
if (!QueryDB($db, $query)) {
|
|
|
974 |
closeDB($db);
|
|
|
975 |
return false;
|
|
|
976 |
}
|
|
|
977 |
} else {
|
|
|
978 |
$query = "insert into tagsatz (tg_num, tg_valid_from, tg_amount, ";
|
|
|
979 |
$query .= "tg_nightr, tg_ration, tg_kmcar, tg_kmdrain, ";
|
|
|
980 |
$query .= "tg_kmplain, tg_whg, tg_minum) values ($co_tagsatz, ";
|
|
|
981 |
$query .= "'$tg_valid_from', $tg_amount, ";
|
|
|
982 |
$query .= "$tg_nightr, $tg_ration, $tg_kmcar, $tg_kmdrain, ";
|
|
|
983 |
$query .= "$tg_kmplain, $tg_whg, $mi_num)";
|
|
|
984 |
|
|
|
985 |
if (!QueryDB($db, $query)) {
|
|
|
986 |
QueryDB($db, "rollback");
|
|
|
987 |
closeDB($db);
|
|
|
988 |
return false;
|
|
|
989 |
}
|
|
|
990 |
|
|
|
991 |
if (isset($tg_num) && $tg_num > 0) {
|
|
|
992 |
$query = "update tagsatz set tg_valid_to = '$tg_valid_from' where tg_num = $tg_num";
|
|
|
993 |
|
|
|
994 |
if (!QueryDB($db, $query)) {
|
|
|
995 |
QueryDB($db, "rollback");
|
|
|
996 |
closeDB($db);
|
|
|
997 |
return false;
|
|
|
998 |
}
|
|
|
999 |
}
|
|
|
1000 |
|
|
|
1001 |
$query = "update counter set co_tagsatz = $co_tagsatz";
|
|
|
1002 |
|
|
|
1003 |
if (!QueryDB($db, $query)) {
|
|
|
1004 |
QueryDB($db, "rollback");
|
|
|
1005 |
closeDB($db);
|
|
|
1006 |
return false;
|
|
|
1007 |
}
|
|
|
1008 |
}
|
|
|
1009 |
}
|
|
|
1010 |
|
|
|
1011 |
QueryDB($db, "commit");
|
|
|
1012 |
Journal(303, "Mitarbeiter: $mi_num = $mi_nname $mi_vname", $db);
|
|
|
1013 |
closeDB($db);
|
|
|
1014 |
return true;
|
|
|
1015 |
}
|
|
|
1016 |
|
|
|
1017 |
function DelMi($minum) {
|
|
|
1018 |
global $menu;
|
|
|
1019 |
global $headline;
|
|
|
1020 |
global $verrmodul;
|
|
|
1021 |
|
|
|
1022 |
$db = OpenDB();
|
|
|
1023 |
$query = "select mi_nname, mi_vname from mitarbeiter where mi_num = $minum";
|
|
|
1024 |
|
|
|
1025 |
if (!($result = QueryDB($db, $query))) {
|
|
|
1026 |
closeDB($db);
|
|
|
1027 |
return;
|
|
|
1028 |
}
|
|
|
1029 |
|
|
|
1030 |
$data = fetchDB($result, 0);
|
|
|
1031 |
$mi_nname = $data[0];
|
|
|
1032 |
$mi_vname = $data[1];
|
|
|
1033 |
$nav = "minum=$minum&menu=$menu&headline=$headline";
|
|
|
1034 |
?>
|
|
|
1035 |
<form name="Alarm" method="post">
|
|
|
1036 |
<table class="alarm" border=1>
|
|
|
1037 |
<tr><td colspan=2 align="center">Wollen Sie wirklich den Mitarbeiter<br>
|
|
|
1038 |
<? echo "$mi_nname $mi_vname" ?><br>
|
|
|
1039 |
<?
|
|
|
1040 |
if ($verrmodul)
|
|
|
1041 |
echo "mit seinen Tagsätzen ";
|
|
|
1042 |
?>
|
|
|
1043 |
löschen?</td>
|
|
|
1044 |
</tr>
|
|
|
1045 |
<tr>
|
|
|
1046 |
<td align="center"><input type="button" name="yes" value="Loeschen" onClick="javascript:MoveTo('edit_mi.php','func=delete&yes=yes&<? echo "$nav"; ?>')"></td>
|
|
|
1047 |
<td align="center"><input type="button" name="no" value="Abbruch" onClick="javascript:MoveTo('edit_mi.php','no=no&<? echo "$nav"; ?>')"></td>
|
|
|
1048 |
</tr>
|
|
|
1049 |
</table>
|
|
|
1050 |
</form>
|
|
|
1051 |
<?
|
|
|
1052 |
}
|
|
|
1053 |
|
|
|
1054 |
function DeleteMi($minum) {
|
|
|
1055 |
global $verrmodul;
|
|
|
1056 |
|
|
|
1057 |
if ($minum <= 0) {
|
|
|
1058 |
Error("DeleteMi: Interner Fehler: Mitarbeiternummer des zu löschenden Mitarbeiters fehlt!");
|
|
|
1059 |
return;
|
|
|
1060 |
}
|
|
|
1061 |
|
|
|
1062 |
$db = OpenDB();
|
|
|
1063 |
|
|
|
1064 |
if (!QueryDB($db, "begin")) {
|
|
|
1065 |
closeDB($db);
|
|
|
1066 |
return;
|
|
|
1067 |
}
|
|
|
1068 |
|
|
|
1069 |
$query = "delete from tagsatz where tg_minum = $minum";
|
|
|
1070 |
|
|
|
1071 |
if (!QueryDB($db, $query)) {
|
|
|
1072 |
QueryDB($db, "rollback");
|
|
|
1073 |
closeDB($db);
|
|
|
1074 |
return;
|
|
|
1075 |
}
|
|
|
1076 |
|
|
|
1077 |
$query = "delete from mitarbeiter where mi_num = $minum";
|
|
|
1078 |
|
|
|
1079 |
if (!QueryDB($db, $query)) {
|
|
|
1080 |
QueryDB($db, "rollback");
|
|
|
1081 |
closeDB($db);
|
|
|
1082 |
return;
|
|
|
1083 |
}
|
|
|
1084 |
|
|
|
1085 |
QueryDB($db, "commit");
|
|
|
1086 |
closeDB($db);
|
|
|
1087 |
}
|
|
|
1088 |
|
|
|
1089 |
$minew = $_REQUEST['minew'];
|
|
|
1090 |
$miedit = $_REQUEST['miedit'];
|
|
|
1091 |
$midel = $_REQUEST['midel'];
|
|
|
1092 |
$func = $_REQUEST['func'];
|
|
|
1093 |
|
|
|
1094 |
if (isset($knopf) && $knopf == 30)
|
|
|
1095 |
EditMitarbeiter();
|
|
|
1096 |
|
|
|
1097 |
if (isset($func)) {
|
|
|
1098 |
if ($func == "CheckNewMi") {
|
|
|
1099 |
if (CheckNewMi($unum, $headline, $menu, $rstufe)) {
|
|
|
1100 |
/* echo "<p class=\"cry\">Daten wurden erfolgreich gespeichert!</p>\n";
|
|
|
1101 |
echo "<form name=\"forms\" action=\"forms.php\" method=\"post\">";
|
|
|
1102 |
echo "<input type=\"hidden\" name=\"unum\" value=\"$unum\">";
|
|
|
1103 |
echo "<input type=\"hidden\" name=\"headline\" value=\"4\">";
|
|
|
1104 |
echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">";
|
|
|
1105 |
echo "<input type=\"hidden\" name=\"rstufe\" value=\"$rstufe\">";
|
|
|
1106 |
echo "<input type=\"hidden\" name=\"knopf\" value=\"30\">";
|
|
|
1107 |
Button("Weiter -->", "forms");
|
|
|
1108 |
echo "</form>\n"; */
|
|
|
1109 |
EditMitarbeiter();
|
|
|
1110 |
}
|
|
|
1111 |
}
|
|
|
1112 |
|
|
|
1113 |
if ($func == "CheckEditMi") {
|
|
|
1114 |
$minum = $_REQUEST['minum'];
|
|
|
1115 |
|
|
|
1116 |
if (CheckEditMi($minum, $unum, $headline, $menu, $rstufe)) {
|
|
|
1117 |
echo "<p class=\"cry\">Daten wurden erfolgreich gespeichert!</p>\n";
|
|
|
1118 |
/* echo "<form name=\"forms\" action=\"forms.php\" method=\"post\">";
|
|
|
1119 |
echo "<input type=\"hidden\" name=\"unum\" value=\"$unum\">";
|
|
|
1120 |
echo "<input type=\"hidden\" name=\"headline\" value=\"4\">";
|
|
|
1121 |
echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">";
|
|
|
1122 |
echo "<input type=\"hidden\" name=\"rstufe\" value=\"$rstufe\">";
|
|
|
1123 |
echo "<input type=\"hidden\" name=\"knopf\" value=\"30\">";
|
|
|
1124 |
Button("Weiter -->", "forms");
|
|
|
1125 |
echo "</form>\n"; */
|
|
|
1126 |
EditMitarbeiter();
|
|
|
1127 |
}
|
|
|
1128 |
}
|
|
|
1129 |
|
|
|
1130 |
if ($func == "delete" && $_REQUEST['yes'] == "yes") {
|
|
|
1131 |
$minum = $_REQUEST['minum'];
|
|
|
1132 |
|
|
|
1133 |
if (DeleteMi($minum)) {
|
|
|
1134 |
Journal(106, "Mitarbeiter: $minum");
|
|
|
1135 |
echo "<p class=\"cry\">Mitarbeiter wurde erfolgreich gelöscht!</p>\n";
|
|
|
1136 |
}
|
|
|
1137 |
|
|
|
1138 |
/* echo "<form name=\"forms\" action=\"forms.php\" method=\"post\">";
|
|
|
1139 |
echo "<input type=\"hidden\" name=\"unum\" value=\"$unum\">";
|
|
|
1140 |
echo "<input type=\"hidden\" name=\"headline\" value=\"4\">";
|
|
|
1141 |
echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">";
|
|
|
1142 |
echo "<input type=\"hidden\" name=\"rstufe\" value=\"$rstufe\">";
|
|
|
1143 |
echo "<input type=\"hidden\" name=\"knopf\" value=\"30\">";
|
|
|
1144 |
Button("Weiter -->", "forms");
|
|
|
1145 |
echo "</form>\n"; */
|
|
|
1146 |
EditMitarbeiter();
|
|
|
1147 |
}
|
|
|
1148 |
}
|
|
|
1149 |
|
|
|
1150 |
if (isset($minew)) {
|
|
|
1151 |
NewMi($unum, $headline, $menu, $rstufe);
|
|
|
1152 |
}
|
|
|
1153 |
|
|
|
1154 |
if (isset($miedit)) {
|
|
|
1155 |
EditMi($miedit, $unum, $headline, $menu, $rstufe);
|
|
|
1156 |
}
|
|
|
1157 |
|
|
|
1158 |
if (isset($midel) && $midel > 0) {
|
|
|
1159 |
DelMi($midel);
|
|
|
1160 |
}
|
|
|
1161 |
|
|
|
1162 |
require('footer.inc');
|
|
|
1163 |
?>
|