219 if (!$ok || (!$sub && !$del && !$dup)) |
220 if (!$ok || (!$sub && !$del && !$dup)) |
220 { |
221 { |
221 if ($infid && (!$sub || !$del) && !isset($inf)) |
222 if ($infid && (!$sub || !$del) && !isset($inf)) |
222 { // update |
223 { // update |
223 $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID, |
224 $sql = "SELECT info_ID,info_name_s,info_name_l,info_date,info_valid_from,info_valid_to,infotyp_ID, |
224 i.persknr,lang,info_file,info_rel_ID,info_freigabe_ID,info_sort, |
225 i.persknr,lang,info_file,info_rel_ID,info_freigabe_ID,info_sort,info_sort,betrag, |
225 CONCAT(nachname,', ',vorname) AS aname |
226 CONCAT(nachname,', ',vorname) AS aname |
226 FROM fhiiqm.Info i LEFT OUTER JOIN fhiiqm.Mitarbeiter m |
227 FROM fhiiqm.Info i LEFT OUTER JOIN fhiiqm.Mitarbeiter m |
227 ON i.persknr=m.persknr |
228 ON i.persknr=m.persknr |
228 WHERE info_ID = $infid"; |
229 WHERE info_ID = $infid"; |
229 if ($result = $dbc -> queryObjectArray($sql)) |
230 if ($result = $dbc -> queryObjectArray($sql)) |
242 $inf["infrel"] = $row->info_rel_ID; |
243 $inf["infrel"] = $row->info_rel_ID; |
243 $inf["ifname"] = $row->info_file; |
244 $inf["ifname"] = $row->info_file; |
244 $inf["lang"] = $row->lang; |
245 $inf["lang"] = $row->lang; |
245 $inf["fg"] = $row->info_freigabe_ID; |
246 $inf["fg"] = $row->info_freigabe_ID; |
246 $inf["sort"] = $row->info_sort; |
247 $inf["sort"] = $row->info_sort; |
|
248 $inf["betr"] = str_replace('.',',',$row->betrag); |
247 } |
249 } |
248 } |
250 } |
249 // Produkt |
251 // Produkt |
250 $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid"; |
252 $sql = "SELECT produkt_ID FROM Info_Produkt WHERE info_ID = $infid"; |
251 if ($result = $dbc -> queryObjectArray($sql)) |
253 if ($result = $dbc -> queryObjectArray($sql)) |
385 |
387 |
386 if ($inf["cdat"] == "") $inf["cdat"] = null; |
388 if ($inf["cdat"] == "") $inf["cdat"] = null; |
387 if ($inf["vdat"] == "") $inf["vdat"] = null; |
389 if ($inf["vdat"] == "") $inf["vdat"] = null; |
388 if ($inf["bdat"] == "") $inf["bdat"] = null; |
390 if ($inf["bdat"] == "") $inf["bdat"] = null; |
389 if ($inf["fg"] == -1) $inf["fg"] = null; |
391 if ($inf["fg"] == -1) $inf["fg"] = null; |
|
392 if (isset($inf['betr']) && $inf['betr']) $betrag = dbformat_wert($inf['betr']); else $betrag = null; |
390 |
393 |
391 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
394 if (!isset($dbc) || !$dbc) $dbc = new dbconnection(); |
392 |
395 |
393 $stmt = $dbc -> stmtinit(); |
396 $stmt = $dbc -> stmtinit(); |
394 if (is_object($stmt)) |
397 if (is_object($stmt)) |
408 infotyp_ID = ?, |
411 infotyp_ID = ?, |
409 persknr = ?, |
412 persknr = ?, |
410 lang = ?, |
413 lang = ?, |
411 info_freigabe_ID = ?, |
414 info_freigabe_ID = ?, |
412 info_sort = ?, |
415 info_sort = ?, |
413 info_rel_ID = ? WHERE info_ID = $infid"); |
416 info_rel_ID = ?, |
414 $stmt -> bind_param('sssssiisisi',$inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"]); |
417 betrag = ? WHERE info_ID = $infid"); |
|
418 $stmt -> bind_param('sssssiisisid',$inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"],$betrag); |
415 $result = $stmt -> execute(); |
419 $result = $stmt -> execute(); |
416 if ($stmt->error) echo "error UPDATE Info: " . $stmt->error . "<br><br>\n"; |
420 if ($stmt->error) echo "error UPDATE Info: " . $stmt->error . "<br><br>\n"; |
417 } |
421 } |
418 else |
422 else |
419 { //INSERT |
423 { //INSERT |
420 $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to, |
424 $stmt -> prepare ("INSERT INTO Info (info_name_s,info_name_l,info_date,info_valid_from,info_valid_to, |
421 infotyp_ID,persknr,lang,info_freigabe_ID,info_sort,info_rel_ID) VALUES (?,?,?,?,?,?,?,?,?,?,?)"); |
425 infotyp_ID,persknr,lang,info_freigabe_ID,info_sort,info_rel_ID,betrag) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); |
422 $stmt -> bind_param('sssssiisisi', $inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"]); |
426 $stmt -> bind_param('sssssiisisid', $inf["iname"],$inf["ilong"],$inf["cdat"],$inf["vdat"],$inf["bdat"],$inf["ityp"],$inf["pers"],$inf["lang"],$inf["fg"],$inf["sort"],$inf["infrel"],$betrag); |
423 $result = $stmt -> execute(); |
427 $result = $stmt -> execute(); |
424 |
428 |
425 if ($stmt->error) echo "error INSERT Info: " . $stmt->error . "<br><br>\n"; |
429 if ($stmt->error) echo "error INSERT Info: " . $stmt->error . "<br><br>\n"; |
426 if ($result) |
430 if ($result) |
427 { // INSERT o.k. |
431 { // INSERT o.k. |
438 // upload File |
442 // upload File |
439 if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] ) |
443 if (is_uploaded_file($_FILES["ifile"]["tmp_name"]) && isset($_FILES["ifile"]["name"]) && $_FILES["ifile"]["name"] ) |
440 { |
444 { |
441 include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/file_upload.inc.php"); |
445 include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/file_upload.inc.php"); |
442 $fname = gen_filename($inf['ifname'],"ifile",$infid); |
446 $fname = gen_filename($inf['ifname'],"ifile",$infid); |
443 $retdf = mod_file("/var/www/fhiiqm/infos",$infid,"","del"); // Loeschen alte Datei |
447 $retdf = mod_file("/var/www/fhiiqm/infos",$infid,"","del"); // Loeschen alte Datei |
444 $retf = upload("ifile", $fname, $infid, "infos"); // Datei prüfen und in Dokumentenverzeichnis verschieben |
448 $retf = upload("ifile", $fname, $infid, "/var/www/fhiiqm/infos"); // Datei prüfen und in Dokumentenverzeichnis (vollstaendiger Pfad)) verschieben |
445 |
449 |
446 if ($retf) |
450 if ($retf) |
447 { // upload o.k. |
451 { // upload o.k. |
448 //UPDATE des Filenamens |
452 //UPDATE des Filenamens |
449 $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid"; |
453 $sql = "UPDATE Info SET info_file = '" . $infid . "_" . $fname ."' WHERE info_ID=$infid"; |